Escrow transaction - Algorand

Escrow transaction

post by nikitagugale on Nov 12, 2021

Hi in my usecase I am trying a group transaction where a flag is trigered on that basis escrow account transfers algo to an account.

Below is my contract code:


def closeAccountTo() -> Expr:

return   Seq(

InnerTxnBuilder.Begin(),

InnerTxnBuilder.SetFields(

{

TxnField.type_enum: TxnType.Payment,

TxnField.amount:App.globalGet(Amount),

TxnField.sender: Global.current_application_address(),

TxnField.receiver: App.globalGet(Seller_Address),

}

),

InnerTxnBuilder.Submit(),

)

Below is my SDK:


transaction.assign_group_id([orderApproveTxn, orderCloseTxn])

signedorderApproveTxn = orderApproveTxn.sign(purchaser_private_key)

signedorderCloseTxn = orderCloseTxn.sign(purchaser_private_key)

client.send_transactions([signedorderApproveTxn,signedorderCloseTxn])

waitForTransaction(client,signedorderCloseTxn.get_txid())

print('signedorderClose: ',signedorderCloseTxn.get_txid())

print('signedorderApprove: ',signedorderApproveTxn.get_txid())

Tis is the error I am facing:


algosdk.error.AlgodHTTPError: TransactionPool.Remember: transaction SZYRFRJU6MTY63XR4EM2AZK6NY7SP6LVUFGTHKSRHFP6KPA4PVWA: logic eval error: invalid Account reference BOBIRTQR7OYWURWNDHYC3AFYAC37IWZVHJ3IHC572JZIM6V6YK45TZ7GZI

Can anyone help me with this?

Thanks

post by fabrice on Nov 12, 2021

All accounts used in inner transactions must be part of the foreign accounts array.

See Smart contract details - Algorand Developer Portal

In the Python SDK, argument accounts: future.transaction — algosdk documentation