Skip to main content
Markets vary along two axes — a liquidity model and a resolution kind. This page has a copy-pasteable script for each combination the SDK exposes.
All amounts are in base units. Examples use uiToBaseUnits(100, 6) → 100_000000n for 100 USDC. endTime accepts a Date, or unix-seconds as number / bigint / BN. creator defaults to the signer; collateralMint defaults to the network’s default (USDC on mainnet).

Parimutuel (P2P) markets

General P2P market

The creator backs one side; everyone else takes the other side with client.p2p.buy. Settlement uses the PnP protocol oracle, and odds default to 1:1.

P2P market with custom odds

Pass oddsBps (100–9900) to price the creator’s side away from 1:1. 2500 bps sets the creator’s side at 25% implied probability, so takers on the other side earn a larger share of the pot. Setting odds creates the market extension PDA (returned as res.extension).

P2P market with a custom oracle

createMarketCustom is identical to createMarket but you designate the settler. See Custom Oracles for the full lifecycle.
Whatever pubkey you pass as oracle can settle() and setEndTime() on this market. Prefer the plain createMarket (protocol oracle) unless you specifically want your own settler.

P2P parameters

string
required
Market question / title, stored on-chain.
BN | bigint | number
required
Collateral the creator deposits to seed their side, in base units.
"yes" | "no"
required
Which side the creator backs.
number | bigint | BN | Date
required
Market end time. May be in the past for an immediately-settleable market.
number
Creator-side odds in bps (100–9900). Omit for default 1:1 (10000). Creates the extension PDA.
PublicKey
Creator / fee recipient. Defaults to the signer; may differ from the payer.
PublicKey
Override the collateral mint. Defaults to the network default.
PublicKey
required
createMarketCustom only. The market’s settler.
number
default:"400000"
CU limit prepended to the tx. Pass 0 to skip the compute-budget instruction.

Pythagorean (AMM) markets

General AMM market

The creator seeds liquidity; prices start at 50/50 and move as traders buy. Settlement uses the PnP protocol oracle.

AMM market with custom odds / oracle

Coin market

Resolves on a token’s price/metric. The type is encoded in the on-chain question as a suffix — "<question>? <chain>:<coinAddress>" — exactly like the PnP frontend, so the oracle recognizes it. createCoinMarket extends the AMM custom params, so oddsBps / oracle are also available.

YouTube market

Resolves on a video’s stats. Encoded on-chain as "<question>? <youtubeLink>".

AMM parameters

string
required
Market question / title, stored on-chain.
BN | bigint | number
required
Liquidity the creator seeds the AMM with, in base units.
number | bigint | BN | Date
required
Market end time.
number
default:"5000"
Custom/coin/youtube paths. YES-side odds in bps (100–9900). Default 5000 (50/50).
PublicKey
Custom/coin/youtube paths. Optional custom settler.
string
required
createCoinMarket only. The coin’s contract address (SPL mint on Solana).
string
default:"solana"
createCoinMarket only. Chain prefix stored in the question.
createYoutubeMarket only. Full YouTube video link.

What you get back

Both models return a result with the transaction signature and the created addresses:
Other resolution kinds (Twitter, DefiLlama, Kalshi) are supported at the protocol level but have no dedicated SDK helper yet. You can still create them as general markets and attach settlement criteria describing how they resolve.

Runnable examples

The SDK repo ships a script for every market type in examples/create-markets/ — clone it, set PNP_KEYPAIR, and run any of them with tsx.