|
1 | 1 | import json |
2 | 2 | import logging |
3 | | -from typing import Any, Optional, Protocol, TextIO, Union |
| 3 | +from typing import Optional, Protocol, TextIO, Union |
4 | 4 |
|
5 | 5 | from multiversx_sdk import ( |
6 | 6 | Address, |
7 | 7 | AwaitingOptions, |
8 | | - SmartContractResult, |
9 | 8 | TokenTransfer, |
10 | 9 | Transaction, |
11 | | - TransactionEvent, |
12 | | - TransactionLogs, |
13 | 10 | TransactionOnNetwork, |
14 | 11 | TransactionsFactoryConfig, |
15 | 12 | TransferTransactionsFactory, |
@@ -116,56 +113,3 @@ def load_transaction_from_file(f: TextIO) -> Transaction: |
116 | 113 | data_json: bytes = f.read().encode() |
117 | 114 | transaction_dictionary = json.loads(data_json).get("tx") or json.loads(data_json).get("emittedTransaction") |
118 | 115 | return Transaction.new_from_dictionary(transaction_dictionary) |
119 | | - |
120 | | - |
121 | | -def transaction_event_to_dictionary(event: TransactionEvent) -> dict[str, Any]: |
122 | | - return { |
123 | | - "address": event.address.to_bech32(), |
124 | | - "identifier": event.identifier, |
125 | | - "topics": [topic.hex() for topic in event.topics], |
126 | | - "data": event.data.decode(), |
127 | | - "additional_data": [data.hex() for data in event.additional_data], |
128 | | - } |
129 | | - |
130 | | - |
131 | | -def transaction_logs_to_dictionary(logs: TransactionLogs) -> dict[str, Any]: |
132 | | - return { |
133 | | - "address": logs.address.to_bech32(), |
134 | | - "events": [transaction_event_to_dictionary(event) for event in logs.events], |
135 | | - } |
136 | | - |
137 | | - |
138 | | -def smart_contract_result_to_dictionary(result: SmartContractResult) -> dict[str, Any]: |
139 | | - return { |
140 | | - "sender": result.sender.to_bech32(), |
141 | | - "receiver": result.receiver.to_bech32(), |
142 | | - "data": result.data.decode(), |
143 | | - "logs": transaction_logs_to_dictionary(result.logs), |
144 | | - } |
145 | | - |
146 | | - |
147 | | -def transaction_on_network_to_dictionary(tx: TransactionOnNetwork) -> dict[str, Any]: |
148 | | - return { |
149 | | - "sender": tx.sender.to_bech32(), |
150 | | - "receiver": tx.receiver.to_bech32(), |
151 | | - "hash": tx.hash.hex(), |
152 | | - "nonce": tx.nonce, |
153 | | - "round": tx.round, |
154 | | - "epoch": tx.epoch, |
155 | | - "timestamp": tx.timestamp, |
156 | | - "blockHash": tx.block_hash.hex(), |
157 | | - "miniBlockHash": tx.miniblock_hash.hex(), |
158 | | - "senderShard": tx.sender_shard, |
159 | | - "receiverShard": tx.receiver_shard, |
160 | | - "value": tx.value, |
161 | | - "gasLimit": tx.gas_limit, |
162 | | - "gasPrice": tx.gas_price, |
163 | | - "function": tx.function, |
164 | | - "data": tx.data.decode(), |
165 | | - "version": tx.version, |
166 | | - "options": tx.options, |
167 | | - "signature": tx.signature.hex(), |
168 | | - "status": tx.status.status, |
169 | | - "smartContractResults": [smart_contract_result_to_dictionary(res) for res in tx.smart_contract_results], |
170 | | - "logs": transaction_logs_to_dictionary(tx.logs), |
171 | | - } |
0 commit comments