diff --git a/src/libs/data/data.js b/src/libs/data/data.js index b8ba4f26..b7615b9c 100644 --- a/src/libs/data/data.js +++ b/src/libs/data/data.js @@ -278,6 +278,10 @@ export function getUnitAmount(amount, denom) { // eslint-disable-next-line no-undef return (BigInt(amount) * 1000000000000000000n).toString() } + if (denom.startsWith('nanolike')) { + // eslint-disable-next-line no-undef + return String((Number(amount) * 1000000000).toFixed()) + } return String((Number(amount) * 1000000).toFixed()) } @@ -288,9 +292,9 @@ export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') { amount = Number(BigInt(Number(tokenAmount)) / 1000000000000000000n) // } } else if (denom.startsWith('basecro')) { - // eslint-disable-next-line no-undef amount = Number(tokenAmount) / 100000000 - // } + } else if (denom.startsWith('nanolike')) { + amount = Number(tokenAmount) / 1000000000 } else { amount = Number(tokenAmount) / 1000000 } @@ -318,11 +322,11 @@ export function formatNumber(count, withAbbr = false, decimals = 2) { return result } -export function tokenFormatter(tokens) { +export function tokenFormatter(tokens, denoms = {}) { if (Array.isArray(tokens)) { - return tokens.map(t => formatToken(t)).join() + return tokens.map(t => formatToken(t, denoms, 2)).join() } - return formatToken(tokens) + return formatToken(tokens, denoms, 2) } export function getCachedValidators(chainName) { diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index e376034c..e778d098 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -651,7 +651,7 @@ export default { return formatTokenAmount(v, dec, denom) }, formatToken(v) { - return tokenFormatter(v) + return tokenFormatter(v, this.denoms) }, formatCurrency(amount, denom) { const qty = this.formatAmount(amount, 2, denom) diff --git a/src/views/WalletAccounts.vue b/src/views/WalletAccounts.vue index dbdd8d19..a02c1933 100644 --- a/src/views/WalletAccounts.vue +++ b/src/views/WalletAccounts.vue @@ -74,7 +74,6 @@