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

@routerprotocol/xplore-core

v1.3.0

Published

TypeScript SDK for router aggregation

Readme

Router Aggregator Core

Documentation CI Release npm version

A TypeScript SDK for router aggregation with comprehensive support for cross-chain bridges and decentralized exchange aggregators.

Overview

Router Aggregator Core provides a unified interface for interacting with multiple routing protocols, categorizing them into two distinct types:

  • Bridges: Cross-chain protocols that facilitate token transfers between different blockchains
  • Exchanges: DEX aggregators that find optimal trading routes within and across chains

Key Features

  • Type-Safe Node Classification: Clear distinction between bridge and exchange nodes with TypeScript support
  • Comprehensive Protocol Support: Support for 9+ major protocols including Relay, deBridge, Across, OpenOcean, and more
  • Chain Compatibility: Built-in compatibility mappings for different blockchain types
  • Utility Functions: Rich set of helper functions for node categorization and filtering
  • Modern TypeScript: Built with strict TypeScript and modern tooling

📦 Installation

# With npm
npm install @routerprotocol/xplore-core

# With yarn
yarn add @routerprotocol/xplore-core

# With pnpm
pnpm add @routerprotocol/xplore-core

# With bun
bun add @routerprotocol/xplore-core

Quick Start

import { BridgeNodes, ExchangeNodes, isBridgeNode, isExchangeNode } from '@routerprotocol/xplore-core'

// Type-safe node classification
const relay = BridgeNodes.RELAY
const openocean = ExchangeNodes.OPENOCEAN

// Runtime type checking
console.log(isBridgeNode(relay))         // true
console.log(isExchangeNode(relay))       // false
console.log(isExchangeNode(openocean))   // true

Supported Protocols

Bridges

  • Relay: Multi-chain bridge supporting EVM, Solana, Sui, and Bitcoin
  • deBridge: Cross-chain liquidity protocol
  • Across: Optimistic cross-chain bridge
  • THORChain: Native cross-chain liquidity protocol supporting Bitcoin
  • Stargate Taxi: Cross-chain bridge using LayerZero
  • Mayan CCTP: Protocol using Circle's Cross-Chain Transfer Protocol
  • Mayan Swift: Fast bridging solution from Mayan
  • GasZip: Native token bridge for gas fee optimization

Exchanges

  • OpenOcean: DEX aggregator with cross-chain capabilities

Documentation

Complete documentation is available at: https://router-protocol.github.io/xplore-core/

📚 API Reference

RouterAggregator

The main class for handling parallel router requests.

Constructor

new RouterAggregator<T>(configs: RouterConfig[], options?: AggregatorOptions)
  • configs: Array of router configurations
  • options: Optional aggregator settings

Methods

execute(endpoint, requestOptions)

Execute requests to all configured routers in parallel.

async execute(endpoint: string, options?: RequestOptions): Promise<AggregatorResult<T>>

Returns an AggregatorResult with:

  • successful: Array of successful responses with timing information
  • failed: Array of failed responses with error details
  • metadata: Execution metadata and statistics

Types

RouterConfig

interface RouterConfig {
  url: string;          // Base router URL
  timeout?: number;     // Request timeout in milliseconds
  headers?: Record<string, string>; // Custom headers
}

AggregatorResult

interface AggregatorResult<T> {
  successful: RouterResponse<T>[];
  failed: RouterResponse<never>[];
  metadata: {
    totalRequests: number;
    successRate: number;
    averageResponseTime: number;
  };
}

RouterResponse

interface RouterResponse<T> {
  routerUrl: string;
  data: T;
  timing: {
    start: number;
    end: number;
    duration: number;
  };
  status: 'success' | 'error';
  error?: string;
}

🛠️ Utilities

The SDK includes helper utilities for response analysis:

import { 
  getFastestResponse, 
  getSuccessRate, 
  groupResponsesByStatus 
} from '@routerprotocol/xplore-core';

const result = await aggregator.execute('/endpoint');

// Get the fastest successful response
const fastest = getFastestResponse(result.successful);

// Calculate success rate
const successRate = getSuccessRate(result);

// Group responses by status
const grouped = groupResponsesByStatus(result);

🔧 Configuration

Router Configuration

const routers = [
  {
    url: 'https://primary-router.com',
    timeout: 5000,
    headers: {
      'Authorization': 'Bearer token',
      'X-API-Key': 'your-key'
    }
  },
  {
    url: 'https://fallback-router.com',
    timeout: 3000
  }
];

Aggregator Options

const options = {
  maxConcurrency: 10,     // Maximum concurrent requests
  retries: 2,             // Number of retries on failure
  retryDelay: 1000       // Delay between retries (ms)
};

const aggregator = new RouterAggregator(routers, options);

Development

# Install dependencies
bun install

# Build the package
bun run build

# Run tests
bun run test

# Type checking
bun run typecheck

# Linting
bun run lint

# Documentation development
bun run docs:dev

# Build documentation
bun run docs:build

🧪 Testing

The project includes comprehensive testing with both Node.js and Bun runtime:

# Run tests with vitest (Node.js)
bun run test

# Run tests with Bun test runner
bun test

🚀 CI/CD

This project uses GitHub Actions for continuous integration and deployment:

  • CI Pipeline: Multi-version testing (Node 20+, Bun latest/1.1.0)
  • Semantic Releases: Automated versioning and publishing
  • Beta Releases: PR-based beta deployments to GitHub Packages
  • Dual Publishing: NPM + GitHub Packages
  • Dependency Updates: Automated via Dependabot

Beta Testing

When you create a pull request, a beta version is automatically published:

# Install beta version (from PR comment)
bun add @routerprotocol/[email protected]

📄 License

ISC

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes following conventional commits
  4. Run tests and ensure they pass
  5. Submit a pull request

Conventional Commits

This project uses semantic release with conventional commits:

  • feat: - New features (minor version bump)
  • fix: - Bug fixes (patch version bump)
  • docs: - Documentation changes (patch version bump)
  • chore: - Maintenance tasks (no version bump)
  • BREAKING CHANGE: - Breaking changes (major version bump)

📈 Performance

Built for high performance with:

  • Parallel request execution using Promise.allSettled()
  • Efficient memory usage with streaming responses
  • Optimized TypeScript compilation with tsup
  • Bundle size monitoring and analysis
  • Native Bun performance optimizations

🔍 Monitoring

The CI pipeline includes:

  • Bundle size analysis
  • Performance benchmarking
  • Memory usage tracking
  • Multi-runtime compatibility testing

Built with ❤️ using Bun and TypeScript