Skip to content

Commit

Permalink
feat: set blockchain config
Browse files Browse the repository at this point in the history
  • Loading branch information
theblockstalk committed Sep 4, 2024
1 parent b483b06 commit 8d528cb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/cli/msig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { printCliHelp } from '..';
import { vestingBulk } from './vestingBulk';
import { hyphaContractSet } from './hyphaContractSet';
import { setResourceConfig } from './setResourceConfig';
import { setBlockchainConfig } from './setBlockchainConfig';

const eosioMsigContract = EosioMsigContract.Instance;

Expand Down Expand Up @@ -312,6 +313,17 @@ export default async function msig(args: string[]) {
test,
}
);
} else if (proposalType === 'set-chain-config') {
await setBlockchainConfig(
{},
{
proposer,
proposalName,
privateKey,
requested: newGovernanceAccounts,
test,
}
);
} else {
throw new Error(`Invalid msig proposal type ${proposalType}`);
}
Expand Down
30 changes: 30 additions & 0 deletions src/cli/msig/setBlockchainConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defaultBlockchainParams } from '../../sdk/services/blockchain';
import { StandardProposalOptions, createProposal, executeProposal } from '.';

// @ts-expect-error args not used
export async function setBlockchainConfig(args, options: StandardProposalOptions) {
const action = {
authorization: [
{
actor: 'tonomy',
permission: 'active',
},
{
actor: 'tonomy',
permission: 'owner',
},
],
account: 'tonomy',
name: 'setparams',
data: { params: defaultBlockchainParams },
};
const proposalHash = await createProposal(
options.proposer,
options.proposalName,
[action],
options.privateKey,
options.requested
);

if (options.test) await executeProposal(options.proposer, options.proposalName, proposalHash);
}

0 comments on commit 8d528cb

Please sign in to comment.