Skip to content
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
- Enhance assignment bot to guard against users with spam PRs `.github/scripts/bot-assignment-check.sh`
- Add CodeRabbit documentation review prompts for docs, sdk_users, and sdk_developers with priorities, philosophy, and edge case checks. ([#1236](https://github.com/hiero-ledger/hiero-sdk-python/issues/1236))
- Enhance NodeAddress tests with additional coverage for proto conversion `tests/unit/node_address_test.py`
- Replaced deprecated `AccountCreateTransaction.set_key()` usage with `set_key_without_alias()` and `set_key_with_alias()` across examples and tests


### Fixed
- GFI workflow casing
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk_users/running_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ transaction.execute(client)
```
transaction = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(initial_balance)
.set_account_memo("Test")
.freeze_with(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def create_account(client: Client):

account_receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo("Account for hbar allowance")
.execute(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def create_account(client, memo="Test Account"):

tx = (
AccountCreateTransaction()
.set_key(public_key)
.set_key_without_alias(public_key)
.set_initial_balance(Hbar(10))
.set_account_memo(memo)
.execute(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def create_account(client: Client):

account_receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo("Account for hbar allowance")
.execute(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def create_account(client, memo="Test Account"):

tx = (
AccountCreateTransaction()
.set_key(public_key)
.set_key_without_alias(public_key)
.set_initial_balance(Hbar(10))
.set_account_memo(memo)
.execute(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/account/account_create_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def create_new_account(client: Client) -> None:

transaction = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(100000000) # 1 HBAR in tinybars
.set_account_memo("My new account")
)
Expand Down
2 changes: 1 addition & 1 deletion examples/account/account_delete_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create_account(client):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo("Test account for delete")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/account/account_records_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def create_account(client):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(2))
.set_account_memo("Test account for records query")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/account/account_update_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def create_account(client):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo("Test account for update")
.freeze_with(client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create_account(client, name, initial_balance=Hbar(10)):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(initial_balance)
.execute(client)
)
Comment on lines 66 to 71
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Missing freeze_with(client) breaks transaction lifecycle.

The transaction is missing freeze_with(client) before execute(client). Examples must follow the complete lifecycle: construction → freeze_with → sign → execute. Users copy these examples verbatim, so they must demonstrate correct SDK patterns.

🔎 Proposed fix
 receipt = (
     AccountCreateTransaction()
     .set_key_without_alias(account_public_key)
     .set_initial_balance(initial_balance)
+    .freeze_with(client)
     .execute(client)
 )

Expand Down
2 changes: 1 addition & 1 deletion examples/logger/logging_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create_account(client, new_key, description=""):
# Create account transaction
transaction = (
AccountCreateTransaction()
.set_key(new_key.public_key())
.set_key_without_alias(new_key.public_key())
.set_initial_balance(100000000) # 1 HBAR in tinybars
.freeze_with(client)
.sign(operator_key)
Expand Down
2 changes: 1 addition & 1 deletion examples/query/account_balance_query_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_account(client, name, initial_balance=Hbar(10)):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(initial_balance)
.execute(client)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/query/account_info_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_test_account(client, operator_key):

receipt = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo("Test account memo")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/query/transaction_get_receipt_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create_account(client, operator_key):
try:
tx = (
AccountCreateTransaction()
.set_key(recipient_key.public_key())
.set_key_without_alias(recipient_key.public_key())
.set_initial_balance(Hbar.from_tinybars(100_000_000))
)
receipt = tx.freeze_with(client).sign(operator_key).execute(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/query/transaction_record_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_account_transaction(client):
# Create the account
receipt = (
AccountCreateTransaction()
.set_key(new_account_key.public_key())
.set_key_without_alias(new_account_key.public_key())
.set_initial_balance(Hbar(1))
.execute(client)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/schedule/schedule_create_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def create_account(client):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(2))
.set_account_memo("Test account for schedule")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/schedule/schedule_delete_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create_account(client):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(2))
.set_account_memo("Test account for schedule")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/schedule/schedule_info_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create_account(client):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(2))
.set_account_memo("Test account for schedule")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/schedule/schedule_sign_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_account(client):

receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(2))
.set_account_memo("Test account for schedule sign")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/account_allowance_approve_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create_account(client):

account_receipt = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo("Account for token allowance")
.execute(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_airdrop_claim_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def create_receiver(
try:
receipt = (
AccountCreateTransaction()
.set_key(receiver_public_key)
.set_key_without_alias(receiver_public_key)
.set_initial_balance(Hbar(1))
.set_receiver_signature_required(signature_required)
.set_max_automatic_token_associations(max_auto_assoc)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_airdrop_claim_signature_required.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def create_receiver(
try:
receipt = (
AccountCreateTransaction()
.set_key(receiver_public_key)
.set_key_without_alias(receiver_public_key)
.set_initial_balance(Hbar(1))
.set_receiver_signature_required(signature_required)
.set_max_automatic_token_associations(max_auto_assoc)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_airdrop_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_account(client, operator_key):
try:
account_tx = (
AccountCreateTransaction()
.set_key(recipient_key.public_key())
.set_key_without_alias(recipient_key.public_key())
.set_initial_balance(Hbar.from_tinybars(100_000_000))
)
account_receipt = (
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_airdrop_transaction_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def create_account(
try:
tx = (
AccountCreateTransaction()
.set_key(recipient_key.public_key())
.set_key_without_alias(recipient_key.public_key())
.set_initial_balance(initial_balance)
)
receipt = tx.freeze_with(client).sign(operator_key).execute(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_associate_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def create_test_account(client, operator_key):
try:
receipt = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo("Test account for token association demo")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_create_transaction_freeze_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def create_demo_account(client: Client, operator_key: PrivateKey) -> DemoAccount
new_key = PrivateKey.generate_ed25519()
receipt = (
AccountCreateTransaction()
.set_key(new_key.public_key())
.set_key_without_alias(new_key.public_key())
.set_initial_balance(Hbar(2))
.set_account_memo("Freeze key demo account")
.freeze_with(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_create_transaction_kyc_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def create_account(client, operator_key, initial_balance=Hbar(2)):
try:
transaction = (
AccountCreateTransaction()
.set_key(account_public_key)
.set_key_without_alias(account_public_key)
.set_initial_balance(initial_balance)
.freeze_with(client)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def create_max_account(
# Configure the new account to require explicit associations before accepting tokens.
tx = (
AccountCreateTransaction()
.set_key(max_key.public_key())
.set_key_without_alias(max_key.public_key())
.set_initial_balance(Hbar(5))
.set_account_memo("max (auto-assoc = 0)")
.set_max_automatic_token_associations(0)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_create_transaction_pause_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def create_temp_account(client, operator_key):

tx = (
AccountCreateTransaction()
.set_key(pub_key) # MUST use public key
.set_key_without_alias(pub_key) # MUST use public key
.set_initial_balance(Hbar.from_tinybars(1000))
.freeze_with(client)
.sign(operator_key)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_create_transaction_wipe_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def create_recipient_account(client):
private_key = PrivateKey.generate_ed25519()
tx = (
AccountCreateTransaction()
.set_key(private_key.public_key())
.set_key_without_alias(private_key.public_key())
.set_initial_balance(Hbar(2))
)
receipt = tx.execute(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_dissociate_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_new_account(client, operator_id, operator_key):
# Build the transaction
tx = (
AccountCreateTransaction()
.set_key(recipient_key.public_key()) # <-- THE FIX: Call as a method
.set_key_without_alias(recipient_key.public_key()) # <-- THE FIX: Call as a method
.set_initial_balance(Hbar.from_tinybars(100_000_000)) # 1 Hbar
)

Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_grant_kyc_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def create_test_account(client):
# Create new account with initial balance of 1 HBAR
transaction = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.freeze_with(client)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_reject_transaction_fungible_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_test_account(client):
# Create new account with initial balance of 1 HBAR
receipt = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.execute(client)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_reject_transaction_nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_test_account(client):
# Create new account with initial balance of 1 HBAR
receipt = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.execute(client)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_revoke_kyc_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def create_test_account(client):
# Create new account with initial balance of 1 HBAR
transaction = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.freeze_with(client)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/token_wipe_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_test_account(client):
# Create new account with initial balance of 1 HBAR
transaction = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.freeze_with(client)
)
Expand Down
2 changes: 1 addition & 1 deletion examples/transaction/transfer_transaction_fungible.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_account(client, operator_key):
try:
tx = (
AccountCreateTransaction()
.set_key(recipient_key.public_key())
.set_key_without_alias(recipient_key.public_key())
.set_initial_balance(Hbar.from_tinybars(100_000_000))
)
receipt = tx.freeze_with(client).sign(operator_key).execute(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/transaction/transfer_transaction_hbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def create_account(client, operator_key):
try:
tx = (
AccountCreateTransaction()
.set_key(recipient_key.public_key())
.set_key_without_alias(recipient_key.public_key())
.set_initial_balance(Hbar.from_tinybars(100_000_000))
)
receipt = tx.freeze_with(client).sign(operator_key).execute(client)
Expand Down
2 changes: 1 addition & 1 deletion examples/transaction/transfer_transaction_nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_test_account(client):
# Create new account with initial balance of 1 HBAR
transaction = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.freeze_with(client)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/account_info_query_e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_integration_account_info_query_can_execute():

receipt = (
AccountCreateTransaction()
.set_key(new_account_public_key)
.set_key_without_alias(new_account_public_key)
.set_initial_balance(Hbar(1))
.set_account_memo(account_memo)
.execute(env.client)
Expand Down
Loading
Loading