-
Notifications
You must be signed in to change notification settings - Fork 10
/
mint.ts
31 lines (26 loc) · 938 Bytes
/
mint.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
import * as BIP39 from "bip39";
import { CarbonSDK } from "./_sdk";
import { BigNumber } from "bignumber.js";
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");
const response = await sdk.query.coin.TokenAll({})
console.log("tokens: ", response.tokens)
const indivToken = response.tokens[0]
const result = await connectedSDK.coin.mintToken({
creator: connectedSDK.wallet.bech32Address,
denom: indivToken.denom,
amount: new BigNumber(100000),
to: connectedSDK.wallet.bech32Address,
})
console.log(result)
})().catch(console.error).finally(() => process.exit(0));