Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: v2.47.0 #2352

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v2.47.0

## What's Changed

* revert: mirror node queries changes by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2328
* feature: change or remove existing keys from a token [HIP-540] by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2299
* release: proto v2.15.0-beta.1 by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2351

## v2.46.0

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ tasks:
"test:release":
cmds:
- task: build
# - task: test:unit
- task: test:unit
- task: examples:build
- task: simple_rest_signature_provider:build
- task: common_js_test:build
Expand Down
119 changes: 55 additions & 64 deletions examples/change-or-remove-token-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ async function main() {
const infoLogger = new Logger(LogLevel.Info);
client.setLogger(infoLogger);


const adminKey = PrivateKey.generateED25519();
const supplyKey = PrivateKey.generateED25519();
const newSupplyKey = PrivateKey.generateED25519();
Expand All @@ -61,14 +60,14 @@ async function main() {
console.log("=====================================================");
console.log("Initializing token keys...");
console.log("-----------------------------------------------------");
console.log('Admin key:', adminKey.publicKey.toString());
console.log('Supply key:', supplyKey.publicKey.toString());
console.log('New supply key:', newSupplyKey.publicKey.toString());
console.log('Wipe key:', wipeKey.publicKey.toString());
console.log('Freeze key:', freezeKey.publicKey.toString());
console.log('Pause key:', pauseKey.publicKey.toString());
console.log('Fee schedule key:', feeScheduleKey.publicKey.toString());
console.log('Metadata key:', metadataKey.publicKey.toString());
console.log("Admin key:", adminKey.publicKey.toString());
console.log("Supply key:", supplyKey.publicKey.toString());
console.log("New supply key:", newSupplyKey.publicKey.toString());
console.log("Wipe key:", wipeKey.publicKey.toString());
console.log("Freeze key:", freezeKey.publicKey.toString());
console.log("Pause key:", pauseKey.publicKey.toString());
console.log("Fee schedule key:", feeScheduleKey.publicKey.toString());
console.log("Metadata key:", metadataKey.publicKey.toString());
console.log("Unusable key:", unusableKey.toString());
console.log("=====================================================");
console.log("\n");
Expand All @@ -92,31 +91,27 @@ async function main() {
.setMetadataKey(metadataKey)
.freezeWith(client);

response = await (
await token.sign(adminKey)
).execute(client);
response = await (await token.sign(adminKey)).execute(client);

receipt = await response.getReceipt(client)
console.log('Token create transction status:', receipt.status.toString());
receipt = await response.getReceipt(client);
console.log("Token create transction status:", receipt.status.toString());

const tokenId = receipt.tokenId;
console.log('Token id:', tokenId.toString());
console.log("Token id:", tokenId.toString());
console.log("=====================================================");
console.log("\n");
console.log("=====================================================");
console.log("Token keys:");
console.log("-----------------------------------------------------");
tokenInfo = await new TokenInfoQuery()
.setTokenId(tokenId)
.execute(client);

console.log('Token admin key:', tokenInfo.adminKey.toString());
console.log('Token pause key:', tokenInfo.pauseKey.toString());
console.log('Token freeze key:', tokenInfo.freezeKey.toString());
console.log('Token wipe key:', tokenInfo.wipeKey.toString());
console.log('Token supply key:', tokenInfo.supplyKey.toString());
console.log('Token fee schedule key:', tokenInfo.feeScheduleKey.toString());
console.log('Token metadata key:', tokenInfo.metadataKey.toString());
tokenInfo = await new TokenInfoQuery().setTokenId(tokenId).execute(client);

console.log("Token admin key:", tokenInfo.adminKey.toString());
console.log("Token pause key:", tokenInfo.pauseKey.toString());
console.log("Token freeze key:", tokenInfo.freezeKey.toString());
console.log("Token wipe key:", tokenInfo.wipeKey.toString());
console.log("Token supply key:", tokenInfo.supplyKey.toString());
console.log("Token fee schedule key:", tokenInfo.feeScheduleKey.toString());
console.log("Token metadata key:", tokenInfo.metadataKey.toString());
console.log("=====================================================");
console.log("\n");
console.log("=====================================================");
Expand All @@ -126,18 +121,14 @@ async function main() {
.setTokenId(tokenId)
.setWipeKey(emptyKeyList)
.setKeyVerificationMode(TokenKeyValidation.FullValidation)
.freezeWith(client)
response = await (
await update.sign(adminKey)
).execute(client);
.freezeWith(client);
response = await (await update.sign(adminKey)).execute(client);

receipt = await response.getReceipt(client)
receipt = await response.getReceipt(client);
console.log("Token update transaction status:", receipt.status.toString());

tokenInfo = await new TokenInfoQuery()
.setTokenId(tokenId)
.execute(client);
console.log('Token wipeKey is', tokenInfo.wipeKey);
tokenInfo = await new TokenInfoQuery().setTokenId(tokenId).execute(client);
console.log("Token wipeKey is", tokenInfo.wipeKey);
console.log("=====================================================");
console.log("\n");
console.log("=====================================================");
Expand All @@ -147,68 +138,68 @@ async function main() {
.setTokenId(tokenId)
.setAdminKey(emptyKeyList)
.setKeyVerificationMode(TokenKeyValidation.NoValidation)
.freezeWith(client)
response = await (
await update.sign(adminKey)
).execute(client);
.freezeWith(client);
response = await (await update.sign(adminKey)).execute(client);

receipt = await response.getReceipt(client)
receipt = await response.getReceipt(client);
console.log("Token update transaction status:", receipt.status.toString());

tokenInfo = await new TokenInfoQuery()
.setTokenId(tokenId)
.execute(client);
console.log('Token adminKey is', tokenInfo.adminKey);
tokenInfo = await new TokenInfoQuery().setTokenId(tokenId).execute(client);
console.log("Token adminKey is", tokenInfo.adminKey);
console.log("=====================================================");
console.log("\n");
console.log("=====================================================");
console.log("Updating Supply Key...");
console.log("-----------------------------------------------------");
console.log('Token supplyKey (before update) is', tokenInfo.supplyKey.toString())
console.log(
"Token supplyKey (before update) is",
tokenInfo.supplyKey.toString(),
);
update = new TokenUpdateTransaction()
.setTokenId(tokenId)
.setSupplyKey(newSupplyKey)
.setKeyVerificationMode(TokenKeyValidation.FullValidation)
.freezeWith(client)
.freezeWith(client);
response = await (
await(
await update.sign(supplyKey)
).sign(newSupplyKey)
await (await update.sign(supplyKey)).sign(newSupplyKey)
).execute(client);

receipt = await response.getReceipt(client)
receipt = await response.getReceipt(client);
console.log("Token update transaction status:", receipt.status.toString());

tokenInfo = await new TokenInfoQuery()
.setTokenId(tokenId)
.execute(client);
console.log('Token suppleyKey (after update) is', tokenInfo.supplyKey.toString());
tokenInfo = await new TokenInfoQuery().setTokenId(tokenId).execute(client);
console.log(
"Token suppleyKey (after update) is",
tokenInfo.supplyKey.toString(),
);
console.log("=====================================================");
console.log("\n");
console.log("=====================================================");
console.log("Updating Supply Key to unusable format...");
console.log("-----------------------------------------------------");
console.log('Token supplyKey (before update) is', tokenInfo.supplyKey.toString())
console.log(
"Token supplyKey (before update) is",
tokenInfo.supplyKey.toString(),
);
update = new TokenUpdateTransaction()
.setTokenId(tokenId)
.setSupplyKey(unusableKey)
.setKeyVerificationMode(TokenKeyValidation.NoValidation)
.freezeWith(client);
response = await(
await update.sign(newSupplyKey)
).execute(client);
response = await (await update.sign(newSupplyKey)).execute(client);

receipt = await response.getReceipt(client)
receipt = await response.getReceipt(client);
console.log("Token update transaction status:", receipt.status.toString());

tokenInfo = await new TokenInfoQuery()
.setTokenId(tokenId)
.execute(client);
tokenInfo = await new TokenInfoQuery().setTokenId(tokenId).execute(client);

console.log('Token suppleyKey (after update) is', tokenInfo.supplyKey.toString());
console.log(
"Token suppleyKey (after update) is",
tokenInfo.supplyKey.toString(),
);
console.log("=====================================================");

client.close();
}

main();
void main();
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/sdk",
"version": "2.46.0",
"version": "2.47.0",
"description": "Hedera™ Hashgraph SDK",
"types": "./lib/index.d.ts",
"main": "./lib/index.cjs",
Expand Down Expand Up @@ -58,7 +58,7 @@
"@ethersproject/rlp": "^5.7.0",
"@grpc/grpc-js": "1.8.2",
"@hashgraph/cryptography": "1.4.8-beta.5",
"@hashgraph/proto": "2.15.0",
"@hashgraph/proto": "2.15.0-beta.1",
"axios": "^1.6.4",
"bignumber.js": "^9.1.1",
"bn.js": "^5.1.1",
Expand Down Expand Up @@ -130,4 +130,4 @@
"optional": true
}
}
}
}