From 5c341e930619fd3a5818bd69b0853cfbb324f103 Mon Sep 17 00:00:00 2001 From: BitcoinVM <18786721@qq.com> Date: Mon, 26 Feb 2024 09:37:47 +0800 Subject: [PATCH] update active validator set --- src/stores/useStakingStore.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/stores/useStakingStore.ts b/src/stores/useStakingStore.ts index 678fa413..22c0ed8a 100644 --- a/src/stores/useStakingStore.ts +++ b/src/stores/useStakingStore.ts @@ -63,7 +63,7 @@ export const useStakingStore = defineStore('stakingStore', { } }, async fetchAcitveValdiators() { - return this.fetchValidators('BOND_STATUS_BONDED'); + return this.fetchValidators('BOND_STATUS_BONDED', 500); }, async fetchInacitveValdiators() { return this.fetchValidators('BOND_STATUS_UNBONDED'); @@ -132,12 +132,12 @@ export const useStakingStore = defineStore('stakingStore', { await this.fetchKeyRotation(chain_id, pubKeyToValcons(val.consensus_pubkey, prefix.replace('valoper',''))) } }, - async fetchValidators(status: string) { + async fetchValidators(status: string, limit = 300) { if(this.blockchain.isConsumerChain) { if(this.blockchain.current?.providerChain.api && this.blockchain.current.providerChain.api.length > 0) { const client = CosmosRestClient.newDefault(this.blockchain.current.providerChain.api[0].address) // provider validators - const res = await client.getStakingValidators(status) + const res = await client.getStakingValidators(status, limit) const proVals = res.validators.sort( (a, b) => Number(b.delegator_shares) - Number(a.delegator_shares) ) @@ -148,7 +148,7 @@ export const useStakingStore = defineStore('stakingStore', { return proVals } } - return this.blockchain.rpc?.getStakingValidators(status).then((res) => { + return this.blockchain.rpc?.getStakingValidators(status, limit).then((res) => { const vals = res.validators.sort( (a, b) => Number(b.delegator_shares) - Number(a.delegator_shares) );