Skip to content

Mirror node and mnemonic feature #1

Open
iron-prog wants to merge 6 commits into
mainfrom
mirror-node
Open

Mirror node and mnemonic feature #1
iron-prog wants to merge 6 commits into
mainfrom
mirror-node

Conversation

@iron-prog

Copy link
Copy Markdown
Owner

This PR introduces a typed synchronous Mirror Node client for the Python SDK.

Highlights:

  • Added MirrorNodeClient for common Mirror Node REST workflows.
  • Added typed models for accounts, balances, tokens, transactions, and paginated responses.
  • Added support for account lookup, balance lookup, token lookup, transaction lookup, filtered transaction listing, and pagination.
  • Added configurable sessions, headers, and timeouts.
  • Added HTTP and JSON error handling.
  • Exported the API from both hiero_sdk_python and hiero_sdk_python.mirror_node.
  • Added unit coverage using a fake injectable HTTP session.

Testing performed:

  • Ruff checks passed.
  • Compile checks passed.
  • Unit coverage added for request construction, response mapping, pagination, validation, HTTP failures, invalid JSON, and malformed payload handling.

Known limitation:

  • Full pytest execution is currently blocked in this environment because the generated protobuf package is not present and protobuf generation is failing due to a GitHub download proxy returning HTTP 403.

iron-prog added 6 commits May 27, 2026 10:40
Signed-off-by: iron-prog <dt915725@gmail.com>
Signed-off-by: iron-prog <dt915725@gmail.com>
Signed-off-by: iron-prog <dt915725@gmail.com>
…tion

Signed-off-by: iron-prog <dt915725@gmail.com>
Signed-off-by: iron-prog <dt915725@gmail.com>
Signed-off-by: iron-prog <dt915725@gmail.com>
@iron-prog iron-prog self-assigned this May 30, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53578bf789

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"""Build a transaction model from a mirror node transaction payload."""
node_account_id = _optional_str(data, "node")
return cls(
transaction_id=TransactionId.from_string(_require_str(data, "transaction_id")),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Parse mirror-node transaction IDs before constructing TransactionId

Real mirror-node transaction responses use hyphen-separated IDs such as 0.0.8-1234567890-000000006, while TransactionId.from_string only accepts the SDK form account@seconds.nanos. In any real list_transactions() or get_transaction() response, this line raises ValueError while mapping the page instead of returning transactions; the new tests mask this by using the SDK format rather than the mirror-node response format.

Useful? React with 👍 / 👎.

Comment on lines +260 to +261
if transaction_type is not None:
params["type"] = transaction_type

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Send transactiontype for transaction operation filters

When callers pass transaction_type="CRYPTOTRANSFER", this builds type=CRYPTOTRANSFER, but the mirror-node list-transactions API uses transactiontype for operation names; type is the separate credit/debit account-balance modification filter. This means the documented transaction_type argument either returns a 400 for operation names or filters on the wrong field instead of selecting transaction names.

Useful? React with 👍 / 👎.

from hiero_sdk_python import MirrorNodeClient
from hiero_sdk_python.account.account_id import AccountId
from hiero_sdk_python.hbar import Hbar
from hiero_sdk_python.mirror_node import MirrorNodeError

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Export MirrorNodeError from the mirror_node package

This import path cannot resolve because the commit adds mirror_node_client.py but no hiero_sdk_python/mirror_node/__init__.py that re-exports MirrorNodeError. In a normal test environment collection will fail with ImportError: cannot import name 'MirrorNodeError' from 'hiero_sdk_python.mirror_node' before any of these new unit tests run.

Useful? React with 👍 / 👎.

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.

1 participant