Skip to content

Commit

Permalink
Merge pull request #223 from neutron-org/feat/params-testsuit
Browse files Browse the repository at this point in the history
add sdk-47 params test NTRN-113
  • Loading branch information
pr0n00gler authored Nov 8, 2023
2 parents 992f63f + 85c0a6a commit 57142eb
Show file tree
Hide file tree
Showing 7 changed files with 717 additions and 9 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test:dao": "NO_WAIT_CHANNEL1=1 NO_WAIT_HTTP2=1 NO_WAIT_CHANNEL2=1 NO_WAIT_DELAY=1 jest -b src/testcases/parallel/dao_assert",
"test:globalfee": "jest -b src/testcases/run_in_band/globalfee",
"test:ibc_hooks": "jest -b src/testcases/run_in_band/ibc_hooks",
"test:parameters": "jest -b src/testcases/run_in_band/parameters",
"test:tokenfactory": "jest -b src/testcases/parallel/tokenfactory",
"test:overrule": "jest -b src/testcases/parallel/overrule",
"test:tge:vesting_lp_vault": "jest -b src/testcases/parallel/tge.vesting_lp_vault",
Expand Down Expand Up @@ -85,4 +86,4 @@
"engines": {
"node": ">=11.0 <17"
}
}
}
68 changes: 67 additions & 1 deletion src/helpers/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ import {
InterchaintxsParamsResponse,
} from './types';
import { DEBUG_SUBMIT_TX, getContractBinary } from './env';
import {
ParamsContractmanagerInfo,
ParamsCronInfo,
ParamsFeeburnerInfo,
ParamsFeerefunderInfo,
ParamsInterchainqueriesInfo,
ParamsTokenfactoryInfo,
} from './proposal';
const adminmodule = AdminProto.adminmodule.adminmodule;

export const NEUTRON_DENOM = process.env.NEUTRON_DENOM || 'untrn';
Expand Down Expand Up @@ -68,6 +76,28 @@ export type TotalBurnedNeutronsAmountResponse = {
};
};

export type ParamsContractmanagerResponse = {
params: ParamsContractmanagerInfo;
};

export type ParamsCronResponse = {
params: ParamsCronInfo;
};

export type ParamsFeerefunderResponse = {
params: ParamsFeerefunderInfo;
};

export type ParamsFeeburnerResponse = {
params: ParamsFeeburnerInfo;
};

