diff --git a/public/index.html b/public/index.html index 6c5f0141..2f9acbf5 100644 --- a/public/index.html +++ b/public/index.html @@ -6,9 +6,9 @@ - + - +
diff --git a/src/libs/data/data.js b/src/libs/data/data.js index 65513afe..b8ba4f26 100644 --- a/src/libs/data/data.js +++ b/src/libs/data/data.js @@ -261,6 +261,8 @@ export function formatTokenDenom(tokenDenom) { denom = 'CRO' } else if (denom.startsWith('IBC')) { denom = 'IBC...' + } else if (denom.startsWith('NANOLIKE')) { + denom = 'LIKE' } return denom @@ -298,9 +300,9 @@ export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') { return parseFloat(amount) } -export function formatToken(token, IBCDenom = {}) { +export function formatToken(token, IBCDenom = {}, decimals = 0) { if (token) { - return `${formatTokenAmount(token.amount, 0, token.denom)} ${formatTokenDenom(IBCDenom[token.denom] || token.denom)}` + return `${formatTokenAmount(token.amount, decimals, token.denom)} ${formatTokenDenom(IBCDenom[token.denom] || token.denom)}` } return token } diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 65381495..91e1b48a 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -259,7 +259,10 @@ const chainAPI = class ChainFetch { return this.get('/bank/balances/'.concat(address)).then(data => commonProcess(data)) } - async getStakingReward(address) { + async getStakingReward(address, config = null) { + if (compareVersions(config || 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)) } @@ -268,15 +271,33 @@ const chainAPI = class ChainFetch { } async getStakingDelegations(address, config = null) { + if (compareVersions(config || 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) { + xh.delegation = { + validator_address: x.validator_address, + delegator_address: x.delegator_address, + } + } + return xh + })) + } return this.get(`/cosmos/staking/v1beta1/delegations/${address}`, config).then(data => commonProcess(data)) } async getStakingRedelegations(address, config = null) { + if (compareVersions(config || 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) { - return this.get(`/cosmos/staking/v1beta1/delegators/${address}/unbonding_delegations`).then(data => commonProcess(data)) + async getStakingUnbonding(address, config = null) { + if (compareVersions(config || 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)) } async getBankBalances(address, config = null) { diff --git a/src/views/SummaryAssetsComponent.vue b/src/views/SummaryAssetsComponent.vue index f3d2ca02..52b1c9aa 100644 --- a/src/views/SummaryAssetsComponent.vue +++ b/src/views/SummaryAssetsComponent.vue @@ -17,7 +17,6 @@