Skip to content

Commit

Permalink
Handle "null" values on event fields (they happen sometimes).
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Oct 11, 2024
1 parent 4b77938 commit 231967a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions multiversx_sdk/abi/abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 2 additions & 2 deletions multiversx_sdk/network_providers/transaction_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ allow-direct-references = true

[project]
name = "multiversx-sdk"
version = "0.13.1"
version = "0.13.2"
authors = [
{ name="MultiversX" },
]
Expand Down

0 comments on commit 231967a

Please sign in to comment.