export type ParamsTokenfactoryResponse = {
params: ParamsTokenfactoryInfo;
};
export type ParamsInterchainqueriesResponse = {
params: ParamsInterchainqueriesInfo;
};
cosmosclient.codec.register(
'/neutron.interchainqueries.MsgRemoveInterchainQueryRequest',
neutron.interchainqueries.MsgRemoveInterchainQueryRequest,
Expand Down Expand Up @@ -201,14 +231,50 @@ export class CosmosWrapper {
return account.sequence;
}

async queryInterchainqueriesParams(): Promise<any> {
async queryInterchainqueriesParams(): Promise<ParamsInterchainqueriesResponse> {
const req = await axios.get(
`${this.sdk.url}/neutron/interchainqueries/params`,
);

return req.data;
}

async queryFeeburnerParams(): Promise<ParamsFeeburnerResponse> {
const req = await axios.get(`${this.sdk.url}/neutron/feeburner/params`);

return req.data;
}

async queryFeerefunderParams(): Promise<ParamsFeerefunderResponse> {
const req = await axios.get(
`${this.sdk.url}/neutron-org/neutron/feerefunder/params`,
);

return req.data;
}

async queryContractmanagerParams(): Promise<ParamsContractmanagerResponse> {
const req = await axios.get(
`${this.sdk.url}/neutron/contractmanager/params`,
);

return req.data;
}

async queryCronParams(): Promise<ParamsCronResponse> {
const req = await axios.get(`${this.sdk.url}/neutron/cron/params`);

return req.data;
}

async queryTokenfactoryParams(): Promise<ParamsTokenfactoryResponse> {
const req = await axios.get(
`${this.sdk.url}/osmosis/tokenfactory/v1beta1/params`,
);

return req.data;
}

async queryDelegations(delegatorAddr: cosmosclient.AccAddress): Promise<any> {
const balances = await cosmosclient.rest.staking.delegatorDelegations(
this.sdk,
Expand Down
124 changes: 120 additions & 4 deletions src/helpers/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ import {
SendProposalInfo,
unpinCodesProposal,
updateAdminProposal,
updateInterchaintxsParamsProposal,
updateContractmanagerParamsProposal,
ParamsCronInfo,
ParamsFeerefunderInfo,
ParamsInterchainqueriesInfo,
ParamsInterchaintxsInfo,
ParamsTokenfactoryInfo,
upgradeProposal,
ParamsFeeburnerInfo,
} from './proposal';
import { ibc } from '../generated/ibc/proto';
import cosmosclient from '@cosmos-client/core';
Expand Down Expand Up @@ -1216,11 +1222,121 @@ export class DaoMember {
async submitUpdateParamsInterchaintxsProposal(
title: string,
description: string,
msgSubmitTxMaxMessages: number,
message: ParamsInterchaintxsInfo,
amount: string,
): Promise<number> {
const message = updateInterchaintxsParamsProposal({
msg_submit_tx_max_messages: msgSubmitTxMaxMessages,
return await this.submitSingleChoiceProposal(
title,
description,
[message],
amount,
);
}

/**
* submitUpdateParamsInterchainqueriesProposal creates proposal which changes params of interchaintxs module.
*/

async submitUpdateParamsInterchainqueriesProposal(
title: string,
description: string,
message: ParamsInterchainqueriesInfo,
amount: string,
): Promise<number> {
return await this.submitSingleChoiceProposal(
title,
description,
[message],
amount,
);
}

/**
* submitUpdateParamsTokenfactoryProposal creates proposal which changes params of tokenfactory module.
*/

async submitUpdateParamsTokenfactoryProposal(
title: string,
description: string,
message: ParamsTokenfactoryInfo,
amount: string,
): Promise<number> {
return await this.submitSingleChoiceProposal(
title,
description,
[message],
amount,
);
}

/**
* submitUpdateParamsFeeburnerProposal creates proposal which changes some params of feeburner module.
*/

async submitUpdateParamsFeeburnerProposal(
title: string,
description: string,
message: ParamsFeeburnerInfo,
amount: string,
): Promise<number> {
return await this.submitSingleChoiceProposal(
title,
description,
[message],
amount,
);
}

/**
* submitUpdateParamsFeerefunderProposal creates proposal which changes some params of feerefunder module.
*/

async submitUpdateParamsFeerefunderProposal(
title: string,
description: string,
amount: string,
message: ParamsFeerefunderInfo = {
min_fee: { recv_fee: null, ack_fee: null, timeout_fee: null },
},
): Promise<number> {
return await this.submitSingleChoiceProposal(
title,
description,
[message],
amount,
);
}

/**
* submitUpdateParamsCronProposal creates proposal which changes soe params of cron module.
*/

async submitUpdateParamsCronProposal(
title: string,
description: string,
message: ParamsCronInfo,
amount: string,
): Promise<number> {
return await this.submitSingleChoiceProposal(
title,
description,
[message],
amount,
);
}

/**
* submitUpdateParamsContractmanageProposal creates proposal which changes some params of contractmanager module.
*/

async submitUpdateParamsContractmanageProposal(
title: string,
description: string,
sudoCallGasLimit: string,
amount: string,
): Promise<number> {
const message = updateContractmanagerParamsProposal({
sudo_call_gas_limit: sudoCallGasLimit,
});
return await this.submitSingleChoiceProposal(
title,
Expand Down
Loading

0 comments on commit 57142eb

Please sign in to comment.