py-algorand-sdk
py-algorand-sdk copied to clipboard
ABI decoding of list of tuples
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.0pyteal, v0.13.0 (pointing to current/feature/abibranch)
Steps to reproduce
- Define a PyTeal contract with:
output: abi.StaticArray[abi.Tuple2[abi.Address, abi.String], Literal[2]],
- Print returned Logs.
Expected behaviour
Python list of tuple.
[('JUYTZVK2PL42FJDBLDUSI377RCABBRVICQQKGF73PXG7C2WSVG7JXYZ7SQ', 'foo'), ('MTFEO2IFDY23HL6JBV437WTDOK2QGEFCOKNTQT353KMRJUGXL3GKQZ3FG4', 'spam')]
Actual behaviour
Python list of list.
[[JUYTZVK2PL42FJDBLDUSI377RCABBRVICQQKGF73PXG7C2WSVG7JXYZ7SQ', 'foo'], ['MTFEO2IFDY23HL6JBV437WTDOK2QGEFCOKNTQT353KMRJUGXL3GKQZ3FG4', 'spam']]
Would also be useful to decode ABI bytes types (ByteType, ArrayDynamicType, ArrayStaticType) to Python bytes instead of int / list[int].