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/hooks

v13.0.0

Published

React hooks for the [AGG](https://agg.market) prediction market aggregator. Wraps [`@agg-market/sdk`](https://www.npmjs.com/package/@agg-market/sdk) with React context, shared auth/session state, and data fetching.

Downloads

1,644

Readme

@agg-market/hooks

React hooks for the AGG prediction market aggregator. Wraps @agg-market/sdk with React context, shared auth/session state, and data fetching.

For pre-built trading components, see @agg-market/ui. For the connect/sign-in UX and auth method adapters, see @agg-market/auth.

Install

npm install @agg-market/sdk @agg-market/hooks

Quick start

Wrap your app in <AggProvider>:

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

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

function App() {
  return (
    <AggProvider client={client}>
      <YourApp />
    </AggProvider>
  );
}

Auth Session State

AggProvider owns the shared AGG auth session. It keeps client.isAuthenticated, the current user profile, and token-backed session refresh/sign-out behavior in sync for the rest of the hooks layer.

For most apps, use @agg-market/auth on top of AggProvider:

import { AggProvider } from "@agg-market/hooks";
import { createAggClient } from "@agg-market/sdk";
import { AggAuthProvider, ConnectButton, createEmailAuthMethod } from "@agg-market/auth";
import { useSiweAuthMethod } from "@agg-market/auth/siwe";
import { WagmiProvider } from "wagmi";
import { wagmiConfig } from "./wagmi-config";

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

function AuthButton() {
  const siwe = useSiweAuthMethod();

  return (
    <AggAuthProvider methods={[siwe, createEmailAuthMethod()]}>
      <ConnectButton />
    </AggAuthProvider>
  );
}

function App() {
  return (
    <WagmiProvider config={wagmiConfig}>
      <AggProvider client={client}>
        <AuthButton />
      </AggProvider>
    </WagmiProvider>
  );
}

useAggAuth Compatibility Hook

useAggAuth remains available as a lower-level helper for apps that want to wire their own wallet UI and directly trigger SIWE or SIWS message signing:

import { useAggAuth } from "@agg-market/hooks";
import { useAccount, useSignMessage } from "wagmi";

function SignIn() {
  const { address, chainId } = useAccount();
  const { signMessageAsync } = useSignMessage();
  const { signIn, signOut, isAuthenticated, user } = useAggAuth({
    signMessage: async (message) => signMessageAsync({ message }),
    address,
    chainId,
  });

  if (isAuthenticated) {
    return (
      <div>
        <p>Signed in as {user?.id}</p>
        <button onClick={signOut}>Sign out</button>
      </div>
    );
  }

  return <button onClick={() => signIn("Sign in to AGG")}>Sign in with Ethereum</button>;
}

For Solana, pass a signMessage function that signs the raw UTF-8 message bytes and returns a base58-encoded Ed25519 signature:

import bs58 from "bs58";
import { useWallet } from "@solana/wallet-adapter-react";
import { useAggAuth } from "@agg-market/hooks";

function SolanaSignIn() {
  const { publicKey, signMessage } = useWallet();
  const { signIn, isLoading } = useAggAuth({
    address: publicKey?.toBase58(),
    chain: "solana",
    chainId: "mainnet",
    signMessage: async (message) => {
      const signedBytes = await signMessage!(new TextEncoder().encode(message));
      return bs58.encode(signedBytes);
    },
  });

  return (
    <button onClick={() => signIn("Sign in to AGG")} disabled={isLoading}>
      Sign in with Solana
    </button>
  );
}

This stays Ledger-compatible because the dapp builds the SIWS message and the wallet only needs to support signMessage().

Hooks

| Hook | Description | | -------------------------- | -------------------------------------------- | | useAggClient() | Access the AggClient instance from context | | useAggAuth(options) | Wallet-signature helper for SIWE/SIWS | | useHello() | Health check — { data, error, isLoading } | | useVenueEvents(options) | Fetch prediction market events | | useCategories(options) | Fetch market categories | | useOrderBook(options) | Fetch orderbook data | | useVenueBalances(venues) | Fetch balances across venues |

Peer dependencies

  • @agg-market/sdk
  • react ^18.0.0 or ^19.0.0

Related packages

| Package | Description | | -------------------------------------------------------------------- | ------------------------------------ | | @agg-market/sdk | Vanilla TypeScript client | | @agg-market/ui | Pre-built React trading components | | @agg-market/auth | Auth adapters and connect/sign-in UI |

License

MIT