Skip to content

Commit 22d6e82

Browse files
fix: replace deprecated AccountCreateTransaction.set_key usage
Signed-off-by: prishajaiswal75 <prisha.jaiswal.btech2023@sitpune.edu.in>
1 parent 4ade123 commit 22d6e82

File tree

54 files changed

+92
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+92
-98
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions

docs/sdk_users/running_examples.md

Lines changed: 1 addition & 1 deletion

examples/account/account_allowance_approve_transaction_hbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def create_account(client: Client):
4040

4141
account_receipt = (
4242
AccountCreateTransaction()
43-
.set_key(account_public_key)
43+
.set_key_without_alias(account_public_key)
4444
.set_initial_balance(Hbar(1))
4545
.set_account_memo("Account for hbar allowance")
4646
.execute(client)

examples/account/account_allowance_approve_transaction_nft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def create_account(client, memo="Test Account"):
6666

6767
tx = (
6868
AccountCreateTransaction()
69-
.set_key(public_key)
69+
.set_key_without_alias(public_key)
7070
.set_initial_balance(Hbar(10))
7171
.set_account_memo(memo)
7272
.execute(client)

examples/account/account_allowance_delete_transaction_hbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def create_account(client: Client):
4040

4141
account_receipt = (
4242
AccountCreateTransaction()
43-
.set_key(account_public_key)
43+
.set_key_without_alias(account_public_key)
4444
.set_initial_balance(Hbar(1))
4545
.set_account_memo("Account for hbar allowance")
4646
.execute(client)

examples/account/account_allowance_delete_transaction_nft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def create_account(client, memo="Test Account"):
6868

6969
tx = (
7070
AccountCreateTransaction()
71-
.set_key(public_key)
71+
.set_key_without_alias(public_key)
7272
.set_initial_balance(Hbar(10))
7373
.set_account_memo(memo)
7474
.execute(client)

examples/account/account_create_transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def create_new_account(client: Client, operator_key: PrivateKey) -> None:
107107

108108
transaction = (
109109
AccountCreateTransaction()
110-
.set_key(new_account_public_key)
110+
.set_key_without_alias(new_account_public_key)
111111
.set_initial_balance(100000000) # 1 HBAR in tinybars
112112
.set_account_memo("My new account")
113113
.freeze_with(client)

examples/account/account_create_transaction_evm_alias.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,13 @@ def create_account_with_alias(client):
4848
print("\nSTEP 1: Generating a new ECDSA key pair for the account alias...")
4949
private_key = PrivateKey.generate('ecdsa')
5050
public_key = private_key.public_key()
51-
evm_address = public_key.to_evm_address()
52-
if evm_address is None:
53-
print("❌ Error: Failed to generate EVM address from public key.")
54-
sys.exit(1)
55-
print(f"✅ Generated new ECDSA key pair. EVM Address (alias): {evm_address}")
51+
print(f"✅ Generated new ECDSA key pair. The EVM address alias will be automatically derived.")
5652
# Create the account with the alias
5753
print("\nSTEP 2: Creating the account with the EVM address alias...")
5854
transaction = (
5955
AccountCreateTransaction()
60-
.set_key(public_key)
56+
.set_key_with_alias(public_key)
6157
.set_initial_balance(Hbar(5))
62-
.set_alias(evm_address)
6358
)
6459

6560
# Sign the transaction with both the new key and the operator key

examples/account/account_delete_transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def create_account(client):
3939

4040
receipt = (
4141
AccountCreateTransaction()
42-
.set_key(account_public_key)
42+
.set_key_without_alias(account_public_key)
4343
.set_initial_balance(Hbar(1))
4444
.set_account_memo("Test account for delete")
4545
.freeze_with(client)

examples/account/account_records_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def create_account(client):
4646

4747
receipt = (
4848
AccountCreateTransaction()
49-
.set_key(account_public_key)
49+
.set_key_without_alias(account_public_key)
5050
.set_initial_balance(Hbar(2))
5151
.set_account_memo("Test account for records query")
5252
.freeze_with(client)

0 commit comments

Comments
 (0)