Welcome to deBridge API Integrator Examples
This collection provides hands-on examples for integrating deBridge’s cross-chain liquidity network into your applications. Whether you’re building a DEX aggregator, wallet, or DeFi protocol, these examples will help you implement cross-chain swaps, hooks, and affiliate programs.What is deBridge?
deBridge is a cross-chain liquidity network that enables fast, secure transfers between 30+ blockchains including Ethereum, Polygon, Arbitrum, Solana, BNB Chain, and more. The deBridge Liquidity Network (DLN) allows you to:- Execute cross-chain token swaps with competitive rates
- Attach custom logic via hooks for advanced use cases
- Earn affiliate fees by integrating deBridge into your application
- Query order status and transaction history
Key features
Cross-chain orders
Swap tokens between 30+ chains with automatic routing and competitive pricing
Smart hooks
Execute custom logic on the destination chain, like supplying to Aave or staking
Affiliate program
Earn fees on every transaction by integrating deBridge into your platform
Order management
Track, query, and cancel orders with comprehensive status endpoints
Example categories
This repository contains several categories of integration examples:Orders
The most common use case - basic cross-chain token swaps:- EVM to EVM: Polygon USDC → Arbitrum USDC
- EVM to Solana: Base USDC → Solana USDC
- Solana to EVM: Solana SOL → Polygon USDC
- TRON support: TRON USDT → Solana USDC
/src/scripts/orders/
Hooks
Advanced examples that execute custom logic after cross-chain transfers:- EVM to EVM hooks: Transfer USDC from Arbitrum to Polygon and automatically supply to Aave
- Solana to EVM hooks: Bridge from Solana and execute custom contract calls
/src/scripts/hooks/
Affiliates
Examples for earning fees and managing affiliate rewards:- Create orders with affiliate fee percentages (10 basis points = 0.1%)
- Batch withdraw accumulated fees from Solana
- Query orders by referral code
/src/scripts/affiliates/ and /src/scripts/orders/affiliate/
Queries
Utility scripts for tracking and managing orders:- Get order status by ID or transaction hash
- List all orders for a specific address (paginated)
- Query orders by referral code
- Get HyperEVM funding sources
/src/scripts/orders/queries/
Supported chains
The examples support 30+ chains with deBridge-specific chain IDs. Major chains include:deBridge uses internal chain IDs which may differ from standard chain IDs for some chains. Always use the chain IDs from
/src/utils/chains.ts or fetch them from the supported chains API.Architecture overview
The repository is organized for easy exploration and extension:Next steps
Set up your environment
Configure Node.js, install dependencies, and set up environment variablesGo to setup guide →
Run your first example
Execute a cross-chain swap from Polygon to Arbitrum in under 5 minutesGo to quickstart →
Explore advanced examples
Learn about hooks, affiliates, and order managementBrowse all examples →