-
Notifications
You must be signed in to change notification settings - Fork 134
Labels
enhancementNew feature or requestNew feature or requestintermediaterequires some knowledge of the codebase with some defined steps to implement or examplesrequires some knowledge of the codebase with some defined steps to implement or examples
Description
Problem
Currently, the Python SDK implementation of TransactionGetReceiptQuery supports only the following fields:
self.transaction_id: Optional[TransactionId] = transaction_id
self.include_children:bool = False
self._frozen: bool = FalseHowever, it does not expose support for requesting duplicate transaction receipts, which are already supported at the protocol level (Protobuff) and in other SDKs (e.g., JavaScript).
Expected Behavior:
The query should allow user to optionally request receipts for duplicate transaction. Similar as implemented for child receipt in PR #1114.
Eg:
query = (
TransactionGetReceiptQuery()
.set_transaction_id(tx_id)
.set_include_duplicates(True) #True/False
)Solution
- Add support for an
include_duplicatesfield to TransactionGetReceiptQuery class. - Create a setter method
set_include_duplicates(bool). - Update TransactionReceipt class to include the
duplicatesfield. - Add a function to process the duplicates receipts form the TransactionGetReceiptQuery response
# Suggested to created a single method to process both children and duplicate receipt
# Example func that convert the child/duplicates receipts to TransactionReceipt list and then return
def _map_receipt_list(self, proto_receipts: List[transaction_receipt_pb2.TransactionReceipt]) -> List["TransactionReceipt"]:
receipts: List[TransactionReceipt] = []
for receipt in proto_receipts:
receipts.append(TransactionReceipt._from_proto(receipt, self.transaction_id))
return receipts- Update
_make_request()function of TransactionGetReceiptQuery to include_duplicates field while creating the proto - Create a example for demonstrating and using these new field
- Update/Add unit and integration test for the changes
Alternatives
- Additionally add
@propertyfor getting _duplicates from the TransactionReceipt
exploreriiicoderabbitai
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestintermediaterequires some knowledge of the codebase with some defined steps to implement or examplesrequires some knowledge of the codebase with some defined steps to implement or examples