From 3ff7e5dbe987e95837de746427aae6beb61fa389 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 13 Sep 2023 12:52:20 +0400 Subject: [PATCH] post-review + some fixes --- src/helpers/cosmos.ts | 23 +++++++++++++++++++-- src/helpers/dao.ts | 4 +--- src/helpers/proposal.ts | 6 ++---- src/helpers/types.ts | 6 ++++++ src/testcases/parallel/tokenfactory.test.ts | 12 +++++------ 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/helpers/cosmos.ts b/src/helpers/cosmos.ts index 20213722..52353b9a 100644 --- a/src/helpers/cosmos.ts +++ b/src/helpers/cosmos.ts @@ -27,7 +27,7 @@ import { CurrentPlanResponse, PinnedCodesResponse, IcaHostParamsResponse, - GlobalfeeParamsResponse, + GlobalfeeParamsResponse, InterchaintxsParamsResponse, } from './types'; import { DEBUG_SUBMIT_TX, getContractBinary } from './env'; const adminmodule = AdminProto.adminmodule.adminmodule; @@ -75,7 +75,6 @@ cosmosclient.codec.register( '/cosmos.params.v1beta1.ParameterChangeProposal', cosmosclient.proto.cosmos.params.v1beta1.ParameterChangeProposal, ); - cosmosclient.codec.register( '/neutron.interchainqueries.MsgRemoveInterchainQueryRequest', neutron.interchainqueries.MsgRemoveInterchainQueryRequest, @@ -104,6 +103,11 @@ cosmosclient.codec.register( '/pob.builder.v1.MsgAuctionBid', pob.builder.v1.MsgAuctionBid, ); +cosmosclient.codec.register( + '/neutron.interchaintxs.v1.MsgUpdateParams', + neutron.interchaintxs.v1.MsgUpdateParams, +); + export class CosmosWrapper { readonly sdk: cosmosclient.CosmosSDK; @@ -396,6 +400,21 @@ export class CosmosWrapper { } } + async queryMaxTxsAllowed(): Promise { + try { + const req = await axios.get( + `${this.sdk.url}/ibc/apps/interchain_accounts/host/v1/params`, + {}, + ); + return req.data.params.msg_submit_tx_max_messages; + } catch (e) { + if (e.response?.data?.message !== undefined) { + throw new Error(e.response?.data?.message); + } + throw e; + } + } + async queryGlobalfeeParams(): Promise { const req = await axios.get( `${this.sdk.url}/gaia/globalfee/v1beta1/params`, diff --git a/src/helpers/dao.ts b/src/helpers/dao.ts index 2348d1d9..5a48fb26 100644 --- a/src/helpers/dao.ts +++ b/src/helpers/dao.ts @@ -1209,7 +1209,7 @@ export class DaoMember { } /** - * submitUnpinCodesProposal creates proposal which unpins given code ids to wasmvm. + * submitUpdateParamsInterchaintxsProposal creates proposal which changes params of interchaintxs module. */ async submitUpdateParamsInterchaintxsProposal( @@ -1219,8 +1219,6 @@ export class DaoMember { amount: string, ): Promise { const message = updateInterchaintxsParamsProposal({ - title, - description, msg_submit_tx_max_messages: msgSubmitTxMaxMessages, }); return await this.submitSingleChoiceProposal( diff --git a/src/helpers/proposal.ts b/src/helpers/proposal.ts index 66df51ff..e5284364 100644 --- a/src/helpers/proposal.ts +++ b/src/helpers/proposal.ts @@ -17,8 +17,6 @@ export type PinCodesInfo = { }; export type UpdateParamsInterchaintxsInfo = { - title: string; - description: string; msg_submit_tx_max_messages: number; }; export type UpdateAdmin = { @@ -205,9 +203,9 @@ export const updateInterchaintxsParamsProposal = ( admin_proposal: { proposal_execute_message: { message: JSON.stringify({ - '@type': '/neutron.interchaintxs.MsgUpdateParams', + '@type': '/neutron.interchaintxs.v1.MsgUpdateParams', authority: ADMIN_MODULE_ADDRESS, - pararms: { + params: { msg_submit_tx_max_messages: info.msg_submit_tx_max_messages, }, }), diff --git a/src/helpers/types.ts b/src/helpers/types.ts index 9780bf12..3ae5bdae 100644 --- a/src/helpers/types.ts +++ b/src/helpers/types.ts @@ -284,6 +284,12 @@ export type IcaHostParamsResponse = { }; }; +export type InterchaintxsParamsResponse = { + params: { + msg_submit_tx_max_messages: number; + }; +}; + export type GlobalfeeParamsResponse = { minimum_gas_prices: cosmos.base.v1beta1.ICoin[]; bypass_min_fee_msg_types: string[]; diff --git a/src/testcases/parallel/tokenfactory.test.ts b/src/testcases/parallel/tokenfactory.test.ts index ed0c1a5c..02186f82 100644 --- a/src/testcases/parallel/tokenfactory.test.ts +++ b/src/testcases/parallel/tokenfactory.test.ts @@ -25,8 +25,8 @@ interface AuthorityMetadata { readonly authority_metadata: { readonly Admin: string }; } -interface BerforeSendHook { - readonly cosmwasm_address: string; +interface BeforeSendHook { + readonly contract_addr: string; } describe('Neutron / Tokenfactory', () => { @@ -192,7 +192,7 @@ describe('Neutron / Tokenfactory', () => { }); }); - test('create denom, set before', async () => { + test('create denom, set before send hook', async () => { const denom = `test5`; const data = await msgCreateDenom( @@ -217,7 +217,7 @@ describe('Neutron / Tokenfactory', () => { newTokenDenom, ); - expect(hookAfter.cosmwasm_address).toEqual(ownerWallet.address.toString()); + expect(hookAfter.contract_addr).toEqual(ownerWallet.address.toString()); }); describe('wasmbindings', () => { @@ -413,8 +413,8 @@ const getAuthorityMetadata = async ( const getBeforeSendHook = async ( sdkUrl: string, denom: string, -): Promise => { - const res = await axios.get( +): Promise => { + const res = await axios.get( `${sdkUrl}/osmosis/tokenfactory/v1beta1/denoms/${denom}/before_send_hook`, );