Skip to content

Commit

Permalink
Merge branch 'release/v1.15.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
algojack committed Jun 16, 2022
2 parents 760d892 + 2718bd0 commit 671aeb6
Show file tree
Hide file tree
Showing 10 changed files with 1,676 additions and 1,581 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

# v1.15.0

## What's Changed
* Break v2_step.py into account_, application_, and other_ by @tzaffi in https://github.com/algorand/py-algorand-sdk/pull/341
* Add method to ABIResult by @barnjamin in https://github.com/algorand/py-algorand-sdk/pull/342
* Add method to get Method by name by @barnjamin in https://github.com/algorand/py-algorand-sdk/pull/345

**Full Changelog**: https://github.com/algorand/py-algorand-sdk/compare/v1.14.0...v1.15.0


# v1.14.0

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UNITS = "@unit.abijson or @unit.algod or @unit.algod.ledger_refactoring or @unit.applications or @unit.atomic_transaction_composer or @unit.dryrun or @unit.dryrun.trace.application or @unit.feetest or @unit.indexer or @unit.indexer.ledger_refactoring or @unit.indexer.logs or @unit.offline or @unit.rekey or @unit.transactions.keyreg or @unit.responses or @unit.responses.231 or @unit.tealsign or @unit.transactions or @unit.transactions.payment or @unit.responses.unlimited_assets"
UNITS = "@unit.abijson or @unit.abijson.byname or @unit.algod or @unit.algod.ledger_refactoring or @unit.applications or @unit.atomic_transaction_composer or @unit.dryrun or @unit.dryrun.trace.application or @unit.feetest or @unit.indexer or @unit.indexer.ledger_refactoring or @unit.indexer.logs or @unit.offline or @unit.rekey or @unit.transactions.keyreg or @unit.responses or @unit.responses.231 or @unit.tealsign or @unit.transactions or @unit.transactions.payment or @unit.responses.unlimited_assets"
unit:
behave --tags=$(UNITS) test -f progress2

Expand Down
5 changes: 4 additions & 1 deletion algosdk/abi/contract.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import Dict, List, Union

from algosdk.abi.method import Method
from algosdk.abi.method import Method, get_method_by_name


class Contract:
Expand Down Expand Up @@ -63,6 +63,9 @@ def undictify(d: dict) -> "Contract":
name=name, desc=desc, networks=networks, methods=method_list
)

def get_method_by_name(self, name: str) -> Method:
return get_method_by_name(self.methods, name)


class NetworkInfo:
"""
Expand Down
5 changes: 4 additions & 1 deletion algosdk/abi/interface.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import List, Union

from algosdk.abi.method import Method
from algosdk.abi.method import Method, get_method_by_name


class Interface:
Expand Down Expand Up @@ -49,3 +49,6 @@ def undictify(d: dict) -> "Interface":
method_list = [Method.undictify(method) for method in d["methods"]]
desc = d["desc"] if "desc" in d else None
return Interface(name=name, desc=desc, methods=method_list)

def get_method_by_name(self, name: str) -> Method:
return get_method_by_name(self.methods, name)
19 changes: 19 additions & 0 deletions algosdk/abi/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ def undictify(d: dict) -> "Method":
return Method(name=name, args=arg_list, returns=return_obj, desc=desc)


def get_method_by_name(methods: List[Method], name: str) -> Method:
methods_filtered = [method for method in methods if method.name == name]

if len(methods_filtered) > 1:
raise KeyError(
"found {} methods with the same name {}".format(
len(methods_filtered),
",".join(
[method.get_signature() for method in methods_filtered]
),
)
)

if len(methods_filtered) == 0:
raise KeyError("found 0 methods for {}".format(name))

return methods_filtered[0]


class Argument:
"""
Represents an argument for a ABI method
Expand Down
4 changes: 4 additions & 0 deletions algosdk/atomic_transaction_composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ def execute(
return_value=return_value,
decode_error=decode_error,
tx_info=tx_info,
method=self.method_dict[i],
)
)
continue
Expand Down Expand Up @@ -545,6 +546,7 @@ def execute(
return_value=return_value,
decode_error=decode_error,
tx_info=tx_info,
method=self.method_dict[i],
)
method_results.append(abi_result)

Expand Down Expand Up @@ -692,12 +694,14 @@ def __init__(
return_value: Any,
decode_error: Optional[Exception],
tx_info: dict,
method: abi.Method,
) -> None:
self.tx_id = tx_id
self.raw_value = raw_value
self.return_value = return_value
self.decode_error = decode_error
self.tx_info = tx_info
self.method = method


class AtomicTransactionResponse:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
description="Algorand SDK in Python",
author="Algorand",
author_email="[email protected]",
version="v1.14.0",
version="v1.15.0",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
Expand Down
Loading

0 comments on commit 671aeb6

Please sign in to comment.