After getting a quote and handling any required approvals, you need to execute the actual transfer transaction. This page covers chain verification, gas handling, signing, and broadcasting.
The Transaction Request
The quote response includes a ready-to-use transactionRequest object:
async function executeWithRetry(quote, walletClient, publicClient, maxRetries = 2) { for (let attempt = 0; attempt < maxRetries; attempt++) { try { return await executeQuote(quote, walletClient, publicClient); } catch (error) { const message = error.message.toLowerCase(); // Don't retry these errors if (message.includes('insufficient funds') || message.includes('user rejected') || message.includes('denied')) { throw error; } // Quote might be stale - get new quote and retry if (message.includes('reverted') && attempt < maxRetries - 1) { console.log('Transaction reverted, fetching new quote...'); quote = await getQuote(originalParams); continue; } throw error; } }}
Gas Optimization Tips
Use EIP-1559 where supported - More predictable gas costs
Don’t over-estimate gas - Quote’s gasLimit is usually accurate
Check gas prices - High gas times may make transfers expensive
Consider L2s - Arbitrum, Optimism, Base have much lower gas costs
// Check if gas cost is reasonableconst gasCostWei = BigInt(txRequest.gasLimit) * BigInt(txRequest.gasPrice);const gasCostEth = Number(gasCostWei) / 1e18;if (gasCostEth > 0.01) { // More than 0.01 ETH console.log(`Warning: High gas cost: ${gasCostEth} ETH`);}