Skip to content

Commit

Permalink
Merge pull request #108 from multiversx/TOOL-273-add-title-to-abi-end…
Browse files Browse the repository at this point in the history
…points

Add title to endpoint definition
  • Loading branch information
danielailie authored Oct 15, 2024
2 parents 205adfb + 85e7562 commit ad12822
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions multiversx_sdk/abi/abi_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ def __init__(self,
inputs: List["ParameterDefinition"],
outputs: List["ParameterDefinition"],
payable_in_tokens: List[str],
only_owner: bool) -> None:
only_owner: bool,
title: str = "") -> None:
self.name = name
self.docs = docs
self.mutability = mutability
self.inputs = inputs
self.outputs = outputs
self.payable_in_tokens = payable_in_tokens
self.only_owner = only_owner
self.title = title

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "EndpointDefinition":
Expand All @@ -107,7 +109,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "EndpointDefinition":
inputs=inputs,
outputs=outputs,
payable_in_tokens=data.get("payableInTokens", []),
only_owner=data.get("onlyOwner", False)
only_owner=data.get("onlyOwner", False),
title=data.get("title", "")
)

def __repr__(self):
Expand All @@ -123,7 +126,8 @@ def __init__(self) -> None:
inputs=[],
outputs=[],
payable_in_tokens=[],
only_owner=False
only_owner=False,
title=""
)

def __repr__(self):
Expand Down
2 changes: 2 additions & 0 deletions multiversx_sdk/abi/abi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def test_abi():

assert abi.definition.endpoints[0].name == "getSum"
assert abi.definition.endpoints[0].inputs == []
assert abi.definition.endpoints[0].title == "Get Sum"
assert abi.definition.endpoints[0].outputs == [ParameterDefinition("", "BigUint")]

assert abi.definition.endpoints[1].name == "add"
assert abi.definition.endpoints[1].title == ""
assert abi.definition.endpoints[1].inputs == [ParameterDefinition("value", "BigUint")]
assert abi.definition.endpoints[1].outputs == []

Expand Down
1 change: 1 addition & 0 deletions multiversx_sdk/testutils/testdata/adder.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"endpoints": [
{
"name": "getSum",
"title": "Get Sum",
"mutability": "readonly",
"inputs": [],
"outputs": [
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.2"
version = "0.14.0"
authors = [
{ name="MultiversX" },
]
Expand Down

0 comments on commit ad12822

Please sign in to comment.