Fix delegations fetch error
This commit is contained in:
parent
fb1b6edc01
commit
b54eec0d4b
@ -260,7 +260,7 @@ const chainAPI = class ChainFetch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getStakingReward(address, config = null) {
|
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(`/distribution/delegators/${address}/rewards`, config).then(data => commonProcess(data))
|
||||||
}
|
}
|
||||||
return this.get(`/cosmos/distribution/v1beta1/delegators/${address}/rewards`).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) {
|
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 => {
|
return this.get(`/staking/delegators/${address}/delegations`, config).then(data => commonProcess(data).map(x => {
|
||||||
const xh = x
|
const xh = x
|
||||||
if (!xh.delegation) {
|
if (!xh.delegation) {
|
||||||
@ -287,14 +287,14 @@ const chainAPI = class ChainFetch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getStakingRedelegations(address, config = null) {
|
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(`/staking/redelegations?delegator=${address}`, config).then(data => commonProcess(data))
|
||||||
}
|
}
|
||||||
return this.get(`/cosmos/staking/v1beta1/delegators/${address}/redelegations`, config).then(data => commonProcess(data))
|
return this.get(`/cosmos/staking/v1beta1/delegators/${address}/redelegations`, config).then(data => commonProcess(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
async getStakingUnbonding(address, config = null) {
|
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(`/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))
|
return this.get(`/cosmos/staking/v1beta1/delegators/${address}/unbonding_delegations`, config).then(data => commonProcess(data))
|
||||||
|
@ -245,9 +245,7 @@
|
|||||||
<b-td> Public Key </b-td><b-td> <object-field-component :tablefield="account.value.public_key" /> </b-td>
|
<b-td> Public Key </b-td><b-td> <object-field-component :tablefield="account.value.public_key" /> </b-td>
|
||||||
</b-tr>
|
</b-tr>
|
||||||
</b-tbody>
|
</b-tbody>
|
||||||
<b-tbody
|
<b-tbody v-else-if="account.type === 'cosmos-sdk/PeriodicVestingAccount' && account.value.base_vesting_account">
|
||||||
v-if="account.type === 'cosmos-sdk/PeriodicVestingAccount' && account.value.base_vesting_account"
|
|
||||||
>
|
|
||||||
<b-tr>
|
<b-tr>
|
||||||
<b-td>
|
<b-td>
|
||||||
Account Type
|
Account Type
|
||||||
@ -326,7 +324,7 @@
|
|||||||
</b-tbody>
|
</b-tbody>
|
||||||
<object-field-component
|
<object-field-component
|
||||||
v-else
|
v-else
|
||||||
:tablefield="account.value?account.value:account"
|
:tablefield="account.value || account"
|
||||||
/>
|
/>
|
||||||
</b-table-simple>
|
</b-table-simple>
|
||||||
</b-card>
|
</b-card>
|
||||||
@ -521,6 +519,9 @@ export default {
|
|||||||
tmp1 += Number(e.balance)
|
tmp1 += Number(e.balance)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
const unbonding = this.formatCurrency(tmp1, stakingDenom)
|
||||||
|
sumCurrency += unbonding
|
||||||
|
sum += tmp1
|
||||||
total.push({
|
total.push({
|
||||||
type: 'unbonding',
|
type: 'unbonding',
|
||||||
color: 'danger',
|
color: 'danger',
|
||||||
@ -528,7 +529,7 @@ export default {
|
|||||||
denom: stakingDenom,
|
denom: stakingDenom,
|
||||||
amount: tmp1,
|
amount: tmp1,
|
||||||
percent: 0,
|
percent: 0,
|
||||||
currency: 0,
|
currency: unbonding,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
total = total.map(x => {
|
total = total.map(x => {
|
||||||
|
Loading…
Reference in New Issue
Block a user