Skip to content

Commit

Permalink
Merge branch 'main' into feat/icq-params-gov-gated
Browse files Browse the repository at this point in the history
  • Loading branch information
swelf19 committed Aug 30, 2024
2 parents cf53a61 + c364ccc commit 1e4527e
Show file tree
Hide file tree
Showing 4 changed files with 414 additions and 368 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neutron-org/neutronjsplus",
"version": "0.4.0-rc21",
"version": "0.5.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "Apache-2.0",
Expand Down
21 changes: 21 additions & 0 deletions src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
chainManagerWrapper,
clearAdminProposal,
clientUpdateProposal,
ConsensusParams,
paramChangeProposal,
ParamChangeProposalInfo,
ParamsContractmanagerInfo,
Expand All @@ -28,6 +29,7 @@ import {
SendProposalInfo,
unpinCodesProposal,
updateAdminProposal,
updateConsensusParamsProposal,
upgradeProposal,
} from './proposal';
import {
Expand Down Expand Up @@ -1380,6 +1382,25 @@ export class DaoMember {
);
}

async submitUpdateParamsConsensusProposal(
chainManagerAddress: string,
title: string,
description: string,
params: ConsensusParams,
amount: string,
): Promise<number> {
const wrappedMessage = chainManagerWrapper(
chainManagerAddress,
updateConsensusParamsProposal(params),
);
return await this.submitSingleChoiceProposal(
title,
description,
[wrappedMessage],
amount,
);
}

/**
* submitUpdateParamsInterchainqueriesProposal creates proposal which changes params of interchaintxs module.
*/
Expand Down
36 changes: 36 additions & 0 deletions src/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,24 @@ export type DynamicFeesParams = {
ntrn_prices: Array<DecCoin>;
};

export type ConsensusParams = {
block: {
max_gas: number;
max_bytes: number;
};
evidence: {
max_age_num_blocks: number;
max_age_duration: string; // Duration
max_bytes: number;
};
validator: {
pub_key_types: string[];
};
abci?: {
vote_extensions_enable_height: number;
};
};

export type DecCoin = {
denom: string;
amount: string;
Expand Down Expand Up @@ -729,3 +747,21 @@ export const updateDynamicFeesParamsProposal = (
},
},
});

export const updateConsensusParamsProposal = (
params: ConsensusParams,
): any => ({
custom: {
submit_admin_proposal: {
admin_proposal: {
proposal_execute_message: {
message: JSON.stringify({
'@type': '/cosmos.consensus.v1.MsgUpdateParams',
authority: ADMIN_MODULE_ADDRESS,
...params,
}),
},
},
},
},
});
Loading

0 comments on commit 1e4527e

Please sign in to comment.