Skip to main content
POST
/
v2
/
swap
/
bytecode
Generate transaction bytecode
curl --request POST \
  --url https://api.deframe.io/v2/swap/bytecode \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "quoteId": "550e8400-e29b-41d4-a716-446655440000",
  "originAddress": "0xb794F5eA0ba39494cE839613fffBA74279579268",
  "destinationAddress": "0xb794F5eA0ba39494cE839613fffBA74279579268",
  "rawQuote": "<unknown>",
  "output": "bytecode",
  "accountId": 12
}
'
{
  "id": "65f1a2b3c4d5e6f789012345",
  "chainId": 1,
  "transactionData": [
    {
      "chainId": 1,
      "to": "0xb794F5eA0ba39494cE839613fffBA74279579268",
      "data": "0x...",
      "value": "0",
      "from": "0xb794F5eA0ba39494cE839613fffBA74279579268"
    }
  ],
  "userOperation": "<unknown>"
}

Authorizations

x-api-key
string
header
required

API key for authentication. Obtain from your Deframe dashboard.

Body

application/json
quoteId
string
required

Quote ID from /v2/swap/quote

Example:

"550e8400-e29b-41d4-a716-446655440000"

originAddress
string
required

Address executing the swap on origin chain

Example:

"0xb794F5eA0ba39494cE839613fffBA74279579268"

destinationAddress
string
required

Address receiving tokens on destination chain

Example:

"0xb794F5eA0ba39494cE839613fffBA74279579268"

rawQuote
any | null

Provider-specific raw quote data from the quote response. Pass this when the quote includes it.

output
enum<string>
default:bytecode

Response format. userOperation returns an EIP-4337 user operation. fireblocks returns a Fireblocks contract call payload (requires accountId).

Available options:
bytecode,
userOperation,
fireblocks
accountId
number

Fireblocks vault account ID. Required when output=fireblocks.

Example:

12

Response

Bytecode generated successfully

id
string
required

ID created for execution tracking

Example:

"65f1a2b3c4d5e6f789012345"

chainId
number
required
Example:

1

transactionData
object
required

Transaction data for execution

userOperation
any | null

ERC-4337 user operation. Only present when output=userOperation.