load origin value for param change proposal

This commit is contained in:
liangping 2023-10-28 08:21:02 +08:00
parent 7e03e3b32d
commit 21ff37aac1
5 changed files with 25 additions and 0 deletions

View File

@ -10,6 +10,7 @@ export const DEFAULT: RequestRegistry = {
url: '/cosmos/auth/v1beta1/accounts/{address}', url: '/cosmos/auth/v1beta1/accounts/{address}',
adapter, adapter,
}, },
params: { url: '/cosmos/params/v1beta1/params?subspace={subspace}&key={key}', adapter },
bank_params: { url: '/cosmos/bank/v1beta1/params', adapter }, bank_params: { url: '/cosmos/bank/v1beta1/params', adapter },
bank_balances_address: { bank_balances_address: {
url: '/cosmos/bank/v1beta1/balances/{address}', url: '/cosmos/bank/v1beta1/balances/{address}',

View File

@ -133,6 +133,10 @@ export class CosmosRestClient extends BaseRestClient<RequestRegistry> {
return this.request(this.registry.slashing_signing_info, {}, query); return this.request(this.registry.slashing_signing_info, {}, query);
} }
// Gov // Gov
async getParams(subspace: string, key: string) {
console.log(this.registry.params, subspace, key)
return this.request(this.registry.params, {subspace, key});
}
async getGovParamsVoting() { async getGovParamsVoting() {
return this.request(this.registry.gov_params_voting, {}); return this.request(this.registry.gov_params_voting, {});
} }

View File

@ -124,6 +124,8 @@ export interface RequestRegistry extends AbstractRegistry {
base_tendermint_validatorsets_latest: Request<PaginatedTendermintValidator>; base_tendermint_validatorsets_latest: Request<PaginatedTendermintValidator>;
base_tendermint_validatorsets_height: Request<PaginatedTendermintValidator>; base_tendermint_validatorsets_height: Request<PaginatedTendermintValidator>;
params: Request<{param: any}>;
tx_txs: Request<PaginatedTxs>; tx_txs: Request<PaginatedTxs>;
tx_txs_block: Request<Tx>; tx_txs_block: Request<Tx>;
tx_hash: Request<{ tx: Tx; tx_response: TxResponse }>; tx_hash: Request<{ tx: Tx; tx_response: TxResponse }>;

View File

@ -4,6 +4,7 @@ import MdEditor from 'md-editor-v3';
import ObjectElement from '@/components/dynamic/ObjectElement.vue'; import ObjectElement from '@/components/dynamic/ObjectElement.vue';
import { import {
useBaseStore, useBaseStore,
useBlockchain,
useFormatter, useFormatter,
useGovStore, useGovStore,
useStakingStore, useStakingStore,
@ -28,6 +29,7 @@ const format = useFormatter();
const store = useGovStore(); const store = useGovStore();
const dialog = useTxDialog(); const dialog = useTxDialog();
const stakingStore = useStakingStore(); const stakingStore = useStakingStore();
const chainStore = useBlockchain();
store.fetchProposal(props.proposal_id).then((res) => { store.fetchProposal(props.proposal_id).then((res) => {
const proposalDetail = reactive(res.proposal); const proposalDetail = reactive(res.proposal);
@ -38,6 +40,20 @@ store.fetchProposal(props.proposal_id).then((res) => {
}); });
} }
proposal.value = proposalDetail; proposal.value = proposalDetail;
// load origin params if the proposal is param change
if(proposalDetail.content?.changes) {
proposalDetail.content?.changes.forEach((item) => {
chainStore.rpc.getParams(item.subspace, item.key).then((res) => {
if(proposal.value.content && res.param) {
if(proposal.value.content.origin){
proposal.value.content.origin.push(res.param);
} else {
proposal.value.content.origin = [res.param];
};
}
})
})
}
}); });
const color = computed(() => { const color = computed(() => {

View File

@ -28,6 +28,8 @@ export interface GovProposal {
'@type': string; '@type': string;
title?: string; title?: string;
description?: string; description?: string;
origin?: any[]
changes?: any[];
plan?: { plan?: {
height?: string | number; height?: string | number;
time?: string | number; time?: string | number;