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

@lixersdk/sdk

v1.0.0

Published

Official Lixer SDK for accessing real-time and historical DeFi swap data across all major DEXs

Downloads

15

Readme

@lixersdk/sdk

Official Lixer SDK for accessing real-time and historical DeFi swap data across all major DEXs.

Installation

npm install @lixersdk/sdk

Quick Start

const LixerSDK = require('@lixersdk/sdk');

// Initialize SDK (no configuration needed)
const lixer = new LixerSDK();

// Get recent swaps
const swaps = await lixer.swaps().getAll({ limit: 10 });
console.log(swaps);

// Get all pools
const pools = await lixer.pools().getAll();
console.log(pools);

// Connect to real-time WebSocket
const ws = await lixer.websocket().connect();
ws.on('message', (data) => {
  const swapEvent = JSON.parse(data);
  console.log('New swap:', swapEvent);
});

TypeScript Support

import LixerSDK, { SwapEvent, Pool } from '@lixersdk/sdk';

const lixer = new LixerSDK();

const swaps: SwapEvent[] = await lixer.swaps().getAll({ limit: 100 });
const pools: Pool[] = await lixer.pools().getAll();

API Reference

Swaps

// Get all swaps with optional filtering
const swaps = await lixer.swaps().getAll({
  limit: 100,     // Optional: number of results (default: 100)
  offset: 0,      // Optional: pagination offset (default: 0)
  pool: '0x...'   // Optional: filter by pool address
});

// Get specific swap by ID
const swap = await lixer.swaps().getById('swap-id');

Pools

// Get all pools
const pools = await lixer.pools().getAll();

// Get swaps for a specific pool
const poolSwaps = await lixer.pools().getSwaps('0x...', {
  limit: 50,
  offset: 0
});

// Get time-series data for a pool
const timeSeries = await lixer.pools().getTimeSeries('0x...', {
  interval: 'hour',  // 'hour', 'day', 'week'
  limit: 24
});

Statistics

// Get global statistics
const globalStats = await lixer.stats().getGlobal();

// Get pool-specific statistics
const poolStats = await lixer.stats().getPool('0x...');

Time Series

// Get time-series swap data
const timeSeries = await lixer.timeseries().getSwaps({
  interval: 'hour',
  limit: 24
});

Health Check

// Check API health
const health = await lixer.health().check();

WebSocket (Real-time Data)

// Get WebSocket connection info
const wsInfo = await lixer.websocket().getUrl();

// Connect to WebSocket for real-time data
const ws = await lixer.websocket().connect();

ws.on('open', () => {
  console.log('Connected to Lixer WebSocket');
});

ws.on('message', (data) => {
  const swapEvent = JSON.parse(data);
  console.log('Real-time swap:', swapEvent);
});

ws.on('error', (error) => {
  console.error('WebSocket error:', error);
});

Configuration

The SDK works out of the box with no configuration required. It automatically connects to Lixer's hosted infrastructure.

If you need to use a custom endpoint (for development or enterprise deployments):

const lixer = new LixerSDK('https://your-custom-endpoint.com');

Or set the environment variable:

export LIXER_API_URL=https://your-custom-endpoint.com

Data Types

SwapEvent

interface SwapEvent {
  id: string;
  blockNumber: number;
  blockHash: string;
  transactionHash: string;
  logIndex: number;
  poolAddress: string;
  timestamp: number;
  timestampISO: string;
  sender: string;
  recipient: string;
  amount0: string;
  amount1: string;
  sqrtPriceX96: string;
  liquidity: string;
  tick: string;
}

Pool

interface Pool {
  id: string;
  factory: string;
  token0: string;
  token1: string;
  fee: string;
  tickSpacing: string;
  liquidity: string;
  sqrtPrice: string;
  tick: string;
  volumeToken0: string;
  volumeToken1: string;
  swapCount: string;
  createdAtTimestamp: string;
  createdAtBlockNumber: string;
}

Error Handling

The SDK includes automatic retry logic and error handling. All methods return Promises and can be used with async/await or .catch():

try {
  const swaps = await lixer.swaps().getAll();
  console.log(swaps);
} catch (error) {
  console.error('Error fetching swaps:', error.message);
}

Requirements

  • Node.js 14 or higher
  • Internet connection for API access

Support

License

MIT