Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add title to endpoint definition #108

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

@andreibancioiu andreibancioiu Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If title is optional (no breaking change), can increment the last segment (since it's < v1).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will leave it like this as it is not a bug fix

authors = [
{ name="MultiversX" },
]
Expand Down
Loading