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

@coset-dev/sdk

v1.1.0

Published

Coset SDK is a TypeScript library for **data requesters** to interact with Coset oracles programmatically. It simplifies reading oracle data, handling paid updates (via x402), and receiving update results.

Downloads

1,510

Readme

Coset SDK

Coset SDK is a TypeScript library for data requesters to interact with Coset oracles programmatically. It simplifies reading oracle data, handling paid updates (via x402), and receiving update results.

Install

npm install @coset-dev/sdk

or

pnpm add @coset-dev/sdk

Quickstart

import { Coset, Networks, PaymentToken } from "@coset-dev/sdk";

const coset = new Coset(
  Networks.MANTLE_TESTNET,
  PaymentToken.USDC,
  "0xabc...", // Oracle address
  process.env.PRIVATE_KEY as `0x${string}` // Wallet private key
);

Read data

const res = await coset.read();

if (res.message) {
  console.error("Read failed:", res.message);
} else {
  console.log("Data:", res.data);
  console.log("Last update:", res.lastUpdateFormatted);
  console.log("Is update recommended?", res.isUpdateRecommended);
}

Strict vs non-strict reads

  • coset.read(false) (default) calls the node path get-data-without-check
  • coset.read(true) calls the node path get-data

Important: read() does not reject

Unlike most SDK methods, coset.read() typically resolves even when the node call fails (often with { message: string, data?: any }). Check res.message as shown above.

Update data (paid)

Coset updates are paid operations. The SDK settles payment via x402, then submits the update to a Coset node.

You need:

  • a wallet private key (for signing)
  • sufficient USDC or CST on the selected network
const update = await coset.update();

console.log("Spent:", update.spent.total);
console.log("Tx:", update.tx);
console.log("Data:", update.data);

Spending limits

await coset.setSpendingLimit(5);

// Later...
await coset.update();

If coset.spent >= coset.spendingLimit, update() rejects with:

{
  message: "Spending limit exceeded",
  spent: { total: 0, gasFee: 0, platformFee: 0, dataProviderFee: 0 },
}

To bypass this guard:

await coset.update({ force: true });

Optional update

If you only want to update when recommended:

const needed = await coset.isUpdateNeeded();
if (needed) await coset.update();

Or use coset.optionalUpdate() (it returns null even if it performs an update).

Networks & payment tokens

Supported:

  • Networks: mantle, mantle-testnet
  • Payment tokens: USDC, CST

Token addresses are resolved internally based on the selected Networks + PaymentToken combination (see the API reference in the docs).

Docs

You can learn everything about Coset SDK at developer documentation.