From b966213acebd58414172b9d8bf0df4b3770e26da Mon Sep 17 00:00:00 2001 From: Erialos Date: Thu, 10 Nov 2022 09:05:11 -0700 Subject: [PATCH] Fixed improper use of the asset array I did not implement the chain config correctly with the assets part being an array. To test I removed the `|| '6'` and then added it to look in `assets[0]`. It returned the proper decimal for the chain config. --- src/views/Dashboard.vue | 4 ++-- src/views/WalletAccountDetail.vue | 2 +- src/views/WalletDelegations.vue | 4 ++-- src/views/components/OperationModal/components/Delegate.vue | 2 +- src/views/components/OperationModal/components/Redelegate.vue | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 8e93c636..97e2399d 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -581,7 +581,7 @@ export default { 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' + const decimal = conf.assets[0].exponent || '6' return { valAddress: x.delegation.validator_address, validator: getStakingValidatorOperator(this.$store.state.chains.selected.chain_name, x.delegation.validator_address), @@ -700,7 +700,7 @@ export default { }, fetchAccount(address) { const conf = this.$http.getSelectedConfig() - const decimal = conf.assets.exponent || '6' + const decimal = conf.assets[0].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 a66e7f49..c4e85aa8 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -622,7 +622,7 @@ export default { deleTable() { const re = [] const conf = this.$http.getSelectedConfig() - const decimal = conf.assets.exponent || '6' + const decimal = conf.assets[0].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) diff --git a/src/views/WalletDelegations.vue b/src/views/WalletDelegations.vue index 3d97efa1..f7840fb4 100644 --- a/src/views/WalletDelegations.vue +++ b/src/views/WalletDelegations.vue @@ -120,7 +120,7 @@ export default { computed: { formatedDelegations() { const conf = this.$http.getSelectedConfig() - const decimal = conf.assets.exponent || '6' + const decimal = conf.assets[0].exponent || '6' return this.delegations.map(x => ({ validator: { logo: x.chain.logo, @@ -138,7 +138,7 @@ export default { groupedDelegations() { const group = {} const conf = this.$http.getSelectedConfig() - const decimal = conf.assets.exponent || '6' + const decimal = conf.assets[0].exponent || '6' this.delegations.forEach(x => { const d = { validator: { diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index 3d308833..3e04a910 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -236,7 +236,7 @@ export default { }, format(v) { const conf = this.$http.getSelectedConfig() - const decimal = conf.assets.exponent || '6' + const decimal = conf.assets[0].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 05b57f74..4bcba09d 100644 --- a/src/views/components/OperationModal/components/Redelegate.vue +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -180,7 +180,7 @@ export default { }, tokenOptions() { const conf = this.$http.getSelectedConfig() - const decimal = conf.assets.exponent || '6' + const decimal = conf.assets[0].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, {}, decimal) })) },