Overview
The Bridging SDK enables cross-chain token swaps by combining CoW Protocol swaps with bridge providers like Across and Bungee. It automatically routes trades through optimal paths and manages the bridging process.Installation
BridgingSdk
Main SDK class for bridging tokens between different chains.Constructor
BridgingSdkOptions
required
Configuration options for the SDK
BridgeProvider[]
required
Array of bridge providers (e.g., AcrossBridgeProvider, BungeeBridgeProvider)
TradingSdk
Optional TradingSdk instance. Creates a new one if not provided.
OrderBookApi
Optional OrderBookApi instance
boolean
Enable debug logging
AbstractProviderAdapter
Optional provider adapter (ethers v5, ethers v6, or viem)
getQuote()
Get a cross-chain quote with a callback to post the order.QuoteBridgeRequest
required
Quote parameters
OrderKind
required
Order type:
OrderKind.SELL or OrderKind.BUYbigint
required
Amount to sell or buy (in token atoms)
SupportedChainId
required
Source chain ID
string
required
Sell token contract address
number
required
Sell token decimals
TargetChainId
required
Destination chain ID
string
required
Buy token contract address
number
required
Buy token decimals
SignerLike
required
Wallet signer
string
Order owner address (defaults to signer address)
number
Slippage tolerance for the swap in basis points
number
Slippage tolerance for the bridge in basis points
SwapAdvancedSettings
Optional advanced settings for the swap
CrossChainQuoteAndPost
Returns either
QuoteAndPost for same-chain swaps or BridgeQuoteAndPost for cross-chain swapsQuoteResults
CoW Protocol swap quote details
BridgeQuoteResults
function
Callback function to post the order on-chain
getMultiQuotes()
Get quotes from multiple bridge providers in parallel with progressive results.MultiQuoteRequest
required
Multi-quote request parameters
QuoteBridgeRequest
required
Base quote parameters
string[]
Optional array of provider IDs to query. If not provided, queries all available providers.
MultiQuoteResult[]
getBestQuote()
Get the best quote from multiple providers based on buyAmount after slippage.MultiQuoteRequest
required
Same parameters as
getMultiQuotes()MultiQuoteResult | null
The best quote result found, or null if no successful quotes
getSourceNetworks()
Get available source networks for bridging.ChainInfo[]
Array of supported source chain information
getTargetNetworks()
Get available target networks for bridging.ChainInfo[]
Array of supported destination chains across all providers
getBuyTokens()
Get available buy tokens for a specific target chain.BuyTokensParams
required
GetProviderBuyTokens
getOrder()
Get details about a cross-chain order.GetOrderParams
required
CrossChainOrder | null
Order details including bridge status, or null if not found