Skip to main content

POST DEX Approve

Endpoint

POST /dexApprove
Returns the approval transaction data needed before executing a DEX swap.

Request Body

{
  "tokenIdTo": "6689b73ec90e45f3b3e51558",
  "tokenIdFrom": "6689b73ec90e45f3b3e51553",
  "addressFrom": "0x45CF73349a4895fabA18c0f51f06D79f0794898D",
  "amount": 1,
  "swap": "sw",
  "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"
  }
}

Request Fields

FieldTypeDescription
tokenIdTostringDestination token identifier
tokenIdFromstringSource token identifier
addressFromstringAddress from which the amount will be deducted
amountnumberApproval amount
swapstringSwap type identifier (e.g., sw)
routeobjectRouting configuration (RouteDTO from dexQuote)

Example Response

[
  {
    "data": "0x095ea7b300000000000000000000000072788af7fc87d14da73f94e353e52b76e230035b000000000000000000000000000000000000000000000000016345785d8a0000",
    "to": "0x0000000000000000000000000000000000000000",
    "from": "0x789",
    "fromChain": {
      "id": "667160411933f7647414f091",
      "created": "2024-06-18T10:24:01.870Z",
      "modified": "2024-09-04T13:41:54.131Z",
      "name": "Ethereum",
      "shortName": "ethereum",
      "addressValidation": "^(0x)[0-9A-Fa-f]{40}$",
      "explorerUrl": "https://etherscan.io/tx/{txHash}",
      "addressUrl": "https://etherscan.io/tokens/{address}",
      "kind": "evm",
      "chainId": 1,
      "block": "0",
      "gasPrice": "0",
      "lastBaseFeePerGas": "0",
      "maxFeePerGas": "0",
      "maxPriorityFeePerGas": "0",
      "enabled": true,
      "icon": "http://localhost:3000/assets/dexchains/667160411933f7647414f091.png"
    }
  }
]

Response Fields

FieldTypeDescription
datastringEncoded transaction data (hex) to submit on-chain
tostringTarget contract address
fromstringSource token address
fromChainobjectSource chain details (ChainDTO)

ChainDTO Fields

FieldTypeDescription
idstringUnique chain identifier
createdstringCreation timestamp
modifiedstringLast modification timestamp
namestringChain full name
shortNamestringChain abbreviation
addressValidationstringRegex for address validation
memoNeededbooleanWhether memo is required
explorerUrlstringBlock explorer URL format
addressUrlstringToken address URL format
iconstringChain icon URL
kindstringChain type (e.g., evm)
chainIdnumberBlockchain network ID
blockbigintCurrent block number
gasPricebigintCurrent gas price
lastBaseFeePerGasbigintRecent base fee
maxFeePerGasbigintMaximum fee ceiling
maxPriorityFeePerGasbigintPriority fee limit
enabledbooleanWhether chain is active
shortNameV1stringLegacy chain abbreviation