diff --git a/.coderabbit.yaml b/.coderabbit.yaml index f1a2bd502..5d1451996 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -19,8 +19,8 @@ reviews: poem: false # Do not write a literal poem (spammy) enable_prompt_for_ai_agents: false # Disable prompts for AI agents (spammy) + # --- CUSTOM INSTRUCTIONS FOR EXAMPLES DIRECTORY --- path_instructions: - # --- CUSTOM INSTRUCTIONS FOR EXAMPLES DIRECTORY --- - path: "examples/**/*" instructions: | You are acting as a senior maintainer reviewing SDK examples. Your goal is to ensure examples work verbatim for users who copy-paste them. @@ -63,352 +63,6 @@ reviews: - Be concise, technical, and opinionated. - Flag out-of-scope improvements as potential new issues rather than blocking. - # --- UNIT TESTS REVIEW INSTRUCTIONS --- - - path: "tests/unit/**/*" - instructions: | - You are acting as a senior maintainer reviewing unit tests for the hiero-sdk-python project. Your goal is to ensure tests are extensive, deterministic, and protect against breaking changes. - - **CRITICAL PRINCIPLES - Tests Must Fail Loudly & Deterministically**: - - Tests must provide useful error messages when they fail for future debugging. - - No `print()` statements - use assertions with descriptive messages. - - No timing-dependent or unseeded random assertions. - - No network calls or external dependencies (unit tests are isolated). - - No unjustified TODOs or skipped tests without tracking issues. - - **PRIORITY 1 - Protect Against Breaking Changes**: - - Assert public attributes exist (e.g., `assert hasattr(obj, 'account_id')`). - - Assert return types where relevant (e.g., `assert isinstance(result, AccountId)`). - - Assert fluent setters return `self` (e.g., `assert tx.set_memo("test") is tx`). - - Assert backward-compatible defaults are maintained. - - If a breaking change is introduced, tests must assert deprecation behavior and test old behavior until removal. - - **PRIORITY 2 - Constructor & Setter Behavior**: - - Test constructor behavior with valid inputs, edge cases, and invalid inputs. - - Test setter behavior including method chaining (fluent interface). - - Verify that setters validate input and raise appropriate exceptions. - - Test that getters return expected values after construction/setting. - - **PRIORITY 3 - Comprehensive Coverage**: - - Unit tests should be extensive - test even if we don't expect users to use it currently. - - Cover happy paths AND unhappy paths/edge cases. - - Test boundary conditions, null/None values, empty collections, etc. - - Avoid brittle ordering assertions unless order is part of the contract. - - **PRIORITY 4 - No Mocks for Non-Existent Modules**: - - All imports must reference actual SDK modules - no hallucinated paths. - - Validate import paths against the actual `src/hiero_sdk_python` structure. - - Mocks should only be used for external dependencies, not SDK internals. - - **PRIORITY 5 - Test Framework Philosophy**: - - Prefer repetitive but clear tests over abstracted helper functions. - - Some core functionality may warrant helper files (considered an exception). - - Discourage custom helper functions; prefer pytest fixtures when shared setup is needed. - - Prefer testing real functionality over mocked behavior. - - **AVOID**: - - Linter or formatting feedback (leave that to ruff/pre-commit). - - Nitpicking minor stylistic issues unless they impact maintainability. - - Overly abstracted test helpers that obscure what's being tested. - - **PHILOSOPHY**: - - Unit tests protect our future selves - be defensive and forward-looking. - - Tests should be readable by SDK developers: clear names, brief docstrings, key inline comments. - - When tests fail, we should immediately know what broke and why. - - # --- INTEGRATION TESTS REVIEW INSTRUCTIONS --- - - path: "tests/integration/**/*" - instructions: | - You are acting as a senior maintainer reviewing integration tests for the hiero-sdk-python project. Your goal is to ensure end-to-end tests validate real network behavior safely and deterministically. - - **CRITICAL PRINCIPLES - Safety & Diagnosability**: - - **Prioritize safety**: No implicit or default mainnet usage. - - Secrets and credentials must be injected safely (env vars, not hardcoded). - - Test failures must be diagnosable with clear error messages. - - Tests must assert observable network behavior, not just `SUCCESS`. - - Failure-path tests must assert specific `ResponseCode` values (e.g., `TOKEN_HAS_NO_PAUSE_KEY`). - - **PRIORITY 1 - End-to-End Behavior**: - - Tests should be end-to-end: construct → freeze → sign → execute → verify. - - Validate resulting balances, ownership, and state changes (not just transaction success). - - Assert transaction receipts contain expected data (IDs, serial numbers, etc.). - - Verify network state after operations (e.g., account balance changed, token transferred). - - **PRIORITY 2 - Test Structure & Maintainability**: - - One major behavior per test (clear focus). - - Tests should be readable: clear names, brief docstrings, key inline comments. - - Minimal abstraction layers - prefer clarity over DRY. - - Is the file too monolithic? Flag if tests should be split into smaller modules. - - Are helper functions good candidates for pytest fixtures or shared utilities? - - **PRIORITY 3 - Isolation & Cleanup**: - - Local account creation over operator reuse (avoid state pollution). - - Are accounts, tokens, and allowances properly cleaned up to avoid state leakage? - - Recommend teardown strategies or fixture scoping improvements. - - Tests should not depend on execution order (avoid brittle assumptions). - - **PRIORITY 4 - Assertions & Coverage**: - - Do tests validate only success/failure, or also assert resulting state? - - Suggest additional assertions that would strengthen correctness (balances, allowances, ownership). - - Cover happy paths AND unhappy paths (e.g., invalid spender, revoked allowance, insufficient balance). - - Avoid timing-based or flaky assumptions. - - **PRIORITY 5 - Observability & Debugging**: - - Could structured logging or transaction metadata improve debugging? - - Suggest capturing allowance values, transaction IDs, and balances in logs. - - Ensure error messages provide context for failure diagnosis. - - **AVOID**: - - Linter or formatting feedback. - - Overly abstracted helpers that obscure what's being tested. - - Timing-dependent assertions (use explicit waits or retries if needed). - - **PHILOSOPHY**: - - Integration tests validate real network behavior - they must be reliable and safe. - - Tests should protect against regressions while being maintainable. - - When tests fail in CI, developers should immediately understand what broke. - - Redundant setup code should be refactored, but clarity trumps abstraction. - - # --- DOCUMENTATION REVIEW INSTRUCTIONS --- - - path: "docs/**" - instructions: | - You are reviewing documentation for the Hiero Python SDK. These pages serve both SDK users and SDK developers. - - Priority 1 - Correctness (code, commands, links) - 1. Verify code snippets conceptually run and match the current SDK API. - 2. Check shell commands and workflow steps against actual project tooling. - 3. Validate URLs and cross-references; flag broken or misleading links. - - Priority 2 - Clarity and completeness - 1. Ensure each page states its purpose and expected outcome early. - 2. Prefer concrete, step-wise explanations over vague descriptions. - 3. Highlight missing prerequisites that would block a reader. - 4. For larger gaps, suggest filing a follow-up issue instead of blocking. - - Priority 3 - Consistency and navigation - 1. Encourage consistent terminology with the SDK and examples. - 2. Check headings form a logical reading path. - 3. Confirm each page makes clear which audience it serves. - - PHILOSOPHY - - Treat docs as work-in-progress: optimize for correctness and clarity over perfection. - - Keep feedback concise, action-oriented, and focused on reader success. - - Do not request large-scale restructures unless current structure blocks understanding. - - AVOID - - Avoid lint-style feedback on Markdown formatting or minor wording. - - Avoid proposing new conventions without clear benefit. - - Avoid turning every high-level gap into a blocker. - - - path: "docs/sdk_users/**" - instructions: | - These documents are for SDK users who want to USE the Hiero Python SDK quickly and correctly. - - Priority 1 - High-level guidance - 1. Ensure explanations are conceptual and point to `/examples` for runnable code. - 2. Check that required environment variables and network choices are clearly stated. - - Priority 2 - No hidden assumptions - 1. Assume zero prior knowledge of this SDK and minimal Hedera background. - 2. Avoid requiring knowledge of repository layout or contribution workflow. - - PHILOSOPHY - - Keep explanations high-level and conceptual; defer runnable examples to `/examples`. - - Focus on what users need to know before diving into code examples. - - - path: "docs/sdk_developers/**" - instructions: | - These documents are for SDK developers and contributors, including `docs/sdk_developers/training/**`. - - Priority 1 - Workflow accuracy - 1. Ensure contribution, branching, rebasing, signing (DCO, GPG), CI, linting, and testing instructions match the repo. - 2. Verify `git` and GitHub flows agree with CONTRIBUTING.md and current practice. - 3. Flag outdated references to scripts, directories, or configuration files. - - Priority 2 - Training flow - 1. For training docs, ensure logical progression and clear prerequisites. - 2. Check that cross-links between training files are coherent. - - PHILOSOPHY - - Treat these docs as a training ground for future maintainers and regular contributors. - - Help readers move from "I cloned the repo" to "I can safely extend and debug the SDK". - - Balance approachability for beginners with enough depth for experts. - - # --- CUSTOM INSTRUCTIONS FOR .GITHUB DIRECTORY --- - - path: ".github/workflows/**/*" - instructions: | - Review workflows as security-sensitive infrastructure. - - A good workflow is small, focused, and boring. - If a workflow is clever, generic, or overly flexible, it is a risk. - - --------------------------------------------------------- - PRIORITY 0 — ABSOLUTE REQUIREMENTS - --------------------------------------------------------- - - All third-party actions MUST be pinned to full commit SHAs, similar to other workflows. - - `permissions:` MUST be explicitly declared and minimally scoped. - - Workflows MUST behave safely when executed from forks. - - YAML MUST orchestrate steps, not implement business logic. - - Any workflow that mutates GitHub state MUST support dry-run mode. - - Dry-run behavior must be explicit and visible in logs. - - Workflows MUST NOT modify repository source code outside `.github/`. - - --------------------------------------------------------- - PRIORITY 1 — SCOPE, FOCUS & RESTRAINT - --------------------------------------------------------- - - The title of each workflow must be relevant, match similar naming schemes, and match its script filename. - - Each workflow MUST have a single, clearly defined objective and SHOULD document this in a top-level comment. - - Flag workflows that: - - Attempt to be generic “frameworks” - - Include speculative or future-facing logic - - Perform actions unrelated to the stated goal - - Over-abstraction and excess flexibility are maintenance risks. - - --------------------------------------------------------- - PRIORITY 2 — INPUT HARDENING - --------------------------------------------------------- - - Treat ALL GitHub event data as potentially hostile input, including: - - issue titles, bodies, and comments - - labels, usernames, branch names - - Free-form user input MUST NOT be passed directly into: - - shell commands - - gh CLI arguments - - Node.js exec / spawn calls - - Require strict allowlists or exact string matches. - - Flag any use of: - - eval or bash -c - - backticks or $(...) with user-controlled input - - --------------------------------------------------------- - PRIORITY 3 — DRY-RUN & SAFE OPERATION - --------------------------------------------------------- - - Workflows that mutate state MUST expose: - workflow_dispatch: - inputs: - dry_run: - default: "true" - - When dry_run=true, workflows MUST: - - Log dry mode is active - - Function on dry run: never post, comment, label, assign or edit - - Be easy to expand in the future - - Exit successfully - - --------------------------------------------------------- - PRIORITY 4 — SCRIPT EXTRACTION & CODE TRIM - --------------------------------------------------------- - - YAML should orchestrate execution only. - - All non-trivial logic MUST live in: - - `.github/scripts/*.sh` - - `.github/scripts/*.js` - - Workflow filenames and their primary scripts SHOULD share a clear, matching name. - - Scripts MUST remain: - - Purpose-built - - Trim and readable - - Easy to maintain - - Flag: - - Large `run: |` blocks - - Inline loops, conditionals, or API calls in YAML - - Overly generic helper scripts for narrow tasks - - --------------------------------------------------------- - PRIORITY 5 — API EFFICIENCY & DISCIPLINE - --------------------------------------------------------- - - GitHub API usage must be intentional and minimal. - - Prefer: - - Aggregated queries over per-entity loops - - Server-side filtering over client-side iteration - - Reusing data already present in the event payload - - Pagination MUST: - - Be considered and justified - - Enforce hard upper bounds - - Flag: - - Repeated API calls inside loops - - Unbounded pagination - - Fetching data already available in context - - --------------------------------------------------------- - PRIORITY 6 — CONCURRENCY & IDEMPOTENCY - --------------------------------------------------------- - - Workflows that mutate state MUST: - - Define a deterministic concurrency group - - Be safe under retries and parallel execution - - Duplicate prevention is REQUIRED: - - Marker-based comment detection - - Check-before-create logic for labels and assignments - - Assume workflows may: - - Run multiple times - - Be retried automatically - - Execute concurrently with other automations - - Workflows should avoid logic that duplicates or causes conflicts. - - --------------------------------------------------------- - PRIORITY 7 — PERMISSION CORRECTNESS - --------------------------------------------------------- - - Requested permissions MUST exactly match behavior. - - Explicitly validate common cases: - - issues: write → comments, labels, assignments - - contents: read → repository checkout - - pull-requests: write → PR mutations - - Flag: - - Over-permissioned workflows - - Under-permissioned workflows that would fail at runtime - - Reliance on default permissions - - --------------------------------------------------------- - PRIORITY 8 — LOGGING & OPERABILITY - --------------------------------------------------------- - - Logs should include, where applicable: - - repository - - workflow name - - issue or PR number - - triggering actor - - dry-run status - - decisions made (performed vs skipped) - - Avoid: - - Silent success or silent skips - - Raw payload dumps - - Any secret or token leakage - - # ============================================================ - # SHELL SCRIPTS - # ============================================================ - - path: ".github/scripts/**/*.sh" - instructions: | - Treat shell scripts as production-grade automation. - - Scripts should be small, focused, and explicit. - Avoid “do-everything” or overly generic scripts. - - - MUST use: `set -euo pipefail` - - MUST validate all required environment variables - - MUST defensively quote variables - - MUST validate all untrusted input - - MUST have bounded loops and pagination - - MUST support dry-run mode if state is mutated - - MUST log key decisions and early exits - - # ============================================================ - # JAVASCRIPT SCRIPTS - # ============================================================ - - path: ".github/scripts/**/*.js" - instructions: | - Review JavaScript scripts as long-lived automation code. - - Scripts must remain: - - Focused - - Readable - - Purpose-built - - - All `context.payload` fields MUST be validated - - Free-form text MUST NOT be trusted - - Dynamic code execution is prohibited - - Avoid `child_process.exec`; prefer `execFile` if needed - - All async operations MUST be wrapped in try/catch - - Errors MUST include contextual metadata - - Duplicate API calls MUST be avoided - - Marker-based deduplication is required - - Scripts MUST NOT assume write access - - Permission failures MUST be handled gracefully - chat: art: false # Don't draw ASCII art (false) - auto_reply: false # Don't allow bot to converse (spammy) + auto_reply: false # Don't allow bot to converse (spammy) \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index eedc48ceb..43721aef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1. - Added GitHub workflow that makes sure newly added test files follow pytest test files naming conventions (#1054) - Added advanced issue template for contributors `.github/ISSUE_TEMPLATE/06_advanced_issue.yml`. - Add new tests to `tests/unit/topic_info_query_test.py` (#1124) + - Added `coding_token_transactions.md` for a high level overview training on how token transactions are created in the python sdk. - Added prompt for codeRabbit on how to review /examples ([#1180](https://github.com/hiero-ledger/hiero-sdk-python/issues/1180)) - Add Linked Issue Enforcer to automatically close PRs without linked issues `.github/workflows/bot-linked-issue-enforcer.yml`. @@ -80,6 +81,9 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1. - Added merge conflict bot workflow (`.github/workflows/bot-merge-conflict.yml`) and helper script (`.github/scripts/bot-merge-conflict.js`) to detect and notify about PR merge conflicts, with retry logic for unknown mergeable states, idempotent commenting, and push-to-main recheck logic (#1247) - Added workflow to prevent assigning intermediate issues to contributors without prior Good First Issue completion (#1143). - Added `Client.from_env()` and network-specific factory methods (e.g., `Client.for_testnet()`) to simplify client initialization and reduce boilerplate. [[#1251](https://github.com/hiero-ledger/hiero-sdk-python/issues/1251)] +======= + + ### Changed @@ -134,6 +138,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 diff --git a/docs/sdk_users/running_examples.md b/docs/sdk_users/running_examples.md index d01de678d..03bec4770 100644 --- a/docs/sdk_users/running_examples.md +++ b/docs/sdk_users/running_examples.md @@ -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) diff --git a/examples/account/account_allowance_approve_transaction_hbar.py b/examples/account/account_allowance_approve_transaction_hbar.py index 48c98b575..f892ac31c 100644 --- a/examples/account/account_allowance_approve_transaction_hbar.py +++ b/examples/account/account_allowance_approve_transaction_hbar.py @@ -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) diff --git a/examples/account/account_allowance_approve_transaction_nft.py b/examples/account/account_allowance_approve_transaction_nft.py index 40c08333d..7186de4fe 100644 --- a/examples/account/account_allowance_approve_transaction_nft.py +++ b/examples/account/account_allowance_approve_transaction_nft.py @@ -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) diff --git a/examples/account/account_allowance_delete_transaction_hbar.py b/examples/account/account_allowance_delete_transaction_hbar.py index c36693d85..7e73e5ac6 100644 --- a/examples/account/account_allowance_delete_transaction_hbar.py +++ b/examples/account/account_allowance_delete_transaction_hbar.py @@ -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) diff --git a/examples/account/account_allowance_delete_transaction_nft.py b/examples/account/account_allowance_delete_transaction_nft.py index 29a7f2e50..ea8a0652a 100644 --- a/examples/account/account_allowance_delete_transaction_nft.py +++ b/examples/account/account_allowance_delete_transaction_nft.py @@ -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) diff --git a/examples/account/account_create_transaction.py b/examples/account/account_create_transaction.py index 26e35fdf4..821cd2649 100644 --- a/examples/account/account_create_transaction.py +++ b/examples/account/account_create_transaction.py @@ -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") ) diff --git a/examples/account/account_delete_transaction.py b/examples/account/account_delete_transaction.py index 8c8f3b69a..aeb9ff02c 100644 --- a/examples/account/account_delete_transaction.py +++ b/examples/account/account_delete_transaction.py @@ -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) diff --git a/examples/account/account_records_query.py b/examples/account/account_records_query.py index 62e58ac35..9f1430fa2 100644 --- a/examples/account/account_records_query.py +++ b/examples/account/account_records_query.py @@ -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) diff --git a/examples/account/account_update_transaction.py b/examples/account/account_update_transaction.py index 3e8794977..e496a4364 100644 --- a/examples/account/account_update_transaction.py +++ b/examples/account/account_update_transaction.py @@ -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) diff --git a/examples/consensus/topic_create_transaction_revenue_generating.py b/examples/consensus/topic_create_transaction_revenue_generating.py index 0d833bc68..7a513cffb 100644 --- a/examples/consensus/topic_create_transaction_revenue_generating.py +++ b/examples/consensus/topic_create_transaction_revenue_generating.py @@ -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) ) diff --git a/examples/logger/logging_example.py b/examples/logger/logging_example.py index 047e59395..be38fdcec 100644 --- a/examples/logger/logging_example.py +++ b/examples/logger/logging_example.py @@ -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) diff --git a/examples/query/account_balance_query_2.py b/examples/query/account_balance_query_2.py index b618d3d06..421110ed4 100644 --- a/examples/query/account_balance_query_2.py +++ b/examples/query/account_balance_query_2.py @@ -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) ) diff --git a/examples/query/account_info_query.py b/examples/query/account_info_query.py index fb61c79b0..af6261a89 100644 --- a/examples/query/account_info_query.py +++ b/examples/query/account_info_query.py @@ -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) diff --git a/examples/query/transaction_get_receipt_query.py b/examples/query/transaction_get_receipt_query.py index c5f57f55d..9d51ded0f 100644 --- a/examples/query/transaction_get_receipt_query.py +++ b/examples/query/transaction_get_receipt_query.py @@ -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) diff --git a/examples/query/transaction_record_query.py b/examples/query/transaction_record_query.py index cb7cde2ef..1be620179 100644 --- a/examples/query/transaction_record_query.py +++ b/examples/query/transaction_record_query.py @@ -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) ) diff --git a/examples/schedule/schedule_create_transaction.py b/examples/schedule/schedule_create_transaction.py index 321010cbb..8fa5e7cbd 100644 --- a/examples/schedule/schedule_create_transaction.py +++ b/examples/schedule/schedule_create_transaction.py @@ -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) diff --git a/examples/schedule/schedule_delete_transaction.py b/examples/schedule/schedule_delete_transaction.py index 87ab93a2b..5a8708820 100644 --- a/examples/schedule/schedule_delete_transaction.py +++ b/examples/schedule/schedule_delete_transaction.py @@ -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) diff --git a/examples/schedule/schedule_info_query.py b/examples/schedule/schedule_info_query.py index d11fda1b3..d4130e5f2 100644 --- a/examples/schedule/schedule_info_query.py +++ b/examples/schedule/schedule_info_query.py @@ -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) diff --git a/examples/schedule/schedule_sign_transaction.py b/examples/schedule/schedule_sign_transaction.py index 67c27bda4..c899f4a75 100644 --- a/examples/schedule/schedule_sign_transaction.py +++ b/examples/schedule/schedule_sign_transaction.py @@ -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) diff --git a/examples/tokens/account_allowance_approve_transaction.py b/examples/tokens/account_allowance_approve_transaction.py index fb83f5f9e..c98f2218c 100644 --- a/examples/tokens/account_allowance_approve_transaction.py +++ b/examples/tokens/account_allowance_approve_transaction.py @@ -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) diff --git a/examples/tokens/token_airdrop_claim_auto.py b/examples/tokens/token_airdrop_claim_auto.py index 562d93c2d..dc31f830c 100644 --- a/examples/tokens/token_airdrop_claim_auto.py +++ b/examples/tokens/token_airdrop_claim_auto.py @@ -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) diff --git a/examples/tokens/token_airdrop_claim_signature_required.py b/examples/tokens/token_airdrop_claim_signature_required.py index 2abcb7ca6..c3e0b4866 100644 --- a/examples/tokens/token_airdrop_claim_signature_required.py +++ b/examples/tokens/token_airdrop_claim_signature_required.py @@ -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) diff --git a/examples/tokens/token_airdrop_transaction.py b/examples/tokens/token_airdrop_transaction.py index e411f111f..2a2fffb67 100644 --- a/examples/tokens/token_airdrop_transaction.py +++ b/examples/tokens/token_airdrop_transaction.py @@ -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 = ( diff --git a/examples/tokens/token_airdrop_transaction_cancel.py b/examples/tokens/token_airdrop_transaction_cancel.py index f39e4343c..e3e471da8 100644 --- a/examples/tokens/token_airdrop_transaction_cancel.py +++ b/examples/tokens/token_airdrop_transaction_cancel.py @@ -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) diff --git a/examples/tokens/token_associate_transaction.py b/examples/tokens/token_associate_transaction.py index 3904baad4..949dd2560 100644 --- a/examples/tokens/token_associate_transaction.py +++ b/examples/tokens/token_associate_transaction.py @@ -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) diff --git a/examples/tokens/token_create_transaction_freeze_key.py b/examples/tokens/token_create_transaction_freeze_key.py index 712a434d8..65109efbd 100644 --- a/examples/tokens/token_create_transaction_freeze_key.py +++ b/examples/tokens/token_create_transaction_freeze_key.py @@ -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) diff --git a/examples/tokens/token_create_transaction_kyc_key.py b/examples/tokens/token_create_transaction_kyc_key.py index ce20ee22b..df319a7ec 100644 --- a/examples/tokens/token_create_transaction_kyc_key.py +++ b/examples/tokens/token_create_transaction_kyc_key.py @@ -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) ) diff --git a/examples/tokens/token_create_transaction_max_automatic_token_associations_0.py b/examples/tokens/token_create_transaction_max_automatic_token_associations_0.py index 5660fd411..88aa7e7ab 100644 --- a/examples/tokens/token_create_transaction_max_automatic_token_associations_0.py +++ b/examples/tokens/token_create_transaction_max_automatic_token_associations_0.py @@ -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) diff --git a/examples/tokens/token_create_transaction_pause_key.py b/examples/tokens/token_create_transaction_pause_key.py index 31197a31d..a2b916e1c 100644 --- a/examples/tokens/token_create_transaction_pause_key.py +++ b/examples/tokens/token_create_transaction_pause_key.py @@ -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) diff --git a/examples/tokens/token_create_transaction_wipe_key.py b/examples/tokens/token_create_transaction_wipe_key.py index 914958e18..9c02acbea 100644 --- a/examples/tokens/token_create_transaction_wipe_key.py +++ b/examples/tokens/token_create_transaction_wipe_key.py @@ -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) diff --git a/examples/tokens/token_dissociate_transaction.py b/examples/tokens/token_dissociate_transaction.py index 933329317..6861252c4 100644 --- a/examples/tokens/token_dissociate_transaction.py +++ b/examples/tokens/token_dissociate_transaction.py @@ -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 ) diff --git a/examples/tokens/token_grant_kyc_transaction.py b/examples/tokens/token_grant_kyc_transaction.py index 35f841a94..ad5673297 100644 --- a/examples/tokens/token_grant_kyc_transaction.py +++ b/examples/tokens/token_grant_kyc_transaction.py @@ -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) ) diff --git a/examples/tokens/token_reject_transaction_fungible_token.py b/examples/tokens/token_reject_transaction_fungible_token.py index 2a9171b4d..9bff05447 100644 --- a/examples/tokens/token_reject_transaction_fungible_token.py +++ b/examples/tokens/token_reject_transaction_fungible_token.py @@ -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) ) diff --git a/examples/tokens/token_reject_transaction_nft.py b/examples/tokens/token_reject_transaction_nft.py index 7be75b082..9a5c8c501 100644 --- a/examples/tokens/token_reject_transaction_nft.py +++ b/examples/tokens/token_reject_transaction_nft.py @@ -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) ) diff --git a/examples/tokens/token_revoke_kyc_transaction.py b/examples/tokens/token_revoke_kyc_transaction.py index 122d19df7..4f0ac41e2 100644 --- a/examples/tokens/token_revoke_kyc_transaction.py +++ b/examples/tokens/token_revoke_kyc_transaction.py @@ -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) ) diff --git a/examples/tokens/token_wipe_transaction.py b/examples/tokens/token_wipe_transaction.py index f0a2c3816..9d71454c1 100644 --- a/examples/tokens/token_wipe_transaction.py +++ b/examples/tokens/token_wipe_transaction.py @@ -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) ) diff --git a/examples/transaction/transfer_transaction_fungible.py b/examples/transaction/transfer_transaction_fungible.py index 1ed099a1d..550eeba95 100644 --- a/examples/transaction/transfer_transaction_fungible.py +++ b/examples/transaction/transfer_transaction_fungible.py @@ -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) diff --git a/examples/transaction/transfer_transaction_hbar.py b/examples/transaction/transfer_transaction_hbar.py index c78edecfb..44782466d 100644 --- a/examples/transaction/transfer_transaction_hbar.py +++ b/examples/transaction/transfer_transaction_hbar.py @@ -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) diff --git a/examples/transaction/transfer_transaction_nft.py b/examples/transaction/transfer_transaction_nft.py index 77adf8a5f..bc108d1fb 100644 --- a/examples/transaction/transfer_transaction_nft.py +++ b/examples/transaction/transfer_transaction_nft.py @@ -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) ) diff --git a/tests/integration/account_info_query_e2e_test.py b/tests/integration/account_info_query_e2e_test.py index e16c6b989..ba5032104 100644 --- a/tests/integration/account_info_query_e2e_test.py +++ b/tests/integration/account_info_query_e2e_test.py @@ -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) diff --git a/tests/integration/account_update_transaction_e2e_test.py b/tests/integration/account_update_transaction_e2e_test.py index b31a1aaa0..06aac3c5a 100644 --- a/tests/integration/account_update_transaction_e2e_test.py +++ b/tests/integration/account_update_transaction_e2e_test.py @@ -25,7 +25,7 @@ def test_integration_account_update_transaction_can_execute(env): receipt = ( AccountCreateTransaction() - .set_key(env.operator_key.public_key()) + .set_key_without_alias(env.operator_key.public_key()) .set_initial_balance(Hbar(2)) .set_account_memo(initial_memo) .set_receiver_signature_required(False) @@ -101,7 +101,7 @@ def test_integration_account_update_transaction_fails_with_invalid_signature(env receipt = ( AccountCreateTransaction() - .set_key(initial_public_key) + .set_key_without_alias(initial_public_key) .set_initial_balance(Hbar(1)) .execute(env.client) ) @@ -139,7 +139,7 @@ def test_integration_account_update_transaction_partial_update(env): # Create initial account receipt = ( AccountCreateTransaction() - .set_key(env.operator_key.public_key()) + .set_key_without_alias(env.operator_key.public_key()) .set_initial_balance(Hbar(1)) .set_account_memo("Initial memo") .set_receiver_signature_required(False) @@ -338,7 +338,7 @@ def test_integration_account_update_transaction_with_staking_fields(env): # Create two accounts - one to stake to receipt1 = ( AccountCreateTransaction() - .set_key(env.operator_key.public_key()) + .set_key_without_alias(env.operator_key.public_key()) .set_initial_balance(Hbar(2)) .execute(env.client) ) @@ -348,7 +348,7 @@ def test_integration_account_update_transaction_with_staking_fields(env): # Create account to update receipt2 = ( AccountCreateTransaction() - .set_key(env.operator_key.public_key()) + .set_key_without_alias(env.operator_key.public_key()) .set_initial_balance(Hbar(2)) .execute(env.client) ) diff --git a/tests/integration/batch_transaction_e2e_test.py b/tests/integration/batch_transaction_e2e_test.py index e401736d6..1071149c1 100644 --- a/tests/integration/batch_transaction_e2e_test.py +++ b/tests/integration/batch_transaction_e2e_test.py @@ -279,14 +279,14 @@ def test_successful_inner_transactions_should_incur_fees_even_though_one_fails(e tx1 = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(1) .batchify(env.client, batch_key) ) tx2 = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(1) .batchify(env.client, batch_key) ) @@ -294,7 +294,7 @@ def test_successful_inner_transactions_should_incur_fees_even_though_one_fails(e # Invalid Tx tx3 = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(1) .set_receiver_signature_required(True) .batchify(env.client, batch_key) diff --git a/tests/integration/query_e2e_test.py b/tests/integration/query_e2e_test.py index c72ecb971..105c9a715 100644 --- a/tests/integration/query_e2e_test.py +++ b/tests/integration/query_e2e_test.py @@ -22,7 +22,7 @@ def test_integration_free_query_no_cost(): initial_balance = Hbar(1) receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(initial_balance) .execute(env.client) ) @@ -72,7 +72,7 @@ def test_integration_free_query_with_manual_payment(): initial_balance = Hbar(1) receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(initial_balance) .execute(env.client) ) @@ -129,7 +129,7 @@ def test_integration_paid_query_network_cost(): receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(1)) .execute(env.client) ) @@ -168,7 +168,7 @@ def test_integration_paid_query_manual_payment(): receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(1)) .execute(env.client) ) @@ -214,7 +214,7 @@ def test_integration_paid_query_payment_too_high_fails(): receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(1)) .execute(env.client) ) diff --git a/tests/integration/revenue_generating_topics_e2e_test.py b/tests/integration/revenue_generating_topics_e2e_test.py index 8c87a751f..f521e4cd1 100644 --- a/tests/integration/revenue_generating_topics_e2e_test.py +++ b/tests/integration/revenue_generating_topics_e2e_test.py @@ -528,7 +528,7 @@ def test_integration_revenue_generating_topic_does_not_charge_hbars_fee_exempt_k # Create payer with 1 HBAR and fee exempt key receipt = ( AccountCreateTransaction() - .set_key(fee_exempt_key1.public_key()) + .set_key_without_alias(fee_exempt_key1.public_key()) .set_initial_balance(Hbar(1)) .execute(env.client) ) @@ -591,7 +591,7 @@ def test_integration_revenue_generating_topic_does_not_charge_tokens_fee_exempt_ receipt = ( AccountCreateTransaction() - .set_key(fee_exempt_key1.public_key()) + .set_key_without_alias(fee_exempt_key1.public_key()) .set_initial_balance(Hbar(1)) .execute(env.client) ) diff --git a/tests/integration/token_grant_kyc_transaction_e2e_test.py b/tests/integration/token_grant_kyc_transaction_e2e_test.py index 82821e9b1..f2c3dad06 100644 --- a/tests/integration/token_grant_kyc_transaction_e2e_test.py +++ b/tests/integration/token_grant_kyc_transaction_e2e_test.py @@ -19,7 +19,7 @@ def test_token_grant_kyc_transaction_can_execute(): # Create a new account receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(2)) .execute(env.client) ) @@ -62,7 +62,7 @@ def test_token_grant_kyc_transaction_fails_with_no_kyc_key(): # Create a new account receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(2)) .execute(env.client) ) @@ -116,7 +116,7 @@ def test_token_grant_kyc_transaction_fails_when_account_not_associated(): # Create a new account receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(2)) .execute(env.client) ) diff --git a/tests/integration/token_reject_transaction_e2e_test.py b/tests/integration/token_reject_transaction_e2e_test.py index 0afc62384..98c913f22 100644 --- a/tests/integration/token_reject_transaction_e2e_test.py +++ b/tests/integration/token_reject_transaction_e2e_test.py @@ -113,7 +113,7 @@ def test_integration_token_reject_transaction_can_execute_for_nft(): new_account_public_key = new_account_private_key.public_key() receipt = (AccountCreateTransaction() - .set_key(new_account_public_key).set_initial_balance(Hbar(1)) + .set_key_without_alias(new_account_public_key).set_initial_balance(Hbar(1)) .set_account_memo("Receiver Account").execute(env.client)) assert receipt.status == ResponseCode.SUCCESS, f"Account creation failed with status: {ResponseCode(receipt.status).name}" account_id = receipt.account_id @@ -174,7 +174,7 @@ def test_integration_token_reject_transaction_can_execute_for_ft_and_nft_paralle new_account_private_key = PrivateKey.generate() new_account_public_key = new_account_private_key.public_key() - receipt = AccountCreateTransaction().set_key(new_account_public_key).set_initial_balance(Hbar(1)).set_account_memo("Receiver Account").execute(env.client) + receipt = AccountCreateTransaction().set_key_without_alias(new_account_public_key).set_initial_balance(Hbar(1)).set_account_memo("Receiver Account").execute(env.client) assert receipt.status == ResponseCode.SUCCESS, f"Account creation failed with status: {ResponseCode(receipt.status).name}" account_id = receipt.account_id assert account_id is not None @@ -880,7 +880,7 @@ def test_token_reject_transaction_receiver_sig_required_nft(): treasury_private_key = PrivateKey.generate() treasury_public_key = treasury_private_key.public_key() - receipt = (AccountCreateTransaction().set_key(treasury_public_key).set_initial_balance(Hbar(0)) + receipt = (AccountCreateTransaction().set_key_without_alias(treasury_public_key).set_initial_balance(Hbar(0)) .set_receiver_signature_required(True).set_account_memo("Treasury Account") .freeze_with(env.client).sign(treasury_private_key).execute(env.client)) assert receipt.status == ResponseCode.SUCCESS, f"Treasury account creation failed with status: {ResponseCode(receipt.status).name}" @@ -900,7 +900,7 @@ def test_token_reject_transaction_receiver_sig_required_nft(): receiver_private_key = PrivateKey.generate() receiver_public_key = receiver_private_key.public_key() - receipt = (AccountCreateTransaction().set_key(receiver_public_key).set_initial_balance(Hbar(1)).set_account_memo("Receiver Account").execute(env.client)) + receipt = (AccountCreateTransaction().set_key_without_alias(receiver_public_key).set_initial_balance(Hbar(1)).set_account_memo("Receiver Account").execute(env.client)) assert receipt.status == ResponseCode.SUCCESS, f"Receiver account creation failed with status: {ResponseCode(receipt.status).name}" receiver_id = receipt.account_id diff --git a/tests/integration/token_revoke_kyc_transaction_e2e_test.py b/tests/integration/token_revoke_kyc_transaction_e2e_test.py index 01cb670be..6f5c27509 100644 --- a/tests/integration/token_revoke_kyc_transaction_e2e_test.py +++ b/tests/integration/token_revoke_kyc_transaction_e2e_test.py @@ -20,7 +20,7 @@ def test_token_revoke_kyc_transaction_can_execute(): # Create a new account receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(2)) .execute(env.client) ) @@ -72,7 +72,7 @@ def test_token_revoke_kyc_transaction_fails_with_no_kyc_key(): # Create a new account receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(2)) .execute(env.client) ) @@ -124,7 +124,7 @@ def test_token_revoke_kyc_transaction_fails_when_account_not_associated(): # Create a new account receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(2)) .execute(env.client) ) diff --git a/tests/integration/token_update_transaction_e2e_test.py b/tests/integration/token_update_transaction_e2e_test.py index 0402d245f..10889c032 100644 --- a/tests/integration/token_update_transaction_e2e_test.py +++ b/tests/integration/token_update_transaction_e2e_test.py @@ -110,7 +110,7 @@ def test_integration_token_update_transaction_different_keys(): # Create new account with first key tx = ( AccountCreateTransaction() - .set_key(keys[0].public_key()) + .set_key_without_alias(keys[0].public_key()) .set_initial_balance(Hbar(2)) ) receipt = tx.execute(env.client) @@ -174,7 +174,7 @@ def test_integration_token_update_transaction_treasury(): receipt = ( AccountCreateTransaction() - .set_key(new_public_key) + .set_key_without_alias(new_public_key) .set_initial_balance(Hbar(2)) .execute(env.client) ) diff --git a/tests/integration/transaction_record_query_e2e_test.py b/tests/integration/transaction_record_query_e2e_test.py index 7885b6c9c..f8e1d5f25 100644 --- a/tests/integration/transaction_record_query_e2e_test.py +++ b/tests/integration/transaction_record_query_e2e_test.py @@ -22,7 +22,7 @@ def test_transaction_record_query_can_execute(): # Create new account receipt = ( AccountCreateTransaction() - .set_key(new_account_public_key) + .set_key_without_alias(new_account_public_key) .set_initial_balance(Hbar(1)) .execute(env.client) ) diff --git a/tests/integration/utils.py b/tests/integration/utils.py index c0ee81333..b814ab1ba 100644 --- a/tests/integration/utils.py +++ b/tests/integration/utils.py @@ -56,7 +56,7 @@ def create_account(self, initial_hbar: float = 1.0) -> Account: key = PrivateKey.generate() tx = ( AccountCreateTransaction() - .set_key(key.public_key()) + .set_key_without_alias(key.public_key()) .set_initial_balance(Hbar(initial_hbar)) ) receipt = tx.execute(self.client) diff --git a/tests/unit/account_create_transaction_test.py b/tests/unit/account_create_transaction_test.py index 224e20181..a0a8a8670 100644 --- a/tests/unit/account_create_transaction_test.py +++ b/tests/unit/account_create_transaction_test.py @@ -42,7 +42,7 @@ def test_account_create_transaction_build(mock_account_ids): account_tx = ( AccountCreateTransaction() - .set_key(new_public_key) + .set_key_without_alias(new_public_key) .set_initial_balance(100000000) .set_account_memo("Test account") ) @@ -67,7 +67,7 @@ def test_account_create_transaction_build_scheduled_body(mock_account_ids): account_tx = ( AccountCreateTransaction() - .set_key(new_public_key) + .set_key_without_alias(new_public_key) .set_initial_balance(200000000) .set_account_memo("Schedulable account") .set_receiver_signature_required(True) @@ -102,7 +102,7 @@ def test_account_create_transaction_sign(mock_account_ids, mock_client): account_tx = ( AccountCreateTransaction() - .set_key(new_public_key) + .set_key_without_alias(new_public_key) .set_initial_balance(100000000) .set_account_memo("Test account") ) @@ -167,7 +167,7 @@ def test_account_create_transaction(): new_key = PrivateKey.generate() transaction = ( AccountCreateTransaction() - .set_key(new_key.public_key()) + .set_key_without_alias(new_key.public_key()) .set_initial_balance(100000000) # 1 HBAR ) @@ -187,9 +187,9 @@ def test_sign_account_create_without_freezing_raises_error(mock_account_ids): account_tx = ( AccountCreateTransaction() - .set_key(new_public_key) + .set_key_without_alias(new_public_key) .set_initial_balance(100000000) - .set_account_memo("Test account") + .set_account_memo("Test account")) ) account_tx.transaction_id = generate_transaction_id(operator_id) account_tx.node_account_id = node_account_id @@ -234,7 +234,7 @@ def test_account_create_build_with_max_auto_assoc(mock_account_ids): account_tx = ( AccountCreateTransaction() - .set_key(new_public_key) + .set_key_without_alias(new_public_key) .set_max_automatic_token_associations(-1) # Test the new value ) account_tx.transaction_id = generate_transaction_id(operator_id) @@ -331,7 +331,7 @@ def test_create_account_transaction_with_set_alias(mock_account_ids): tx = ( AccountCreateTransaction() - .set_key(public_key) + .set_key_with_alias(public_key) .set_alias(evm_address) ) @@ -357,7 +357,7 @@ def test_create_account_transaction_with_set_alias_from_string(mock_account_ids, tx = ( AccountCreateTransaction() - .set_key(public_key) + .set_key_with_alias(public_key) .set_alias(alias_str) ) @@ -383,7 +383,7 @@ def test_create_account_transaction_with_set_alias_from_string(mock_account_ids, def test_create_account_transaction_with_set_alias_from_invalid_string(invalid_str): """Test invalid alias strings raise ValueError.""" public_key = PrivateKey.generate().public_key() - tx = AccountCreateTransaction().set_key(public_key) + tx = AccountCreateTransaction().set_key_without_alias(public_key) with pytest.raises(ValueError): tx.set_alias(invalid_str) @@ -391,7 +391,7 @@ def test_create_account_transaction_with_set_alias_from_invalid_string(invalid_s def test_create_account_transaction_with_set_alias_from_invalid_type(): """Test alias with invalid type raises TypeError.""" public_key = PrivateKey.generate().public_key() - tx = AccountCreateTransaction().set_key(public_key) + tx = AccountCreateTransaction().set_key_without_alias(public_key) with pytest.raises(TypeError): tx.set_alias(1234) diff --git a/tests/unit/executable_test.py b/tests/unit/executable_test.py index bfd844ab3..d0be5d424 100644 --- a/tests/unit/executable_test.py +++ b/tests/unit/executable_test.py @@ -52,7 +52,7 @@ def test_retry_success_before_max_attempts(): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -75,7 +75,7 @@ def test_retry_failure_after_max_attempts(): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -115,7 +115,7 @@ def test_node_switching_after_single_grpc_error(): with mock_hedera_servers(response_sequences) as client, patch('hiero_sdk_python.executable.time.sleep'): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -152,7 +152,7 @@ def test_node_switching_after_multiple_grpc_errors(): with mock_hedera_servers(response_sequences) as client, patch('hiero_sdk_python.executable.time.sleep'): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -188,7 +188,7 @@ def test_transaction_with_expired_error_not_retried(): with mock_hedera_servers(response_sequences) as client, patch('hiero_sdk_python.executable.time.sleep'): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -219,7 +219,7 @@ def test_transaction_with_fatal_error_not_retried(): with mock_hedera_servers(response_sequences) as client, patch('hiero_sdk_python.executable.time.sleep'): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -253,7 +253,7 @@ def test_exponential_backoff_retry(): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -291,7 +291,7 @@ def test_retriable_error_does_not_switch_node(): with mock_hedera_servers(response_sequences) as client, patch('hiero_sdk_python.executable.time.sleep'): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) ) @@ -407,7 +407,7 @@ def test_transaction_node_switching_body_bytes(): transaction = ( AccountCreateTransaction() - .set_key(PrivateKey.generate().public_key()) + .set_key_without_alias(PrivateKey.generate().public_key()) .set_initial_balance(100_000_000) .freeze_with(client) .sign(client.operator_private_key)