Question about inner transactions fields set

Hi everyone, I have some questions about building inner transactions in a smart contract and any help is appreciated.

  1. If I want to build an inner transaction in the contract and use it to transfer asset to another account, do I have to name the xfer_asset in the InnerTxnBuilder.SetFields if that’s only one type of asset in the contract account and it’s already opted in?
  2. If I want to build an inner transaction in the contract and use it to transfer asset to another account, do I have to name the recipient as Txn.account[i] if I could use other expression to get the address from other app?
  1. Yes, you need
  2. The recipient needs to be a 32-byte “raw” address (without checksum and without the base32 encoding) and needs to be inside the array Txn.account. But the expression itself does not need to be Txn.account[i], it can be any expression that would be equal to one of the Txn.account[i] at execution.
1 Like

Thank you for the quick reply, Fabrice. That helps a lot!