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 🙏

© 2025 – Pkg Stats / Ryan Hefner

bitquery-ton-sdk

v1.0.0

Published

A lightweight JavaScript SDK to query TON blockchain DEX trades, token analytics, and top traders using the Bitquery GraphQL API.

Readme

bitquery-ton-sdk

A lightweight SDK for querying TON blockchain data via the Bitquery GraphQL API. Easily fetch real-time DEX trades, token trades, top traders, and top tokens from The Open Network (TON).

🚀 Features

  • Fetch latest TON DEX trades
  • Get latest trades for specific TON tokens
  • Identify top traders by trade count
  • Discover top tokens by USD volume
  • Built-in GraphQL queries powered by Bitquery

📦 Installation

npm install bitquery-ton-sdk

🛠 Usage

➤ CommonJS (Node.js default)

const {
  getDexTrades,
  getTokenDexTrades,
  getTopTaders,
  getTopTokens
} = require('bitquery-ton-sdk');

const token = 'YOUR_BITQUERY_API_TOKEN';

getDexTrades(token, 50).then(console.log);
getTokenDexTrades(token, '0:abc123...', 25).then(console.log);
getTopTaders({ token, since: '2024-10-01T00:00:00Z', num: 20 }).then(console.log);
getTopTokens({ token, since: '2024-10-01T00:00:00Z', num: 15 }).then(console.log);

➤ ES6 Modules (Modern Node.js / Frontend)

import {
  getDexTrades,
  getTokenDexTrades,
  getTopTaders,
  getTopTokens
} from 'bitquery-ton-sdk';

const token = 'YOUR_BITQUERY_API_TOKEN';

const main = async () => {
  const trades = await getDexTrades(token, 50);
  console.log(trades);

  const tokenTrades = await getTokenDexTrades(token, '0:abc123...', 25);
  console.log(tokenTrades);

  const topTraders = await getTopTaders({ token, since: '2024-10-01T00:00:00Z', num: 20 });
  console.log(topTraders);

  const topTokens = await getTopTokens({ token, since: '2024-10-01T00:00:00Z', num: 15 });
  console.log(topTokens);
};

main();

⚠️ To use ESM in Node.js, either rename your file to .mjs or set "type": "module" in your package.json.

📚 API Reference

getDexTrades(token, num)

Fetch latest DEX trades on TON.

  • token: Bitquery API token (required)
  • num: Number of trades to return (optional, default: 100)

getTokenDexTrades(token, currency, num)

Get latest DEX trades for a specific token by its smart contract address.

  • token: Bitquery API token (required)
  • currency: Token smart contract address (required)
  • num: Number of trades (optional, default: 100)

getTopTaders({ token, since, num })

Return top traders on TON by trade count.

  • token: Bitquery API token (required)
  • since: ISO time string for filtering (optional, default: "2024-10-21T05:36:05Z")
  • num: Max results to return (optional, default: 100)

getTopTokens({ token, since, num })

Return most traded tokens by USD volume.

  • token: Bitquery API token (required)
  • since: ISO time string for filtering (optional, default: "2024-10-21T05:36:05Z")
  • num: Max results to return (optional, default: 100)

🔐 Authentication

This SDK uses the Bitquery GraphQL streaming API. You’ll need an Access Token from Bitquery.

Set your token in each request:

const token = 'your-api-key';

🧑‍💻 Contributing

We welcome issues and pull requests to improve the SDK.

📄 License

MIT