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
options BridgingSdkOptions
required
Configuration options for the SDK Array of bridge providers (e.g., AcrossBridgeProvider, BungeeBridgeProvider)
Optional TradingSdk instance. Creates a new one if not provided.
Optional OrderBookApi instance
Cache configuration settings options.cacheConfig.enabled Enable caching for networks and tokens
options.cacheConfig.intermediateTokensTtl TTL in milliseconds for intermediate tokens cache (default: 5 minutes)
options.cacheConfig.buyTokensTtl TTL in milliseconds for buy tokens cache (default: 2 minutes)
Optional provider adapter (ethers v5, ethers v6, or viem)
getQuote()
Get a cross-chain quote with a callback to post the order.
quoteBridgeRequest QuoteBridgeRequest
required
Quote parameters Order type: OrderKind.SELL or OrderKind.BUY
quoteBridgeRequest.amount Amount to sell or buy (in token atoms)
quoteBridgeRequest.sellTokenChainId Source chain ID
quoteBridgeRequest.sellTokenAddress Sell token contract address
quoteBridgeRequest.sellTokenDecimals Sell token decimals
quoteBridgeRequest.buyTokenChainId Destination chain ID
quoteBridgeRequest.buyTokenAddress Buy token contract address
quoteBridgeRequest.buyTokenDecimals Buy token decimals
quoteBridgeRequest.signer Wallet signer
Order owner address (defaults to signer address)
quoteBridgeRequest.swapSlippageBps Slippage tolerance for the swap in basis points
quoteBridgeRequest.bridgeSlippageBps Slippage tolerance for the bridge in basis points
Optional advanced settings for the swap
Returns either QuoteAndPost for same-chain swaps or BridgeQuoteAndPost for cross-chain swaps:
CoW Protocol swap quote details
Bridge quote details (only for cross-chain swaps) amountsAndCosts BridgeQuoteAmountsAndCosts
Bridging amounts and costs breakdown
Bridge fees Relayer capital cost fee (in token atoms)
Destination gas fee (in token atoms)
Estimated time to complete the bridge
Callback function to post the order on-chain
getMultiQuotes()
Get quotes from multiple bridge providers in parallel with progressive results.
request MultiQuoteRequest
required
Multi-quote request parameters request.quoteBridgeRequest QuoteBridgeRequest
required
Base quote parameters
Optional array of provider IDs to query. If not provided, queries all available providers.
Optional behavior configuration request.options.onQuoteResult Callback invoked as soon as each provider returns a result
request.options.totalTimeout Maximum time to wait for all providers (milliseconds)
request.options.providerTimeout Maximum time to wait for each provider (milliseconds)
Array of results from each provider quote BridgeQuoteAndPost | null
Quote result, or null if the provider failed
Error if the provider failed
getBestQuote()
Get the best quote from multiple providers based on buyAmount after slippage.
Same parameters as getMultiQuotes()
The best quote result found, or null if no successful quotes
getSourceNetworks()
Get available source networks for bridging.
Array of supported source chain information
getTargetNetworks()
Get available target networks for bridging.
Array of supported destination chains across all providers
getBuyTokens()
Get available buy tokens for a specific target chain.
params GetBuyTokensParams
required
Token query parameters Source chain ID (for filtering)
Sell token address (for filtering)
Array of available buy tokens
Whether any route is available
getOrder()
Get details about a cross-chain order.
Chain where order was settled
Environment (‘prod’ or ‘staging’)
Order details including bridge status, or null if not found
Cache Management
The SDK provides methods to manage the internal cache.
Bridge Providers
AcrossBridgeProvider
Bridge provider using the Across Protocol.
BungeeBridgeProvider
Bridge provider using Bungee (Socket).
NearIntentsBridgeProvider
Bridge provider for NEAR Protocol intents.
Types
QuoteBridgeRequest
Parameters for requesting a bridge quote.
BridgeQuoteResult
Result of a bridge quote request.
BridgeQuoteAndPost
Combined quote result for cross-chain swaps.
Examples
Basic Cross-Chain Swap
Compare Multiple Providers
Get Available Tokens