From 140f91186e757468ca3c5f25d07154ebc4205ca2 Mon Sep 17 00:00:00 2001 From: Wei-Jun Hung Date: Mon, 16 Aug 2021 16:10:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20inactive=20validators=20no?= =?UTF-8?q?t=20displayed=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/cosmos-source.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apis/cosmos-source.js b/apis/cosmos-source.js index 6073685a..f962215e 100644 --- a/apis/cosmos-source.js +++ b/apis/cosmos-source.js @@ -207,18 +207,24 @@ export default class CosmosAPI { } async loadValidators() { const [ - validators, + { result: bondedValidators }, + { result: unbondingValidators }, + { result: unbondedValidators }, + { result: unspecifiedValidators }, annualProvision, supply, pool ] = await Promise.all([ this.query(`staking/validators?status=BOND_STATUS_BONDED`), + this.query(`staking/validators?status=BOND_STATUS_UNBONDING`), + this.query(`staking/validators?status=BOND_STATUS_UNBONDED`), + this.query(`staking/validators?status=BOND_STATUS_UNSPECIFIED`), this.getAnnualProvision().catch(() => undefined), this.getStakingSupply(), this.query(`cosmos/staking/v1beta1/pool`) ]) - return validators.result.map(validator => reducers.validatorReducer(validator, annualProvision, supply, pool)) - + const allValidators = bondedValidators.concat(unbondingValidators, unbondedValidators, unspecifiedValidators) + return allValidators.map(validator => reducers.validatorReducer(validator, annualProvision, supply, pool)) } async getInflation() {