-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtoken_key_reset.js
39 lines (28 loc) · 1.36 KB
/
token_key_reset.js
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
// Import classes etc.
import { Connection } from "./modules/connection.js";
import { PrivateKey, TokenUpdateTransaction } from "@hashgraph/sdk";
// ******* START - EDIT ZONE (Only make changes below here) ********
let tokenId = "0.0.34812767";
// ******* END - EDIT ZONE (Only make changes above here) ********
async function main(){
// SETUP CLIENTS
let client = new Connection().client;
//Create the transaction and freeze for manual signing
const transaction = await new TokenUpdateTransaction()
.setTokenId(tokenId)
.setSupplyKey(PrivateKey.fromString(process.env.SUPPLY_KEY))
.setPauseKey(PrivateKey.fromString(process.env.PAUSE_KEY))
.setFreezeKey(PrivateKey.fromString(process.env.FREEZE_KEY))
.setWipeKey(PrivateKey.fromString(process.env.WIPE_KEY))
.freezeWith(client);
//Sign the transaction with the admin key
const signTx = await transaction.sign(PrivateKey.fromString(process.env.ADMIN_KEY));
//Submit the signed transaction to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status.toString();
console.log("The transaction consensus status is " + transactionStatus);
}
main();