Merge pull request #91 from donne1226/master

change validator api
This commit is contained in:
ping 2022-03-20 14:35:53 +08:00 committed by GitHub
commit 02b5baf304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)