bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 31쪽 중 5쪽
inId=137
> \&dstChainTokenOut=0x0000000000000000000000000000000000000000
> \&dstChainTokenOutAmount=auto
> \&dstChainTokenOutRecipient=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8
> \&srcChainOrderAuthorityAddress=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8
> \&dstChainOrderAuthorityAddress=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8
> \&senderAddress=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8
> \&prependOperatingExpenses=true
> \&affiliateFee=0.1
> \&affiliateFeeBeneficiary=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8
> \&referralCode=31805](https://dln.debridge.finance/v1.0/dln/order/create-tx?srcChainId=42161\&srcChainTokenIn=0x912ce59144191c1204e64559fe8253a0e49e6548\&srcChainTokenInAmount=1000000000000000000000\&dstChainId=137\&dstChainTokenOut=0x0000000000000000000000000000000000000000\&dstChainTokenOutAmount=auto\&dstChainTokenOutRecipient=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8\&srcChainOrderAuthorityAddress=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8\&dstChainOrderAuthorityAddress=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8\&senderAddress=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8\&prependOperatingExpenses=true\&affiliateFee=0.1\&affiliateFeeBeneficiary=0x55A8f5cce1d53D9Ff84EC0962882b447E5914dB8\&referralCode=31805)
<Accordion title="JSON Example">
```json theme={null}
{
"estimation": {
"srcChainTokenIn": {
"address": "0x912ce59144191c1204e64559fe8253a0e49e6548",
"chainId": 42161,
"decimals": 18,
"name": "Arbitrum",
"symbol": "ARB",
"amount": "1000097362178910640486",
"approximateOperatingExpense": "97362178910640486",
"mutatedWithOperatingExpense": true,
"approximateUsdValue": 337.491121850529,
"originApproximateUsdValue": 337.458266178442
},
"srcChainTokenOut": {
"address": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"chainId": 42161,
"decimals": 6,
"name": "USD Coin",
"symbol": "USDC",
"amount": "336778910",
"maxRefundAmount": "1182866",
"approximateUsdValue": 336.77891
},
"dstChainTokenOut": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 137,
"decimals": 18,
"name": "Polygon",
"symbol": "MATIC",
"amount": "1414379129275580318365",
"recommendedAmount": "1414379129275580318365",
"maxTheoreticalAmount": "1427196423556434769924",
"approximateUsdValue": 334.305266698456,
"recommendedApproximateUsdValue": 334.305266698456,
"maxTheoreticalApproximateUsdValue": 337.334786078531
},
"costsDetails": [
{
"chain": "42161",
"tokenIn": "0x912ce59144191c1204e64559fe8253a0e49e6548",
"tokenOut": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"amountIn": "1000097362178910640486",
"amountOut": "337961776",
"type": "PreSwap"
},
{
"chain": "42161",
"tokenIn": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"tokenOut": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"amountIn": "337961776",
"amountOut": "336778910",
"type": "PreSwapEstimatedSlippage",
"payload": {
"feeAmount": "1182866",
"feeBps": "35",
"estimatedVolatilityBps": "35"
}
},
{
"chain": "42161",
"tokenIn": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"tokenOut": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"amountIn": "336778910",
"amountOut": "336644199",
"type": "DlnProtocolFee",
"payload": {
"feeAmount": "134711",
"feeBps": "4",
"feeApproximateUsdValue": "0.134711"
}
},
{
"chain": "137",
"tokenIn": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"tokenOut": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"amountIn": "336644199",
"amountOut": "336509542",
"type": "TakerMargin",
"payload": {
"feeAmount": "134657",
"feeBps": "4"
}
},
{
"chain": "137",
"tokenIn": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"tokenOut": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"amountIn": "336509542",
"amountOut": "336476680",
"type": "EstimatedOperatingExpenses",
"payload": {
"feeAmount": "32862"
}
},
{
"chain": "137",
"tokenIn": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"tokenOut": "0x0000000000000000000000000000000000000000",
"amountIn": "336476680",
"amountOut": "1422201236073987248230",
"type": "AfterSwap",
"payload": {
"amountOutBeforeCorrection": "1422201236073987248230"
}
},
{
"chain": "137",
"tokenIn": "0x0000000000000000000000000000000000000000",
"tokenOut": "0x0000000000000000000000000000000000000000",
"amountIn": "1422201236073987248230",
"amountOut": "1414379129275580318365",
"type": "AfterSwapEstimatedSlippage",
"payload": {
"feeAmount": "7822106798406929865",
"feeBps": "55",
"estimatedVolatilityBps": "55"
}
}
],
"recommendedSlippage": 0.9
},
"tx": {
"value": "1000000000000000",
"data": "0x4d8160ba000000000000000000000000912ce59144191c1204e64559fe8253a0e49e654800000000000000000000000000000000000000000000003637239428a726d96600000000000000000000000000000000000000000000000000000000000001400000000000000000000000006131b5fae19ea4f9d964eac0408e4408b66337b50000000000000000000000000000000000000000000000000000000000000160000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831000000000000000000000000000000000000000000000000000000001412d69e00000000000000000000000055a8f5cce1d53d9ff84ec0962882b447e5914db8000000000000000000000000ef4fb24ad0916217251f553c0596f8edc630eb660000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a4e21fd0e90000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c7d3ab410d49b664d03fe5b1038852ac852b1b29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000001c402020000003d0200000011d53ec50bc8f54b9357fbfe2a7de034fc00f8b3000000000000000d8dc8e50a29c9b65e0100000000000000000000000000000000000000000a0000002e020000006f38e884725a116c9c7fbf208e79fe8828a2595f010100000000000000000000000000000001000276a40a020000003d020000006ce9bc2d8093d32adde4695a4530b96558388f7e0000000000000028a95aaf1e7d5d23080100000000000000000000000000000000000000000a0000006102000000b1026b8e7276e7ac75410f1fcbbe21796e8f7526af88d065e77c8cc2239327c5edb3a432268e5831010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010009046d15912ce59144191c1204e64559fe8253a0e49e6548af88d065e77c8cc2239327c5edb3a432268e5831663dc15d3c1ac63ff12e45ab68fea3f0a883c25100000000000000000000000068151dea000000540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001510000000000000000000000001424e3304f82e73edb06d29ff62c91ec8f5ff06571bdeb2900000000000000000000000000000000000000000000000000000000000000000000000000000000912ce59144191c1204e64559fe8253a0e49e6548000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000663dc15d3c1ac63ff12e45ab68fea3f0a883c25100000000000000000000000000000000000000000000003637239428a726d966000000000000000000000000000000000000000000000000000000001412d69d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c7d3ab410d49b664d03fe5b1038852ac852b1b29000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000003637239428a726d96600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002707b22536f75726365223a2264654272696467652d346663642d396531662d393161373561343166333562222c22416d6f756e74496e555344223a223333382e3534393433323535393439343835222c22416d6f756e744f7574555344223a223333382e3436323735373036353236383134222c22526566657272616c223a22222c22466c616773223a302c22416d6f756e744f7574223a22333337393631373736222c2254696d657374616d70223a313734363231333137382c22526f7574654944223a2264356636393531372d343162362d346237632d616435302d623032663132313261373130222c22496e74656772697479496e666f223a7b224b65794944223a2231222c225369676e6174757265223a22634552725149787330784b50584d3670726d4c484f4e553757324b762b365839646a6c4b385a6972746361762b66617a744c46646e33775a2f6c5277317533487a4d5649554d7a65507a567476303663782b386742754174594651714f626e6159624d6d6b7774786e6848346b4a336c3278544f733134457639585735386b54757069496c48494f7a565479644f4a693838707238746c753534757353514b55453142707353356a35456651415577303137626271384b557670496943346f685050506b66514d33457a4c575a3362427976504367646e6442332f4444597433544e5970525262474e36476e623375664a682f5a696e4f3749666d49587576625a5046316a335a2f77327a333655774d495866732f334142333376774d5a6d4d4f2b7747774637696c5a7a3770783865646336695a5939672b5368735852354a37794f4e467072773674495831652b674757464637513d3d227d7d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000424b930370100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000196926a90a000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000007c3d000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831000000000000000000000000000000000000000000000000000000001412d69e000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000004cac74145fd542829d000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000001a000000000000000000000000055a8f5cce1d53d9ff84ec0962882b447e5914db800000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001455a8f5cce1d53d9ff84ec0962882b447e5914db8000000000000000000000000000000000000000000000000000000000000000000000000000000000000001455a8f5cce1d53d9ff84ec0962882b447e5914db80000000000000000000000000000000000000000000000000000000000000000000000000000000000000014555ce236c0220695b68341bc48c68d52210cc35b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042010100000066d986c862e659010000000000000000000000009d8242d55f1474ac4c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"to": "0x663DC15D3C1aC63ff12E45Ab68FeA3F0a883C251"
},
"prependedOperatingExpenseCost": "97362178910640486",
"order": {
"approximateFulfillmentDelay": 3,
"salt": 1746213179552,
"metadata": "0x010100000066d986c862e659010000000000000000000000009d8242d55f1474ac4c0000000000000000000000000000000000000000000000000000000000000000"
},
"orderId": "0x19499ede9b21fa5cc0ce5f74a155482576ff7d85b51863fb5231dbf648300b6a",
"fixFee": "1000000000000000",
"userPoints": 198.47,
"integratorPoints": 49.62
}
```
</Accordion>
# Cross-Chain Order Creation
Source: https://docs.debridge.com/dln-details/integration-guidelines/order-creation/creating-order/creating-order
Creating cross-chain orders with the deBridge Liquidity Network API: a step-by-step guide to using the `create-tx` endpoint for estimating outcomes and constructing transactions, along with best practices for quoting strategies and timing guarantees.
The `create-tx` endpoint is intended to be used for both estimating and constructing order transactions. There are detailed breakdowns of parameters
and the response fields.
We do recommend reading deeper into these articles, but if you want to get up and running, have a look at the quick start section.
Swagger specs of `create-tx` can be found here.
# Paired Quote and Transaction
The `create-tx` ednpoint is intentionally dual-purpose:
* It estimates a realistic, market-aware outcome (`estimation`)
* It constructs a ready-to-sign transaction (`tx`) whenever the call includes the necessary wallet data
This design intentionally removes the distinction between “get quote” and “build transaction” that exists in typical single-chain swap APIs.
A detailed parameter reference & field-by-field response breakdown lives in the [API
Parameters](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters) and [API
Response](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/response) sub-pages, while Swagger specs for `create-tx`
can be explored [here](/api-reference/dln/this-endpoint-returns-the-data-for-a-transaction-to-place-a-cross-chain-dln-order). For a hands-on
walk-through, see the [Quick Start](/dln-details/integration-guidelines/order-creation/creating-order/quick-start) section of the docs.
# Why Quote and Transaction Are Paired
DLN works with *intent-based orders* that traverse two independent blockchains, two swaps, and several off-chain actors (API, solvers, validators). An
accurate quote must already account for:
* Source-chain liquidity and gas
* Destination-chain liquidity and gas
* A solver’s operating expenses and target margin
* Short-term market volatility during the time the order is in flight
* Generating that quote is the most computationally expensive step; producing the transaction payload afterwards is trivial. A “lightweight quote” would be misleading and would cause orders to be ignored by solvers.
# How the `create-tx` Endpoint Behaves
| **Scenario** | **Returned Fields** | **Typical Use-Case** |
| ----------------------------------------------------------------- | --------------------- | -------------------------------------- |
| All required fields present (wallet connected, amounts known) | `estimation` and `tx` | Production trade flow |
| Wallet address missing (connect-wallet screen, fiat on-ramp flow) | `estimation` | Pre-trade previews, fiat on-ramp flows |
If dstChainTokenOutRecipient, srcChainOrderAuthorityAddress, or dstChainOrderAuthorityAddress are absent, the API withholds tx. Recipient and authorities parameters are required for creating the transaction. Replay the same call once addresses are known to receive the full response pair.
# Do Not Replay the Quote Into a Second Call
<Danger>
Passing the returned `srcChainTokenInAmount` and dstChainTokenOutAmount back to `create-tx` forces the endpoint into [limit-order quoting
strategy](/dln-details/integration-guidelines/order-creation/creating-order/quoting-strategies) (both amounts fixed). Limit orders can drive solver profit negative, so they
are typically ignored—use the original quote + transaction pair and let the user sign immediately.
</Danger>
Replay-and-fixing the amounts:
* Converts a healthy market order into a potentially unattractive limit order
* Slashes the fulfillment probability
Placing limit orders is fine but they can end up being unprofitable and remain unfilled. If more than \~30 seconds have passed, request a fresh
quote-plus-transaction pair instead of re-using stale numbers. Profitable market orders are filled within seconds; unprofitable ones linger until they
become profitable or the user cancels them.
# Timing Guarantees
Quotes remain solvent if the paired transaction is signed and broadcast within \~30 seconds. Beyond that window:
* Gas cost or price movements may exceed the solver’s margin.
* Solvers will skip the order; users must cancel and retry.
For ERC-20 flows with `prependOperatingExpenses=true`, approve a slightly higher allowance (≈ +30 %) or approve infinity to avoid a second approval if operating expenses drift upward while the user is signing.
<Accordion title="Estimation and Full Pair">
```typescript theme={null}
// 1. Preview (wallet not yet connected)
const preview = await fetch(
'/dln/order/create-tx?srcChainId=56&srcChainTokenIn=<token_in_address>&srcChainTokenInAmount=1000000&' +
'dstChainId=43114&dstChainTokenOut=<token_out_address>&dstChainTokenOutAmount=auto'
).then(data => data.json());
// preview.estimation is present; preview.tx is undefined.
// 2. User connects wallet; replay with authority/recipient addresses
const full = await fetch(
'/dln/order/create-tx?srcChainId=56&srcChainTokenIn=<token_in_address>&srcChainTokenInAmount=1000000&' +
'dstChainId=43114&dstChainTokenOut=<token_out_address>&dstChainTokenOutAmount=auto&' +
'dstChainTokenOutRecipient=<user_address>&srcChainOrderAuthorityAddress=<user_address>&' +
'dstChainOrderAuthorityAddress=<user_address>'
).then(data => data.json());
// full.estimation and full.tx are now present.
// Sign full.tx within 30 s for >99.9 % fill probability.
```
</Accordion>
# Key Takeaways
* One endpoint, one response—never separate quote retrieval from transaction generation.
* The estimate/transaction pair maximizes fulfillment probability by eliminating UI-induced latency.
* When wallet addresses are unknown, call `create-tx` for estimation only, then repeat once addresses are set.
* Re-using quoted amounts in a second request reduces the likelihood of order fulfillment and should be avoided.
Following this pattern ensures that orders hit the network with fresh spreads, remain attractive to solvers, and settle cross-chain in seconds.
# Quickstart
Source: https://docs.debridge.com/dln-details/integration-guidelines/order-creation/creating-order/quick-start
deBridge Liquidity Network API Quickstart – EVM and Solana.
# Disclaimer
<Danger>
The provided code is for demonstration purposes only and is supplied "as is" without warranties of any kind. Users are responsible
for reviewing, testing, and validating the code before executing transactions with real funds. We are not liable for any losses or
damages resulting from its use.
</Danger>
# Overview
[This repository](https://github.com/debridge-finance/api-integrator-example) serves as a practical resource for integrators
aiming to get started with hands-on examples of using the deBridge Liqudity Network protocol via API.
More details on submitting chain-specific orders can be found
[here](/dln-details/integration-guidelines/order-creation/creating-order/creating-order).
# EVM
[Included](https://github.com/debridge-finance/api-integrator-example/blob/master/src/scripts/orders/example-swap.ts) is a
comprehensive TypeScript script demonstrating the transfer of 0.1 USDC from Polygon to Arbitrum. The script outlines all necessary
steps for completing a cross-chain swap between the two networks. It also includes examples for executing the approve function on
ERC-20 tokens and showcases various deBridge API integrations.
# Solana
There are also examples of
[creating an order from Polygon (EVM) to Solana](https://github.com/debridge-finance/api-integrator-example/blob/master/src/scripts/orders/poly-usdc-to-sol.ts)
and
[from Solana to Polygon (EVM)](https://github.com/debridge-finance/api-integrator-example/blob/master/src/scripts/orders/sol-usdc-to-p프로젝트로 돌아가기