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

yellow-ts

v0.0.10

Published

TypeScript SDK wrapping @erc7824/nitrolite with websocket-ts (reconnect + backoff), providing an xrpl.js-like interface.

Readme

yellow-ts - Yellow.com Clearnet SDK for Typescript

TypeScript SDK for Yellow.com Clearnet that wraps @erc7824/nitrolite and uses websocket-ts for elegant backoff + reconnect, exposing an interface similar to xrpl.js.

  • Works in Node.js and the browser
  • Reconnects automatically with exponential backoff
  • JSON-RPC-style request method with id correlation and timeouts

Install

npm install yellow-ts
# peer deps are installed automatically as regular deps:
#   - websocket-ts
#   - @erc7824/nitrolite

Usage (xrpl.js-like)

CommonJS:

const { Client } = require("yellow-ts");

async function main() {
  // Defaults to wss://clearnet.yellow.com/ws if url is omitted
  const client = new Client({ url: "wss://clearnet.yellow.com/ws" })
  await client.connect();

  console.log(response);
  await client.disconnect();
}

main();

ESM / TypeScript:

import { Client } from "yellow-ts";
import { RPCMethod, RPCResponse } from "@erc7824/nitrolite";

const client = new Client({
  // url optional; defaults to wss://clearnet.yellow.com/ws
  url: "wss://clearnet.yellow.com/ws"
});

await client.connect();

console.log('Yellow Server connected');

// Listen for all messages with switch statement
client.listen(async (message: RPCResponse) => {
  switch (message.method) {
    case RPCMethod.AuthVerify:
      console.log('Auth Verify', message);
      // Handle authentication verification
      // Example: Send a transfer after authentication
      break;
      
    case RPCMethod.Assets:
      console.log('Assets', message.params);
      break;
      
    case RPCMethod.Error:
      console.log('Error', message.params);
      break;
      
    case RPCMethod.ChannelsUpdate:
      console.log('Channels Update', message.params);
      break;
      
    case RPCMethod.BalanceUpdate:
      console.log('Balance Update', message.params);
      break;
      
    default:
      console.log('Unknown message:', message);
      break;
  }
});

await client.disconnect();

API

WebSocket Methods

  • new Client(options?: ClientOptions) - Options include websocket URL, timeouts, backoff settings, and optional nitrolite configuration
  • connect(): Promise<void>
  • disconnect(code?: number, reason?: string): Promise<void>
  • request<T = any>(request: RequestObject): Promise<T>
  • sendMessage(message: any): Promise<T | void> - Send a raw message over websocket. If the message contains an id field, awaits and returns the response with the matching id.
  • listen(event?: string, callback: Function): () => void - Listen for messages. Returns a function to remove the listener.

Awaiting Responses with sendMessage

When you send a message that includes a request id, sendMessage will automatically wait for the corresponding response and return it:

import { Client } from "yellow-ts";
import { createGetConfigMessage, createEIP712AuthMessageSigner } from "@erc7824/nitrolite";

const client = new Client();
await client.connect();

// Create a signed message with a request ID
const requestId = 12345;
const message = createGetConfigMessage(signer, requestId);

// sendMessage detects the id and awaits the matching response
const response = await client.sendMessage(message);
console.log(response); // Response with id: 12345

If the message does not contain an id field, sendMessage sends the message without waiting for a response (fire-and-forget).

On disconnect, all in-flight requests are rejected. Reconnect is automatic via websocket-ts.

Node and Browser

This package targets both Node and browsers. It depends on websocket-ts under the hood for reconnection/backoff behavior.

Types

Type definitions are included. @erc7824/nitrolite is also re-exported from the root as nitrolite.

Build

npm run build

Acceptance tests

These tests connect to a live Yellow clearnet websocket. By default they use wss://clearnet.yellow.com/ws. To run them, set YELLOW_E2E=1 (or provide YELLOW_WS_URL). You can also override the command and params:

# Enable acceptance tests
export YELLOW_E2E=1

# Optional (override default URL)
export YELLOW_WS_URL="wss://clearnet.yellow.com/ws"



npm test

License

MIT