Skip to content

Commit 164c542

Browse files
authored
feat(contract_manager): add generate set fee payload script to contract manager (#1563)
* add generate set fee payload script to contract manager * address comments
1 parent 368e108 commit 164c542

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import yargs from "yargs";
2+
import { hideBin } from "yargs/helpers";
3+
import { DefaultStore } from "../src";
4+
import { Chain } from "../src/chains";
5+
6+
const parser = yargs(hideBin(process.argv))
7+
.usage("Usage: $0 --chain <chain_id> --fee <fee> --exponent <exponent>")
8+
.options({
9+
chain: {
10+
type: "string",
11+
demandOption: true,
12+
desc: "Chain for which to generate the Set Fee payload",
13+
},
14+
fee: {
15+
type: "number",
16+
demandOption: true,
17+
desc: "The new fee to set",
18+
},
19+
exponent: {
20+
type: "number",
21+
demandOption: true,
22+
desc: "The new fee exponent to set",
23+
},
24+
});
25+
26+
async function main() {
27+
const { chain, fee, exponent } = await parser.argv;
28+
29+
const chain_obj = DefaultStore.chains[chain];
30+
if (!chain_obj) {
31+
throw new Error(`Chain with ID '${chain}' does not exist.`);
32+
}
33+
34+
const payload = chain_obj.generateGovernanceSetFeePayload(fee, exponent);
35+
console.log(
36+
`Generated payload for chain ${chain_obj}:`,
37+
payload.toString("hex")
38+
);
39+
}
40+
41+
main();

0 commit comments

Comments
 (0)