-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathset_msg_fee.ts
54 lines (46 loc) · 1.63 KB
/
set_msg_fee.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import BigNumber from "bignumber.js";
import * as BIP39 from "bip39";
import { CarbonSDK } from "./_sdk";
import "./_setup";
(async () => {
const mnemonics = process.env.MNEMONICS ?? BIP39.generateMnemonic();
console.log("mnemonics", mnemonics);
const sdk = await CarbonSDK.instance({
network: CarbonSDK.Network.LocalHost,
config: {
tmRpcUrl: process.env.TRPC_ENDPOINT,
},
});
const connectedSDK = await sdk.connectWithMnemonic(mnemonics);
console.log("connected sdk");
// set gas cost for msg type
const setGasCostResult = await connectedSDK.admin.setMsgGasCost({
msgType: "test1",
gasCost: new BigNumber(100),
});
console.log(setGasCostResult);
// set min gas price
const setMinGasPriceResult = await connectedSDK.admin.setMinGasPrice({
denom: "test2",
gasPrice: new BigNumber(1000),
});
console.log(setMinGasPriceResult);
// test1 and test2 available
console.log((await connectedSDK.query.fee.MsgGasCostAll({})).msgGasCosts);
console.log((await connectedSDK.query.fee.MinGasPriceAll({})).minGasPrices);
// remove gas cost for msg type
const removeGasCostResult = await connectedSDK.admin.removeMsgGasCost({
msgType: "test1",
});
console.log(removeGasCostResult);
// remove min gas price
const removeMinGasPriceResult = await connectedSDK.admin.removeMinGasPrice({
denom: "test2",
});
console.log(removeMinGasPriceResult);
// test1 and test2 removed
console.log((await connectedSDK.query.fee.MsgGasCostAll({})).msgGasCosts);
console.log((await connectedSDK.query.fee.MinGasPriceAll({})).minGasPrices);
})()
.catch(console.error)
.finally(() => process.exit(0));