Skip to main content
pnp-core is the official TypeScript SDK for the PnP protocol on Solana. It wraps the on-chain program in one clean, type-safe client so you can create markets, take positions, settle, and redeem without hand-rolling instructions or account resolution.

Create markets

Parimutuel (P2P) and Pythagorean (AMM) markets — general, coin, or YouTube.

Trade & redeem

Buy into a side, read live odds, and redeem winning positions.

Type-safe

One @coral-xyz/anchor Program is the source of truth for every account and discriminator.

Node & browser

Works with a Node Keypair or any browser wallet adapter. Ships ESM + CJS + .d.ts.

How it fits together

Everything hangs off a single PnpClient, which exposes three namespaces: PnP markets vary along two independent axes — pick one from each:
pnp-core is a from-scratch rewrite of the older pnp-sdk. The client is now PnpClient (constructed from an options object) and methods are grouped under p2p / amm / oracle instead of living flat on the client.

Installation

@solana/web3.js and @coral-xyz/anchor are peer dependencies — install them alongside pnp-core. Node 18+ is required.

Construct a client

Use the mainnet() / devnet() presets, or the full constructor for custom RPC and commitment.

Your first calls

Reads need no wallet; writes need a signer.
Amounts are always in base units, not UI units. For 6-decimal USDC, 100 USDC is 100_000000n. Use uiToBaseUnits(100, 6) / baseUnitsToUi(amount, 6) to convert.

Where to next

Create a Market

Every create path: P2P, AMM, coin, and YouTube markets.

Trading & Redemption

Buy into a side, read odds, and redeem winnings.

Custom Oracles

Designate your own settler and attach settlement criteria.

API Reference

Every export, method, and type.