Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
439 changes: 219 additions & 220 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Local Node
OPERATOR_KEY=0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4
OPERATOR_ID=0.0.1022
OPERATOR_KEY=0x105d050185ccb907fba04dd92d8de9e32c18305e097ab41dadda21489a211524
OPERATOR_ID=0.0.1012
HEDERA_NETWORK=local-node

NODE_COMMAND=node
2 changes: 1 addition & 1 deletion examples/account-alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function main() {

console.log('"Creating" a new account');

const privateKey = PrivateKey.generateED25519();
const privateKey = PrivateKey.generateECDSA();
const publicKey = privateKey.publicKey;

// Assuming that the target shard and realm are known.
Expand Down
6 changes: 3 additions & 3 deletions examples/account-allowance.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ async function main() {

console.log("Generating accounts for example...");

const aliceKey = PrivateKey.generateED25519();
const bobKey = PrivateKey.generateED25519();
const charlieKey = PrivateKey.generateED25519();
const aliceKey = PrivateKey.generateECDSA();
const bobKey = PrivateKey.generateECDSA();
const charlieKey = PrivateKey.generateECDSA();

try {
let transaction = await new AccountCreateTransaction()
Expand Down
3 changes: 1 addition & 2 deletions examples/account-create-with-hts.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ async function main() {
const supplyKey = PrivateKey.generateECDSA();
const freezeKey = PrivateKey.generateECDSA();
const wipeKey = PrivateKey.generateECDSA();

if (process.env.OPERATOR_ID == null || process.env.OPERATOR_KEY == null) {
throw new Error(
"Environment variables OPERATOR_ID, and OPERATOR_KEY are required.",
);
}
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const nodes = {
"127.0.0.1:50211": new AccountId(3),
Expand Down
2 changes: 1 addition & 1 deletion examples/batch-tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function main() {
}

const operatorAccId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorPrivKey = PrivateKey.fromStringED25519(
const operatorPrivKey = PrivateKey.fromStringECDSA(
process.env.OPERATOR_KEY,
);

Expand Down
18 changes: 9 additions & 9 deletions examples/change-or-remove-token-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ async function main() {

// Configure client using environment variables
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const client = Client.forName(network).setOperator(operatorId, operatorKey);

// Set logger
const infoLogger = new Logger(LogLevel.Info);
client.setLogger(infoLogger);

const adminKey = PrivateKey.generateED25519();
const supplyKey = PrivateKey.generateED25519();
const newSupplyKey = PrivateKey.generateED25519();
const wipeKey = PrivateKey.generateED25519();
const freezeKey = PrivateKey.generateED25519();
const pauseKey = PrivateKey.generateED25519();
const feeScheduleKey = PrivateKey.generateED25519();
const metadataKey = PrivateKey.generateED25519();
const adminKey = PrivateKey.generateECDSA();
const supplyKey = PrivateKey.generateECDSA();
const newSupplyKey = PrivateKey.generateECDSA();
const wipeKey = PrivateKey.generateECDSA();
const freezeKey = PrivateKey.generateECDSA();
const pauseKey = PrivateKey.generateECDSA();
const feeScheduleKey = PrivateKey.generateECDSA();
const metadataKey = PrivateKey.generateECDSA();

// This HIP introduces ability to remove lower-privilege keys (Wipe, KYC, Freeze, Pause, Supply, Fee Schedule, Metadata) from a Token:
// - using an update with the empty KeyList;
Expand Down
2 changes: 1 addition & 1 deletion examples/consensus-pub-sub.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions examples/contract-nonces.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function main() {
try {
const fileCreateTxResponse = await (
await new FileCreateTransaction()
.setKeys([PrivateKey.fromStringDer(process.env.OPERATOR_KEY)])
.setKeys([PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY)])
.setContents(SMART_CONTRACT_BYTECODE)
.setMaxTransactionFee(new Hbar(2))
.freezeWithSigner(wallet)
Expand All @@ -48,7 +48,9 @@ async function main() {

const contractCreateTxResponse = await (
await new ContractCreateTransaction()
.setAdminKey(PrivateKey.fromStringDer(process.env.OPERATOR_KEY))
.setAdminKey(
PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY),
)
.setGas(100000)
.setBytecodeFileId(newFileId)
.setContractMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dotenv.config();
/*
Reference: [HIP-583 Expand alias support in CryptoCreate & CryptoTransfer Transactions](https://hips.hedera.com/hip/hip-583)
## Example 1:
- Create an ECSDA private key and an ED25519 admin private key
- Create an ECSDA private key and an ECDSA admin private key
- Extract the ECDSA public key
- Extract the Ethereum public address
- Use the `AccountCreateTransaction`
Expand All @@ -32,7 +32,7 @@ async function main() {
);
}
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const nodes = {
"127.0.0.1:50211": new AccountId(3),
Expand All @@ -47,9 +47,9 @@ async function main() {
/**
* Step 1
*
* Create an ECSDA private key and an ED25519 admin private key
* Create an ECSDA private key and an ECDSA admin private key
*/
const adminKey = PrivateKey.generateED25519();
const adminKey = PrivateKey.generateECDSA();
console.log(`Admin private key: ${adminKey.toStringDer()}`);

const privateKey = PrivateKey.generateECDSA();
Expand Down
6 changes: 3 additions & 3 deletions examples/create-account-with-alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function main() {
);
}
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const nodes = {
"127.0.0.1:50211": new AccountId(3),
Expand Down Expand Up @@ -193,7 +193,7 @@ async function main() {
*
* Create an account key and an ECSDA private alias key
*/
const key = PrivateKey.generateED25519();
const key = PrivateKey.generateECDSA();
const aliasKey = PrivateKey.generateECDSA();
console.log(`Alias key: ${aliasKey.toStringDer()}`);

Expand Down Expand Up @@ -341,7 +341,7 @@ async function main() {
*
* Create an account key and an derive an ECSDA public alias key
*/
const key = PrivateKey.generateED25519();
const key = PrivateKey.generateECDSA();
const aliasKey = PrivateKey.generateECDSA();
const publicAliasKey = aliasKey.publicKey;

Expand Down
4 changes: 2 additions & 2 deletions examples/create-account-with-thresholdkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function main() {
}

const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

// Create the client based on the HEDERA_NETWORK environment variable
const client = Client.forName(process.env.HEDERA_NETWORK);
Expand All @@ -56,7 +56,7 @@ async function main() {
const privateKeys = [];
const publicKeys = [];
for (let i = 0; i < 3; i++) {
const key = PrivateKey.generateED25519();
const key = PrivateKey.generateECDSA();
privateKeys.push(key);
publicKeys.push(key.publicKey);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/create-topic-with-revenue.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function main() {
}

const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const client = Client.forName(process.env.HEDERA_NETWORK).setOperator(
operatorId,
Expand Down
2 changes: 1 addition & 1 deletion examples/create-update-delete-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function main() {

const network = process.env.HEDERA_NETWORK;
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);
const client = Client.forName(network).setOperator(operatorId, operatorKey);

// Transaction parameters
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-umd/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>Hiero UMD Builder</h1>
<div class="json-container" ></div>
<img src="bouncing-circles.svg" class="loading" />
<div class="execute-notice">
You should use an ED25519 key for the operator. The network set
You should use an ECDSA key for the operator. The network set
is TESTNET.
</span>
</main>
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-umd/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function executeTx() {

// setup client and operator
const operatorId = sdk.AccountId.fromString(operatorIdValue);
const operatorKey = sdk.PrivateKey.fromStringED25519(operatorKeyValue);
const operatorKey = sdk.PrivateKey.fromStringECDSA(operatorKeyValue);
const client = sdk.Client.forTestnet().setOperator(operatorId, operatorKey);

// start loading until the query is executed
Expand Down
2 changes: 1 addition & 1 deletion examples/ecrecover-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function main() {
}

const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);
const client = Client.forLocalNode().setOperator(operatorId, operatorKey);

console.log(`Operator account: ${operatorId.toString()}`);
Expand Down
2 changes: 1 addition & 1 deletion examples/ecrecover-mirror-node-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function main() {
}

const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);
const client = Client.forLocalNode().setOperator(operatorId, operatorKey);

console.log(`Operator account: ${operatorId.toString()}`);
Expand Down
4 changes: 2 additions & 2 deletions examples/error-handling-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ async function main() {
}

const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const client = Client.forName(process.env.HEDERA_NETWORK);
client.setOperator(operatorId, operatorKey);

const newKey = PrivateKey.generateED25519();
const newKey = PrivateKey.generateECDSA();
console.log(`Generated new public key: ${newKey.publicKey.toString()}`);
let accountId = null;

Expand Down
2 changes: 1 addition & 1 deletion examples/error-handling-single-node-execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function main() {
}

const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorKey = PrivateKey.fromStringED25519(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const client = Client.forName(process.env.HEDERA_NETWORK);
client.setOperator(operatorId, operatorKey);
Expand Down
8 changes: 4 additions & 4 deletions examples/exempt-custom-fees.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.fromStringDer(process.env.OPERATOR_KEY);
const operatorKey = PrivateKey.fromStringECDSA(process.env.OPERATOR_KEY);

const provider = new LocalProvider();

Expand All @@ -58,7 +58,7 @@ async function main() {
* Create accounts A, B, and C
*/

let firstAccountPrivateKey = PrivateKey.generateED25519();
let firstAccountPrivateKey = PrivateKey.generateECDSA();
let firstAccountPublicKey = firstAccountPrivateKey.publicKey;

let createAccountAtx = await new AccountCreateTransaction()
Expand All @@ -77,7 +77,7 @@ async function main() {
provider,
);

let secondAccountPrivateKey = PrivateKey.generateED25519();
let secondAccountPrivateKey = PrivateKey.generateECDSA();
let secondAccountPublicKey = secondAccountPrivateKey.publicKey;

let createAccountBtx = await new AccountCreateTransaction()
Expand All @@ -96,7 +96,7 @@ async function main() {
provider,
);

let thirdAccountPrivateKey = PrivateKey.generateED25519();
let thirdAccountPrivateKey = PrivateKey.generateECDSA();
let thirdAccountPublicKey = thirdAccountPrivateKey.publicKey;

let createAccountCtx = await new AccountCreateTransaction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ const ClientProvider = ({ children }) => {
// Set operator for the client
newClient.setOperator(
AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID),
PrivateKey.fromStringDer(process.env.NEXT_PUBLIC_OPERATOR_KEY),
PrivateKey.fromStringECDSA(
process.env.NEXT_PUBLIC_OPERATOR_KEY,
),
);

setClient(newClient);
Expand Down Expand Up @@ -176,7 +178,7 @@ const AsyncClientDemo = () => {

setIsActionLoading(true);
try {
const privateKey = PrivateKey.generateED25519();
const privateKey = PrivateKey.generateECDSA();
const publicKey = privateKey.publicKey;

const transaction = await new AccountCreateTransaction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Home = () => {
const client = useMemo(() => {
return WebClient.forNetwork(initialNetwork).setOperator(
AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID),
PrivateKey.fromStringDer(process.env.NEXT_PUBLIC_OPERATOR_KEY),
PrivateKey.fromStringECDSA(process.env.NEXT_PUBLIC_OPERATOR_KEY),
);
}, []);

Expand Down Expand Up @@ -80,7 +80,7 @@ const Home = () => {
setIsLoading(true);
try {
console.log(client.network);
const privateKey = PrivateKey.generateED25519();
const privateKey = PrivateKey.generateECDSA();
const publicKey = privateKey.publicKey;

const transaction = await new AccountCreateTransaction()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventEmitter from "events";
import { useEffect, useState } from "react";
import { useEffect, useState, useRef } from "react";

const TopicListener = ({ topicId }) => {
const [messages, setMessages] = useState([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const MessageQueryPage = () => {

// Setup Hedera client
const accountId = AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID);
const operatorKey = PrivateKey.fromStringED25519(
const operatorKey = PrivateKey.fromStringECDSA(
process.env.NEXT_PUBLIC_OPERATOR_KEY,
);
const client = Client.forTestnet().setOperator(accountId, operatorKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const JumboPage = () => {
const operatorId = AccountId.fromString(
process.env.NEXT_PUBLIC_OPERATOR_ID,
);
const operatorKey = PrivateKey.fromStringED25519(
const operatorKey = PrivateKey.fromStringECDSA(
process.env.NEXT_PUBLIC_OPERATOR_KEY,
);
const [contractId, setContractId] = useState("0.0.6255191");
Expand Down
4 changes: 2 additions & 2 deletions examples/frontend-examples/src/app/transaction/size/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Home = () => {

const client = WebClient.forTestnet().setOperator(
AccountId.fromString(process.env.NEXT_PUBLIC_OPERATOR_ID),
PrivateKey.fromStringDer(process.env.NEXT_PUBLIC_OPERATOR_KEY),
PrivateKey.fromStringECDSA(process.env.NEXT_PUBLIC_OPERATOR_KEY),
);

return (
Expand Down Expand Up @@ -48,7 +48,7 @@ const Home = () => {
const tx = new AccountCreateTransaction();
if (key) {
tx.setKeyWithoutAlias(
PublicKey.fromStringED25519(key),
PublicKey.fromStringECDSA(key),
);
}
if (initialBalance) {
Expand Down
Loading
Loading