Skip to content

Commit

Permalink
fix: currency conversion USDT (#573)
Browse files Browse the repository at this point in the history
* add price by currency

* fix lint

* use web3 utils fromWei to convert USDT

Co-authored-by: Hildegard Lydia <37687466+hilyds@users.noreply.github.com>
  • Loading branch information
rubenkristian and hilyds authored Nov 9, 2022
1 parent 7120860 commit af85fd4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/views/Dashboard/Lab/Registration/Services/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
<div>
<span>
Price :
{{ web3.utils.fromWei(String(service.info.pricesByCurrency[0].totalPrice.replaceAll(",","")), "ether") }}
{{ service.info.pricesByCurrency[0].currency }}
{{ priceByCurrency(String(service.info.pricesByCurrency[0].totalPrice.replaceAll(",","")), service.info.pricesByCurrency[0].currency) }}
</span>
</div>
<div>
Expand Down Expand Up @@ -210,6 +209,11 @@ export default {
this.isShowError = true
}
}
},
priceByCurrency(amount, currency) {
let price = this.web3.utils.fromWei(amount, currency === "USDT" ? "mwei" : "ether")
return `${price} ${currency}`
}
}
}
Expand Down

0 comments on commit af85fd4

Please sign in to comment.