-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path4_bond.ts
49 lines (46 loc) · 1.07 KB
/
4_bond.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
import { MsgExecuteContract } from "@terra-money/terra.js";
import yargs from "yargs/yargs";
import { createLCDClient, createWallet, sendTxWithConfirm } from "./helpers";
import * as keystore from "./keystore";
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 user = await createWallet(terra, argv["key"], argv["key-dir"]);
const { txhash } = await sendTxWithConfirm(user, [
new MsgExecuteContract(
user.key.accAddress,
argv["hub-address"],
{
bond: {},
},
{
uluna: argv["amount"],
}
),
]);
console.log(`Success! Txhash: ${txhash}`);
})();