From b54eec0d4b391a0bb04ada4e654f74eea67664ed Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 14 Oct 2021 02:50:39 +0800 Subject: [PATCH] Fix delegations fetch error --- src/libs/fetch.js | 8 ++++---- src/views/WalletAccountDetail.vue | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 91e1b48a..6b6e48fe 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -260,7 +260,7 @@ const chainAPI = class ChainFetch { } async getStakingReward(address, config = null) { - if (compareVersions(config || this.config.sdk_version, '0.40') < 0) { + if (compareVersions(config ? config.sdk_version : this.config.sdk_version, '0.40') < 0) { return this.get(`/distribution/delegators/${address}/rewards`, config).then(data => commonProcess(data)) } return this.get(`/cosmos/distribution/v1beta1/delegators/${address}/rewards`).then(data => commonProcess(data)) @@ -271,7 +271,7 @@ const chainAPI = class ChainFetch { } async getStakingDelegations(address, config = null) { - if (compareVersions(config || this.config.sdk_version, '0.40') < 0) { + if (compareVersions(config ? config.sdk_version : this.config.sdk_version, '0.40') < 0) { return this.get(`/staking/delegators/${address}/delegations`, config).then(data => commonProcess(data).map(x => { const xh = x if (!xh.delegation) { @@ -287,14 +287,14 @@ const chainAPI = class ChainFetch { } async getStakingRedelegations(address, config = null) { - if (compareVersions(config || this.config.sdk_version, '0.40') < 0) { + if (compareVersions(config ? config.sdk_version : this.config.sdk_version, '0.40') < 0) { return this.get(`/staking/redelegations?delegator=${address}`, config).then(data => commonProcess(data)) } return this.get(`/cosmos/staking/v1beta1/delegators/${address}/redelegations`, config).then(data => commonProcess(data)) } async getStakingUnbonding(address, config = null) { - if (compareVersions(config || this.config.sdk_version, '0.40') < 0) { + if (compareVersions(config ? config.sdk_version : this.config.sdk_version, '0.40') < 0) { return this.get(`/staking/delegators/${address}/unbonding_delegations`, config).then(data => commonProcess(data)) } return this.get(`/cosmos/staking/v1beta1/delegators/${address}/unbonding_delegations`, config).then(data => commonProcess(data)) diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index d022e997..e376034c 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -245,9 +245,7 @@ Public Key - + Account Type @@ -326,7 +324,7 @@ @@ -521,6 +519,9 @@ export default { tmp1 += Number(e.balance) }) }) + const unbonding = this.formatCurrency(tmp1, stakingDenom) + sumCurrency += unbonding + sum += tmp1 total.push({ type: 'unbonding', color: 'danger', @@ -528,7 +529,7 @@ export default { denom: stakingDenom, amount: tmp1, percent: 0, - currency: 0, + currency: unbonding, }) } total = total.map(x => {