Skip to content

Commit

Permalink
post-review + some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
quasisamurai committed Sep 13, 2023
1 parent 3648f51 commit 3ff7e5d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
23 changes: 21 additions & 2 deletions src/helpers/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
CurrentPlanResponse,
PinnedCodesResponse,
IcaHostParamsResponse,
GlobalfeeParamsResponse,
GlobalfeeParamsResponse, InterchaintxsParamsResponse,

Check failure on line 30 in src/helpers/cosmos.ts

View workflow job for this annotation

GitHub Actions / Actions - lint

Insert `⏎·`
} from './types';
import { DEBUG_SUBMIT_TX, getContractBinary } from './env';
const adminmodule = AdminProto.adminmodule.adminmodule;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
);

Check failure on line 109 in src/helpers/cosmos.ts

View workflow job for this annotation

GitHub Actions / Actions - lint

Delete `⏎`


export class CosmosWrapper {
readonly sdk: cosmosclient.CosmosSDK;
Expand Down Expand Up @@ -396,6 +400,21 @@ export class CosmosWrapper {
}
}

async queryMaxTxsAllowed(): Promise<number> {
try {
const req = await axios.get<InterchaintxsParamsResponse>(
`${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<GlobalfeeParamsResponse> {
const req = await axios.get(
`${this.sdk.url}/gaia/globalfee/v1beta1/params`,
Expand Down
4 changes: 1 addition & 3 deletions src/helpers/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -1219,8 +1219,6 @@ export class DaoMember {
amount: string,
): Promise<number> {
const message = updateInterchaintxsParamsProposal({
title,
description,
msg_submit_tx_max_messages: msgSubmitTxMaxMessages,
});
return await this.submitSingleChoiceProposal(
Expand Down
6 changes: 2 additions & 4 deletions src/helpers/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export type PinCodesInfo = {
};

export type UpdateParamsInterchaintxsInfo = {
title: string;
description: string;
msg_submit_tx_max_messages: number;
};
export type UpdateAdmin = {
Expand Down Expand Up @@ -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,
},
}),
Expand Down
6 changes: 6 additions & 0 deletions src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
12 changes: 6 additions & 6 deletions src/testcases/parallel/tokenfactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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(
Expand All @@ -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', () => {
Expand Down Expand Up @@ -413,8 +413,8 @@ const getAuthorityMetadata = async (
const getBeforeSendHook = async (
sdkUrl: string,
denom: string,
): Promise<BerforeSendHook> => {
const res = await axios.get<BerforeSendHook>(
): Promise<BeforeSendHook> => {
const res = await axios.get<BeforeSendHook>(
`${sdkUrl}/osmosis/tokenfactory/v1beta1/denoms/${denom}/before_send_hook`,
);

Expand Down

0 comments on commit 3ff7e5d

Please sign in to comment.