$37
PREREQUISITE: Read ../common/SKILL.md for environment detection, auth, and chain configuration.
| Want to... | Go to |
|---|---|
| Look up chain IDs / tokens | ../common/chain-config.md |
| Run preflight checks | preflight.md |
| Sign and send transaction | ../signing/SKILL.md |
| Track cross-chain order | monitoring.md |
| SDK workflow (coming soon) | Not yet available — use MCP |
Before starting, verify MCP is connected:
Call mcp__debridge__get_supported_chains (no parameters).
If it returns chain data → MCP is ready. Continue below.
If tool not found → MCP not connected. Set up the connection:
claude mcp add --transport http debridge https://agents.debridge.com/mcpclaude mcp add debridge npx -- -y @debridge-finance/debridge-mcp@latestBoth require restarting the session. For full setup details: read ACCESS_SETUP in ../common/SKILL.md or ../common/mcp-setup.md.
Determine whether this is a same-chain or cross-chain operation:
Look up token addresses and decimals on the swap chain.
Call mcp__debridge__search_tokens:
- query: "USDC" (NOT "search" — the parameter is "query")
- chainId: "42161" (string, NOT number)
Repeat for the output token. Record address and decimals.
Call mcp__debridge__transaction_same_chain_swap:
- chainId: "42161" (string, chain deBridge ID)
- tokenIn: "0xaf88...e5831" (input token address)
- tokenInAmount: "1000000000" (amount in raw units — see Amount Conversion)
- tokenOut: "0x0000...0000" (output token address)
- tokenOutRecipient: "0xYourAddress" (recipient address on the same chain)
Optional parameters:
slippage — tolerance or "auto" (default: auto)tokenOutAmount — expected output or "auto"senderAddress — transaction submitter addressaffiliateFeePercent / affiliateFeeRecipient — affiliate feesAll parameters are strings. Do NOT pass numbers for chain IDs.
The response includes:
tx — the transaction object to sign and send (format depends on chain, see below)tokenIn / tokenOut — token metadata with amount, minAmount, approximateUsdValueslippage / recommendedSlippage — applied and recommended slippage (bps)estimatedTransactionFee — gas estimate with total (in raw native units) and approximateUsdValuecomparedAggregators — price comparison with other DEX aggregatorscostsDetails — detailed fee breakdownEVM chains — tx contains {to, data, value}:
{
"tx": { "to": "0x663D...c251", "data": "0x258c...", "value": "0" },
"tokenOut": { "amount": "10027065", "minAmount": "10019037", ... }
}
Solana (chain ID 7565164) — tx contains {data} only (hex-encoded serialized transaction):
{
"tx": { "data": "0x01000000..." },
"tokenOut": { "amount": "87206972", "minAmount": "86927910", ... }
}
Solana transactions are fully serialized — pass tx.data to the Solana signing pipeline (see ../signing/ows-signing.md for OWS Solana flow).
Read preflight.md before proceeding.
Checks: balance, allowance (for ERC-20 input on EVM), and gas budget.
Read ../signing/SKILL.md — it detects the available signer and routes to the correct signing method.
Same-chain swaps settle in a single transaction. No monitoring step needed — the tx receipt confirms completion.
Cross-chain swaps (also called bridges or cross-chain transfers) move tokens between different blockchains.
Solana (deBridge chain ID 7565164):
Gh9ZwEm...), not hex — validate format before calling create_tx.11111111111111111111111111111111 (32 ones).Tron (deBridge chain ID 100000026):
T9yD14N...), starting with T — not the same encoding as Solana.For both: the source side (EVM) follows the normal EVM flow — approval if needed on the source chain, then sign and send. The approveTx from create_tx is always a source-chain operation.
Look up token addresses and decimals on source and destination chains.
Call mcp__debridge__search_tokens:
- query: "USDC" (NOT "search" — the parameter is "query")
- chainId: "1" (string, NOT number)
Repeat for destination chain. Record address and decimals from the response.
For native tokens (ETH, BNB, etc.), use the zero address from ../common/chain-config.md.
For Solana native token (SOL), use 11111111111111111111111111111111.
Call mcp__debridge__create_tx:
- srcChainId: "1" (string, source chain deBridge ID)
- srcChainTokenIn: "0xA0b8...eB48" (source token address)
- srcChainTokenInAmount: "100000000" (amount in raw units — see Amount Conversion)
- dstChainId: "42161" (string, destination chain deBridge ID)
- dstChainTokenOut: "0xaf88...e5831" (destination token address)
- dstChainTokenOutRecipient: "0xRecipient..." (recipient on destination chain)
- srcChainOrderAuthorityAddress: "0xSender..." (REQUIRED — sender's address on source chain)
- dstChainOrderAuthorityAddress: "0xRecipient..." (REQUIRED — recipient's address on destination chain)
All parameters are strings. Do NOT pass numbers for chain IDs.
Optional parameters:
dstChainTokenOutAmount — expected output amount or "auto" for best quote (default: auto)prependOperatingExpenses — set true to add estimated operating expenses to the input amountaffiliateFeePercent / affiliateFeeRecipient — affiliate feesThe response from create_tx includes:
tx — the main transaction object (to, data, value, chainId)approveTx — token approval transaction (if ERC-20 allowance is insufficient)orderId — the DLN order ID for trackingRead preflight.md before proceeding.
Preflight checks:
Read ../signing/SKILL.md — it detects the available signer and routes to the correct signing method.
Execution order:
approveTx is present → sign and send approval first. Wait for 1 confirmation.tx. Record the transaction hash.Read monitoring.md to track the DLN order from creation to fulfillment on the destination chain.
All amounts must be in raw units (smallest indivisible unit) as strings.
raw_units = human_amount × 10^decimals
Example: 100 USDC (6 decimals) → "100000000"
See ../common/chain-config.md for decimals and conversion table.
The ../common/scripts/ directory has TypeScript helpers that handle amount conversion, balance checks, allowances, and approvals. All scripts auto-discover RPC endpoints from Chainlist and read token decimals on-chain.
| Script | Purpose | Example |
|---|---|---|
convert-amount.ts | Convert human ↔ raw units | npx tsx ../common/scripts/convert-amount.ts 100 0xA0b8...eB48 1 |
balance.ts | Query native or ERC-20 balance | npx tsx ../common/scripts/balance.ts 0xAddr 42161 --token 0xToken |
allowance.ts | Check ERC-20 allowance | npx tsx ../common/scripts/allowance.ts 0xToken 0xOwner 0xSpender 1 --check 100 |
approve.ts | Send ERC-20 approval tx | npx tsx ../common/scripts/approve.ts 0xToken 0xSpender 1 --amount 1000 |
rpc.ts | Discover RPC from Chainlist | npx tsx ../common/scripts/rpc.ts 42161 --json |
All scripts support --json for machine-readable output and --rpc <url> to override RPC discovery.
| Error | Cause | Fix |
|---|---|---|
| No route found | Token pair not supported on chains | Check get_supported_chains and search_tokens |
| Insufficient allowance | Preflight should catch this | Send approval tx first, then retry |
| Slippage exceeded | Price moved during execution | Re-call create_tx or transaction_same_chain_swap for fresh quote |
| Amount too small | Below minimum amount | Increase amount or check minimum |
| Insufficient liquidity | Pool too small for amount | Reduce amount or try a different pair |
| Destination chain unsupported | Wrong chain ID format | Use deBridge chain IDs from ../common/chain-config.md |