-
Notifications
You must be signed in to change notification settings - Fork 190
feat: Added support for include_children to the TransactionRecordQuery class #1621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4db4c75
f33daf9
dfe2039
e2e4055
f729433
1df0f7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import os | ||
mukundkumarjha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from hiero_sdk_python.client import Client | ||
| from hiero_sdk_python.query.transaction_record_query import TransactionRecordQuery | ||
|
|
||
| def main(): | ||
| # Setup client | ||
| client = Client.for_testnet() | ||
mukundkumarjha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # ... (add operator credentials) ... | ||
|
|
||
| # 1. Execute a transaction that is likely to have child records | ||
| # (e.g., a complex Smart Contract call) | ||
mukundkumarjha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| print("Executing transaction...") | ||
|
|
||
| # 2. Query the record and explicitly request children | ||
| tx_id = "..." # your transaction id | ||
|
|
||
| query = ( | ||
| TransactionRecordQuery() | ||
| .set_transaction_id(tx_id) | ||
| .set_include_children(True) # The new feature! | ||
| ) | ||
|
|
||
| record = query.execute(client) | ||
mukundkumarjha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # 3. Demonstrate accessing the children | ||
| print(f"Parent Transaction ID: {record.transaction_id}") | ||
| print(f"Number of child records found: {len(record.children)}") | ||
|
|
||
| for i, child in enumerate(record.children): | ||
| print(f"Child {i+1} Status: {child.receipt.status}") | ||
|
|
||
|
Comment on lines
+23
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, find and read the file in question
fd "transaction_record_with_children.py" --type fRepository: hiero-ledger/hiero-sdk-python Length of output: 129 🏁 Script executed: # Check if the file exists and read its content
if [ -f "examples/transaction/transaction_record_with_children.py" ]; then
wc -l examples/transaction/transaction_record_with_children.py
echo "---"
cat -n examples/transaction/transaction_record_with_children.py
else
echo "File not found"
fiRepository: hiero-ledger/hiero-sdk-python Length of output: 1383 🏁 Script executed: # Verify ResponseCode exists in hiero_sdk_python
find . -type f -name "*.py" | xargs grep -l "class ResponseCode" | head -5Repository: hiero-ledger/hiero-sdk-python Length of output: 112 🏁 Script executed: # Check how ResponseCode is imported in other example files
find examples -type f -name "*.py" -exec grep -l "ResponseCode" {} \; | head -5Repository: hiero-ledger/hiero-sdk-python Length of output: 3862 🏁 Script executed: # Look for patterns of receipt.status usage in examples
rg "receipt\.status" examples --type py -B 2 -A 2 | head -40Repository: hiero-ledger/hiero-sdk-python Length of output: 3540 🏁 Script executed: # Check how ResponseCode is imported in those example files
head -20 examples/tokens/token_fee_schedule_update_transaction_fungible.py | grep -E "^(import|from)" | head -10Repository: hiero-ledger/hiero-sdk-python Length of output: 498 🏁 Script executed: # Check if there's a general pattern for error handling in examples
head -30 examples/tokens/token_create_transaction_token_fee_schedule_key.py | grep -E "^(import|from)" | head -10Repository: hiero-ledger/hiero-sdk-python Length of output: 454 🏁 Script executed: # Verify the ResponseCode import path can be used as suggested
head -5 src/hiero_sdk_python/response_code.pyRepository: hiero-ledger/hiero-sdk-python Length of output: 154 🏁 Script executed: # Check other transaction_record examples for patterns
find examples -name "*transaction_record*" -type fRepository: hiero-ledger/hiero-sdk-python Length of output: 172 🏁 Script executed: # Look at how examples handle query results without receipt checks (queries vs transactions)
rg "\.execute\(client\)" examples/query --type py -A 3 | head -20Repository: hiero-ledger/hiero-sdk-python Length of output: 988 🏁 Script executed: # Check the other transaction_record query example
cat -n examples/query/transaction_record_query.py | head -40Repository: hiero-ledger/hiero-sdk-python Length of output: 1536 🏁 Script executed: # Verify ResponseCode is used consistently in query examples
rg "ResponseCode" examples/query --type py -B 1 -A 1 | head -30Repository: hiero-ledger/hiero-sdk-python Length of output: 2088 Validate child receipt status using Line 30 prints the raw numeric status without converting to ✅ Suggested improvement from hiero_sdk_python.query.transaction_record_query import TransactionRecordQuery
+from hiero_sdk_python.response_code import ResponseCode
@@
for i, child in enumerate(record.children):
- print(f"Child {i+1} Status: {child.receipt.status}")
+ status = ResponseCode(child.receipt.status)
+ print(f"Child {i+1} Status: {status.name}")
+ if status != ResponseCode.SUCCESS:
+ print(f"Warning: Child {i+1} failed with status {status.name}") |
||
| if __name__ == "__main__": | ||
| main() | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,8 +1,10 @@ | ||||||
| from typing import Optional, Any, Union, List | ||||||
| from typing import Optional, Any, Union | ||||||
| from hiero_sdk_python.hapi.services import ( | ||||||
| query_header_pb2, | ||||||
| transaction_get_record_pb2, | ||||||
| query_pb2, | ||||||
| ) | ||||||
| transaction_record_pb2, | ||||||
| ) | ||||||
|
Comment on lines
+1
to
9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File has unresolved merge-conflict residue — will not parse as valid Python. The file contains duplicate/conflicting code from what appears to be an incomplete merge with the
Ruff's static analysis confirms numerous syntax errors throughout the file. The entire file needs to be properly rebased/merged against 🧰 Tools🪛 Ruff (0.14.14)[warning] 8-8: Unexpected indentation (invalid-syntax) [warning] 9-9: Expected a statement (invalid-syntax) |
||||||
| from hiero_sdk_python.client.client import Client | ||||||
|
|
@@ -25,12 +27,20 @@ | |||||
| def __init__( | ||||||
| self, | ||||||
| transaction_id: Optional[TransactionId] = None, | ||||||
| include_children: bool = False, | ||||||
mukundkumarjha marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| ): | ||||||
| include_duplicates: bool = False, | ||||||
| ) -> None: | ||||||
| """ | ||||||
| Initializes the TransactionRecordQuery with the provided transaction ID. | ||||||
| """ | ||||||
| super().__init__() | ||||||
| self.transaction_id: Optional[TransactionId] = transaction_id | ||||||
| self.include_children = include_children | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing type hint
Suggested change
|
||||||
|
|
||||||
| def set_transaction_id(self, transaction_id: TransactionId): | ||||||
| """ | ||||||
| Sets the transaction ID for the query. | ||||||
| if not isinstance(include_duplicates, bool): | ||||||
| raise TypeError( | ||||||
| f"include_duplicates must be a bool (True or False), got {type(include_duplicates).__name__}" | ||||||
|
|
@@ -85,6 +95,10 @@ | |||||
| self.transaction_id = transaction_id | ||||||
| return self | ||||||
|
|
||||||
| def set_include_children(self, include_children): | ||||||
| self.include_children = include_children | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor suggestion consider adding a docstring |
||||||
| return self | ||||||
|
Comment on lines
+98
to
+100
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
def set_include_children(self, include_children):
+ if not isinstance(include_children, bool):
+ raise TypeError(
+ f"include_children must be a boolean, got {type(include_children).__name__}"
+ )
self.include_children = include_children
return selfAs per coding guidelines, "Ensure naming matches existing query patterns" — the validation pattern used by |
||||||
|
|
||||||
| def _make_request(self): | ||||||
| """ | ||||||
| Constructs the protobuf request for the transaction record query. | ||||||
|
|
@@ -100,6 +114,37 @@ | |||||
| AttributeError: If the Query protobuf structure is invalid. | ||||||
| Exception: If any other error occurs during request construction. | ||||||
| """ | ||||||
| try: | ||||||
| if not self.transaction_id: | ||||||
| raise ValueError( | ||||||
| "Transaction ID must be set before making the request." | ||||||
| ) | ||||||
|
|
||||||
| query_header = self._make_request_header() | ||||||
| transaction_get_record = ( | ||||||
| transaction_get_record_pb2.TransactionGetRecordQuery() | ||||||
| ) | ||||||
| transaction_get_record.header.CopyFrom(query_header) | ||||||
|
|
||||||
| transaction_get_record.transactionID.CopyFrom( | ||||||
| self.transaction_id._to_proto() | ||||||
| ) | ||||||
| transaction_get_record.include_child_records = self.include_children | ||||||
| query = query_pb2.Query() | ||||||
| if not hasattr(query, "transactionGetRecord"): | ||||||
| raise AttributeError( | ||||||
| "Query object has no attribute 'transactionGetRecord'" | ||||||
| ) | ||||||
| query.transactionGetRecord.CopyFrom(transaction_get_record) | ||||||
|
|
||||||
| return query | ||||||
| except Exception as e: | ||||||
| print(f"Exception in _make_request: {e}") | ||||||
| raise | ||||||
|
Comment on lines
+117
to
+143
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove Production query code must not use Proposed simplified _make_request def _make_request(self):
- try:
- if not self.transaction_id:
- raise ValueError(
- "Transaction ID must be set before making the request."
- )
-
- query_header = self._make_request_header()
- transaction_get_record = (
- transaction_get_record_pb2.TransactionGetRecordQuery()
- )
- transaction_get_record.header.CopyFrom(query_header)
-
- transaction_get_record.transactionID.CopyFrom(
- self.transaction_id._to_proto()
- )
- transaction_get_record.include_child_records = self.include_children
- query = query_pb2.Query()
- if not hasattr(query, "transactionGetRecord"):
- raise AttributeError(
- "Query object has no attribute 'transactionGetRecord'"
- )
- query.transactionGetRecord.CopyFrom(transaction_get_record)
-
- return query
- except Exception as e:
- print(f"Exception in _make_request: {e}")
- raise
+ if self.transaction_id is None:
+ raise ValueError("Transaction ID must be set before making the request.")
+
+ query_header = self._make_request_header()
+ transaction_get_record = transaction_get_record_pb2.TransactionGetRecordQuery()
+ transaction_get_record.header.CopyFrom(query_header)
+ transaction_get_record.transactionID.CopyFrom(self.transaction_id._to_proto())
+ transaction_get_record.include_child_records = self.include_children
+ transaction_get_record.includeDuplicates = self.include_duplicates
+
+ query = query_pb2.Query()
+ query.transactionGetRecord.CopyFrom(transaction_get_record)
+ return queryAs per coding guidelines, Review Focus 6: "Introduces side effects (logging, prints, stack traces)" should be flagged. Review Focus 3: "_make_request() MUST... Call |
||||||
|
|
||||||
| def _get_method(self, channel: _Channel) -> _Method: | ||||||
| """ | ||||||
| Returns the appropriate gRPC method for the transaction receipt query. | ||||||
| if self.transaction_id is None: | ||||||
| raise ValueError("Transaction ID must be set before making the request.") | ||||||
|
|
||||||
|
|
@@ -189,6 +234,7 @@ | |||||
| == query_header_pb2.ResponseType.COST_ANSWER | ||||||
| ): | ||||||
| return _ExecutionState.FINISHED | ||||||
| pass | ||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| elif ( | ||||||
| status in retryable_statuses | ||||||
| or status == ResponseCode.PLATFORM_TRANSACTION_NOT_CREATED | ||||||
|
|
@@ -236,6 +282,24 @@ | |||||
| return PrecheckError(status) | ||||||
|
|
||||||
| receipt = response.transactionGetRecord.transactionRecord.receipt | ||||||
|
|
||||||
| return ReceiptStatusError( | ||||||
| status, | ||||||
| self.transaction_id, | ||||||
| TransactionReceipt._from_proto(receipt, self.transaction_id), | ||||||
| ) | ||||||
|
|
||||||
| def _map_record_list( | ||||||
| self, | ||||||
| proto_records: List[transaction_get_record_pb2.TransactionGetRecordResponse], | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. must be
Suggested change
|
||||||
| ) -> List[TransactionRecord]: | ||||||
| records: List[TransactionRecord] = [] | ||||||
| for record in proto_records: | ||||||
| records.append(TransactionRecord._from_proto(record, self.transaction_id)) | ||||||
|
|
||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| return records | ||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| def execute(self, client): | ||||||
|
|
||||||
| return ReceiptStatusError(status, self.transaction_id, TransactionReceipt._from_proto(receipt, self.transaction_id)) | ||||||
|
|
||||||
|
|
@@ -261,6 +325,15 @@ | |||||
| ReceiptStatusError: If the transaction record contains an error status | ||||||
| """ | ||||||
| self._before_execute(client) | ||||||
| response = self._execute(client) | ||||||
| if not response.HasField("transactionGetRecord"): | ||||||
| raise AttributeError("Response does not contain 'transactionGetRecord'") | ||||||
| record_response = response.transactionGetRecord | ||||||
| children = self._map_record_list(record_response.child_transaction_records) | ||||||
| return TransactionRecord._from_proto( | ||||||
| response.transactionGetRecord.transactionRecord, | ||||||
| self.transaction_id, | ||||||
| children=children, | ||||||
| response = self._execute(client, timeout) | ||||||
| primary_proto = response.transactionGetRecord.transactionRecord | ||||||
| if self.include_duplicates: | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
|
|
||
| from collections import defaultdict | ||
| from dataclasses import dataclass, field | ||
| from typing import Optional | ||
| from typing import Optional, List | ||
|
|
||
| from hiero_sdk_python.account.account_id import AccountId | ||
| from hiero_sdk_python.contract.contract_function_result import ContractFunctionResult | ||
|
|
@@ -36,7 +36,7 @@ class TransactionRecord: | |
| Represents a record of a completed transaction on the Hiero network. | ||
| This class combines detailed information about the a transaction including the | ||
| transaction ID, receipt, token and NFT transfers, fees & other | ||
| metadata such as pseudo-random number generation(PRNG) results and | ||
| metadata such as pseudo-random number generation(PRNG) results and | ||
| pending airdrop records. | ||
|
|
||
| Attributes: | ||
|
|
@@ -46,16 +46,17 @@ class TransactionRecord: | |
| transaction_fee (Optional[int]): The total network fee (in tinybars) charged for the transaction. | ||
| receipt (Optional[TransactionReceipt]): The receipt summarizing the outcome and status of the transaction. | ||
| call_result (Optional[ContractFunctionResult]): The result of a contract call if the transaction was a smart contract execution. | ||
| token_transfers (defaultdict[TokenId, defaultdict[AccountId, int]]): | ||
| A mapping of token IDs to account-level transfer amounts. | ||
| Represents fungible token movements within the transaction. | ||
| nft_transfers (defaultdict[TokenId, list[TokenNftTransfer]]): | ||
| token_transfers (defaultdict[TokenId, defaultdict[AccountId, int]]): | ||
| A mapping of token IDs to account-level transfer amounts. | ||
| Represents fungible token movements within the transaction. | ||
| nft_transfers (defaultdict[TokenId, list[TokenNftTransfer]]): | ||
| A mapping of token IDs to lists of NFT transfers for that token. | ||
| transfers (defaultdict[AccountId, int]): A mapping of account IDs to hbar transfer amounts (positive for credit, negative for debit). | ||
| new_pending_airdrops (list[PendingAirdropRecord]):A list of new airdrop records created by this transaction. | ||
|
|
||
| prng_number (Optional[int]): A pseudo-random integer generated by the network (if applicable). | ||
| prng_bytes (Optional[bytes]): A pseudo-random byte array generated by the network (if applicable). | ||
|
|
||
| duplicates (list[TransactionRecord]): A list of duplicate transaction records returned when queried | ||
| with include_duplicates=True. Empty by default. | ||
| """ | ||
|
|
@@ -67,23 +68,30 @@ class TransactionRecord: | |
| receipt: Optional[TransactionReceipt] = None | ||
| call_result: Optional[ContractFunctionResult] = None | ||
|
|
||
| token_transfers: defaultdict[TokenId, defaultdict[AccountId, int]] = field(default_factory=lambda: defaultdict(lambda: defaultdict(int))) | ||
| nft_transfers: defaultdict[TokenId, list[TokenNftTransfer]] = field(default_factory=lambda: defaultdict(list[TokenNftTransfer])) | ||
| transfers: defaultdict[AccountId, int] = field(default_factory=lambda: defaultdict(int)) | ||
| token_transfers: defaultdict[TokenId, defaultdict[AccountId, int]] = field( | ||
| default_factory=lambda: defaultdict(lambda: defaultdict(int)) | ||
| ) | ||
| nft_transfers: defaultdict[TokenId, list[TokenNftTransfer]] = field( | ||
| default_factory=lambda: defaultdict(list[TokenNftTransfer]) | ||
| ) | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| transfers: defaultdict[AccountId, int] = field( | ||
| default_factory=lambda: defaultdict(int) | ||
| ) | ||
| new_pending_airdrops: list[PendingAirdropRecord] = field(default_factory=list) | ||
|
|
||
| prng_number: Optional[int] = None | ||
| prng_bytes: Optional[bytes] = None | ||
| children: List[TransactionId] = None | ||
mukundkumarjha marked this conversation as resolved.
Show resolved
Hide resolved
mukundkumarjha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| duplicates: list['TransactionRecord'] = field(default_factory=list) | ||
|
|
||
| def __repr__(self) -> str: | ||
| """Returns a human-readable string representation of the TransactionRecord. | ||
| This method constructs a detailed string containing all significant fields of the | ||
|
|
||
| This method constructs a detailed string containing all significant fields of the | ||
| transaction record including transaction ID, hash, memo, fees, status, transfers, | ||
| and PRNG results. For the receipt status, it attempts to resolve the numeric status | ||
| to a human-readable ResponseCode name. | ||
|
|
||
| Returns: | ||
| str: A string representation showing all significant fields of the TransactionRecord. | ||
| """ | ||
|
|
@@ -95,6 +103,20 @@ def __repr__(self) -> str: | |
| status = ResponseCode(self.receipt.status).name | ||
| except (ValueError, AttributeError): | ||
| status = self.receipt.status | ||
| return ( | ||
| f"TransactionRecord(transaction_id='{self.transaction_id}', " | ||
| f"transaction_hash={self.transaction_hash}, " | ||
| f"transaction_memo='{self.transaction_memo}', " | ||
| f"transaction_fee={self.transaction_fee}, " | ||
| f"receipt_status='{status}', " | ||
| f"token_transfers={dict(self.token_transfers)}, " | ||
| f"nft_transfers={dict(self.nft_transfers)}, " | ||
| f"transfers={dict(self.transfers)}, " | ||
| f"new_pending_airdrops={list(self.new_pending_airdrops)}, " | ||
| f"call_result={self.call_result}, " | ||
| f"prng_number={self.prng_number}, " | ||
| f"prng_bytes={self.prng_bytes})" | ||
| ) | ||
| return (f"TransactionRecord(transaction_id='{self.transaction_id}', " | ||
| f"transaction_hash={self.transaction_hash}, " | ||
| f"transaction_memo='{self.transaction_memo}', " | ||
|
|
@@ -114,6 +136,8 @@ def _from_proto( | |
| cls, | ||
| proto: transaction_record_pb2.TransactionRecord, | ||
| transaction_id: Optional[TransactionId] = None, | ||
| children=None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add type hinting |
||
| ) -> "TransactionRecord": | ||
| duplicates: Optional[list['TransactionRecord']] = None, | ||
| ) -> 'TransactionRecord': | ||
| """Creates a TransactionRecord instance from a protobuf transaction record. | ||
|
|
@@ -132,6 +156,11 @@ def _from_proto( | |
| into appropriate defaultdict collections for efficient access. | ||
|
|
||
| Args: | ||
| proto (transaction_record_pb2.TransactionRecord): The raw protobuf | ||
| transaction record containing all transaction data. | ||
| transaction_id (Optional[TransactionId]): Optional transaction ID to | ||
| associate with the record. If not provided, will be extracted from | ||
| the protobuf message if available. | ||
| proto: The raw protobuf transaction record containing all transaction data. | ||
| transaction_id: The transaction ID to associate with this record (required). | ||
| duplicates: Optional list of duplicate transaction records to attach. | ||
|
|
@@ -140,6 +169,28 @@ def _from_proto( | |
| Returns: | ||
| TransactionRecord: A new instance containing all processed and structured data. | ||
| """ | ||
| token_transfers = defaultdict(lambda: defaultdict(int)) | ||
| for token_transfer_list in proto.tokenTransferLists: | ||
| token_id = TokenId._from_proto(token_transfer_list.token) | ||
| for transfer in token_transfer_list.transfers: | ||
| account_id = AccountId._from_proto(transfer.accountID) | ||
| token_transfers[token_id][account_id] = transfer.amount | ||
|
|
||
| nft_transfers = defaultdict(list[TokenNftTransfer]) | ||
| for token_transfer_list in proto.tokenTransferLists: | ||
| token_id = TokenId._from_proto(token_transfer_list.token) | ||
| nft_transfers[token_id] = TokenNftTransfer._from_proto(token_transfer_list) | ||
|
|
||
| transfers = defaultdict(int) | ||
| for transfer in proto.transferList.accountAmounts: | ||
| account_id = AccountId._from_proto(transfer.accountID) | ||
| transfers[account_id] += transfer.amount | ||
|
|
||
| new_pending_airdrops: list[PendingAirdropRecord] = [] | ||
| for pending_airdrop in proto.new_pending_airdrops: | ||
| new_pending_airdrops.append( | ||
| PendingAirdropRecord._from_proto(pending_airdrop) | ||
| ) | ||
| tx_id = cls._resolve_transaction_id(proto, transaction_id) | ||
| duplicates = duplicates or [] | ||
|
|
||
|
|
@@ -148,6 +199,7 @@ def _from_proto( | |
| new_pending_airdrops = cls._parse_pending_airdrops(proto) | ||
| call_result = cls._parse_contract_call_result(proto) | ||
|
|
||
| children: Optional[List["TransactionRecord"]] = None | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line can be romove
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical bug: Line 202 declares Remove this line so the - children: Optional[List["TransactionRecord"]] = None
return cls(
transaction_id=tx_id,
...
children=children, |
||
| return cls( | ||
| transaction_id=tx_id, | ||
| transaction_hash=proto.transactionHash, | ||
|
|
@@ -158,6 +210,12 @@ def _from_proto( | |
| nft_transfers=nft_transfers, | ||
| transfers=transfers, | ||
| new_pending_airdrops=new_pending_airdrops, | ||
| children=children, | ||
| call_result=( | ||
| ContractFunctionResult._from_proto(proto.contractCallResult) | ||
| if proto.HasField("contractCallResult") | ||
| else None | ||
| ), | ||
| call_result=call_result, | ||
| prng_number=proto.prng_number, | ||
| prng_bytes=proto.prng_bytes, | ||
|
|
@@ -291,7 +349,9 @@ def _to_proto(self) -> transaction_record_pb2.TransactionRecord: | |
| transfer.amount = amount | ||
|
|
||
| for pending_airdrop in self.new_pending_airdrops: | ||
| record_proto.new_pending_airdrops.add().CopyFrom(pending_airdrop._to_proto()) | ||
| record_proto.new_pending_airdrops.add().CopyFrom( | ||
| pending_airdrop._to_proto() | ||
| ) | ||
|
|
||
| return record_proto | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.