pnp-core. For per-method details see the
API Reference.
Full market lifecycle
Create → take a position → settle → redeem, end to end:Read-only client
Omitwallet for a client that only reads and derives — perfect for indexers, dashboards, and
server-side rendering. Write methods throw if called.
Browser wallet adapter
Pass any wallet-adapter-compatible object (exposingpublicKey + signTransaction). If it also
exposes signMessage, off-chain flows like setSettlementCriteria work too.
Working with units
On-chain amounts are base units; UI values are human-readable. Convert explicitly.Error handling
SDK writes are normalasync calls — wrap them and surface program logs, which carry the
on-chain revert reason.
Security
- Keep custom-oracle / settler keys in a secrets manager — that key can settle markets.
- Set
minTokensOutonbuyto bound slippage. - Use a private RPC endpoint for production throughput and reliability.
Runnable examples
The SDK repo ships a script for every market type inexamples/create-markets/.
Create a Market
Every create path, with parameters.
Trading & Redemption
Buy, read odds, redeem.
FAQ
Which networks are supported?
Which networks are supported?
Mainnet and devnet, via
PnpClient.mainnet() / PnpClient.devnet() (or cluster in the
constructor). The program id is identical on both.Do I need a wallet to read data?
Do I need a wallet to read data?
No. Construct the client without
wallet for reads and PDA derivations. Only writes require
a signer.Can I create Twitter / DefiLlama / Kalshi markets?
Can I create Twitter / DefiLlama / Kalshi markets?
Those resolution kinds exist at the protocol level but have no dedicated SDK helper yet.
Create a general market and attach settlement criteria.
Does the SDK support AMM trading?
Does the SDK support AMM trading?
AMM markets are create + read (
readPrice / readMultiplier) in pnp-core today. The
supported end-to-end trading flow is the parimutuel (p2p) path.ESM or CommonJS?
ESM or CommonJS?
Both.
pnp-core ships import (ESM), require (CJS), and TypeScript declarations.