You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method only allows values to be a compile-time sequence of values, or to be another dynamic array. As a consequence of this, it's not currently possible to create an array of arbitrary length at runtime in PyTeal.
Possible Solutions
There are two possible solutions that could address this problem.
If implemented in conjunction with Add ability to set individual elements in ABI containers #602, add the ability to create an arbitrary-sized dynamic array at runtime, perhaps with a default value to fill the array with. This would be similar in spirit to languages like Go or C, where you can dynamically allocate an array of a certain size and then set its elements individually.
The text was updated successfully, but these errors were encountered:
Problem
Contract methods which return dynamic arrays likely do not know the size of the array they need to return at compile time.
Unfortunately, the only way to initialize/modify an
abi.DynamicArray
value is with theset
method:pyteal/pyteal/ast/abi/array_dynamic.py
Lines 55 to 58 in a3b5b29
This method only allows
values
to be a compile-time sequence of values, or to be another dynamic array. As a consequence of this, it's not currently possible to create an array of arbitrary length at runtime in PyTeal.Possible Solutions
There are two possible solutions that could address this problem.
abi.DynamicArray
#604 is the start of a PR to do this.The text was updated successfully, but these errors were encountered: