From 74687eed0487f9c457a2b7f6178549dd50fe2e00 Mon Sep 17 00:00:00 2001 From: danielailie Date: Tue, 15 Oct 2024 10:49:21 +0300 Subject: [PATCH 1/4] Add title to endpoint definition --- multiversx_sdk/abi/abi_definition.py | 10 +++++++--- multiversx_sdk/abi/abi_test.py | 2 ++ multiversx_sdk/testutils/testdata/adder.abi.json | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/multiversx_sdk/abi/abi_definition.py b/multiversx_sdk/abi/abi_definition.py index 83d05950..db512502 100644 --- a/multiversx_sdk/abi/abi_definition.py +++ b/multiversx_sdk/abi/abi_definition.py @@ -86,7 +86,8 @@ 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 @@ -94,6 +95,7 @@ def __init__(self, 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": @@ -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): @@ -123,7 +126,8 @@ def __init__(self) -> None: inputs=[], outputs=[], payable_in_tokens=[], - only_owner=False + only_owner=False, + title="" ) def __repr__(self): diff --git a/multiversx_sdk/abi/abi_test.py b/multiversx_sdk/abi/abi_test.py index 93ac0962..0121726f 100644 --- a/multiversx_sdk/abi/abi_test.py +++ b/multiversx_sdk/abi/abi_test.py @@ -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 == [] diff --git a/multiversx_sdk/testutils/testdata/adder.abi.json b/multiversx_sdk/testutils/testdata/adder.abi.json index 4772ced4..8ccb8ed0 100644 --- a/multiversx_sdk/testutils/testdata/adder.abi.json +++ b/multiversx_sdk/testutils/testdata/adder.abi.json @@ -21,6 +21,7 @@ "endpoints": [ { "name": "getSum", + "title": "Get Sum", "mutability": "readonly", "inputs": [], "outputs": [ From 6e8bd59953c8393fdd4b086e81450382bba76768 Mon Sep 17 00:00:00 2001 From: danielailie Date: Tue, 15 Oct 2024 11:07:30 +0300 Subject: [PATCH 2/4] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a0a1e39d..d66bad14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ allow-direct-references = true [project] name = "multiversx-sdk" -version = "0.13.2" +version = "0.14.0" authors = [ { name="MultiversX" }, ] From 58156a2851aafb625d15f6392bfa8542aba1f4db Mon Sep 17 00:00:00 2001 From: danielailie Date: Tue, 15 Oct 2024 11:10:15 +0300 Subject: [PATCH 3/4] Add optional type to title --- multiversx_sdk/abi/abi_definition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multiversx_sdk/abi/abi_definition.py b/multiversx_sdk/abi/abi_definition.py index db512502..8dee5349 100644 --- a/multiversx_sdk/abi/abi_definition.py +++ b/multiversx_sdk/abi/abi_definition.py @@ -1,6 +1,6 @@ import json from pathlib import Path -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional class AbiDefinition: @@ -87,7 +87,7 @@ def __init__(self, outputs: List["ParameterDefinition"], payable_in_tokens: List[str], only_owner: bool, - title: str) -> None: + title: Optional[str]) -> None: self.name = name self.docs = docs self.mutability = mutability From 85e75628334ac3a84d714061aa1546dd0fbd9735 Mon Sep 17 00:00:00 2001 From: danielailie Date: Tue, 15 Oct 2024 11:21:26 +0300 Subject: [PATCH 4/4] Add default value to title --- multiversx_sdk/abi/abi_definition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multiversx_sdk/abi/abi_definition.py b/multiversx_sdk/abi/abi_definition.py index 8dee5349..0aaf5b3c 100644 --- a/multiversx_sdk/abi/abi_definition.py +++ b/multiversx_sdk/abi/abi_definition.py @@ -1,6 +1,6 @@ import json from pathlib import Path -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List class AbiDefinition: @@ -87,7 +87,7 @@ def __init__(self, outputs: List["ParameterDefinition"], payable_in_tokens: List[str], only_owner: bool, - title: Optional[str]) -> None: + title: str = "") -> None: self.name = name self.docs = docs self.mutability = mutability