feat: Add support for include_children to TransactionRecordQuery#1959
Conversation
…class(1512) Signed-off-by: Antonio Ceppellini <antonio.ceppellini@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1959 +/- ##
=======================================
Coverage 93.53% 93.54%
=======================================
Files 141 141
Lines 9146 9160 +14
=======================================
+ Hits 8555 8569 +14
Misses 591 591 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdded support for requesting child transaction records via a new include_children flag on TransactionRecordQuery. TransactionRecord now exposes a children list that is populated when child records are returned and mapped. Changes
Sequence DiagramsequenceDiagram
participant Client as Client
participant Query as TransactionRecordQuery
participant Server as Server
participant Record as TransactionRecord
Client->>Query: set_include_children(True)
Query->>Query: store include_children=True
Client->>Query: execute(client)
Query->>Query: _make_request(include_child_records=True)
Query->>Server: TransactionGetRecord request
Server-->>Query: Response (parent + child_transaction_records)
Query->>Query: _map_record_list(child_transaction_records)
loop for each child_proto
Query->>Record: _from_proto(child_proto)
Record-->>Query: child TransactionRecord
end
Query->>Record: _from_proto(parent_proto, children=[...])
Record-->>Query: parent TransactionRecord (children populated)
Query-->>Client: return TransactionRecord with children
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 56b4e967-30f7-4291-b046-3623cc0d86fb
📒 Files selected for processing (7)
CHANGELOG.mdexamples/query/transaction_record_query_with_children.pysrc/hiero_sdk_python/query/transaction_record_query.pysrc/hiero_sdk_python/transaction/transaction_record.pytests/integration/transaction_record_query_e2e_test.pytests/unit/transaction_record_query_test.pytests/unit/transaction_record_test.py
CHANGELOG.md
Outdated
|
|
||
| ### Added | ||
| - Added CodeRabbit review instructions in `.coderabbit.yaml` for account module `src/hiero_sdk_python/account/`. | ||
| - Add support for `include_children` to TransactionRecordQuery (#1512)(https://github.com/hiero-ledger/hiero-sdk-python/issues/1512) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider simplifying the issue reference format.
The entry uses both (#1512) and the full URL (https://github.com/hiero-ledger/hiero-sdk-python/issues/1512), which is redundant since GitHub automatically links #1512 to the issue. For consistency with other entries (e.g., lines 134, 224), consider using just the short form:
-- Add support for `include_children` to TransactionRecordQuery (`#1512`)(https://github.com/hiero-ledger/hiero-sdk-python/issues/1512)
+- Add support for `include_children` to TransactionRecordQuery (`#1512`)That said, the content accurately describes the feature being added.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Add support for `include_children` to TransactionRecordQuery (#1512)(https://github.com/hiero-ledger/hiero-sdk-python/issues/1512) | |
| - Add support for `include_children` to TransactionRecordQuery (`#1512`) |
|
Hi, this is WorkflowBot.
|
…class(1512) Signed-off-by: Antonio Ceppellini <antonio.ceppellini@gmail.com>
…class(1512) Signed-off-by: Antonio Ceppellini <antonio.ceppellini@gmail.com>
| f"prng_bytes={self.prng_bytes}, " | ||
| f"duplicates_count={len(self.duplicates)})") | ||
| f"duplicates_count={len(self.duplicates)}, " | ||
| f"children={self.children})") |
There was a problem hiding this comment.
I think we should keep it len(self.children) to keep consistent with the duplicate records
…class(1512) Signed-off-by: Antonio Ceppellini <antonio.ceppellini@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9d0e6d1c-a777-4919-92f8-0b40778ccfad
📒 Files selected for processing (7)
CHANGELOG.mdexamples/query/transaction_record_query_with_children.pysrc/hiero_sdk_python/query/transaction_record_query.pysrc/hiero_sdk_python/transaction/transaction_record.pytests/integration/transaction_record_query_e2e_test.pytests/unit/transaction_record_query_test.pytests/unit/transaction_record_test.py
| ) | ||
| receipt = transaction.execute(client) | ||
|
|
||
| return transaction.transaction_id |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Add receipt status validation before returning transaction_id.
The function doesn't verify receipt.status == ResponseCode.SUCCESS before returning, which could mask failures.
🛡️ Add status check
receipt = transaction.execute(client)
+ if receipt.status != ResponseCode.SUCCESS:
+ print(f"Transfer failed with status: {ResponseCode(receipt.status).name}")
+ sys.exit(1)
+
return transaction.transaction_id…nsactionRecordQuery
…class(1512)
Description:
This PR adds support for
include_childrento theTransactionRecordQueryclass.Related issue(s):
Fixes #1512
Checklist