diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 1293cbad..8e93c636 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -469,7 +469,7 @@ import { } from 'bootstrap-vue' import { formatNumber, formatTokenAmount, isToken, percent, timeIn, toDay, toDuration, tokenFormatter, getLocalAccounts, - getStakingValidatorOperator, + getStakingValidatorOperator, formatToken, } from '@/libs/utils' import OperationModal from '@/views/components/OperationModal/index.vue' import Ripple from 'vue-ripple-directive' @@ -580,10 +580,12 @@ export default { stakingList() { return this.delegations.map(x => { const rewards = this.rewards.find(r => r.validator_address === x.delegation.validator_address) + const conf = this.$http.getSelectedConfig() + const decimal = conf.assets.exponent || '6' return { valAddress: x.delegation.validator_address, validator: getStakingValidatorOperator(this.$store.state.chains.selected.chain_name, x.delegation.validator_address), - delegation: this.formatToken([x.balance]), + delegation: formatToken(x.balance, {}, decimal), rewards: rewards ? this.formatToken(rewards.reward) : '', action: '', } @@ -697,6 +699,8 @@ export default { return '-' }, fetchAccount(address) { + const conf = this.$http.getSelectedConfig() + const decimal = conf.assets.exponent || '6' this.address = address this.$http.getBankAccountBalance(address).then(bal => { this.walletBalances = this.formatToken(bal) diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index fbfaa725..a66e7f49 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -621,12 +621,14 @@ export default { }, deleTable() { const re = [] + const conf = this.$http.getSelectedConfig() + const decimal = conf.assets.exponent || '6' if (this.reward.rewards && this.delegations && this.delegations.length > 0) { this.delegations.forEach(e => { const reward = this.reward.rewards.find(r => r.validator_address === e.delegation.validator_address) re.push({ validator: getStakingValidatorOperator(this.$http.config.chain_name, e.delegation.validator_address, 8), - token: formatToken(e.balance, {}, 2), + token: formatToken(e.balance, {}, decimal), reward: tokenFormatter(reward.reward, this.denoms), action: e.delegation.validator_address, }) diff --git a/src/views/WalletDelegations.vue b/src/views/WalletDelegations.vue index 6d9dcbc8..3d97efa1 100644 --- a/src/views/WalletDelegations.vue +++ b/src/views/WalletDelegations.vue @@ -119,6 +119,8 @@ export default { }, computed: { formatedDelegations() { + const conf = this.$http.getSelectedConfig() + const decimal = conf.assets.exponent || '6' return this.delegations.map(x => ({ validator: { logo: x.chain.logo, @@ -128,13 +130,15 @@ export default { }, delegator: x.keyname, delegator_address: x.delegation.delegator_address, - delegation: formatToken(x.balance), + delegation: formatToken(x.balance, {}, decimal), reward: this.findReward(x.delegation.delegator_address, x.delegation.validator_address), // action: '', })) }, groupedDelegations() { const group = {} + const conf = this.$http.getSelectedConfig() + const decimal = conf.assets.exponent || '6' this.delegations.forEach(x => { const d = { validator: { @@ -145,7 +149,7 @@ export default { }, delegator: x.keyname, delegator_address: x.delegation.delegator_address, - delegation: formatToken(x.balance), + delegation: formatToken(x.balance, {}, decimal), reward: this.findReward(x.delegation.delegator_address, x.delegation.validator_address), // action: '', } diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index 4d32d812..3d308833 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -235,7 +235,9 @@ export default { return formatTokenDenom(this.token) }, format(v) { - return formatToken(v, this.IBCDenom, 6) + const conf = this.$http.getSelectedConfig() + const decimal = conf.assets.exponent || '6' + return formatToken(v, this.IBCDenom, decimal) }, }, } diff --git a/src/views/components/OperationModal/components/Redelegate.vue b/src/views/components/OperationModal/components/Redelegate.vue index a347d4f9..05b57f74 100644 --- a/src/views/components/OperationModal/components/Redelegate.vue +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -179,8 +179,10 @@ export default { return options }, tokenOptions() { + const conf = this.$http.getSelectedConfig() + const decimal = conf.assets.exponent || '6' if (!this.delegations) return [] - return this.delegations.filter(x => x.delegation.validator_address === this.validatorAddress).map(x => ({ value: x.balance.denom, label: formatToken(x.balance) })) + return this.delegations.filter(x => x.delegation.validator_address === this.validatorAddress).map(x => ({ value: x.balance.denom, label: formatToken(x.balance, {}, decimal) })) }, msg() { return [{