Skip to main content

POST DEX Exchange

Endpoint

POST /dexExchange
Initiates a DEX swap. Returns transaction metadata including the on-chain transaction data to submit.

Request Body

{
  "amount": 0.2,
  "tokenIdTo": "6689b73ec90e45f3b3e51558",
  "tokenIdFrom": "6689b73ec90e45f3b3e51553",
  "addressTo": "H1DiPSsBVBpDG57q5ZnxhZpRrsPQBvZfrbFQth6wyGyw",
  "addressFrom": "0x45CF73349a4895fabA18c0f51f06D79f0794898D",
  "swap": "sw",
  "quoteId": "66fa79723eccf00d849b48ed",
  "route": {
    "duration": 1,
    "gas": "5387746374601800",
    "quote": {
      "integration": "debridge",
      "type": "swap",
      "bridgeFee": "29257969",
      "bridgeFeeInNativeToken": "1000000000000000",
      "amount": "657693444",
      "decimals": 9,
      "amountUSD": "94.905",
      "bridgeFeeUSD": "4.221",
      "bridgeFeeInNativeTokenUSD": "2.434",
      "fees": [
        {
          "type": "bridge",
          "amount": "29257969",
          "amountUSD": "4.221",
          "chainSlug": "solana",
          "tokenSymbol": "SOL",
          "tokenAddress": "11111111111111111111111111111111",
          "decimals": 9,
          "deductedFromSourceToken": true
        },
        {
          "type": "bridge",
          "amount": "1000000000000000",
          "amountUSD": "2.434",
          "chainSlug": "ethereum",
          "tokenSymbol": "ETH",
          "tokenAddress": "0x0000000000000000000000000000000000000000",
          "decimals": 18,
          "deductedFromSourceToken": false
        },
        {
          "type": "gas",
          "amount": "5387746374601800",
          "amountUSD": "13.118",
          "chainSlug": "ethereum",
          "tokenSymbol": "ETH",
          "tokenAddress": "0x0000000000000000000000000000000000000000",
          "decimals": 18,
          "deductedFromSourceToken": false
        },
        {
          "type": "partner",
          "amount": "200000",
          "amountUSD": "0.200",
          "chainSlug": "ethereum",
          "tokenSymbol": "USDT",
          "tokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
          "decimals": 6,
          "deductedFromSourceToken": true
        }
      ]
    },
    "route": [
      {
        "bridge": "debridge",
        "bridgeTokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "steps": ["allowance", "approve", "send"],
        "name": "USDC",
        "part": 100
      }
    ],
    "distribution": { "debridge": 1 },
    "gasUSD": "13.118",
    "useXmr": false,
    "deviceInfo": "MacOS",
    "isMobile": false
  }
}

Request Fields

FieldTypeDescription
amountnumberAmount to exchange (e.g., 0.2)
tokenIdTostringID of the output token
tokenIdFromstringID of the input token
addressTostringDestination wallet address
addressFromstringSender’s wallet address
swapstringSwap method identifier (e.g., sw)
quoteIdstringQuote ID from dexQuote response
routeobjectFull route object from dexQuote raw response. See RouteDTO below

RouteDTO Fields

FieldTypeDescription
durationnumberEstimated duration of the swap in minutes
gasstringGas fee for the swap transaction
quoteobjectQuote data for the swap. See QuoteDataDTO below
routearrayArray of bridge route objects
distributionobjectDistribution of the swap across bridges
gasUSDstringGas fee in USD
useXmrbooleanWhether XMR is used for anonymous routing
deviceInfostringDevice information (example: MacOS)
isMobilebooleanWhether the client is a mobile device

QuoteDataDTO Fields

FieldTypeDescription
integrationstringIntegration name (example: debridge)
typestringType of exchange (example: swap)
bridgeFeestringFee for bridge transactions (example: 29257969)
bridgeFeeInNativeTokenstringBridge fee in native tokens (example: 1000000000000000)
amountstringAmount involved in the exchange (example: 657693444)
decimalsnumberNumber of decimals for precision (example: 9)
amountUSDstringAmount converted to USD (example: 94.905)
bridgeFeeUSDstringBridge fee in USD (example: 4.221)
bridgeFeeInNativeTokenUSDstringBridge fee in native token converted to USD
feesarrayArray of fee objects (bridge, gas, partner fees)

Example Response

{
  "houdiniId": "h9NpKm75gRnX7GWaFATwYn",
  "created": "2024-10-08T12:22:25.843Z",
  "senderAddress": "0xe90cAc99ccab34A669fFC2eE4e9c0E5067dE29ac",
  "receiverAddress": "H1DiPSsBVBpDG57q5ZnxhZpRrsPQBvZfrbFQth6wyGyw",
  "anonymous": false,
  "expires": "2024-10-08T12:52:25.843Z",
  "status": 0,
  "inAmount": 50,
  "inSymbol": "6689b73ec90e45f3b3e51592",
  "outAmount": 0.266471241,
  "outSymbol": "6689b73ec90e45f3b3e51558",
  "senderTag": "",
  "receiverTag": "",
  "notified": false,
  "eta": 1,
  "inAmountUsd": 38.422,
  "inCreated": "2024-10-08T12:22:25.843Z",
  "quote": {
    "amountIn": 50,
    "amountOut": 0.266471241
  },
  "metadata": {
    "from": "0xe90cAc99ccab34A669fFC2eE4e9c0E5067dE29ac",
    "to": "0xD0c0bA0b6F151729f4BacB40b8Bb8047360b1ad6",
    "data": "0x601e0bbe...",
    "value": "0x11c37937e08000",
    "txId": "0x2c0d17c9ecde56ec1604582abfe102c331c235be9da45aa266519080d3e9d10d",
    "gas": "0x0699bc"
  },
  "isDex": true
}

Response Fields

FieldTypeDescription
houdiniIdstringUnique transaction identifier
createdstringTimestamp when transaction was created
senderAddressstringSender’s wallet address
receiverAddressstringRecipient’s wallet address
anonymousbooleanWhether transaction is anonymous
expiresstringExpiration timestamp
statusnumberStatus code
inAmountnumberInput amount
inSymbolstringInput token ID
outAmountnumberOutput amount
outSymbolstringOutput token ID
etanumberEstimated time in minutes
inAmountUsdnumberInput amount in USD
inCreatedstringTimestamp when input was created
quoteobjectQuoted exchange details
metadataobjectOn-chain transaction data to submit
isDexbooleantrue for DEX transactions

metadata Object

FieldTypeDescription
fromstringSender address
tostringContract address to call
datastringEncoded calldata (hex)
valuestringETH value to send (hex)
txIdstringTransaction ID
gasstringGas limit (hex)