Skip to main content
POST
/
buildTx
Build a transaction for swap or bridge
curl --request POST \
  --url https://api.dzap.io/v1/buildTx \
  --header 'Content-Type: application/json' \
  --data '
{
  "fromChain": 42161,
  "sender": "0x99BCEBf44433E901597D9fCb16E799a4847519f6",
  "refundee": "0x99BCEBf44433E901597D9fCb16E799a4847519f6",
  "gasless": false,
  "hasPermit2ApprovalForAllTokens": false,
  "data": [
    {
      "amount": "332999",
      "srcToken": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
      "destToken": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
      "slippage": 0.9,
      "toChain": 137,
      "protocol": "relayLink",
      "recipient": "0x99BCEBf44433E901597D9fCb16E799a4847519f6",
      "additionalInfo": {},
      "permitData": "<string>"
    }
  ]
}
'
{
  "status": "success",
  "txId": "0x3078393942432d3735313966362d313737333033363131363530350000000000",
  "chainId": 42161,
  "transaction": {
    "data": "0x....",
    "to": "0xF708e11A7C94abdE8f6217B13e6fE39C8b9cC0a6",
    "from": "0x99BCEBf44433E901597D9fCb16E799a4847519f6",
    "value": "0",
    "gasLimit": "591538"
  },
  "gasless": false,
  "quotes": {
    "42161_0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9-1_0xdAC17F958D2ee523a2206206994597C13D831ec7": {
      "additionalInfo": {
        "requestId": "0xf92bad334960ea4aee169f077027fa52edc4374de82ed07248887a9d0a11629e",
        "bridgeProvider": "relayLink",
        "srcSwapProvider": "sushiswap"
      },
      "provider": "dZap",
      "destAmount": "169925",
      "minDestAmount": "168226"
    }
  }
}

Body

application/json
fromChain
integer
required

Source chain ID where the transaction will be executed

Example:

42161

sender
string<address>
required

User's wallet address that will send the transaction

Example:

"0x99BCEBf44433E901597D9fCb16E799a4847519f6"

refundee
string<address>
required

Address to receive refunds in case of failed transactions

Example:

"0x99BCEBf44433E901597D9fCb16E799a4847519f6"

gasless
boolean
required

Whether the user will use gasless execution

Example:

false

hasPermit2ApprovalForAllTokens
boolean
required

Whether the sender has Permit2 approval for all tokens in the route

Example:

false

data
object[]
required

Array of build details per token pair (one entry per quote pair)

disablePricing
boolean

Skip USD pricing for faster build

disableEstimation
boolean

Whether to disable gas estimation and simulation

Response

Successful response. Contains status, txId, chainId, transaction (EVM: data, to, from, value, gasLimit), gasless, quotes (per-pair destAmount/minDestAmount/provider/additionalInfo), and additionalInfo (per-pair requestId, bridgeProvider, srcSwapProvider). For Solana: transaction may include svmTxData. For Bitcoin: btcTxData.

status
string
required

Build status

Example:

"success"

txId
string
required

Unique transaction/build identifier (hex)

Example:

"0x3078393942432d3735313966362d313737333033363131363530350000000000"

chainId
integer
required

Chain ID where the transaction is to be executed

Example:

42161

transaction
object
required

EVM transaction payload (when gasless is false)

gasless
boolean
required

Whether this is a gasless (intent) build

Example:

false

quotes
object
required

Per-pair quote summary. Keys are pair identifiers (e.g. fromChain_srcToken-toChain_destToken). Each value contains provider, destAmount, minDestAmount, and optional additionalInfo (requestId, bridgeProvider, srcSwapProvider).

svmTxData
object

Solana transaction data when destination is SVM

btcTxData
object

Bitcoin transaction data when applicable