Skip to main content

Introduction

Cross-chain orders enable you to transfer tokens between different blockchains using deBridge’s decentralized liquidity network. You can bridge tokens between EVM chains (Ethereum, Polygon, Arbitrum, BNB Chain), Solana, and Tron.

How It Works

A cross-chain order involves:
  1. Creating an order - Call createDebridgeBridgeOrder with source and destination chain details
  2. Approving tokens - For EVM chains, approve the deBridge contract to spend your tokens
  3. Submitting the transaction - Send the transaction on the source chain
  4. Receiving tokens - Tokens arrive on the destination chain after fulfillment

Supported Routes

You can create cross-chain orders between:

EVM to EVM

Transfer tokens between Ethereum, Polygon, Arbitrum, BNB Chain, and other EVM chains

EVM to Solana

Bridge tokens from EVM chains to Solana

Solana to EVM

Bridge tokens from Solana to EVM chains

Tron to Solana

Transfer tokens from Tron to Solana

Order Parameters

All cross-chain orders require these core parameters:
ParameterDescriptionExample
srcChainIdSource chain ID'137' (Polygon)
srcChainTokenInToken address on source chain'0x...'
srcChainTokenInAmountAmount in token’s smallest unit'5000000' (5 USDC)
dstChainIdDestination chain ID'42161' (Arbitrum)
dstChainTokenOutToken address on destination chain'0x...'
dstChainTokenOutRecipientRecipient address'0x...' or Solana address
accountSender’s wallet address'0x...'

Optional Parameters

You can customize orders with optional parameters:

Authority Addresses

const orderInput = {
  // ... required parameters
  srcChainOrderAuthorityAddress: wallet.address,
  dstChainOrderAuthorityAddress: recipientAddress,
};

Affiliate Fees

Earn fees by adding affiliate parameters:
const orderInput = {
  // ... required parameters
  affiliateFeePercent: 0.1, // 0.1% fee
  affiliateFeeRecipient: wallet.address,
};

Referral Code

const orderInput = {
  // ... required parameters
  referralCode: 31805,
};

Token Approval (EVM Chains)

When bridging from EVM chains, you must approve the deBridge contract to spend your tokens:
const tokenContract = new Contract(
  orderInput.srcChainTokenIn,
  erc20Abi,
  signer
);

// Check current allowance
const currentAllowance = await tokenContract.allowance(
  senderAddress,
  spenderAddress
);

// Approve if needed
if (currentAllowance < requiredAmount) {
  const approveTx = await tokenContract.approve(
    spenderAddress,
    requiredAmount
  );
  await approveTx.wait();
}

Error Handling

Always implement proper error handling:
try {
  const order = await createDebridgeBridgeOrder(orderInput);
  
  if (!order?.tx?.to || !order?.tx?.data) {
    throw new Error("Invalid order response");
  }
  
  // Submit transaction
  const txResponse = await signer.sendTransaction(order.tx);
  await txResponse.wait();
  
} catch (error) {
  console.error("Bridge order failed:", error);
  process.exitCode = 1;
}

Order Estimation

The order response includes estimation data:
const order = await createDebridgeBridgeOrder(orderInput);

console.log("Input amount:", order.estimation.srcChainTokenIn.amount);
console.log("Output amount:", order.estimation.dstChainTokenOut.amount);
console.log("Fees:", order.estimation.fees);

Next Steps

Explore specific cross-chain transfer examples:

Build docs developers (and LLMs) love