An engineering walkthrough for integrating DLN’s same-chain swaps with executable transactions, affiliate fees, and production-grade tracking.
A product surface wants single-network token conversions that behave like reliable transactions, not optimistic quotes. The integration path is
intentionally compact: first, ask for a quote; then, once the sender and recipient are known, request the fully constructed transaction. Under the
hood, DLN simulates routes across multiple aggregators and returns calldata that targets DeBridgeRouter on EVM, or a serialized transaction on
Solana. The result is an estimation-then-execution loop that stays responsive and grounded in market reality, with the added benefit of adaptive
slippage that takes real-time conditions into account.
Use GET /v1.0/chain/estimation to retrieve a quote for the desired pair. This step is suitable when the wallet is not connected or recipient is
not yet known.Minimal request - SOL for USDC on Solana
Copy
Ask AI
{ "chainId": "7565164", "tokenIn": "11111111111111111111111111111111", // SOL on Solana "tokenInAmount": "200000", "tokenOut": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC on Solana, "slippage": "auto" // Default value}
The response contains pricing, route details, aggregator comparison, and costs metadata used to inform UI and future submission.
The recommended value for slippage parameter is auto. The API selects a minimum reasonable slippage band from live market conditions and simulations.
Full response schema
Copy
Ask AI
{ "estimation": { "tokenIn": { "address": "string", // token address "name": "string", // token name "symbol": "string", // token symbol "decimals": 0, // token decimals "amount": "string", // input amount "approximateUsdValue": 0 // approximate USD value of input amount }, "tokenOut": { "address": "string", // token address "name": "string", // token name "symbol": "string", // token symbol "decimals": 0, // token decimals "amount": "string", // output amount "minAmount": "string", // minimum output amount "approximateUsdValue": 0 // approximate USD value of output amount }, "slippage": 0, // slippage percentage (e.g. 0.5 for 0.5%) "recommendedSlippage": 0, // recommended slippage percentage based on route simulation and volatility "protocolFee": "string", // protocol fee amount in tokenIn "estimatedTransactionFee": { // estimated transaction fee details "total": "string", "details": { "giveOrderState": "string", "giveOrderWallet": "string", "nonceMaster": "string", "txFee": "string", "priorityFee": "string", "gasLimit": "string", "gasPrice": "string", "baseFee": "string", "maxFeePerGas": "string", "maxPriorityFeePerGas": "string" }, "approximateUsdValue": 0 // approximate USD value of the total estimated transaction fee }, "costsDetails": [ // Breakdown of costs and fees { "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" } } ], "comparedAggregators": [ // List of queried aggregators and their rates { "name": "string", "amount": "string", "approximateUsdValue": 0, "priceDrop": 0, "imageUrl": "string" } ] }}
Use GET /v1.0/chain/transaction to obtain the same quote fields plus a tx object ready to be signed and broadcast.Minimal request - USDC for MATIC on Polygon
DLN’s same-chain swaps leverage multiple DeFi aggregators to ensure competitive pricing and route diversity. Response payload for both estimation and
transaction endpoints includes the comparedAggregators field, which lists the aggregators queried during route discovery. This transparency allows
integrators to understand the aggregator choice and provides insights into the liquidity sources considered for the swap.
The full script (simulation, CU sizing, prioritization fee median, and final submission) is available
here and can be
reused for inspiration in real integrations.
Affiliate fees are supported in the same-chain flow. The parameters used are affiliateFeePercent and affiliateFeeRecipient.More details are available in the the Same-Chain Affiliate Fees article.
The higher the affiliate fee, the worse rates the users using the app will get.
For listing same-chain swaps of a single wallet POST https://stats-api.dln.trade/api/Orders/filteredList should be used with a filterMode: "SameChain" parameter.`:Allowed values for filterMode are:
{ "orders": [ { "orderId": { /* order ID object - with bytes, bytes array and string values */ }, "creationTimestamp": 1759141461, // Unix timestamp "giveOfferWithMetadata": { "chainId": { /* chain ID object with different representations */ }, "tokenAddress": { /* token address object - with different representations */ }, "amount": { /* amount object - with different representations */ }, "metadata": { /* input token metadata */ "decimals": 6, "name": "Dephaser JPY", "symbol": "JPYT", "logoURI": null }, "decimals": 6, "name": "Dephaser JPY", "symbol": "JPYT", "logoURI": null }, "takeOfferWithMetadata": { "chainId": { /* chain ID object with different representations */ }, "tokenAddress": { /* token address object - with different representations */ }, "amount": { /* amount object - with different representations */ }, "metadata": { /* output token metadata */ "decimals": 18, "name": "AntHive", "symbol": "ANTH", "logoURI": null }, "decimals": 18, "name": "AntHive", "symbol": "ANTH", "logoURI": null }, "state": "Fulfilled", // Swap state "affiliateFee": { "beneficiarySrc": { /* affiliate fee beneficiary address object - with bytes, bytes array and string values */ }, "amount": { /* amount object - with bytes, bytes array and string values */ } }, "createEventTransactionHash": { /* transaction hash object - with bytes, bytes array and string values */ }, "tradeType": "SameChain" } ], "totalCount": 24}
Same-chain swaps do not create an on-chain DLN order entity. The Stats API maps same-chain data into an order-like representation purely for
consistency in histories and dashboards.
To get details of a single order from the transaction hash, GET https://stats-api.dln.trade/api/SameChainSwap/${chainId}/tx/${transactionHash}
should be used with chainId and transactionHash parameters. Response structure is identical to the order object in the filtered list.
Quotes are tied to current market conditions and route simulations. Signing and submission should occur shortly after a transaction payload is
received; stale quotes should be refreshed every 30 seconds. The recommended value for slippage parameter is "auto". The API selects a minimum
reasonable slippage bound based on volatility and route simulation, a design that reduces execution risk without forcing conservative hard-coding.
Fetch the estimation endpoint for quotes before the wallet is connected; request the transaction endpoint for quotes and a transaction object
once senderAddress and tokenOutRecipient are known.
Prefer adaptive slippage with auto.
On EVM, ensure tokenIn allowance toward the DeBridgeRouter target in tx.to.
Refresh quotes every 30 seconds if signing is delayed to avoid staleness.
Use Stats API filterList endpoint with filterMode: "SameChain" for observability.