Home

Batched Transactions

Openforts' smart contract accounts are able to execute multiple transactions in a batch. With batched transactions, you can save time and reduce gas costs by submitting multiple operations at once.

To execute a batch transaction, you can send a transaction intent with multiple interactions. Each interaction will be executed in the order they are received. If any of the interactions fail, the entire batch will fail and no changes will be made.

Fore security reasons, there is a limit of 9 interactions per transaction intent.

command-line

_11
curl https://api.openfort.xyz/v1/transaction_intents \
_11
-H "Authorization: Bearer $YOUR_SECRET_KEY" \
_11
-d player="pla_..." \
_11
-d chainId=80002 \
_11
-d optimistic=true \
_11
-d "interactions[0][contract]=con_..." \
_11
-d "interactions[0][functionName]=mint" \
_11
-d "interactions[0][functionArgs][0]=0x63B7...484f" \
_11
-d "interactions[1][contract]=con_..." \
_11
-d "interactions[1][functionName]=transfer" \
_11
-d "interactions[1][functionArgs][0]=0x32B7...213d"

note

Batch transactions are also safer, thanks to a property known as "atomicity".

This means that either all transactions within the batch will execute or none of them will, ensuring that your operations are executed seamlessly without any room for errors.