-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (26 loc) · 1.2 KB
/
Copy pathindex.js
File metadata and controls
38 lines (26 loc) · 1.2 KB
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
const {
createAccount, createToken, buyToken, burnToken,
getBalance, getTokenBalance, transfer, getToken,
} = require("./hts");
require("dotenv").config();
const treasuryAccountId = process.env.ACCOUNT_ID;
const treasuryPrivateKey = process.env.PRIVATE_KEY;
async function main() {
const [accId, accKey] = await createAccount();
console.log(accId, accKey);
const token = await createToken("Token", "TOK");
console.log(token);
const balance_transfer = await transfer(treasuryAccountId, "0.0.307141", treasuryPrivateKey);
console.log(balance_transfer);
const transaction_buy = await buyToken("0.0.305536", 1, "0.0.307141", "302e020100300506032b6570042204201b00250e3e1892eba8f81ee42b401354095bc59e2017c4942b6be8daf7a76844");
console.log(transaction_buy);
const transaction_burn = await burnToken("0.0.305536", 1, "0.0.307141", "302e020100300506032b6570042204201b00250e3e1892eba8f81ee42b401354095bc59e2017c4942b6be8daf7a76844");
console.log(transaction_burn);
const balance = await getBalance("0.0.307141");
console.log(balance);
const balance_token = await getTokenBalance("0.0.307141");
console.log(balance_token);
const token_info = await getToken("0.0.305536");
console.log(token_info);
}
main();