Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions cosmwasm/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,31 @@ const itsUnfreezeChain = async (
return executeContractMessage(client, config, options, 'InterchainTokenService', msg, fee, defaultTitle);
};

const executeContractViaGovernance = async (
client: ClientManager,
config: ConfigManager,
options: ContractCommandOptions & { msg?: string },
_args: string[],
fee?: string | StdFee,
): Promise<void> => {
const { contractName, msg } = options;

if (!contractName) {
throw new Error('Contract name is required (-c, --contractName)');
}

if (!msg) {
throw new Error('Message is required (--msg)');
}

const title = options.title || `Execute message on ${contractName}`;
const description = options.description || title;

validateParameters({ isNonEmptyString: { title, description } });

await executeByGovernance(client, config, { ...options, msg: [msg], title, description }, [], fee);
};

// ==================== End Emergency Operations ====================

const programHandler = () => {
Expand Down Expand Up @@ -886,6 +911,13 @@ const programHandler = () => {
fetchCodeId: true,
});

const executeContractCmd = program
.command('execute-contract')
.description('Execute an arbitrary contract message via governance proposal')
.option('--msg <message>', 'contract message in JSON format')
.action((options) => mainProcessor(executeContractViaGovernance, options, []));
addAmplifierOptions(executeContractCmd, { proposalOptions: true });
Comment thread
AttissNgo marked this conversation as resolved.
Outdated
Comment thread
AttissNgo marked this conversation as resolved.
Outdated

// ==================== Emergency Operations Commands ====================

const routerFreezeChainCmd = program
Expand Down
Loading