-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path6_rebalance.ts
38 lines (35 loc) · 966 Bytes
/
6_rebalance.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
import yargs from "yargs/yargs";
import { MsgExecuteContract } from "@terra-money/terra.js";
import * as keystore from "./keystore";
import { createLCDClient, createWallet, sendTxWithConfirm } from "./helpers";
const argv = yargs(process.argv)
.options({
network: {
type: "string",
demandOption: true,
},
key: {
type: "string",
demandOption: true,
},
"key-dir": {
type: "string",
demandOption: false,
default: keystore.DEFAULT_KEY_DIR,
},
"hub-address": {
type: "string",
demandOption: true,
},
})
.parseSync();
(async function () {
const terra = createLCDClient(argv["network"]);
const worker = await createWallet(terra, argv["key"], argv["key-dir"]);
const { txhash } = await sendTxWithConfirm(worker, [
new MsgExecuteContract(worker.key.accAddress, argv["hub-address"], {
rebalance: {},
}),
]);
console.log(`Success! Txhash: ${txhash}`);
})();