Documentation Index
Fetch the complete documentation index at: https://mintlify.com/1inch/cross-chain-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Cross-chain swaps made simple
Build atomic swaps between EVM chains and Solana using the 1inch Fusion+ protocol. Secure, trustless, and developer-friendly.
Quick start
Get your first cross-chain swap running in minutes
Install the SDK
Install via npm, yarn, or pnpm:npm install @1inch/cross-chain-sdk
Initialize the SDK
Set up your SDK instance with authentication:import { SDK, PrivateKeyProviderConnector } from '@1inch/cross-chain-sdk'
import Web3 from 'web3'
const sdk = new SDK({
url: 'https://api.1inch.com/fusion-plus',
authKey: 'your-auth-key',
blockchainProvider: new PrivateKeyProviderConnector(privateKey, web3)
})
Create your first swap
Execute a cross-chain swap from Polygon to Binance:import { NetworkEnum, HashLock, PresetEnum } from '@1inch/cross-chain-sdk'
import { randomBytes } from 'crypto'
// Get quote
const quote = await sdk.getQuote({
amount: '10000000',
srcChainId: NetworkEnum.POLYGON,
dstChainId: NetworkEnum.BINANCE,
srcTokenAddress: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', // USDT
dstTokenAddress: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', // BNB
enableEstimate: true,
walletAddress
})
// Generate secrets
const secrets = Array.from({ length: quote.presets[PresetEnum.fast].secretsCount })
.map(() => '0x' + randomBytes(32).toString('hex'))
const hashLock = secrets.length === 1
? HashLock.forSingleFill(secrets[0])
: HashLock.forMultipleFills(HashLock.getMerkleLeaves(secrets))
// Create and submit order
const { hash, order, quoteId } = await sdk.createOrder(quote, {
walletAddress,
hashLock,
preset: PresetEnum.fast,
secretHashes: secrets.map(s => HashLock.hashSecret(s))
})
await sdk.submitOrder(quote.srcChainId, order, quoteId, secretHashes)
Explore by topic
Learn the core concepts and dive into advanced features
Core Concepts
Understand atomic swaps, hash locks, and the Fusion+ protocol
EVM to EVM Swaps
Execute cross-chain swaps between Ethereum, Polygon, Arbitrum, and more
Solana Integration
Bridge assets between Solana and EVM chains seamlessly
WebSocket API
Track orders in real-time with WebSocket subscriptions
Integrator Fees
Collect fees on swaps routed through your application
Order Tracking
Monitor order status, handle secrets, and manage refunds
Key features
Everything you need for secure cross-chain swaps
Trustless Escrow
Hash-lock based atomic swaps ensure funds are secure without trusted intermediaries
Multi-Chain Support
Swap between Ethereum, Polygon, Arbitrum, Optimism, Avalanche, Solana, and more
Type-Safe API
Full TypeScript support with comprehensive type definitions and IDE autocomplete
Fee Collection
Earn integrator fees on every swap routed through your application
Ready to start building?
Follow our quickstart guide to execute your first cross-chain swap in under 5 minutes
View Quickstart Guide