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

@agg-market/sdk

v7.0.0

Published

Vanilla TypeScript client for the [AGG](https://agg.market) prediction market aggregator. Works in browsers, Node.js, and React Native with no framework dependency.

Downloads

891

Readme

@agg-market/sdk

Vanilla TypeScript client for the AGG prediction market aggregator. Works in browsers, Node.js, and React Native with no framework dependency.

For React apps, see @agg-market/hooks, @agg-market/ui, and @agg-market/auth.

Install

npm install @agg-market/sdk

Quick start

import { createAggClient } from "@agg-market/sdk";

const client = createAggClient({
  baseUrl: "https://api.agg.market",
  appId: "your-app-id",
});

// Health check
const hello = await client.getHello();

// Check auth state
console.log(client.isAuthenticated, client.user);

Authentication

The SDK exposes the provider-agnostic auth primitives used by @agg-market/auth and custom app integrations.

Message-signing auth (SIWE / SIWS)

// 1. Start the auth flow
const { nonce } = await client.authStart({ provider: "siwe" });

// 2. Build the SIWE message
const message = client.buildSiweMessage({
  address: "0x...",
  chainId: 1,
  nonce,
  domain: window.location.host,
  uri: window.location.origin,
});

// 3. Sign with the user's wallet (wagmi, ethers, etc.)
const signature = await wallet.signMessage(message);

// 4. Verify and get tokens directly from /auth/verify
const { accessToken, refreshToken, user } = await client.verify({ message, signature });

// 5. Sign out
client.signOut();

Redirect auth (Google / Twitter / Apple / Email)

const response = await client.authStart({
  provider: "google",
  redirectUrl: "https://yourapp.com/auth/callback",
});

if (response.type === "redirect") {
  window.location.assign(response.url);
}

When AGG redirects back with a one-time auth code, exchange it for tokens:

const params = new URLSearchParams(window.location.search);
const code = params.get("code");

if (code) {
  const { accessToken, refreshToken, user } = await client.exchangeAuthCode(code);
  window.history.replaceState(null, "", window.location.pathname);
}

Auth sessions are automatically persisted to localStorage and restored on construction.

API methods

| Method | Description | | -------------------------------------------------- | ------------------------------------------ | | authStart(body) | Start any AGG auth flow | | startAuth(body) | Alias for authStart(body) | | getNonce() | Legacy SIWE nonce helper | | buildSiweMessage(params) | Build an EIP-4361 message string | | buildSiwsMessage(params) | Build a Solana sign-in message | | verify({ message, signature }) | Verify signature and get auth tokens | | verifySignIn({ message, signature }) | Alias for verify({ message, signature }) | | exchangeAuthCode(code) | Exchange redirect auth code for tokens | | setSession({ accessToken, refreshToken, user? }) | Seed tokens from a redirect callback | | signOut() | Clear auth state | | isAuthenticated | Check if user is signed in | | user | Get the current user | | onAuthStateChange(listener) | Subscribe to auth state changes |

Headers

The SDK automatically attaches the correct headers on every request:

  • x-app-id — from the appId you provided
  • Authorization: Bearer <jwt> — after sign-in
  • x-admin-key — if you provided an adminKey

Related packages

| Package | Description | | ---------------------------------------------------------------------- | -------------------------------------- | | @agg-market/hooks | React hooks for auth and data fetching | | @agg-market/ui | Pre-built React trading components | | @agg-market/auth | Auth adapters and connect/sign-in UI |

License

MIT