Skip to main content
Once a market exists, users take positions and — after settlement — redeem winnings. The full trade lifecycle lives on client.p2p; the AMM namespace currently exposes market creation plus price/multiplier reads.
1

Buy into a side

client.p2p.buy — spend collateral to mint decision tokens.
2

Watch the odds

client.p2p.getMarket — implied probabilities and pot sizes update as people trade.
3

Settle

An authorized settler calls client.p2p.settle after endTime. See Custom Oracles.
4

Redeem

Winners call client.p2p.redeem to burn winning tokens and collect the payout.

Buy into a P2P market

Spend amount collateral (base units) to mint decision tokens on side. The buyer’s YES/NO associated token accounts are created on demand.
PublicKey | bigint | number
required
The market to bet on — its numeric id or PDA.
"yes" | "no"
required
Side to buy (mint decision tokens for).
BN | bigint | number
required
Collateral to spend, in base units.
BN | bigint | number
default:"0"
Slippage floor: minimum decision tokens to receive. 0 disables the guard.
number
default:"300000"
CU limit prepended to the tx (covers ATA creation). 0 skips it.
New-rules markets (id ≥ 79) use a locked-liquidity model: only the creator may buy the creator’s side, and the opposite side is whitelist-gated. The SDK passes the gate PDA automatically — an unauthorized buy reverts on-chain. Legacy markets (id < 79) are open.

Read a market’s state

getMarket decodes and enriches a market — pot sizes, implied probabilities, mints, and status — from a numeric id or PDA. No wallet required.
Key fields on P2PMarket: yesPot / noPot / totalPot, impliedYesProbability / impliedNoProbability (0–1), creatorSide, endTime, resolved, winner, oddsBps, and the yesMint / noMint / collateralMint addresses. See the API Reference for the full shape.

Read AMM prices & multipliers

AMM (Pythagorean) markets expose spot prices and potential payout multiples. Fresh markets read 50/50 and 2×/2×.
AMM markets are create + read in pnp-core today. On-chain AMM buys/sells aren’t yet exposed through the SDK — the parimutuel (p2p) path is the supported end-to-end trading flow.

Redeem a winning position

After a market is settled, the winner burns their winning decision tokens and receives the payout. A 2% fee is taken from the gross payout (60% to the creator’s fee treasury, 40% to the P2P admin); you receive the rest.
redeem only works after the market is settled (status === "resolved"). The signer must hold the winning-side tokens. Redeeming before settlement reverts on-chain. To take back unmatched collateral instead, see Refunds.

End-to-end