From 231967a910cdd6d504a31aaf07f5aac38eef9ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Fri, 11 Oct 2024 11:35:32 +0300 Subject: [PATCH] Handle "null" values on event fields (they happen sometimes). --- multiversx_sdk/abi/abi.py | 2 ++ multiversx_sdk/network_providers/transaction_events.py | 4 ++-- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/multiversx_sdk/abi/abi.py b/multiversx_sdk/abi/abi.py index f0baffde..f9ef7ef3 100644 --- a/multiversx_sdk/abi/abi.py +++ b/multiversx_sdk/abi/abi.py @@ -265,6 +265,8 @@ def _create_prototype(self, type_formula: TypeFormula) -> Any: return I16Value() if name == "i32": return I32Value() + if name == "i64": + return I64Value() if name == "BigUint": return BigUIntValue() if name == "BigInt": diff --git a/multiversx_sdk/network_providers/transaction_events.py b/multiversx_sdk/network_providers/transaction_events.py index 2ba0e895..cd3d833d 100644 --- a/multiversx_sdk/network_providers/transaction_events.py +++ b/multiversx_sdk/network_providers/transaction_events.py @@ -23,14 +23,14 @@ def from_http_response(response: Dict[str, Any]) -> 'TransactionEvent': result.address = Address.new_from_bech32(address) if address else EmptyAddress() result.identifier = response.get('identifier', '') - topics = response.get('topics', []) + topics = response.get('topics') or [] result.topics = [TransactionEventTopic(item) for item in topics] raw_data = base64.b64decode(response.get('responseData', b'')) result.data_payload = TransactionEventData(raw_data) result.data = raw_data.decode() - additional_data: Any = response.get("additionalData", []) + additional_data: Any = response.get("additionalData") or [] if additional_data is None: additional_data = [] result.additional_data = [TransactionEventData(base64.b64decode(data)) for data in additional_data] diff --git a/pyproject.toml b/pyproject.toml index ded7fa83..a0a1e39d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ allow-direct-references = true [project] name = "multiversx-sdk" -version = "0.13.1" +version = "0.13.2" authors = [ { name="MultiversX" }, ]