@snowmonster_defi/sdk 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,368 @@
1
+ # @danaszova/avax-router-sdk
2
+
3
+ <div align="center">
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@danaszova/avax-router-sdk.svg?style=flat-square)](https://www.npmjs.com/package/@danaszova/avax-router-sdk)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@danaszova/avax-router-sdk.svg?style=flat-square)](https://www.npmjs.com/package/@danaszova/avax-router-sdk)
7
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@danaszova/avax-router-sdk?style=flat-square)](https://bundlephobia.com/package/@danaszova/avax-router-sdk)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg?style=flat-square)](https://www.typescriptlang.org/)
10
+ [![Live Demo](https://img.shields.io/badge/Live-Demo-brightgreen.svg?style=flat-square)](https://codesandbox.io/s/github/avax-router/sdk/tree/main/demo/codesandbox)
11
+
12
+ **🚀 The Most Powerful DEX Aggregator SDK on Avalanche**
13
+
14
+ *Stop manually checking multiple DEXes. Get the best swap rate with a single API call.*
15
+
16
+ [**Try Live Demo →**](https://codesandbox.io/s/avax-router-sdk-demo)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## What Problem Does This Solve?
23
+
24
+ Every DEX on Avalanche has different prices and liquidity. Finding the best swap rate means checking Trader Joe, Pangolin, and others manually. **This SDK does it for you automatically** - querying all DEXes in parallel and returning the best execution.
25
+
26
+ **Result:** Users get more tokens for their swaps. You earn partner fees. Everyone wins.
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ npm install @danaszova/avax-router-sdk
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Quick Start
39
+
40
+ ### 30-Second Example (Copy & Paste)
41
+
42
+ ```typescript
43
+ import { AvaxRouter } from '@danaszova/avax-router-sdk';
44
+
45
+ const router = new AvaxRouter();
46
+
47
+ // Get the best quote across all DEXes
48
+ const quote = await router.getBestQuote({
49
+ tokenIn: 'AVAX',
50
+ tokenOut: 'USDC',
51
+ amountIn: '1.0',
52
+ });
53
+
54
+ console.log(`You get: ${quote.amountOutFormatted} USDC`);
55
+ console.log(`Best DEX: ${quote.bestDex}`);
56
+ console.log(`Savings: ${quote.savingsVsWorst}% vs worst route`);
57
+ ```
58
+
59
+ ### React Example
60
+
61
+ ```tsx
62
+ import { useQuote, useSwap } from '@danaszova/avax-router-sdk/react';
63
+
64
+ function SwapWidget() {
65
+ const { quote, loading } = useQuote({
66
+ tokenIn: 'AVAX',
67
+ tokenOut: 'USDC',
68
+ amountIn: '1.0',
69
+ });
70
+
71
+ const { swap } = useSwap();
72
+
73
+ if (loading) return <div>Finding best price...</div>;
74
+
75
+ return (
76
+ <div>
77
+ <h2>Best Price: {quote?.amountOutFormatted} USDC</h2>
78
+ <p>via {quote?.bestDex}</p>
79
+ <button onClick={() => swap(quote, signer)}>Swap</button>
80
+ </div>
81
+ );
82
+ }
83
+ ```
84
+
85
+ ---
86
+
87
+ ## API Reference
88
+
89
+ ### Core SDK
90
+
91
+ #### `new AvaxRouter(config?)`
92
+
93
+ Create a new router instance.
94
+
95
+ | Option | Type | Default | Description |
96
+ |--------|------|---------|-------------|
97
+ | `apiUrl` | `string` | Production API | Custom API endpoint |
98
+ | `partnerId` | `string` | - | Your partner ID for fee sharing |
99
+ | `partnerAddress` | `string` | - | Address to receive partner fees |
100
+ | `partnerFeeBps` | `number` | 0 | Partner fee in basis points (max: 50 = 0.50%) |
101
+
102
+ #### `router.getBestQuote(params)`
103
+
104
+ Get the best quote across all supported DEXes.
105
+
106
+ ```typescript
107
+ const quote = await router.getBestQuote({
108
+ tokenIn: 'AVAX', // Token symbol or address
109
+ tokenOut: 'USDC', // Token symbol or address
110
+ amountIn: '1.0', // Amount as string
111
+ slippagePercent: 0.5, // Optional, default 0.5%
112
+ });
113
+ ```
114
+
115
+ **Returns:**
116
+ ```typescript
117
+ {
118
+ amountOut: string; // Raw output amount
119
+ amountOutFormatted: string; // Human-readable amount
120
+ bestDex: string; // DEX with best price
121
+ route: string[]; // Swap route path
122
+ priceImpact: number; // Price impact %
123
+ savingsVsWorst: number; // Savings vs worst DEX
124
+ }
125
+ ```
126
+
127
+ #### `router.getAllQuotes(params)`
128
+
129
+ Get quotes from all DEXes for comparison.
130
+
131
+ ```typescript
132
+ const quotes = await router.getAllQuotes({
133
+ tokenIn: 'AVAX',
134
+ tokenOut: 'USDC',
135
+ amountIn: '1.0',
136
+ });
137
+
138
+ quotes.forEach(q => {
139
+ console.log(`${q.dex}: ${q.amountOutFormatted}`);
140
+ });
141
+ ```
142
+
143
+ #### `router.swap(params, signer)`
144
+
145
+ Execute a swap with the best route.
146
+
147
+ ```typescript
148
+ import { ethers } from 'ethers';
149
+
150
+ const provider = new ethers.BrowserProvider(window.ethereum);
151
+ const signer = await provider.getSigner();
152
+
153
+ const result = await router.swap({
154
+ tokenIn: 'AVAX',
155
+ tokenOut: 'USDC',
156
+ amountIn: '1.0',
157
+ slippagePercent: 0.5,
158
+ }, signer);
159
+
160
+ console.log(`TX: ${result.txHash}`);
161
+ ```
162
+
163
+ #### `router.getSupportedTokens()`
164
+
165
+ Get list of all supported tokens.
166
+
167
+ #### `router.getSupportedDexes()`
168
+
169
+ Get list of all supported DEXes.
170
+
171
+ ---
172
+
173
+ ### React Hooks
174
+
175
+ #### `useQuote(params)`
176
+
177
+ React hook for fetching quotes with auto-refresh.
178
+
179
+ ```typescript
180
+ const {
181
+ quote, // Best quote
182
+ quotes, // All DEX quotes
183
+ loading, // Loading state
184
+ error, // Error object
185
+ refetch // Manual refetch function
186
+ } = useQuote({
187
+ tokenIn: 'AVAX',
188
+ tokenOut: 'USDC',
189
+ amountIn: '1.0',
190
+ autoFetch: true, // Auto-fetch on mount
191
+ refreshInterval: 10000, // Refresh every 10s
192
+ });
193
+ ```
194
+
195
+ #### `useSwap(config?)`
196
+
197
+ React hook for executing swaps.
198
+
199
+ ```typescript
200
+ const {
201
+ swap, // Execute swap function
202
+ txHash, // Transaction hash after swap
203
+ loading, // Loading state
204
+ error, // Error object
205
+ reset // Reset state
206
+ } = useSwap({
207
+ partnerId: 'your-id',
208
+ partnerFeeBps: 25,
209
+ });
210
+
211
+ // Execute
212
+ await swap({
213
+ tokenIn: 'AVAX',
214
+ tokenOut: 'USDC',
215
+ amountIn: '1.0',
216
+ }, signer);
217
+ ```
218
+
219
+ #### `useTokenPrice(token)`
220
+
221
+ Get real-time token price.
222
+
223
+ ```typescript
224
+ const { price, loading, error } = useTokenPrice('AVAX');
225
+ ```
226
+
227
+ #### `useWallet()`
228
+
229
+ Get wallet connection state.
230
+
231
+ ```typescript
232
+ const { address, isConnected, chainId } = useWallet();
233
+ ```
234
+
235
+ ---
236
+
237
+ ## 💰 Partner Fees (Monetize Your App!)
238
+
239
+ Earn up to **0.50%** on every swap through your integration:
240
+
241
+ ```typescript
242
+ const router = new AvaxRouter({
243
+ partnerId: 'my-dapp',
244
+ partnerAddress: '0xYourAddress',
245
+ partnerFeeBps: 25, // 0.25% fee
246
+ });
247
+ ```
248
+
249
+ | Daily Volume | Your Fee (0.25%) | Monthly Earnings |
250
+ |--------------|------------------|------------------|
251
+ | $10,000 | $25/day | $750 |
252
+ | $100,000 | $250/day | $7,500 |
253
+ | $1,000,000 | $2,500/day | $75,000 |
254
+
255
+ ---
256
+
257
+ ## Supported DEXes
258
+
259
+ | DEX | Type | Status |
260
+ |-----|------|--------|
261
+ | Trader Joe V1 | AMM | ✅ Live |
262
+ | Trader Joe V2 | Liquidity Book | ✅ Live |
263
+ | Pangolin | AMM | ✅ Live |
264
+
265
+ ---
266
+
267
+ ## Token Addresses
268
+
269
+ ```typescript
270
+ import { AVALANCHE_TOKENS } from '@danaszova/avax-router-sdk';
271
+
272
+ AVALANCHE_TOKENS.AVAX; // Native
273
+ AVALANCHE_TOKENS.WAVAX; // 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7
274
+ AVALANCHE_TOKENS.USDC; // 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E
275
+ AVALANCHE_TOKENS.USDT; // 0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7
276
+ AVALANCHE_TOKENS.JOE; // 0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd
277
+ AVALANCHE_TOKENS.PNG; // 0x60781C2586D68229fde47564546784ab3fACA982
278
+ ```
279
+
280
+ ---
281
+
282
+ ## TypeScript Support
283
+
284
+ Full TypeScript support with exported types:
285
+
286
+ ```typescript
287
+ import type {
288
+ Quote,
289
+ SwapParams,
290
+ SwapResult,
291
+ AvaxRouterConfig,
292
+ Token,
293
+ Dex,
294
+ UseQuoteOptions,
295
+ UseSwapOptions,
296
+ } from '@danaszova/avax-router-sdk';
297
+ ```
298
+
299
+ ---
300
+
301
+ ## Bundle Size
302
+
303
+ | Format | Size | Gzipped |
304
+ |--------|------|---------|
305
+ | ESM | ~7KB | ~2.5KB |
306
+ | CJS | ~8KB | ~2.8KB |
307
+
308
+ Tree-shakeable! Import only what you need.
309
+
310
+ ---
311
+
312
+ ## Requirements
313
+
314
+ - Node.js >= 16
315
+ - React >= 18 (for React hooks)
316
+ - ethers >= 6 (for swap execution)
317
+
318
+ ---
319
+
320
+ ## Framework Examples
321
+
322
+ ### Next.js App Router
323
+
324
+ ```typescript
325
+ // app/api/quote/route.ts
326
+ import { AvaxRouter } from '@danaszova/avax-router-sdk';
327
+
328
+ const router = new AvaxRouter();
329
+
330
+ export async function GET(req: Request) {
331
+ const { searchParams } = new URL(req.url);
332
+ const quote = await router.getBestQuote({
333
+ tokenIn: searchParams.get('from')!,
334
+ tokenOut: searchParams.get('to')!,
335
+ amountIn: searchParams.get('amount')!,
336
+ });
337
+ return Response.json(quote);
338
+ }
339
+ ```
340
+
341
+ ### wagmi/viem
342
+
343
+ ```tsx
344
+ import { useAccount, useWalletClient } from 'wagmi';
345
+ import { useQuote } from '@danaszova/avax-router-sdk/react';
346
+
347
+ function SwapComponent() {
348
+ const { data: walletClient } = useWalletClient();
349
+ const { quote } = useQuote({ tokenIn: 'AVAX', tokenOut: 'USDC', amountIn: '1' });
350
+ // Use walletClient to sign transactions
351
+ }
352
+ ```
353
+
354
+ ---
355
+
356
+ ## License
357
+
358
+ MIT © AVAX Router Team
359
+
360
+ ---
361
+
362
+ <div align="center">
363
+
364
+ **Built with ❤️ on Avalanche**
365
+
366
+ [Website](https://avax-router.com) · [Docs](https://docs.avax-router.com) · [Twitter](https://twitter.com/avaxrouter) · [Discord](https://discord.gg/avaxrouter)
367
+
368
+ </div>
@@ -0,0 +1,177 @@
1
+ /**
2
+ * AVAX Router SDK Types
3
+ */
4
+ interface AvaxRouterConfig {
5
+ /** API base URL (default: https://api.avaxrouter.com) */
6
+ apiUrl?: string;
7
+ /** Partner ID for fee sharing */
8
+ partnerId?: string;
9
+ /** Partner fee in basis points (max 50 = 0.50%) */
10
+ partnerFeeBps?: number;
11
+ /** Partner address to receive fees */
12
+ partnerAddress?: string;
13
+ }
14
+ interface TokenInfo {
15
+ address: string;
16
+ symbol: string;
17
+ name: string;
18
+ decimals: number;
19
+ logoURI?: string;
20
+ }
21
+ interface QuoteParams {
22
+ /** Input token address or symbol */
23
+ tokenIn: string;
24
+ /** Output token address or symbol */
25
+ tokenOut: string;
26
+ /** Amount of input tokens (in human-readable format) */
27
+ amountIn: string;
28
+ }
29
+ interface QuoteResult {
30
+ /** Input token address */
31
+ tokenIn: string;
32
+ /** Output token address */
33
+ tokenOut: string;
34
+ /** Amount in (raw) */
35
+ amountIn: bigint;
36
+ /** Expected amount out (raw) */
37
+ amountOut: bigint;
38
+ /** Amount out formatted for display */
39
+ amountOutFormatted: string;
40
+ /** Best DEX for this route */
41
+ bestDex: string;
42
+ /** All quotes from different DEXes */
43
+ allQuotes: DexQuote[];
44
+ /** Price impact */
45
+ priceImpact?: number;
46
+ /** Route path (for multi-hop) */
47
+ route?: string[];
48
+ /** Protocol fee in basis points */
49
+ protocolFeeBps: number;
50
+ /** Partner fee in basis points (if applicable) */
51
+ partnerFeeBps?: number;
52
+ /** Estimated gas cost */
53
+ estimatedGas?: bigint;
54
+ }
55
+ interface DexQuote {
56
+ /** DEX name */
57
+ dex: string;
58
+ /** Output amount (raw) */
59
+ amountOut: bigint;
60
+ /** Output amount formatted */
61
+ amountOutFormatted: string;
62
+ /** Whether this quote is the best */
63
+ isBest: boolean;
64
+ }
65
+ interface SwapParams extends QuoteParams {
66
+ /** Minimum output amount (slippage protection) */
67
+ minAmountOut?: string;
68
+ /** Slippage tolerance in percent (default: 0.5) */
69
+ slippagePercent?: number;
70
+ /** Recipient address (defaults to connected wallet) */
71
+ recipient?: string;
72
+ /** Deadline in seconds (default: 1200 = 20 min) */
73
+ deadline?: number;
74
+ }
75
+ interface SwapResult {
76
+ /** Transaction hash */
77
+ txHash: string;
78
+ /** Amount of tokens swapped */
79
+ amountIn: string;
80
+ /** Amount of tokens received */
81
+ amountOut: string;
82
+ /** DEX used for the swap */
83
+ dexUsed: string;
84
+ /** Protocol fee paid */
85
+ protocolFee: string;
86
+ /** Partner fee paid (if applicable) */
87
+ partnerFee?: string;
88
+ }
89
+ interface SwapStatus {
90
+ status: 'pending' | 'confirmed' | 'failed';
91
+ txHash?: string;
92
+ blockNumber?: number;
93
+ gasUsed?: bigint;
94
+ amountIn?: string;
95
+ amountOut?: string;
96
+ error?: string;
97
+ }
98
+ declare const AVALANCHE_TOKENS: {
99
+ readonly AVAX: "0x0000000000000000000000000000000000000000";
100
+ readonly WAVAX: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7";
101
+ readonly USDC: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E";
102
+ readonly USDT: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7";
103
+ readonly JOE: "0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd";
104
+ readonly PNG: "0x60781C2586D68229fde47564546784ab3fACA982";
105
+ };
106
+ declare const DEX_ROUTER_ADDRESS: `0x${string}`;
107
+ declare const API_ENDPOINTS: {
108
+ readonly mainnet: "https://api.avaxrouter.com";
109
+ readonly testnet: "https://api-testnet.avaxrouter.com";
110
+ readonly local: "http://localhost:3000";
111
+ };
112
+
113
+ /**
114
+ * AVAX Router SDK Client
115
+ *
116
+ * Main entry point for interacting with AVAX Router
117
+ */
118
+
119
+ declare class AvaxRouter {
120
+ private apiUrl;
121
+ private partnerId?;
122
+ private partnerFeeBps?;
123
+ private partnerAddress?;
124
+ constructor(config?: AvaxRouterConfig);
125
+ /**
126
+ * Get the best quote across all DEXes
127
+ */
128
+ getBestQuote(params: QuoteParams): Promise<QuoteResult>;
129
+ /**
130
+ * Get quotes from all DEXes
131
+ */
132
+ getAllQuotes(params: QuoteParams): Promise<QuoteResult[]>;
133
+ /**
134
+ * Prepare a swap transaction (returns unsigned transaction data)
135
+ */
136
+ prepareSwap(params: SwapParams): Promise<{
137
+ to: string;
138
+ data: string;
139
+ value: string;
140
+ gasLimit?: string;
141
+ }>;
142
+ /**
143
+ * Execute a swap (requires signer - use with ethers.js or viem)
144
+ *
145
+ * @example
146
+ * // With ethers.js
147
+ * const router = new AvaxRouter();
148
+ * const signer = await ethers.getSigner();
149
+ * const result = await router.swap({ tokenIn: 'AVAX', tokenOut: 'USDC', amountIn: '1.0' }, signer);
150
+ */
151
+ swap(params: SwapParams, signer: any): Promise<SwapResult>;
152
+ /**
153
+ * Get the status of a swap transaction
154
+ */
155
+ getSwapStatus(txHash: string): Promise<SwapStatus>;
156
+ /**
157
+ * Get list of supported tokens
158
+ */
159
+ getSupportedTokens(): Promise<Array<{
160
+ address: string;
161
+ symbol: string;
162
+ name: string;
163
+ decimals: number;
164
+ logoURI?: string;
165
+ }>>;
166
+ /**
167
+ * Get list of supported DEXes
168
+ */
169
+ getSupportedDexes(): Promise<Array<{
170
+ name: string;
171
+ adapter: string;
172
+ version: string;
173
+ }>>;
174
+ }
175
+ declare function getClient(config?: AvaxRouterConfig): AvaxRouter;
176
+
177
+ export { API_ENDPOINTS, AVALANCHE_TOKENS, AvaxRouter, type AvaxRouterConfig, DEX_ROUTER_ADDRESS, type DexQuote, type QuoteParams, type QuoteResult, type SwapParams, type SwapResult, type SwapStatus, type TokenInfo, getClient };
@@ -0,0 +1,177 @@
1
+ /**
2
+ * AVAX Router SDK Types
3
+ */
4
+ interface AvaxRouterConfig {
5
+ /** API base URL (default: https://api.avaxrouter.com) */
6
+ apiUrl?: string;
7
+ /** Partner ID for fee sharing */
8
+ partnerId?: string;
9
+ /** Partner fee in basis points (max 50 = 0.50%) */
10
+ partnerFeeBps?: number;
11
+ /** Partner address to receive fees */
12
+ partnerAddress?: string;
13
+ }
14
+ interface TokenInfo {
15
+ address: string;
16
+ symbol: string;
17
+ name: string;
18
+ decimals: number;
19
+ logoURI?: string;
20
+ }
21
+ interface QuoteParams {
22
+ /** Input token address or symbol */
23
+ tokenIn: string;
24
+ /** Output token address or symbol */
25
+ tokenOut: string;
26
+ /** Amount of input tokens (in human-readable format) */
27
+ amountIn: string;
28
+ }
29
+ interface QuoteResult {
30
+ /** Input token address */
31
+ tokenIn: string;
32
+ /** Output token address */
33
+ tokenOut: string;
34
+ /** Amount in (raw) */
35
+ amountIn: bigint;
36
+ /** Expected amount out (raw) */
37
+ amountOut: bigint;
38
+ /** Amount out formatted for display */
39
+ amountOutFormatted: string;
40
+ /** Best DEX for this route */
41
+ bestDex: string;
42
+ /** All quotes from different DEXes */
43
+ allQuotes: DexQuote[];
44
+ /** Price impact */
45
+ priceImpact?: number;
46
+ /** Route path (for multi-hop) */
47
+ route?: string[];
48
+ /** Protocol fee in basis points */
49
+ protocolFeeBps: number;
50
+ /** Partner fee in basis points (if applicable) */
51
+ partnerFeeBps?: number;
52
+ /** Estimated gas cost */
53
+ estimatedGas?: bigint;
54
+ }
55
+ interface DexQuote {
56
+ /** DEX name */
57
+ dex: string;
58
+ /** Output amount (raw) */
59
+ amountOut: bigint;
60
+ /** Output amount formatted */
61
+ amountOutFormatted: string;
62
+ /** Whether this quote is the best */
63
+ isBest: boolean;
64
+ }
65
+ interface SwapParams extends QuoteParams {
66
+ /** Minimum output amount (slippage protection) */
67
+ minAmountOut?: string;
68
+ /** Slippage tolerance in percent (default: 0.5) */
69
+ slippagePercent?: number;
70
+ /** Recipient address (defaults to connected wallet) */
71
+ recipient?: string;
72
+ /** Deadline in seconds (default: 1200 = 20 min) */
73
+ deadline?: number;
74
+ }
75
+ interface SwapResult {
76
+ /** Transaction hash */
77
+ txHash: string;
78
+ /** Amount of tokens swapped */
79
+ amountIn: string;
80
+ /** Amount of tokens received */
81
+ amountOut: string;
82
+ /** DEX used for the swap */
83
+ dexUsed: string;
84
+ /** Protocol fee paid */
85
+ protocolFee: string;
86
+ /** Partner fee paid (if applicable) */
87
+ partnerFee?: string;
88
+ }
89
+ interface SwapStatus {
90
+ status: 'pending' | 'confirmed' | 'failed';
91
+ txHash?: string;
92
+ blockNumber?: number;
93
+ gasUsed?: bigint;
94
+ amountIn?: string;
95
+ amountOut?: string;
96
+ error?: string;
97
+ }
98
+ declare const AVALANCHE_TOKENS: {
99
+ readonly AVAX: "0x0000000000000000000000000000000000000000";
100
+ readonly WAVAX: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7";
101
+ readonly USDC: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E";
102
+ readonly USDT: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7";
103
+ readonly JOE: "0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd";
104
+ readonly PNG: "0x60781C2586D68229fde47564546784ab3fACA982";
105
+ };
106
+ declare const DEX_ROUTER_ADDRESS: `0x${string}`;
107
+ declare const API_ENDPOINTS: {
108
+ readonly mainnet: "https://api.avaxrouter.com";
109
+ readonly testnet: "https://api-testnet.avaxrouter.com";
110
+ readonly local: "http://localhost:3000";
111
+ };
112
+
113
+ /**
114
+ * AVAX Router SDK Client
115
+ *
116
+ * Main entry point for interacting with AVAX Router
117
+ */
118
+
119
+ declare class AvaxRouter {
120
+ private apiUrl;
121
+ private partnerId?;
122
+ private partnerFeeBps?;
123
+ private partnerAddress?;
124
+ constructor(config?: AvaxRouterConfig);
125
+ /**
126
+ * Get the best quote across all DEXes
127
+ */
128
+ getBestQuote(params: QuoteParams): Promise<QuoteResult>;
129
+ /**
130
+ * Get quotes from all DEXes
131
+ */
132
+ getAllQuotes(params: QuoteParams): Promise<QuoteResult[]>;
133
+ /**
134
+ * Prepare a swap transaction (returns unsigned transaction data)
135
+ */
136
+ prepareSwap(params: SwapParams): Promise<{
137
+ to: string;
138
+ data: string;
139
+ value: string;
140
+ gasLimit?: string;
141
+ }>;
142
+ /**
143
+ * Execute a swap (requires signer - use with ethers.js or viem)
144
+ *
145
+ * @example
146
+ * // With ethers.js
147
+ * const router = new AvaxRouter();
148
+ * const signer = await ethers.getSigner();
149
+ * const result = await router.swap({ tokenIn: 'AVAX', tokenOut: 'USDC', amountIn: '1.0' }, signer);
150
+ */
151
+ swap(params: SwapParams, signer: any): Promise<SwapResult>;
152
+ /**
153
+ * Get the status of a swap transaction
154
+ */
155
+ getSwapStatus(txHash: string): Promise<SwapStatus>;
156
+ /**
157
+ * Get list of supported tokens
158
+ */
159
+ getSupportedTokens(): Promise<Array<{
160
+ address: string;
161
+ symbol: string;
162
+ name: string;
163
+ decimals: number;
164
+ logoURI?: string;
165
+ }>>;
166
+ /**
167
+ * Get list of supported DEXes
168
+ */
169
+ getSupportedDexes(): Promise<Array<{
170
+ name: string;
171
+ adapter: string;
172
+ version: string;
173
+ }>>;
174
+ }
175
+ declare function getClient(config?: AvaxRouterConfig): AvaxRouter;
176
+
177
+ export { API_ENDPOINTS, AVALANCHE_TOKENS, AvaxRouter, type AvaxRouterConfig, DEX_ROUTER_ADDRESS, type DexQuote, type QuoteParams, type QuoteResult, type SwapParams, type SwapResult, type SwapStatus, type TokenInfo, getClient };