npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@danaszova/avax-router-sdk

v1.0.1

Published

🚀 The most powerful DEX aggregator SDK on Avalanche. Get the best swap rates across Trader Joe, Pangolin & more with a single API call. Features React hooks, TypeScript support, and partner fee sharing up to 0.50%.

Downloads

229

Readme

@danaszova/avax-router-sdk

🚀 The Most Powerful DEX Aggregator SDK on Avalanche

No favorites. No games. Just the best price.

npm version License: MIT TypeScript

One API call. Multiple DEXes. Best execution.

Quick Start · React Hooks · API Reference · Monetize


Why AVAX Router SDK?

🔥 Best Price Guaranteed - Aggregates liquidity from all major Avalanche DEXes to find you the optimal route

Lightning Fast - Sub-second quotes with intelligent caching and parallel DEX queries

💰 Monetize Your App - Earn up to 0.50% partner fee on every swap through your integration

🪝 React Hooks - Beautiful, type-safe React hooks for seamless integration

📝 Full TypeScript - Comprehensive types for excellent DX and fewer bugs

🔧 Framework Agnostic - Core SDK works with any JavaScript framework

Installation

# npm
npm install @danaszova/avax-router-sdk

# yarn
yarn add @danaszova/avax-router-sdk

# pnpm
pnpm add @danaszova/avax-router-sdk

Quick Start

Core SDK (Headless)

import { AvaxRouter } from '@danaszova/avax-router-sdk';

const router = new AvaxRouter();

// Get the best quote across all DEXes
const quote = await router.getBestQuote({
  tokenIn: 'AVAX',
  tokenOut: 'USDC',
  amountIn: '1.0',
});

console.log(`Best price: ${quote.amountOutFormatted} USDC`);
console.log(`Route: ${quote.route}`);
console.log(`DEX: ${quote.bestDex}`);

React SDK

import { useQuote, useSwap } from '@danaszova/avax-router-sdk/react';

function SwapWidget() {
  const { quote, loading, error } = useQuote({
    tokenIn: 'AVAX',
    tokenOut: 'USDC',
    amountIn: '1.0',
  });

  const { swap, loading: swapping } = useSwap();

  if (loading) return <div>Finding best price...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <div>
      <p>💰 You get: {quote?.amountOutFormatted} USDC</p>
      <p>📍 Route: {quote?.route}</p>
      <p>🏢 Best DEX: {quote?.bestDex}</p>
      <button onClick={() => swap({ ... }, signer)} disabled={swapping}>
        {swapping ? 'Swapping...' : 'Swap'}
      </button>
    </div>
  );
}

💰 Partner Fees - Monetize Your App!

Earn revenue by integrating AVAX Router. Set your partner fee (up to 0.50%):

const router = new AvaxRouter({
  partnerId: 'your-partner-id',
  partnerAddress: '0xYourAddress',
  partnerFeeBps: 25, // 0.25% fee on every swap
});

Fee Structure: | Fee Type | Amount | Goes To | |----------|--------|---------| | Protocol fee | 0.05% | AVAX Router | | Partner fee | 0% - 0.50% | YOU | | Total | 0.05% - 0.55% | |

Example earnings:

  • $100,000 daily volume × 0.25% = $250/day in partner fees
  • $1M daily volume × 0.25% = $2,500/day in partner fees

Supported DEXes

| DEX | Type | Status | |-----|------|--------| | Trader Joe V1 | AMM | ✅ Live | | Trader Joe V2 | Liquidity Book | ✅ Live | | Pangolin | AMM | ✅ Live | | More coming soon | | 🚧 |

API Reference

AvaxRouter Class

Main client for interacting with AVAX Router.

const router = new AvaxRouter({
  apiUrl: 'https://api.avax-router.com',  // Optional
  partnerId: 'your-partner-id',           // Optional
  partnerAddress: '0xYourAddress',        // Optional
  partnerFeeBps: 25,                      // Optional, max 50
});

Methods

| Method | Description | Returns | |--------|-------------|---------| | getBestQuote(params) | Get best quote across all DEXes | Promise<Quote> | | getAllQuotes(params) | Get quotes from each DEX | Promise<Quote[]> | | prepareSwap(params) | Prepare unsigned transaction | Promise<TxData> | | swap(params, signer) | Execute swap with signer | Promise<TxResult> | | getSwapStatus(txHash) | Check transaction status | Promise<Status> | | getSupportedTokens() | List supported tokens | Promise<Token[]> | | getSupportedDexes() | List supported DEXes | Promise<Dex[]> |

React Hooks

useQuote

const { 
  quote,      // Best quote result
  quotes,     // All DEX quotes
  loading,    // Loading state
  error,      // Error if any
  refetch     // Manual refetch function
} = useQuote({
  tokenIn: 'AVAX',
  tokenOut: 'USDC',
  amountIn: '1.0',
  autoFetch: true,         // Auto-fetch on mount
  refreshInterval: 10000,  // Refresh every 10s
});

useSwap

const { 
  swap,       // Execute swap function
  txHash,     // Transaction hash
  loading,    // Loading state
  error,      // Error if any
  reset       // Reset state
} = useSwap({
  config: { partnerId: 'your-id' }
});

// Execute
await swap({
  tokenIn: 'AVAX',
  tokenOut: 'USDC',
  amountIn: '1.0',
  slippagePercent: 0.5,
}, signer);

useTokenPrice

const { price, loading, error } = useTokenPrice('AVAX');
console.log(`AVAX price: $${price}`);

useWallet

const { address, isConnected, chainId } = useWallet();

Token Addresses

import { AVALANCHE_TOKENS } from '@danaszova/avax-router-sdk';

AVALANCHE_TOKENS.AVAX;   // Native AVAX
AVALANCHE_TOKENS.WAVAX;  // 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7
AVALANCHE_TOKENS.USDC;   // 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E
AVALANCHE_TOKENS.USDT;   // 0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7
AVALANCHE_TOKENS.JOE;    // 0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd
AVALANCHE_TOKENS.PNG;    // 0x60781C2586D68229fde47564546784ab3fACA982

Examples

With ethers.js

import { ethers } from 'ethers';
import { AvaxRouter } from '@danaszova/avax-router-sdk';

const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();

const router = new AvaxRouter();
const result = await router.swap({
  tokenIn: 'AVAX',
  tokenOut: 'USDC',
  amountIn: '1.0',
  slippagePercent: 0.5,
}, signer);

console.log(`✅ Swapped! TX: ${result.txHash}`);

With wagmi/viem

import { useAccount, useWalletClient } from 'wagmi';
import { useQuote, useSwap } from '@danaszova/avax-router-sdk/react';

function SwapComponent() {
  const { address } = useAccount();
  const { data: walletClient } = useWalletClient();
  
  const { quote, loading } = useQuote({
    tokenIn: 'AVAX',
    tokenOut: 'USDC',
    amountIn: '1.0',
  });

  const handleSwap = async () => {
    // Use walletClient with prepared swap data
  };
}

Next.js App Router

// app/api/quote/route.ts
import { AvaxRouter } from '@danaszova/avax-router-sdk';

const router = new AvaxRouter();

export async function GET(request: Request) {
  const { searchParams } = new URL(request.url);
  const quote = await router.getBestQuote({
    tokenIn: searchParams.get('from'),
    tokenOut: searchParams.get('to'),
    amountIn: searchParams.get('amount'),
  });
  return Response.json(quote);
}

TypeScript Support

Full TypeScript support with exported types:

import type { 
  Quote, 
  SwapParams, 
  AvaxRouterConfig,
  Token,
  Dex
} from '@danaszova/avax-router-sdk';

Requirements

  • Node.js >= 16
  • For React hooks: React >= 18

License

MIT © AVAX Router Team


Built with ❤️ on Avalanche

Website · Documentation · Twitter · Discord