GET
/
v1.0
/
dln
/
order
/
create-tx
This endpoint returns the data for a transaction to place a cross-chain DLN order.
curl --request GET \
  --url https://dln.debridge.finance/v1.0/dln/order/create-tx
{
  "estimation": {
    "srcChainTokenIn": {
      "address": "<string>",
      "name": "<string>",
      "symbol": "<string>",
      "decimals": 123,
      "amount": "<string>",
      "chainId": 123,
      "approximateOperatingExpense": "<string>",
      "mutatedWithOperatingExpense": true,
      "approximateUsdValue": 123,
      "originApproximateUsdValue": 123
    },
    "srcChainTokenOut": {
      "address": "<string>",
      "name": "<string>",
      "symbol": "<string>",
      "decimals": 123,
      "amount": "<string>",
      "chainId": 123,
      "maxRefundAmount": "<string>",
      "approximateUsdValue": 123
    },
    "dstChainTokenOut": {
      "address": "<string>",
      "name": "<string>",
      "symbol": "<string>",
      "decimals": 123,
      "amount": "<string>",
      "chainId": 123,
      "recommendedAmount": "<string>",
      "withoutAdditionalTakerRewardsAmount": "<string>",
      "maxTheoreticalAmount": "<string>",
      "approximateUsdValue": 123,
      "recommendedApproximateUsdValue": 123,
      "maxTheoreticalApproximateUsdValue": 123,
      "withoutAdditionalTakerRewardsApproximateUsdValue": 123
    },
    "recommendedSlippage": 123,
    "costsDetails": [
      {
        "chain": "<string>",
        "tokenIn": "<string>",
        "tokenOut": "<string>",
        "amountIn": "<string>",
        "amountOut": "<string>",
        "type": "<string>",
        "payload": {
          "feeAmount": "<string>",
          "feeBps": "<string>",
          "amountOutBeforeCorrection": "<string>",
          "estimatedVolatilityBps": "<string>",
          "actualFeeAmount": "<string>",
          "actualFeeBps": "<string>",
          "subsidyAmount": "<string>",
          "feeApproximateUsdValue": "<string>"
        }
      }
    ]
  },
  "tx": {
    "to": "<string>",
    "data": "<string>",
    "value": "<string>",
    "gasLimit": 123
  },
  "orderId": "<string>",
  "prependedOperatingExpenseCost": "<string>",
  "order": {
    "approximateFulfillmentDelay": 123,
    "salt": 123,
    "metadata": "<string>"
  },
  "fixFee": "<string>",
  "protocolFee": "<string>",
  "userPoints": 123,
  "integratorPoints": 123,
  "actualUserPoints": 123,
  "actualIntegratorPoints": 123,
  "estimatedTransactionFee": {
    "total": "<string>",
    "details": {
      "giveOrderState": "<string>",
      "giveOrderWallet": "<string>",
      "nonceMaster": "<string>",
      "txFee": "<string>",
      "priorityFee": "<string>",
      "gasLimit": "<string>",
      "gasPrice": "<string>",
      "baseFee": "<string>",
      "maxFeePerGas": "<string>",
      "maxPriorityFeePerGas": "<string>"
    },
    "approximateUsdValue": 123
  },
  "usdPriceImpact": {}
}

Query Parameters

srcChainId
enum<string>
required

An ID of a source chain, a chain where the cross-chain swap will start

Available options:
1,
10,
56,
137,
8453,
42161,
43114,
59144,
7565164,
100000001,
100000002,
100000008,
100000009,
100000013,
100000014,
100000017,
100000020,
100000021,
100000022,
100000023,
100000025,
100000026,
100000027,
100000028
srcChainTokenIn
string
required

An address (on a source chain) of an input token to swap

srcChainTokenInAmount
string
required

An amount of input tokens to swap

dstChainId
enum<string>
default:56
required

An ID of a destination chain, a chain where the cross-chain swap will finish. Must differ from srcChainId!

Available options:
1,
10,
56,
137,
8453,
42161,
43114,
59144,
7565164,
100000001,
100000002,
100000008,
100000009,
100000013,
100000014,
100000017,
100000020,
100000021,
100000022,
100000023,
100000025,
100000026,
100000027,
100000028
dstChainTokenOut
string
required

An address (on a destination chain) of a target token.

dstChainTokenOutAmount
string

Amount of the target asset the market maker expects to receive upon order fulfillment. This property can be set to "auto" so that the API will suggest the best possible outcome of the order based on current market conditions and the protocol fees, keeping the order in a reasonable-to-fullfill state

additionalTakerRewardBps
integer

additionalTakerRewardBps is additionally laid in on top of default taker margin.

srcIntermediaryTokenAddress
string

An address (on a source chain) of an intermediary token a user's input funds should be swapped to prior order creation. This token must be publicly traded and listed on major DEX aggregators. Examples: USDC on Ethereum, DAI on Ethereum, USDC on Solana. This property can be either a Circle-issued USDC token or ETH, or an arbitrary token; setting an arbitrary token also requires you to specify dstIntermediaryTokenAddress, intermediaryTokenUSDPrice and dstIntermediaryTokenSpenderAddress properties as well.

dstIntermediaryTokenAddress
string

An address (on a destination chain) of an intermediary token whose value assumed to be equal to the value of srcIntermediaryTokenAddress . This token must be publicly traded and listed on major DEX aggregators. Examples: USDC on Ethereum, DAI on Ethereum, USDC on Solana. Setting this property also requires you to specify srcIntermediaryTokenAddress, intermediaryTokenUSDPrice and dstIntermediaryTokenSpenderAddress properties as well.

dstIntermediaryTokenSpenderAddress
string

