Skip to content

Conversation

@KubanjaElijahEldred
Copy link

@KubanjaElijahEldred KubanjaElijahEldred commented Nov 26, 2025

… (#830)

Description:

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

MonaaEid and others added 2 commits November 26, 2025 14:40
…hiero-ledger#830)

Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
Signed-off-by: kubanjaelijaheldred <kubanjaelijah2037@gmail.com>
Signed-off-by: KUBANJA ELIJAH ELDRED <kubanjaelijah2037@gmail.com>
@exploreriii exploreriii changed the title feat: Refactor TokenDissociateTransaction to use set_token_ids method… chore: add documentation for max attempts error Nov 26, 2025
@exploreriii
Copy link
Contributor

Hi @KubanjaElijahEldred
Please I recommend you start again, you have added a change to someone elses commit - you can see here you are changing Monaad's commit

Alternatively you'll need to rebase from main, soft revert, then resign only your changes (more advanced)

Please get in touch if you need help, read MAINTAINERS.md

Screenshot 2025-11-26 at 15 07 33

@KubanjaElijahEldred
Copy link
Author

KubanjaElijahEldred commented Nov 26, 2025 via email

exploreriii

This comment was marked as outdated.

@exploreriii
Copy link
Contributor

Hello, please contact me if you'd like help, see MAINTAINERS.md

@github-actions
Copy link

Hi, this is WorkflowBot.
Your pull request cannot be merged as it is not passing all our workflow checks.
Please click on each check to review the logs and resolve issues so all checks pass.
To help you:

- Added `examples/token_create_transaction_wipe_key.py` to demonstrate token wiping and the role of the wipe key.
- Added `examples/account_allowance_approve_transaction_hbar.py` and `examples/account_allowance_delete_transaction_hbar.py`, deleted `examples/account_allowance_hbar.py`. [#775]
- Added `docs\sdk_developers\training\receipts.md` as a training guide for users to understand hedera receipts.
- Add comprehensive documentation for `MaxAttemptsError` in `docs/sdk_developers/training/max_attempts_error.md` (2025-11-26)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hello please move these changelog entries to the UNRELEASED section 👍
i.e. under added roughly in line 10

  • Add comprehensive documentation for MaxAttemptsError in docs/sdk_developers/training/max_attempts_error.md (2025-11-26)
  • Add practical example examples/errors/max_attempts_error.py demonstrating network error handling and recovery strategies (2025-11-26)
  • Document error handling patterns for network failures and node retry attempts (Create docs/sdk_developers/training/max_attempts_error.md #877)


Many developers assume that if `execute()` doesn't throw, the transaction succeeded. These exceptions explicitly show different stages of failure.

## Example Usage
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to demonstrate the other two error types 👍

We can just explain you can catch a MaxAttemptsError like so

except MaxAttemptsError as e:
print(f"Max attempts reached: {e}")

Then for a full demonstration, add a link to the example.

when the SDK exhausts retry attempts to communicate with network nodes.
"""

import time
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi - lots of good stuff here, however, the script currently does not work

I had a go from what you had above and added some fixes:

import os
import dotenv

from hiero_sdk_python import TransferTransaction
from hiero_sdk_python.exceptions import MaxAttemptsError
from hiero_sdk_python.client.network import Network
from hiero_sdk_python.client.client import Client
from hiero_sdk_python.account.account_id import AccountId
from hiero_sdk_python.crypto.private_key import PrivateKey
from hiero_sdk_python.response_code import ResponseCode
from hiero_sdk_python.account.account_create_transaction import AccountCreateTransaction
from hiero_sdk_python.node import _Node

dotenv.load_dotenv()

def custom_network_from_dict(node_dict: dict[str, str]) -> Network:
    nodes = []
    for account, address in node_dict.items():
        nodes.append(_Node(AccountId.from_string(account), address, None))
    return Network(network="custom", nodes=nodes)

def setup_client() -> Client:
    """Initialize and set up the client with operator account using env vars."""
    network = custom_network_from_dict({"0.0.3": "192.0.2.0:50211"})
    client = Client(network)


    operator_id = AccountId.from_string(os.getenv("OPERATOR_ID", ""))
    operator_key = PrivateKey.from_string(os.getenv("OPERATOR_KEY", ""))
    client.set_operator(operator_id, operator_key)
    print(f"Client set up with operator id {client.operator_account_id}")

    return client

client = setup_client()

new_private_key = PrivateKey.generate()
new_public_key = new_private_key.public_key()

receipt = (AccountCreateTransaction()
                  .set_key(new_public_key)
                  .set_initial_balance(10_000_000)
                  .freeze_with(client)
                  .sign(client.operator_private_key)
                  .execute(client)
)
new_account_id = receipt.account_id

hbar_transaction = (TransferTransaction()
            .add_hbar_transfer(client.operator_account_id, -1000)
            .add_hbar_transfer(new_account_id, 1000)
            .freeze_with(client)
            .sign(client.operator_private_key)
)


try:
    # Execute the transaction
    receipt_hbar = hbar_transaction.execute(client)
    print("Transaction executed, checking receipt status...")
    print(f"The response code is {ResponseCode(receipt_hbar.status).name}")

except MaxAttemptsError as e:
    print(f"Max attempts reached: {e}")

We can use the environment variables and don't need to create too much new variables

Please use and edit this to show what you'd like - and make sure it runs! Contact us if needed

docs/sdk_developers/discord.md

Copy link
Contributor

Choose a reason for hiding this comment

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

this may wokr without creating an account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants