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

ABI decoding of list of tuples #355

Open
cusma opened this issue Jun 28, 2022 · 1 comment
Open

ABI decoding of list of tuples #355

cusma opened this issue Jun 28, 2022 · 1 comment
Labels
bug Something isn't working external contribution good first issue Good for newcomers Team Lamprey

Comments

@cusma
Copy link

cusma commented Jun 28, 2022

Subject of the issue

Defined output type with PyTeal ABI to return a list of tuple, like:

output: abi.StaticArray[abi.Tuple2[abi.Address, abi.String], Literal[2]],

The decoded output returns a list of list instead.

Your environment

  • algod, 3.7.2.stable [rel/stable] (commit #e2f78420)
  • py-algorand-sdk, v1.15.0
  • pyteal, v0.13.0 (pointing to current /feature/abi branch)

Steps to reproduce

  1. Define a PyTeal contract with:
output: abi.StaticArray[abi.Tuple2[abi.Address, abi.String], Literal[2]],
  1. Print returned Logs.

Expected behaviour

Python list of tuple.

[('JUYTZVK2PL42FJDBLDUSI377RCABBRVICQQKGF73PXG7C2WSVG7JXYZ7SQ', 'foo'), ('MTFEO2IFDY23HL6JBV437WTDOK2QGEFCOKNTQT353KMRJUGXL3GKQZ3FG4', 'spam')]

Actual behaviour

Python list of list.

[[JUYTZVK2PL42FJDBLDUSI377RCABBRVICQQKGF73PXG7C2WSVG7JXYZ7SQ', 'foo'], ['MTFEO2IFDY23HL6JBV437WTDOK2QGEFCOKNTQT353KMRJUGXL3GKQZ3FG4', 'spam']]
@cusma cusma added the new-bug Bug report that needs triage label Jun 28, 2022
@algoanne algoanne added bug Something isn't working and removed new-bug Bug report that needs triage labels Apr 18, 2023
@algoanne algoanne added the good first issue Good for newcomers label May 22, 2023
@cusma
Copy link
Author

cusma commented Oct 23, 2023

Would also be useful to decode ABI bytes types (ByteType, ArrayDynamicType, ArrayStaticType) to Python bytes instead of int / list[int].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external contribution good first issue Good for newcomers Team Lamprey
Projects
None yet
Development

No branches or pull requests

3 participants