Batch token approvals with Swaps transactions
On EVM chains, you will need to grant token approvals to submit transactions. Thespender
in the approval should be the to
address in the transaction object returned by the /getAction
endpoint.
Recent EIPs enable applications to batch the approval and Swaps transactions. This means EVM ERC20 transactions are still only a single transaction for your users.
We recommend the wallet_sendCalls
method enabled by EIP 5792.
The example below generates a cross-chain swap for 10 USDC on Base to USDT on Arbitrum. It demonstrates how to call the /getAction
endpoint and batch the returned transaction with an approval for 10 USDC on Base so that both the approval and swap can be submitted in a single transaction. Refer to the [EVM Broadcast Guide]