forked from cerc-io/cosmos-explorer
Fix issues
This commit is contained in:
parent
b54eec0d4b
commit
22123af7c8
@ -278,6 +278,10 @@ export function getUnitAmount(amount, denom) {
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
return (BigInt(amount) * 1000000000000000000n).toString()
|
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())
|
return String((Number(amount) * 1000000).toFixed())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,9 +292,9 @@ export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') {
|
|||||||
amount = Number(BigInt(Number(tokenAmount)) / 1000000000000000000n)
|
amount = Number(BigInt(Number(tokenAmount)) / 1000000000000000000n)
|
||||||
// }
|
// }
|
||||||
} else if (denom.startsWith('basecro')) {
|
} else if (denom.startsWith('basecro')) {
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
amount = Number(tokenAmount) / 100000000
|
amount = Number(tokenAmount) / 100000000
|
||||||
// }
|
} else if (denom.startsWith('nanolike')) {
|
||||||
|
amount = Number(tokenAmount) / 1000000000
|
||||||
} else {
|
} else {
|
||||||
amount = Number(tokenAmount) / 1000000
|
amount = Number(tokenAmount) / 1000000
|
||||||
}
|
}
|
||||||
@ -318,11 +322,11 @@ export function formatNumber(count, withAbbr = false, decimals = 2) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export function tokenFormatter(tokens) {
|
export function tokenFormatter(tokens, denoms = {}) {
|
||||||
if (Array.isArray(tokens)) {
|
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) {
|
export function getCachedValidators(chainName) {
|
||||||
|
@ -651,7 +651,7 @@ export default {
|
|||||||
return formatTokenAmount(v, dec, denom)
|
return formatTokenAmount(v, dec, denom)
|
||||||
},
|
},
|
||||||
formatToken(v) {
|
formatToken(v) {
|
||||||
return tokenFormatter(v)
|
return tokenFormatter(v, this.denoms)
|
||||||
},
|
},
|
||||||
formatCurrency(amount, denom) {
|
formatCurrency(amount, denom) {
|
||||||
const qty = this.formatAmount(amount, 2, denom)
|
const qty = this.formatAmount(amount, 2, denom)
|
||||||
|
@ -74,7 +74,6 @@
|
|||||||
<b-tabs
|
<b-tabs
|
||||||
v-for="item,index in accounts"
|
v-for="item,index in accounts"
|
||||||
:key="index"
|
:key="index"
|
||||||
pills
|
|
||||||
active-nav-item-class="font-weight-bolder"
|
active-nav-item-class="font-weight-bolder"
|
||||||
>
|
>
|
||||||
<b-tab>
|
<b-tab>
|
||||||
|
Loading…
Reference in New Issue
Block a user