From 38c728b7f53e1ebc93e58ebb4e1844856267df00 Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Sun, 20 Mar 2022 14:28:57 +0800 Subject: [PATCH] change validator api --- src/libs/fetch.js | 2 +- src/views/Staking.vue | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libs/fetch.js b/src/libs/fetch.js index bde71c28..2165dd34 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -165,7 +165,7 @@ export default class ChainFetch { } async getValidatorListByHeight(height) { - return this.get(`/validatorsets/${height}`).then(data => commonProcess(data)) + return this.get(`/cosmos/base/tendermint/v1beta1/validatorsets/${height}?pagination.limit=500`).then(data => commonProcess(data)) } async getStakingValidator(address) { diff --git a/src/views/Staking.vue b/src/views/Staking.vue index 50fe786a..50bc4608 100644 --- a/src/views/Staking.vue +++ b/src/views/Staking.vue @@ -334,16 +334,16 @@ export default { } else { height = 1 } - const changes = [] + const changes = {} data.validators.forEach(x => { - changes[x.pub_key.value] = { latest: Number(x.voting_power), previous: 0 } + changes[x.pub_key.key] = { latest: Number(x.voting_power), previous: 0 } }) this.$http.getValidatorListByHeight(height).then(previous => { previous.validators.forEach(x => { - if (changes[x.pub_key.value]) { - changes[x.pub_key.value].previous = Number(x.voting_power) + if (changes[x.pub_key.key]) { + changes[x.pub_key.key].previous = Number(x.voting_power) } else { - changes[x.pub_key.value] = { latest: 0, previous: Number(x.voting_power) } + changes[x.pub_key.key] = { latest: 0, previous: Number(x.voting_power) } } }) this.$set(this, 'changes', changes)