Quick Start
Start routing cross-chain transfers with MNMX in under 5 minutes.
Installation
bash
1git clone https://github.com/MEMX-labs/mnmx.git2cd mnmx3npm install4npm run buildBasic Usage
typescript
1import { MnmxRouter } from '@mnmx/core';2
3// Initialize the router4const router = new MnmxRouter({5 strategy: 'minimax',6 slippageTolerance: 0.5,7});8
9// Find the optimal route10const route = await router.findRoute({11 from: { chain: 'ethereum', token: 'ETH', amount: '1.0' },12 to: { chain: 'solana', token: 'SOL' },13});14
15// Inspect the result16console.log(route.path); // Route hops17console.log(route.expectedOutput); // Best-case output18console.log(route.guaranteedMinimum); // Minimax (worst-case) output19console.log(route.estimatedTime); // Expected transfer time20console.log(route.totalFees); // Total fees across all hops21
22// Execute the route23const result = await router.execute(route, { signer });24console.log(result.txHash);25console.log(result.actualOutput);Strategy Options
typescript
1// Minimax (default) — best guaranteed minimum2const router = new MnmxRouter({ strategy: 'minimax' });3
4// Cheapest — lowest total fees5const router = new MnmxRouter({ strategy: 'cheapest' });6
7// Fastest — shortest transfer time8const router = new MnmxRouter({ strategy: 'fastest' });9
10// Safest — highest bridge reliability11const router = new MnmxRouter({ strategy: 'safest' });Compare Routes
View all candidate routes before choosing:
typescript
1const routes = await router.findAllRoutes({2 from: { chain: 'ethereum', token: 'ETH', amount: '1.0' },3 to: { chain: 'solana', token: 'SOL' },4});5
6for (const route of routes) {7 console.log(`${route.path.join(' → ')}`);8 console.log(` Expected: ${route.expectedOutput} SOL`);9 console.log(` Minimum: ${route.guaranteedMinimum} SOL`);10 console.log(` Fees: ${route.totalFees}`);11 console.log(` Time: ${route.estimatedTime}`);12 console.log();13}Supported Chains
| Chain | Bridges Available |
|---|---|
| Ethereum | Wormhole, deBridge, LayerZero, Allbridge |
| Solana | Wormhole, deBridge, Allbridge |
| Arbitrum | Wormhole, deBridge, LayerZero |
| Base | Wormhole, LayerZero |
| Polygon | Wormhole, LayerZero, Allbridge |
| BNB Chain | deBridge, LayerZero, Allbridge |
| Optimism | Wormhole, LayerZero |
| Avalanche | Wormhole, LayerZero, Allbridge |
Next Steps
- Read the Architecture guide to understand the system design
- Explore the Routing Engine for the path discovery deep dive
- Learn about the Minimax Algorithm and why it produces better outcomes
- Check Bridge Adapters for supported bridges and how to add new ones