-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path7_queue_unbond.ts
52 lines (48 loc) · 1.28 KB
/
7_queue_unbond.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
import yargs from "yargs/yargs";
import { MsgExecuteContract } from "@terra-money/terra.js";
import * as keystore from "./keystore";
import { createLCDClient, createWallet, encodeBase64, 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,
},
amount: {
type: "string",
demandOption: true,
},
})
.parseSync();
(async function () {
const terra = createLCDClient(argv["network"]);
const worker = await createWallet(terra, argv["key"], argv["key-dir"]);
const config: { stake_token: string } = await terra.wasm.contractQuery(argv["hub-address"], {
config: {},
});
const { txhash } = await sendTxWithConfirm(worker, [
new MsgExecuteContract(worker.key.accAddress, config["stake_token"], {
send: {
contract: argv["hub-address"],
amount: argv["amount"],
msg: encodeBase64({
queue_unbond: {},
}),
},
}),
]);
console.log(`Success! Txhash: ${txhash}`);
})();