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

context-markets

v0.6.1

Published

TypeScript SDK for Context prediction markets

Readme

Install

npm install context-markets
# or
yarn add context-markets
# or
pnpm add context-markets

Quick Start

Read Market Data (no auth)

import { ContextClient } from "context-markets";

const ctx = new ContextClient();

// Search and list markets
const { markets } = await ctx.markets.list({ query: "elections", status: "active" });

// Get quotes, orderbook, oracle
const quotes = await ctx.markets.quotes(markets[0].id);
const book = await ctx.markets.orderbook(markets[0].id);
const oracle = await ctx.markets.oracle(markets[0].id);

// Simulate a trade before placing
const sim = await ctx.markets.simulate(markets[0].id, {
  side: "yes",
  amount: 10,
  amountType: "usd",
});

Place an Order (requires signer)

import { ContextClient } from "context-markets";

const ctx = new ContextClient({
  apiKey: process.env.CONTEXT_API_KEY!,
  signer: { privateKey: process.env.CONTEXT_PRIVATE_KEY! as `0x${string}` },
});

// Place a limit order: buy 10 YES contracts at 45¢
const result = await ctx.orders.create({
  marketId: "0x...",
  outcome: "yes",
  side: "buy",
  priceCents: 45,
  size: 10,
});

// Cancel it
await ctx.orders.cancel(result.order.nonce);

Wallet Setup & Deposits

// One-call setup: approves USDC + operator
await ctx.account.setup();

// Deposit USDC into Holdings contract
await ctx.account.deposit(100); // 100 USDC

// Or use gasless (no ETH needed):
await ctx.account.gaslessSetup();
await ctx.account.gaslessDeposit(100);

Create a Market

const submission = await ctx.questions.submitAndWait(
  "Will BTC close above $100k by Dec 31, 2026?"
);
const { marketId } = await ctx.markets.create(submission.questions[0].id);

Need an API key? Visit context.markets or join our Discord.

Configuration

new ContextClient({
  apiKey: "ctx_pk_...",           // Required for authenticated endpoints
  baseUrl: "https://...",         // Override API base URL
  rpcUrl: "https://...",          // Override RPC URL for on-chain reads
  signer: { privateKey: "0x..." } // Required for order signing & wallet ops
})

The SDK accepts three signer formats: a private key string, a viem Account object, or a viem WalletClient (for browser wallets).

Prices are in cents (1–99). Sizes are in contracts. The SDK maps "yes" / "no" to the correct on-chain outcome index automatically.

Documentation

Ecosystem

| Package | Description | |---------|-------------| | context-markets | TypeScript SDK for trading | | context-markets-react | React hooks for market data and trading | | context-markets-mcp | MCP server for AI agents | | context-markets-cli | CLI for trading from the terminal | | context-skills | AI agent skill files | | context-plugin | Claude Code plugin |

License

MIT — see LICENSE for details.