Hello! In pyteal, is it possibile to pass all foreign accounts to an inner tx call?
Executing:
TxnField.accounts: Gtxn[1].accounts
complains with the following
pyteal.TealInputError: inner transaction set array field TxnField.accounts with non-array value
Ben
June 6, 2022, 2:11pm
2
You can pass it as a python list like TxnField.accounts: [Gtxn[1].accounts[0], Gtxn[1].accounts[1],...]
And if you call it multiple times it’ll append to the list
Ben
What if the outer app call can have a different number of foreign accounts?
That static implementation you proposed would not work unfortunately.
Ben
June 6, 2022, 4:09pm
4
Sure, you can iterate over the length of the outer array and sequential calls to InnerTxnBuilder.SetField(TxnField.accounts, Gtxn[1].accounts[scratchVar.load()])
should append the acct to the list
Ben