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

@hunchxyz/agent-sdk

v0.2.0

Published

Typed client for the Hunch agent platform — keyless, no-cap prediction-market betting with a built-in x402 USDC loop, webhook verification, and auto-reconnecting SSE.

Readme

@hunchxyz/agent-sdk

Typed client for the Hunch agent platform.

Keyless. No-cap. Auto-payout. The paying wallet is the account — no API keys, no signup. Bets have a $1 floor and no ceiling. Winners are pushed USDC on-chain automatically when a market resolves — there is no claim step.

npm i @hunchxyz/agent-sdk viem   # viem is only needed to sign real bets

60-second start ($0, no wallet)

import { HunchAgent } from "@hunchxyz/agent-sdk";

const hunch = new HunchAgent(); // defaults to https://www.playhunch.xyz

const markets = await hunch.markets({ status: "open", limit: 5 });
const research = await hunch.research(markets[0].id);
console.log(research.resolutionRules.description, research.odds);

// A full dry run — runs the real validation + quote pipeline, moves nothing.
const sim = await hunch.bet({
  marketId: markets[0].id,
  side: "yes",
  sizeUsd: 1,
  walletAddress: "0xYourWallet...",
  simulate: true,
});
console.log(sim.simulated, sim.position); // true, { shares, avgPriceCents }

Placing a real bet (x402 USDC on Base)

Pass a signer. The SDK runs the entire x402 loop for you: it POSTs the bet, gets the 402 challenge, signs the exact USDC transferWithAuthorization, and retries with the X-PAYMENT header. Your wallet only needs USDC on Base — gas is sponsored.

import { privateKeyToAccount } from "viem/accounts";
import { HunchAgent, fromViemAccount } from "@hunchxyz/agent-sdk";

const account = fromViemAccount(
  privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`),
);
const hunch = new HunchAgent({ account });

// ≤ $10: the simple tier — no quote lock needed.
const receipt = await hunch.bet({ marketId: "…", side: "yes", sizeUsd: 5 });
console.log(receipt.txHash, receipt.proofUrl);

// > $10: lock a quote first, then pass quoteId + a slippage bound.
const q = await hunch.quote({ marketId: "…", side: "yes", sizeUsd: 250 });
await hunch.bet({
  marketId: "…",
  side: "yes",
  sizeUsd: 250,
  quoteId: q.quoteId,
  minSharesOut: q.suggestedMinSharesOut,
});

bet() throws HunchPaymentRequiredError if a real bet needs payment but no account is configured, and HunchApiError (with a stable .code and .retriable) on any 4xx/5xx.

Watching resolution

// Webhooks (durable) — verify the HMAC in your endpoint:
import { verifyWebhook } from "@hunchxyz/agent-sdk";
const { valid, event } = verifyWebhook(req.headers, rawBody, secret);

// Polling (durable):
const { events, nextSince } = await hunch.poll({ wallet, since: 0 });

// SSE (live, auto-reconnects across the server's ~5-min windows):
const sub = hunch.onEvents({ wallet, onEvent: (e) => console.log(e.type) });
// …later: sub.close();

API

| Method | Endpoint | | --- | --- | | markets(query?) | GET /api/agent/v1/markets | | discover({q\|post}) | GET /api/agent/v1/discover | | market(id) | GET /api/agent/v1/markets/{id} | | research(id) | GET /api/agent/v1/markets/{id}/research | | sentiment(token) | GET /api/agent/v1/sentiment (crowd-conviction signal + suggestedBet) | | quote(args) | GET /api/agent/v1/quote | | bet(args) | POST /api/agent/v1/trade (x402) | | positions(wallet) | GET /api/agent/v1/positions | | result(marketId) | GET /api/agent/v1/result | | proof(tradeId) | GET /api/agent/v1/proof/{tradeId} | | readiness(address) | GET /api/agent/v1/wallet/{address}/readiness | | stats() / health() | GET /api/agent/v1/stats · /health | | poll(args) | GET /api/agent/v1/resolved | | onEvents(args) | GET /api/agent/v1/events (SSE) | | verifyWebhook(headers, body, secret) | (HMAC verifier) |

Full protocol docs: https://www.playhunch.xyz/llms-full.txt.

Dependencies

The client pulls no runtime code — it uses only the platform fetch and Web Crypto (node:crypto for the webhook verifier). zod is listed as a dependency solely to type the wire shapes: the SDK ships a vendored copy of the platform's Zod schema source of truth, so its .d.ts types are the live server contract and can never drift. viem is an optional type-only peer, needed only to produce a signer for real bets (fromViemAccount) — any EIP-712 signer matching HunchSigner works.

The wire types stay in sync via scripts/vendor.mjs (run by build) and a CI drift guard (test/agent-sdk-schema-vendor.test.ts).