Prerequisites: Complete the Get a Quote guide first to obtain a valid quote.
Overview
After obtaining a quote, you can execute the swap by generating the necessary transaction data (bytecode) and submitting it to the blockchain. The Deframe API handles the complexity of preparing the transaction data for different providers and swap types.Executing a Swap
Endpoint
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
quoteId | string | ✅ | The quote ID returned by GET /v2/swap/quote |
originAddress | string | ✅ | The wallet address that will sign and send the transaction |
destinationAddress | string | ✅ | The destination wallet address to receive the swapped tokens. For cross-chain swaps, this address is used as the receiverAddress on the destination chain. |
rawQuote | string | ⬡ | Provider-specific quote data from the quote response. Only present for certain bridge providers — pass it when the quote response includes it. |
Example Request
Response Format
The API returns transaction data ready to be signed and executed:Response Fields
chainId
chainId
The chain ID where these transactions should be executed
transactionData
transactionData
Array of transactions to execute in order. May include:
- Approval transaction: Grants permission to the swap contract
- Swap transaction: Executes the actual token swap
- Tracking transaction: Records the swap in Deframe’s system
to
to
The contract address to send the transaction to
data
data
Encoded transaction data (bytecode) for the contract call
value
value
Amount of native token to send (in wei). Usually “0” unless swapping native tokens.
Transaction Execution
You’ll need to sign and submit the transaction data to the blockchain. This happens on your end - we don’t touch your funds, custody remains yours.Using ethers.js
Using wagmi/viem
Swap Types
The endpoint automatically handles different swap types:- Same-Chain
- Cross-Chain
Same-chain swaps (e.g., USDT to USDC on Ethereum):
- Usually 2-3 transactions: approve + swap (+ tracking)
- Executes immediately on the same blockchain
- Lower fees, faster execution
Error Handling
The API returns appropriate error messages for:- Missing required parameters
- Invalid or expired quote
- Quote not found or already used
- Provider-specific errors during transaction preparation
Complete Workflow
Next Steps
Get Another Quote
Start a new swap
Check Status
Track cross-chain swap progress
Code Examples
View complete implementation examples