Applicable to a EVM-compatible destination chain. An address (on a EVM-compatible destination chain) assumed as a spender of the intermediary token (set as dstIntermediaryTokenAddress) during order fulfillment. This address must hold a reasonable amount (of at least $100 in value for testing purposes, or at least 10% of the average order value) of the given intermediary token, and issue on-chain approvals to spent the given intermediary token by the two trusted DLN contracts (DlnDestination: {CURRENT_ENV[dstChain].pmmDst} and CrosschainForwarder: {CURRENT_ENV[dstChain].evm.forwarderContract}). This property is required when srcIntermediaryTokenAddress and dstIntermediaryTokenAddress are set.

intermediaryTokenUSDPrice
number

A value (a spot price) of the given intermediary token expressed in US dollars. Keep in mind this price is not used to calculate the spread of an order, but only as a reference price for operating expenses incurred by a taker during and after order fulfillment. The order spread is still calculated using the market price quoted from a major DEX.

dstChainTokenOutRecipient
string

Address (on the destination chain) where target tokens should be transferred to after the swap. Required for transaction construction, otherwise only the quote is returned!

senderAddress
string

Address (on the source chain) who submits input tokens for a cross-chain swap

srcChainOrderAuthorityAddress
string

Address (on the source chain) who submits input tokens for a cross-chain swap. Required for transaction construction, otherwise only the quote is returned!

srcAllowedCancelBeneficiary
string

Fixed recipient of the funds of an order in case it is being cancelled. If not set, the recipient could be set later upon order cancellation.

referralCode
number

Make sure you pass your referral code which can be generated here: https://app.debridge.finance/refer With your referral code, your address will earn an additional 25% of deBridge points (https://debridge.finance/blog/introducing-debridge-points/), on top of the points generated by users who engage in activity on deBridge through your referral.

affiliateFeePercent
number

The share of the input amount to be distributed to the affiliateFeeRecipient (if given) address as an affiliate fee.

If you are building on top of deSwap, you might want to take a small fee relative to the amount of a token a user provides for a swap. To achieve this, set this parameter to a desired % (e.g. 0.1 stands for 0.1%; the max value is 10 which stands for 10% of srcAmountInParam) and specify your wallet address in the affiliateFeeRecipient parameter.

For example, setting this parameter to 0.1 means that when the user gives 5000 USDT then you will receive 5 USDT immediately after transaction is being confirmed.

affiliateFeeRecipient
string

An address (on an origin chain) that will receive affiliate fees according to the affiliateFeePercent parameter.

srcChainTokenInSenderPermit
string

Typically, a sender is required to approve token transfer to deBridge forwarder for further transfer and swap. For gas-less cases, a sender-signed permit message may be provided to be executed by deBridge forwarder before actual transfer.

dstChainOrderAuthorityAddress
string

Address on the destination chain whom should be granted the privileges to manage the order (patch, cancel, etc). Required for transaction construction, otherwise only the quote is returned!

enableEstimate
boolean

This flag forces deSwap API to validate the resulting transaction and estimate its gas consumption. You will find the estimation at tx.gasLimit field of the resulting object.

Important: to estimate a transaction, you are required to fill the senderAddress property with the address that will be used to execute this transaction. It should have enough assets on its balance to cover the amount specified in the srcChainTokenInAmount property, and enough ether to cover the protocol global fixed fee.

Caution: if the input token (srcChainTokenIn) is not a native blockchain currency but an ERC-20 token, it is necessary to provide an approve to spend this token by the tx.allowanceTarget contract prior to such estimation. This can be done either by executing increaseAllowance() on-chain or by providing the permit envelope via the srcChainTokenInSenderPermit property. Failing to provide a correct approve to spend will result an error during transaction.

allowedTaker
string

An address (on a destination chain) of a allowed taker.

externalCall
string
deprecated

A stringified versioned JSON with data fields that form an encoded transaction call to be attached to a DLN order and would be executed upon order fulfillment on the destination chain. The following schemas are currently supported:

  • for Solana as a destination chain: { "version": "solana_1", "fields": { "calldata": "0x..." } }

  • for EVM-compatible chains (gas optional): { "version": "evm_1", "fields": { "to": "0x...", "data": "0x...", "gas": 0 } }

dlnHook
string

JSON representing a DLN Hook to be attached to an order. Depending on the destination chain, the following templates are available:

  • for Solana as a destination chain: { "type": "solana_serialized_instructions", "data": { "instructions": "0x..." } }

  • for EVM-based destination chains to make an arbitrary transaction call via the universal DLN hook: { "type": "evm_transaction_call", "data": { "to": "0x...", " calldata": "0x...", "gas": 0 } }

  • for EVM-based destination chains to attach an arbitrary hook: { "type": "evm_hook_data_v1", "data": { "fallbackAddress": "0x...", "target": "0x...", "reward": "0", "isNonAtomic": false, "isSuccessRequired": false, "targetPayload": "0x" } }

prependOperatingExpenses
boolean
default:false

Tells API server to prepend operating expenses to the input amount

metadata
string
otc
boolean
deprecated

Forces a P2P order where input and output tokens are left intact(renamed to ptp)

ptp
boolean

Forces a P2P order where input and output tokens are left intact

skipSolanaRecipientValidation
boolean
default:false

Skip system address validation dstChainTokenOutRecipient in Solana

srcChainPriorityLevel
enum<string>
default:normal

Configures the priority level for transaction fee estimation.

Available options:
normal,
aggressive

Response

The request has succeeded

estimation
object
required
tx
object
required
orderId
string
required
order
object
required
fixFee
string
required
userPoints
number
required
integratorPoints
number
required
prependedOperatingExpenseCost
string
protocolFee
string
actualUserPoints
number
actualIntegratorPoints
number
estimatedTransactionFee
object
usdPriceImpact
object