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

@calp-pro/dex-db

v3.0.1

Published

Database designed for handle relation pair/pool address to token0 & token1 addresses

Downloads

6,542

Readme

  DEX DB  Coverage

Database for decentralize exchangers. Each pair & token address indexed to a number. Then factory information can be presented as:

  • 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc - have index N
  • 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 - have index X
  • 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 - have index Y
data_structure[N    ] = X
data_structure[N + 1] = Y

where N, X, Y are uint24.

Example: [0, 4, 0, 1, 5, 3, ...] where:

  • 0, 4
    • is first and second element at array at index 0, 1 (pair index 0)
    • 0 index of token0 of pair 0
    • 4 index of token1 of pair 0
  • 0, 1
    • is next pair of token at positions 2, 3 (pair index 1)
    • 0 index of token0 of pair 1 (same token can be at different pairs)
    • 1 index of token1 of pair 1
  • 5, 3
    • is next pair of tokens at positions 4, 5 (pair index 2)
    • 5 index of token0 of pair 2
    • 3 index of token1 of pair 2

Install

npm i --save @calp-pro/dex-db

Use

import dex_db from '@calp-pro/dex-db'

const db = dex_db(
    [
        ['0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'],
        ['0x12ede161c702d1494612d19f05992f43aa6a26fb', '0x06af07097c9eeb7fd685c692751d5c66db49c215', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'],
        ['0xa478c2975ab1ea89e8196811f51a7b7ade33eb11', '0x6b175474e89094c44da98b954eedeac495271d0f', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'],
        ['0x07f068ca326a469fc1d87d85d448990c8cba7df9', '0x408e41876cccdc0f92210600ef50372656052a38', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'],
        ['0xae461ca67b15dc8dc81ce7615e0320da1a9ab8d5', '0x6b175474e89094c44da98b954eedeac495271d0f', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'],
        ['0xce407cd7b95b39d3b4d53065e711e713dd5c5999', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0xfa3e941d1f6b7b10ed84a0c211bfa8aee907965e']
    ]
)

const pairs = dex_db.find_pairs_with_token('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'/*USDC*/)

//pairs[0] == '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc'/*WETH/USDC*/)
//pairs[1] == '0x07f068ca326a469fc1d87d85d448990c8cba7df9'/*REN/USDC*/)
//pairs[2] == '0xae461ca67b15dc8dc81ce7615e0320da1a9ab8d5'/*DAI/USDC*/)

API

  • find_pairs_with_token
  • find_pairs_with_tokens
  • get_pair_tokens
  • index
  • index_save
  • save
  • load
  • sort

sort

Compression of deltas five only 10% which is not much for 10mb of tokens/pools addresses. Delivery to web 9mb or 10mb is same long waiting time which is user will wait. Loading should happen in background and each loaded chunk should be processed. Then very important is order of data which came first. Sorting of data helps to present fast most important data and less important left for later.

By default token sorting is done by amount of pairs token have. WETH is top paired token - should appear first at sorted result. By default pair sorting is done by total pairs token0/1 have.