change validator api

This commit is contained in:
donne1226 2022-03-20 14:28:57 +08:00
parent 9b70a55220
commit 38c728b7f5
2 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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)