diff --git a/CHANGELOG.md b/CHANGELOG.md index 24e86b0c1..298d60a4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ 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.38.0 + +## What's Changed + +* Add two grpc-web endpoints for node27/28 to ClientConstants.js by @ElijahLynn in https://github.com/hashgraph/hedera-sdk-js/pull/2019 +* LocalProvider - close method by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2020 +* Method fromEvmAddress() fails to return the contract id from long zero address by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2018 +* Add support for Long and BigNumber to the array methods of ContractFunctionParameters by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2013 +* Added fromStringDer() method (and tests) and deprecated fromString() method by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2030 +* Remove all warnings by @svetoslav-nikol0v in https://github.com/hashgraph/hedera-sdk-js/pull/2033 + ## v2.37.0 ## What's Changed diff --git a/examples/account-create-with-hts.js b/examples/account-create-with-hts.js index 27fd20ebf..521db1e5e 100644 --- a/examples/account-create-with-hts.js +++ b/examples/account-create-with-hts.js @@ -54,7 +54,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/consensus-pub-sub.js b/examples/consensus-pub-sub.js index 71c2f0bce..51197d8a1 100644 --- a/examples/consensus-pub-sub.js +++ b/examples/consensus-pub-sub.js @@ -26,7 +26,7 @@ async function main() { client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromString(process.env.OPERATOR_KEY) + PrivateKey.fromStringDer(process.env.OPERATOR_KEY) ); try { diff --git a/examples/contract-nonces.js b/examples/contract-nonces.js index 7a5ba08c0..f94c0cf04 100644 --- a/examples/contract-nonces.js +++ b/examples/contract-nonces.js @@ -36,7 +36,7 @@ async function main() { try { const fileCreateTxResponse = await ( await new FileCreateTransaction() - .setKeys([PrivateKey.fromString(process.env.OPERATOR_KEY)]) + .setKeys([PrivateKey.fromStringDer(process.env.OPERATOR_KEY)]) .setContents(SMART_CONTRACT_BYTECODE) .setMaxTransactionFee(new Hbar(2)) .freezeWithSigner(wallet) @@ -48,7 +48,7 @@ async function main() { const contractCreateTxResponse = await ( await new ContractCreateTransaction() - .setAdminKey(PrivateKey.fromString(process.env.OPERATOR_KEY)) + .setAdminKey(PrivateKey.fromStringDer(process.env.OPERATOR_KEY)) .setGas(100000) .setBytecodeFileId(newFileId) .setContractMemo( diff --git a/examples/create-account-with-alias-and-receiver-signature.js b/examples/create-account-with-alias-and-receiver-signature.js index 09cc78576..9dfd9471d 100644 --- a/examples/create-account-with-alias-and-receiver-signature.js +++ b/examples/create-account-with-alias-and-receiver-signature.js @@ -32,7 +32,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/create-account-with-alias.js b/examples/create-account-with-alias.js index 546c7331e..e802c1237 100644 --- a/examples/create-account-with-alias.js +++ b/examples/create-account-with-alias.js @@ -31,7 +31,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/exempt-custom-fees.js b/examples/exempt-custom-fees.js index 68ce09fa3..382b15fff 100644 --- a/examples/exempt-custom-fees.js +++ b/examples/exempt-custom-fees.js @@ -44,7 +44,7 @@ async function main() { } // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const provider = new LocalProvider(); diff --git a/examples/generate-txid-on-demand.js b/examples/generate-txid-on-demand.js index c58946246..25c36a9df 100644 --- a/examples/generate-txid-on-demand.js +++ b/examples/generate-txid-on-demand.js @@ -49,7 +49,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); let client; diff --git a/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js b/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js index c1bd06a55..fca9174f5 100644 --- a/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js +++ b/examples/hts-nftP1-fee-create-mint-burn-associate-transfer.js @@ -28,13 +28,13 @@ dotenv.config(); // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); -const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); +const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const treasuryId = AccountId.fromString(process.env.TREASURY_ID); -const treasuryKey = PrivateKey.fromString(process.env.TREASURY_KEY); +const treasuryKey = PrivateKey.fromStringDer(process.env.TREASURY_KEY); const aliceId = AccountId.fromString(process.env.ALICE_ID); -const aliceKey = PrivateKey.fromString(process.env.ALICE_KEY); +const aliceKey = PrivateKey.fromStringDer(process.env.ALICE_KEY); const bobId = AccountId.fromString(process.env.BOB_ID); -const bobKey = PrivateKey.fromString(process.env.BOB_KEY); +const bobKey = PrivateKey.fromStringDer(process.env.BOB_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/hts-nftP2-kyc-upate-schedule.js b/examples/hts-nftP2-kyc-upate-schedule.js index c209f038d..a55a01a89 100644 --- a/examples/hts-nftP2-kyc-upate-schedule.js +++ b/examples/hts-nftP2-kyc-upate-schedule.js @@ -32,13 +32,13 @@ dotenv.config(); // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); -const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); +const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const treasuryId = AccountId.fromString(process.env.TREASURY_ID); -const treasuryKey = PrivateKey.fromString(process.env.TREASURY_KEY); +const treasuryKey = PrivateKey.fromStringDer(process.env.TREASURY_KEY); const aliceId = AccountId.fromString(process.env.ALICE_ID); -const aliceKey = PrivateKey.fromString(process.env.ALICE_KEY); +const aliceKey = PrivateKey.fromStringDer(process.env.ALICE_KEY); const bobId = AccountId.fromString(process.env.BOB_ID); -const bobKey = PrivateKey.fromString(process.env.BOB_KEY); +const bobKey = PrivateKey.fromStringDer(process.env.BOB_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/hts-nftP3-pause-freeze-wipe-delete.js b/examples/hts-nftP3-pause-freeze-wipe-delete.js index 914e20f56..1b706c9e8 100644 --- a/examples/hts-nftP3-pause-freeze-wipe-delete.js +++ b/examples/hts-nftP3-pause-freeze-wipe-delete.js @@ -38,13 +38,13 @@ dotenv.config(); // Configure accounts and client, and generate needed keys const operatorId = AccountId.fromString(process.env.OPERATOR_ID); -const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); +const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const treasuryId = AccountId.fromString(process.env.TREASURY_ID); -const treasuryKey = PrivateKey.fromString(process.env.TREASURY_KEY); +const treasuryKey = PrivateKey.fromStringDer(process.env.TREASURY_KEY); const aliceId = AccountId.fromString(process.env.ALICE_ID); -const aliceKey = PrivateKey.fromString(process.env.ALICE_KEY); +const aliceKey = PrivateKey.fromStringDer(process.env.ALICE_KEY); const bobId = AccountId.fromString(process.env.BOB_ID); -const bobKey = PrivateKey.fromString(process.env.BOB_KEY); +const bobKey = PrivateKey.fromStringDer(process.env.BOB_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/lazy-create-transfer-tx.js b/examples/lazy-create-transfer-tx.js index c415a49be..06109ae37 100644 --- a/examples/lazy-create-transfer-tx.js +++ b/examples/lazy-create-transfer-tx.js @@ -49,7 +49,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/logger-functionalities.js b/examples/logger-functionalities.js index 0d48fc4ed..feb904b91 100644 --- a/examples/logger-functionalities.js +++ b/examples/logger-functionalities.js @@ -42,7 +42,7 @@ async function main() { } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); let debugLogger = new Logger(LogLevel.Debug); let infoLogger = new Logger(LogLevel.Info); diff --git a/examples/multi-sig-offline.js b/examples/multi-sig-offline.js index f76b167bd..3ed97b316 100644 --- a/examples/multi-sig-offline.js +++ b/examples/multi-sig-offline.js @@ -32,7 +32,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromString(process.env.OPERATOR_KEY) + PrivateKey.fromStringDer(process.env.OPERATOR_KEY) ); user1Key = PrivateKey.generate(); diff --git a/examples/nft-add-remove-allowances.js b/examples/nft-add-remove-allowances.js index 2de978588..9e75a2f2f 100644 --- a/examples/nft-add-remove-allowances.js +++ b/examples/nft-add-remove-allowances.js @@ -42,7 +42,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), }; diff --git a/examples/solidity-precompile-example.js b/examples/solidity-precompile-example.js index 8337cc5b6..50f572b62 100644 --- a/examples/solidity-precompile-example.js +++ b/examples/solidity-precompile-example.js @@ -24,7 +24,7 @@ async function main() { provider ); - const operatorPrivateKey = hashgraph.PrivateKey.fromString( + const operatorPrivateKey = hashgraph.PrivateKey.fromStringDer( process.env.OPERATOR_KEY ); const operatorPublicKey = operatorPrivateKey.publicKey; diff --git a/examples/time-drift.js b/examples/time-drift.js index 5a1de4968..dc8583dd6 100644 --- a/examples/time-drift.js +++ b/examples/time-drift.js @@ -54,7 +54,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromString(process.env.OPERATOR_KEY) + PrivateKey.fromStringDer(process.env.OPERATOR_KEY) ); await sync(); diff --git a/examples/topic-message-submit-get-all-chunks-status.js b/examples/topic-message-submit-get-all-chunks-status.js index cd0164960..4c10f0c35 100644 --- a/examples/topic-message-submit-get-all-chunks-status.js +++ b/examples/topic-message-submit-get-all-chunks-status.js @@ -32,7 +32,7 @@ async function main() { const client = Client.forName(process.env.HEDERA_NETWORK).setOperator( AccountId.fromString(process.env.OPERATOR_ID), - PrivateKey.fromString(process.env.OPERATOR_KEY) + PrivateKey.fromStringDer(process.env.OPERATOR_KEY) ); try { diff --git a/examples/transfer-using-evm-address.js b/examples/transfer-using-evm-address.js index a4abddce7..38caf7038 100644 --- a/examples/transfer-using-evm-address.js +++ b/examples/transfer-using-evm-address.js @@ -41,7 +41,7 @@ async function main() { ); } const operatorId = AccountId.fromString(process.env.OPERATOR_ID); - const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY); + const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY); const nodes = { "127.0.0.1:50211": new AccountId(3), diff --git a/examples/zeroTokenOperations.js b/examples/zeroTokenOperations.js index fbfd91ef5..2a9c7c09c 100644 --- a/examples/zeroTokenOperations.js +++ b/examples/zeroTokenOperations.js @@ -33,7 +33,7 @@ async function main() { provider ); - const operatorPrivateKey = hashgraph.PrivateKey.fromString( + const operatorPrivateKey = hashgraph.PrivateKey.fromStringDer( process.env.OPERATOR_KEY ); const operatorPublicKey = operatorPrivateKey.publicKey; diff --git a/package.json b/package.json index aca04e258..94ccbe69e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hashgraph/sdk", - "version": "2.37.0", + "version": "2.38.0", "description": "Hedera™ Hashgraph SDK", "types": "./lib/index.d.ts", "main": "./lib/index.cjs", @@ -57,7 +57,7 @@ "@ethersproject/bytes": "^5.7.0", "@ethersproject/rlp": "^5.7.0", "@grpc/grpc-js": "1.8.2", - "@hashgraph/cryptography": "1.4.8-beta.3", + "@hashgraph/cryptography": "1.4.8-beta.4", "@hashgraph/proto": "2.14.0-beta.2", "axios": "^1.3.1", "bignumber.js": "^9.1.1", diff --git a/packages/cryptography/package.json b/packages/cryptography/package.json index 32cf9ea2a..32a484ae2 100644 --- a/packages/cryptography/package.json +++ b/packages/cryptography/package.json @@ -1,6 +1,6 @@ { "name": "@hashgraph/cryptography", - "version": "1.4.8-beta.3", + "version": "1.4.8-beta.4", "description": "Cryptographic utilities and primitives for the Hedera™ Hashgraph SDK", "main": "./lib/index.cjs", "types": "./lib/index.d.ts", diff --git a/packages/cryptography/src/PrivateKey.js b/packages/cryptography/src/PrivateKey.js index 473096e8c..aeaf883b1 100644 --- a/packages/cryptography/src/PrivateKey.js +++ b/packages/cryptography/src/PrivateKey.js @@ -135,6 +135,13 @@ export default class PrivateKey extends Key { */ static fromBytes(data) { let message; + + if (data.length == 32) { + console.warn( + "WARNING: Consider using fromStringECDSA() or fromStringED2551() on a HEX-encoded string and fromStringDer() on a HEX-encoded string with DER prefix instead.", + ); + } + try { return new PrivateKey(Ed25519PrivateKey.fromBytes(data)); } catch (error) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 138f0d149..26beed189 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,8 +21,8 @@ dependencies: specifier: 1.8.2 version: 1.8.2 '@hashgraph/cryptography': - specifier: 1.4.8-beta.3 - version: 1.4.8-beta.3(expo@49.0.10) + specifier: 1.4.8-beta.4 + version: 1.4.8-beta.4(expo@49.0.10) '@hashgraph/proto': specifier: 2.14.0-beta.2 version: 2.14.0-beta.2 @@ -2588,8 +2588,8 @@ packages: protobufjs: 7.2.5 yargs: 17.7.2 - /@hashgraph/cryptography@1.4.8-beta.3(expo@49.0.10): - resolution: {integrity: sha512-ABmJOMr17ZeH8hf+SAKy+91SNdGjnfqTQlmm0LE4YFyT4Euo/YyIjyhCDQA2Oi+VBOC4p6CdRRa9vs3Q/Waxgg==} + /@hashgraph/cryptography@1.4.8-beta.4(expo@49.0.10): + resolution: {integrity: sha512-43wpRuE6ML04dFNpNPHvEZTKlVT9+dOE7SxyQPMYunsFitJvlIDl1VvOXeOSGbVdsV+nDQQV7C9pZWRSV1e32g==} engines: {node: '>=12.0.0'} peerDependencies: expo: ^45.0.3 diff --git a/src/PrivateKey.js b/src/PrivateKey.js index 048c70ad4..55add2c5d 100644 --- a/src/PrivateKey.js +++ b/src/PrivateKey.js @@ -143,14 +143,10 @@ export default class PrivateKey extends Key { * @deprecated - Use fromStringECDSA() or fromStringED2551() on a HEX-encoded string * and fromStringDer() on a HEX-encoded string with DER prefix instead. * Construct a private key from a hex-encoded string. Requires DER header. - * * @param {string} text * @returns {PrivateKey} */ static fromString(text) { - console.warn( - "WARNING: Consider using fromStringECDSA() or fromStringED2551() on a HEX-encoded string and fromStringDer() on a HEX-encoded string with DER prefix instead." - ); return new PrivateKey(cryptography.PrivateKey.fromString(text)); } diff --git a/src/Wallet.js b/src/Wallet.js index 979f86520..b65325ade 100644 --- a/src/Wallet.js +++ b/src/Wallet.js @@ -57,6 +57,8 @@ import * as util from "./util.js"; */ export default class Wallet { /** + * NOTE: When using string for private key, the string needs to contain DER headers + * * @param {AccountId | string} accountId * @param {PrivateKey | string} privateKey * @param {Provider=} provider @@ -64,7 +66,7 @@ export default class Wallet { constructor(accountId, privateKey, provider) { const key = typeof privateKey === "string" - ? PrivateKey.fromString(privateKey) + ? PrivateKey.fromStringDer(privateKey) : privateKey; this.publicKey = key.publicKey; diff --git a/src/client/Client.js b/src/client/Client.js index 51fa74ece..8d1d9afe0 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -280,6 +280,7 @@ export default class Client { /** * Set the account that will, by default, pay for transactions and queries built with this client. + * NOTE: When using string for private key, the string needs to contain DER headers * * @param {AccountId | string} accountId * @param {PrivateKey | string} privateKey @@ -288,7 +289,7 @@ export default class Client { setOperator(accountId, privateKey) { const key = typeof privateKey === "string" - ? PrivateKey.fromString(privateKey) + ? PrivateKey.fromStringDer(privateKey) : privateKey; return this.setOperatorWith(accountId, key.publicKey, (message) => diff --git a/test/unit/EcdsaPrivateKey.js b/test/unit/EcdsaPrivateKey.js index 9ff0db391..2bde9a6ab 100644 --- a/test/unit/EcdsaPrivateKey.js +++ b/test/unit/EcdsaPrivateKey.js @@ -17,7 +17,7 @@ describe("EcdsaPrivateKey", function () { }); it("fromStringRaw and fromStringDer work", function () { - PrivateKey.fromString( + PrivateKey.fromStringDer( hex.encode(PrivateKey.fromStringECDSA(RAW_KEY).toBytesDer()) ); }); @@ -328,25 +328,25 @@ describe("EcdsaPrivateKey", function () { const PUBLIC_KEY4 = "03b69a75a5ddb1c0747e995d47555019e5d8a28003ab5202bd92f534361fb4ec8a"; - const ecdsaPrivateKey1 = PrivateKey.fromString(PRIVATE_KEY_DER1); + const ecdsaPrivateKey1 = PrivateKey.fromStringDer(PRIVATE_KEY_DER1); expect(ecdsaPrivateKey1.toStringRaw()).to.be.equal(PRIVATE_KEY1); expect(ecdsaPrivateKey1.publicKey.toStringRaw()).to.be.equal( PUBLIC_KEY1 ); - const ecdsaPrivateKey2 = PrivateKey.fromString(PRIVATE_KEY_DER2); + const ecdsaPrivateKey2 = PrivateKey.fromStringDer(PRIVATE_KEY_DER2); expect(ecdsaPrivateKey2.toStringRaw()).to.be.equal(PRIVATE_KEY2); expect(ecdsaPrivateKey2.publicKey.toStringRaw()).to.be.equal( PUBLIC_KEY2 ); - const ecdsaPrivateKey3 = PrivateKey.fromString(PRIVATE_KEY_DER3); + const ecdsaPrivateKey3 = PrivateKey.fromStringDer(PRIVATE_KEY_DER3); expect(ecdsaPrivateKey3.toStringRaw()).to.be.equal(PRIVATE_KEY3); expect(ecdsaPrivateKey3.publicKey.toStringRaw()).to.be.equal( PUBLIC_KEY3 ); - const ecdsaPrivateKey4 = PrivateKey.fromString(PRIVATE_KEY_DER4); + const ecdsaPrivateKey4 = PrivateKey.fromStringDer(PRIVATE_KEY_DER4); expect(ecdsaPrivateKey4.toStringRaw()).to.be.equal(PRIVATE_KEY4); expect(ecdsaPrivateKey4.publicKey.toStringRaw()).to.be.equal( PUBLIC_KEY4 diff --git a/test/unit/Ed25519PrivateKey.js b/test/unit/Ed25519PrivateKey.js index 6a4f7aab2..bf0a02f78 100644 --- a/test/unit/Ed25519PrivateKey.js +++ b/test/unit/Ed25519PrivateKey.js @@ -15,8 +15,8 @@ describe("Ed25519PrivateKey", function () { await PrivateKey.generateED25519Async(); }); - it("fromStringRaw and fromStringDer work", function () { - PrivateKey.fromString( + it("fromStringDer works", function () { + PrivateKey.fromStringDer( hex.encode(PrivateKey.fromStringED25519(RAW_KEY).toBytesDer()) ); }); @@ -263,7 +263,7 @@ describe("Ed25519PrivateKey", function () { var PUBLIC_KEY1 = "8ccd31b53d1835b467aac795dab19b274dd3b37e3daf12fcec6bc02bac87b53d"; - var ed25519PrivateKey1 = PrivateKey.fromString(PRIVATE_KEY_DER1); + var ed25519PrivateKey1 = PrivateKey.fromStringDer(PRIVATE_KEY_DER1); expect(ed25519PrivateKey1.toStringRaw()).to.be.equal(PRIVATE_KEY1); expect(ed25519PrivateKey1.publicKey.toStringRaw()).to.be.equal( PUBLIC_KEY1 diff --git a/test/unit/TokenCreateTransaction.js b/test/unit/TokenCreateTransaction.js index 399c12ee2..39a34525e 100644 --- a/test/unit/TokenCreateTransaction.js +++ b/test/unit/TokenCreateTransaction.js @@ -10,25 +10,25 @@ import Long from "long"; describe("TokenCreateTransaction", function () { it("encodes to correct protobuf", function () { - const key1 = PrivateKey.fromString( + const key1 = PrivateKey.fromStringDer( "302e020100300506032b6570042204205fc37fbd55631722b7ab5ec8e31696f6d3f818a15c5258a1529de7d4a1def6e2" ); - const key2 = PrivateKey.fromString( + const key2 = PrivateKey.fromStringDer( "302e020100300506032b657004220420b5e15b70109fe6e11d1d6d06b20d27b494aa05a28a8bc84c627d9be66e179391" ); - const key3 = PrivateKey.fromString( + const key3 = PrivateKey.fromStringDer( "302e020100300506032b6570042204202b5dc9915d5b6829592f4562a3d099e7b1bdd48da347e351da8d31cd41653016" ); - const key4 = PrivateKey.fromString( + const key4 = PrivateKey.fromStringDer( "302e020100300506032b6570042204205a8571fe4badbc6bd76f03170f5ec4bdc69f2edb93f133477d0ef8f9e17a0f3a" ); - const key5 = PrivateKey.fromString( + const key5 = PrivateKey.fromStringDer( "302e020100300506032b65700422042081c36f46db2bc4e7d993a23718a158c9fffa96719d7e72b3823d8bc9b973d596" ); - const key6 = PrivateKey.fromString( + const key6 = PrivateKey.fromStringDer( "302e020100300506032b657004220420ff498f69b92ea43a0a8fd6e4a7036e5f8b5f23e527b0443bc309cc4ff5b75303" ); - const key7 = PrivateKey.fromString( + const key7 = PrivateKey.fromStringDer( "302e020100300506032b657004220420542b4d4a318a1ae5f91071f34c8d900b1150e83d15fe71d22b8581e1203f99ad" ); const autoRenewAccountId = new AccountId(10); diff --git a/test/unit/TokenUpdateTransaction.js b/test/unit/TokenUpdateTransaction.js index c57dc0f6a..81b4486af 100644 --- a/test/unit/TokenUpdateTransaction.js +++ b/test/unit/TokenUpdateTransaction.js @@ -9,25 +9,25 @@ import Long from "long"; describe("TokenUpdateTransaction", function () { it("encodes to correct protobuf", function () { - const key1 = PrivateKey.fromString( + const key1 = PrivateKey.fromStringDer( "302e020100300506032b6570042204205fc37fbd55631722b7ab5ec8e31696f6d3f818a15c5258a1529de7d4a1def6e2" ); - const key2 = PrivateKey.fromString( + const key2 = PrivateKey.fromStringDer( "302e020100300506032b657004220420b5e15b70109fe6e11d1d6d06b20d27b494aa05a28a8bc84c627d9be66e179391" ); - const key3 = PrivateKey.fromString( + const key3 = PrivateKey.fromStringDer( "302e020100300506032b6570042204202b5dc9915d5b6829592f4562a3d099e7b1bdd48da347e351da8d31cd41653016" ); - const key4 = PrivateKey.fromString( + const key4 = PrivateKey.fromStringDer( "302e020100300506032b6570042204205a8571fe4badbc6bd76f03170f5ec4bdc69f2edb93f133477d0ef8f9e17a0f3a" ); - const key5 = PrivateKey.fromString( + const key5 = PrivateKey.fromStringDer( "302e020100300506032b65700422042081c36f46db2bc4e7d993a23718a158c9fffa96719d7e72b3823d8bc9b973d596" ); - const key6 = PrivateKey.fromString( + const key6 = PrivateKey.fromStringDer( "302e020100300506032b657004220420ff498f69b92ea43a0a8fd6e4a7036e5f8b5f23e527b0443bc309cc4ff5b75303" ); - const key7 = PrivateKey.fromString( + const key7 = PrivateKey.fromStringDer( "302e020100300506032b657004220420542b4d4a318a1ae5f91071f34c8d900b1150e83d15fe71d22b8581e1203f99ad" ); const autoRenewAccountId = new AccountId(10); diff --git a/test/unit/Transaction.js b/test/unit/Transaction.js index ba7172f41..cddaf1b66 100644 --- a/test/unit/Transaction.js +++ b/test/unit/Transaction.js @@ -15,7 +15,7 @@ import Long from "long"; describe("Transaction", function () { it("toBytes", async function () { - const key = PrivateKey.fromString( + const key = PrivateKey.fromStringDer( "302e020100300506032b657004220420a58d361e61756ee809686255fda09bacb846ea8aa589c67ac39cfbcf82dd511c" ); const account = AccountId.fromString("0.0.1004"); @@ -125,10 +125,10 @@ describe("Transaction", function () { }); it("fromBytes fails when bodies differ", function () { - const key1 = PrivateKey.fromString( + const key1 = PrivateKey.fromStringDer( "302e020100300506032b657004220420a58d361e61756ee809686255fda09bacb846ea8aa589c67ac39cfbcf82dd511c" ); - const key2 = PrivateKey.fromString( + const key2 = PrivateKey.fromStringDer( "302e020100300506032b657004220420a58d361e61756ee809686255fda09bacb846ea8aa589c67ac39cfbcf82dd511d" );