This package contains the Synapse Protocol Cross-Chain Swap and Bridging SDK
The Synapse SDK allows you to interact with Synapse Protocol routers and bridges. It handles:
- Getting bridge quotes, performing bridging operations
- Getting swap quotes, performing swaps
- Getting liquidity pool information
- Calculating add/remove liquidity amounts
npm install @synapsecs/sdk-router
To use the SDK, first instantiate it with chain IDs and Ethereum providers:
import { SynapseSDK } from '@synapsecs/sdk-router'
const chainIds = [1, 42161, 10]
// Replace with JSON providers
const providers = [ethereumProvider, arbitrumProvider, optimismProvider]
const synapseSDK = new SynapseSDK(chainIds, providers)
Get a bridge quote from the Synapse Bridge Router:
const { maxAmountOut, originQuery, destQuery, feeConfig, routerAddress } =
await Synapse.bridgeQuote(
1,
42161,
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
'0xaf88d065e77c8cc2239327c5edb3a432268e5831',
BigNumber.from('100000000')
)
Perform a bridge through a Synapse Bridge Router or Synapse CCTP Router:
const { data, to } = await Synapse.bridge(
addressTo,
routerAddress,
originChain,
destinationChain,
tokenIn,
amountIn,
originQuery,
destQuery
)
The Synapse SDK allows quick and easy interaction with Synapse Protocol routers and bridges across multiple chains