Docs
Docs/Quick Start

Quick Start

Start routing cross-chain transfers with MNMX in under 5 minutes.

Installation

bash
1git clone https://github.com/MEMX-labs/mnmx.git
2cd mnmx
3npm install
4npm run build

Basic Usage

typescript
1import { MnmxRouter } from '@mnmx/core';
2
3// Initialize the router
4const router = new MnmxRouter({
5 strategy: 'minimax',
6 slippageTolerance: 0.5,
7});
8
9// Find the optimal route
10const route = await router.findRoute({
11 from: { chain: 'ethereum', token: 'ETH', amount: '1.0' },
12 to: { chain: 'solana', token: 'SOL' },
13});
14
15// Inspect the result
16console.log(route.path); // Route hops
17console.log(route.expectedOutput); // Best-case output
18console.log(route.guaranteedMinimum); // Minimax (worst-case) output
19console.log(route.estimatedTime); // Expected transfer time
20console.log(route.totalFees); // Total fees across all hops
21
22// Execute the route
23const result = await router.execute(route, { signer });
24console.log(result.txHash);
25console.log(result.actualOutput);

Strategy Options

typescript
1// Minimax (default) — best guaranteed minimum
2const router = new MnmxRouter({ strategy: 'minimax' });
3
4// Cheapest — lowest total fees
5const router = new MnmxRouter({ strategy: 'cheapest' });
6
7// Fastest — shortest transfer time
8const router = new MnmxRouter({ strategy: 'fastest' });
9
10// Safest — highest bridge reliability
11const 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

ChainBridges Available
EthereumWormhole, deBridge, LayerZero, Allbridge
SolanaWormhole, deBridge, Allbridge
ArbitrumWormhole, deBridge, LayerZero
BaseWormhole, LayerZero
PolygonWormhole, LayerZero, Allbridge
BNB ChaindeBridge, LayerZero, Allbridge
OptimismWormhole, LayerZero
AvalancheWormhole, LayerZero, Allbridge

Next Steps