Skip to content

Commit

Permalink
Merge pull request #90 from multiversx/abi-token-identifier-alias
Browse files Browse the repository at this point in the history
Add alias for EgldOrEsdtTokenIdentifier = TokenIdentifier
  • Loading branch information
andreibancioiu authored Aug 19, 2024
2 parents d482158 + 344d0e6 commit 0fb0a2b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion multiversx_sdk/abi/abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _create_custom_type_prototype(self, name: str) -> Any:
definition = self.definition.types.structs[name]
return self._create_struct_prototype(definition)

raise ValueError(f"cannot create prototype for custom type {name} not found")
raise ValueError(f"cannot create prototype for custom type {name}: definition not found")

def _create_enum_prototype(self, enum_definition: EnumDefinition) -> Any:
return EnumValue(fields_provider=lambda discriminant: self._provide_fields_for_enum_prototype(discriminant, enum_definition))
Expand Down Expand Up @@ -277,6 +277,8 @@ def _create_prototype(self, type_formula: TypeFormula) -> Any:
return AddressValue()
if name == "TokenIdentifier":
return TokenIdentifierValue()
if name == "EgldOrEsdtTokenIdentifier":
return TokenIdentifierValue()
if name == "CodeMetadata":
return BytesValue()
if name == "tuple":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from multiversx_sdk.abi.abi_definition import AbiDefinition
from multiversx_sdk.converters import TransactionsConverter
from multiversx_sdk.core.address import Address
from multiversx_sdk.core.codec import encode_unsigned_number
from multiversx_sdk.core.transactions_outcome_parsers.resources import (
SmartContractCallOutcome, SmartContractResult, TransactionEvent,
TransactionLogs, TransactionOutcome, find_events_by_first_topic,
Expand Down Expand Up @@ -156,14 +157,14 @@ def test_parse_event_with_multi_values():
identifier="foobar",
topics=[
"doFoobar".encode(),
value.to_bytes(),
encode_unsigned_number(value),
"test".encode(),
(value + 1).to_bytes(),
encode_unsigned_number(value + 1),
"test".encode(),
"test".encode(),
(value + 2).to_bytes()
encode_unsigned_number(value + 2),
],
data_items=[value.to_bytes()]
data_items=[encode_unsigned_number(value)]
)
)

Expand Down
11 changes: 11 additions & 0 deletions multiversx_sdk/testutils/testdata/artificial.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
}
],
"outputs": []
},
{
"name": "orange",
"mutability": "mutable",
"inputs": [
{
"name": "value",
"type": "EgldOrEsdtTokenIdentifier"
}
],
"outputs": []
}
],
"types": {},
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.11.0"
version = "0.11.1"
authors = [
{ name="MultiversX" },
]
Expand Down

0 comments on commit 0fb0a2b

Please sign in to comment.