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

supra-oracle-sdk

v1.0.4

Published

SDK for accessing Supra Pull Oracle data

Readme

Supra Oracle SDK

A lightweight JavaScript SDK to fetch and decode price feed data from Supra's Pull Oracle REST API.


Features

  • Fetches oracle proof data from Supra Pull Oracle
  • Decodes the proof bytes into readable price feeds
  • Supports easy customization of REST endpoint and chain type

Installation

npm install supra-oracle-sdk

Usage

const SupraOracleClient = require('supra-oracle-sdk');

(async () => {
  const client = new SupraOracleClient({
    restAddress: 'https://rpc-testnet-dora-2.supra.com', // optional, defaults to this
    chainType: 'evm' // optional, defaults to 'evm'
  });

  const pairIndexes = [0, 21, 49, 61];
  const oracleData = await client.getOracleData(pairIndexes);

  console.log('Oracle Feed Data:', oracleData);
})();

API new SupraOracleClient(options) options.restAddress — REST API base URL (default: https://rpc-testnet-dora-2.supra.com)

options.chainType — Blockchain type (default: 'evm')

getOracleData(pairIndexes) Fetches and decodes oracle data for the specified array of pairIndexes.

pairIndexes — Array of integer indexes for requested price pairs.

Returns a Promise that resolves to an array of decoded price feed objects:

js Copy Edit [ { pairIndex: '0', price: '98544400000000000000000', decimals: '18', timestamp: '1750623025071' }, ... ]

📈 Historical Price Data (OHLC) The SDK provides support for fetching historical price data from the Supra REST API, returning OHLC (Open, High, Low, Close) candles for a specific trading pair.

🛠 Setup To enable historical price support, pass the history config with your API key when initializing the client:

const SupraOracleClient = require('supra-oracle-sdk');

const oracle = new SupraOracleClient({ history: { enabled: true, apiKey: 'YOUR_API_KEY_HERE', // 🔐 Replace with your actual key baseUrl: 'https://prod-kline-rest.supra.com' // Optional override } }); 📤 Fetch Historical Prices

const historical = await oracle.getHistoricalPrices({ tradingPair: 'btc_usdt', // Format: lowercase with underscore startDate: 1718000000000, // UNIX timestamp in milliseconds (UTC) endDate: 1718086400000, // UNIX timestamp in milliseconds (UTC) interval: 3600 // Interval in seconds (e.g. 60, 3600, 86400) });

console.log(historical.data); /* [ { timestamp: 1718000000000, open: 20000.5, high: 20100.0, low: 19950.0, close: 20050.0, volume: 15.2 }, ... ] */ 🔒 Notes You can request data up to 1 month back.

Time format: timestamps must be in Unix milliseconds.

Intervals are in seconds (e.g. 60 for 1 minute, 3600 for 1 hour, 86400 for 24 hours).

Historical Price Data (OHLC)

The SDK supports fetching historical OHLC (Open, High, Low, Close) candle data for a single trading pair, if you enable and configure the history API with your key.

const oracle = new SupraOracleClient({ history: { enabled: true, apiKey: 'YOUR_API_KEY_HERE', // 🔐 Replace with your key baseUrl: 'https://prod-kline-rest.supra.com' // Optional override } });

Fetch historical prices by specifying the trading pair, start and end timestamps (in Unix milliseconds UTC), and the candle interval (in seconds):

const historical = await oracle.getHistoricalPrices({ tradingPair: 'btc_usdt', // Lowercase with underscore format startDate: 1718000000000, // UNIX ms timestamp (UTC) endDate: 1718086400000, // UNIX ms timestamp (UTC) interval: 3600 // Interval in seconds (e.g., 60, 3600, 86400) });

The returned data is an array of candle objects:

[ { timestamp: 1718000000000, open: 20000.5, high: 20100.0, low: 19950.0, close: 20050.0, volume: 15.2 }, // ... ]