add one method for format price show

This commit is contained in:
zhl 2023-05-30 14:32:36 +08:00
parent 6a6b3acc8e
commit fa4363c2fc
2 changed files with 13 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -519,3 +519,14 @@ function tokenList(funId) {
function tokenPrice(funId, tokenName, amount) {
promiseCb(funId, jc.wallet.calcTokenPrice(tokenName, amount));
}
/**
* format price
*/
function formatPrice(funId, value, decimal, fixed) {
try {
let data = jc.wallet.formatPrice(value, decimal, fixed);
return JSON.stringify({ errcode: 0, data });
} catch (err) {
return JSON.stringify({ errcode: 1, errmsg: err.message || err });
}
}