Hi Im currently developing a smart contract and I wanted to transfer an asa to its escrow account. My initial idea was to let the smart contract opt in to that asset in the application call while the address transfer that asset to the escrow account. All this in a transaction group so something like this:
txns = [AssetTransferTxn(address,params,get_application_address(app_id),1,asa_id), ApplicationNoOpTxn(address, params, app_id, foreign_assets=[asa_id], app_args=[bytes(5),bytes("sell","utf-8")])]
This gets rejected, is it an impossible thing and I have to do two different calls to the application, the first to optin and the second to transfer?
There should be no issue doing it in a transaction group.
However, you need to have the escrow to opt in before you transfer.
That is, you need to switch the two transactions in txns
.
Oh ok yes that makes totally sense, thank you fabrice