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

@sigrex/client

v2.1.1

Published

TypeScript API Client for Sigrex with automatic HMAC-SHA256 request signing and support for ML-DSA44

Readme

Sigrex API TypeScript Client

A fully-typed, isomorphic, zero-dependency TypeScript API client for the Sigrex API with built-in support for automatic request signing (HMAC-SHA256 and custom signers like ML-DSA44).


Features

  • Fully Typed: Generated directly from the Sigrex OpenAPI Specification. Every request payload and response body is strongly-typed.
  • Isomorphic: Works in Node.js, browsers, Cloudflare Workers, Edge runtimes, and other JS environments.
  • Automatic Request Signing: Automatically calculates and attaches required headers (api-key, timestamp, signature) to every request.
  • Flexible Signatures: Supports standard HMAC-SHA256 and provides a callback interface for custom signers (e.g., ML-DSA44).
  • Clean API Hierarchy: Logical grouping of methods matching the API tag hierarchy (e.g., client.strategies.llmSessions.list()).

Installation

npm install @sigrex/client

Quick Start (HMAC-SHA256)

To get started, instantiate the SigrexClient using your public API key and private API secret. All HTTP requests are automatically signed and sent using native fetch.

import { SigrexClient } from '@sigrex/client';

const client = new SigrexClient({
  apiKey: 'YOUR_PUBLIC_API_KEY',
  apiSecret: 'YOUR_PRIVATE_API_SECRET',
});

// Example: Retrieve all exchanges
async function getExchanges() {
  try {
    const exchanges = await client.exchanges.list({ enabled: true });
    console.log('Exchanges:', exchanges);
  } catch (error) {
    console.error('Error fetching exchanges:', error);
  }
}

getExchanges();

Advanced: Post-Quantum Signatures (ML-DSA44)

The Sigrex API supports post-quantum ML-DSA44 signature authentication. You can provide a custom signer callback function to sign requests using @oqs/liboqs-js (or any other cryptographic engine) without adding heavy WebAssembly or native binaries to your core dependencies.

import { SigrexClient } from '@sigrex/client';
import { createMLDSA44 } from '@oqs/liboqs-js';

const PRIVATE_KEY_B64 = 'YOUR_PRIVATE_KEY_BASE64';

const client = new SigrexClient({
  apiKey: 'YOUR_PUBLIC_API_KEY',
  signer: async (message: string) => {
    // Initialize ML-DSA44 signer
    const sig = await createMLDSA44();
  
    // Sign the message payload
    const messageBytes = new TextEncoder().encode(message);
    const signature = sig.sign(
      messageBytes,
      Uint8Array.from(Buffer.from(PRIVATE_KEY_B64, 'base64'))
    );
  
    // Convert signature to base64
    const signatureB64 = Buffer.from(signature).toString('base64');
  
    // Clean up
    sig.destroy();
  
    return signatureB64;
  }
});

// Example: Get active LLM Sessions
async function getLLMSessions() {
  const sessions = await client.strategies.llmSessions.list();
  console.log('Sessions:', sessions);
}

API Reference

The client exposes nested namespaces to make finding endpoints easy and intuitive:

1. Exchanges

Exposes CEX, DEX, and Prediction exchanges.

  • client.exchanges.list(queryParams?)
  • client.exchanges.listCex()
  • client.exchanges.getDex(chain)
  • client.exchanges.listPrediction()
  • client.exchanges.listWithExchangeRate()

2. Strategies

Exposes LLM Sessions, Code Strategies, and Reactions (both LLM and Code).

  • LLM Sessions:
    • client.strategies.llmSessions.list()
    • client.strategies.llmSessions.create(body)
    • client.strategies.llmSessions.get(id)
    • client.strategies.llmSessions.update(id, body)
    • client.strategies.llmSessions.delete(id)
    • client.strategies.llmSessions.status(id, body) (Enable/disable session)
    • client.strategies.llmSessions.public(id, body) (Set visibility)
    • client.strategies.llmSessions.listFolder()
    • client.strategies.llmSessions.createFolder(body)
  • Code Strategies:
    • client.strategies.code.list()
    • client.strategies.code.create(body)
    • client.strategies.code.get(id)
    • client.strategies.code.update(id, body)
    • client.strategies.code.delete(id)
  • Reactions (LLM):
    • client.strategies.reactions.llm.list()
    • client.strategies.reactions.llm.create(body)
  • Reactions (Code):
    • client.strategies.reactions.code.list()
    • client.strategies.reactions.code.create(body)

3. Signal Bots

  • CEX Bots: client.bots.cex.list(), client.bots.cex.create(), etc.
  • DEX Bots: client.bots.dex.list(), client.bots.dex.create(), etc.
  • Prediction Bots: client.bots.prediction.list(), client.bots.prediction.create(), etc.

4. Webhooks

  • Bot Hooks: client.webhooks.bot.list(), client.webhooks.bot.create(), etc.
  • Data Hooks: client.webhooks.data.list(), client.webhooks.data.create(), etc.

5. API Keys Management

Exposes key endpoints for managing third-party LLM and CEX keys securely.

  • Exchange Keys: client.apiKeys.exchange.list(), client.apiKeys.exchange.create(), etc.
  • LLM Keys: client.apiKeys.llm.list(), client.apiKeys.llm.create(), etc.
  • Prediction Keys: client.apiKeys.prediction.list(), client.apiKeys.prediction.create(), etc.

Error Handling

All failed HTTP requests (status code outside 2xx) throw a SigrexError. You can inspect the error's status code, status message, and API-returned error details:

import { SigrexError } from '@sigrex/client';

try {
  await client.strategies.llmSessions.delete('non-existent-id');
} catch (error) {
  if (error instanceof SigrexError) {
    console.error(`API Error [${error.status}]: ${error.message}`);
    console.error('Raw Body:', error.body);
  } else {
    console.error('Network or other error:', error);
  }
}

License

MIT