feat: add governance params

This commit is contained in:
alisa 2023-04-27 14:24:31 +08:00
parent 921536983d
commit 248f4411e3
2 changed files with 11 additions and 5 deletions

View File

@ -30,7 +30,7 @@ onMounted(() => {
<CardParameter :cardItem="store.staking"/> <CardParameter :cardItem="store.staking"/>
<!-- Governance Parameters --> <!-- Governance Parameters -->
<CardParameter :cardItem="store.gov"/>
<!-- Distribution Parameters --> <!-- Distribution Parameters -->
<CardParameter :cardItem="store.distribution"/> <CardParameter :cardItem="store.distribution"/>
<!-- Slashing Parameters --> <!-- Slashing Parameters -->

View File

@ -49,9 +49,6 @@ export const useParamStore = defineStore("paramstore", {
blockchain() { blockchain() {
return useBlockchain() return useBlockchain()
}, },
excludes() {
return this.blockchain().current?.excludes
}
}, },
actions: { actions: {
initial() { initial() {
@ -60,6 +57,7 @@ export const useParamStore = defineStore("paramstore", {
this.handleStakingParams() this.handleStakingParams()
this.handleSlashingParams() this.handleSlashingParams()
this.handleDistributionParams() this.handleDistributionParams()
this.handleGovernanceParams()
}, },
async handleBaseBlockLatest() { async handleBaseBlockLatest() {
try { try {
@ -121,9 +119,16 @@ export const useParamStore = defineStore("paramstore", {
value: value })) value: value }))
}, },
async handleGovernanceParams() { async handleGovernanceParams() {
if(this.excludes && this.excludes.indexOf('governance') > -1){ const excludes = this.blockchain.current?.excludes
if(excludes && excludes.indexOf('governance') > -1){
return return
} }
Promise.all([this.getGovParamsVoting(),this.getGovParamsDeposit(),this.getGovParamsTally()]).then((resArr) => {
console.log(resArr, 'resArrr')
const govParams = {...resArr[0]?.voting_params,...resArr[1]?.deposit_params,...resArr[2]?.tally_params}
this.gov.items = Object.entries(govParams).map(([key, value]) => ({ subtitle:key,
value: value }))
})
}, },
async getBaseTendermintBlockLatest() { async getBaseTendermintBlockLatest() {
@ -164,6 +169,7 @@ export const useParamStore = defineStore("paramstore", {
return await this.blockchain.rpc.getGovParamsTally() return await this.blockchain.rpc.getGovParamsTally()
}, },
} }