From 47607e74163339f8084f555b239e2acb6c1f26e1 Mon Sep 17 00:00:00 2001 From: BitcoinVM <18786721@qq.com> Date: Fri, 23 Feb 2024 20:21:12 +0800 Subject: [PATCH] support UpdateParamsMsg --- src/modules/[chain]/gov/[proposal_id].vue | 27 +++++++++++++++++++++++ src/types/gov.ts | 1 + 2 files changed, 28 insertions(+) diff --git a/src/modules/[chain]/gov/[proposal_id].vue b/src/modules/[chain]/gov/[proposal_id].vue index ec3650f3..1f640c2c 100644 --- a/src/modules/[chain]/gov/[proposal_id].vue +++ b/src/modules/[chain]/gov/[proposal_id].vue @@ -54,8 +54,35 @@ store.fetchProposal(props.proposal_id).then((res) => { }) }) } + + const msgType = proposalDetail.content['@type'] || ''; + if(msgType.endsWith('MsgUpdateParams')) { + if(msgType.indexOf('staking') > -1) { + chainStore.rpc.getStakingParams().then((res) => { + addCurrentParams(res); + }); + } else if(msgType.indexOf('gov') > -1) { + chainStore.rpc.getGovParamsVoting().then((res) => { + addCurrentParams(res); + }); + } else if(msgType.indexOf('distribution') > -1) { + chainStore.rpc.getDistributionParams().then((res) => { + addCurrentParams(res); + }); + } else if(msgType.indexOf('slashing') > -1) { + chainStore.rpc.getSlashingParams().then((res) => { + addCurrentParams(res); + }); + } + } }); +function addCurrentParams(res: any) { + if(proposal.value.content && res.params) { + proposal.value.content.params = [proposal.value.content?.params]; + proposal.value.content.current = [res.params]; + } +} const color = computed(() => { if (proposal.value.status === 'PROPOSAL_STATUS_PASSED') { return 'success'; diff --git a/src/types/gov.ts b/src/types/gov.ts index 96dbe070..5f1b47dd 100644 --- a/src/types/gov.ts +++ b/src/types/gov.ts @@ -31,6 +31,7 @@ export interface GovProposal { description?: string; current?: any[]; changes?: any[]; + params?: any[]; plan?: { height?: string | number; time?: string | number;