ReadonlycfgReadonlydecodeExpiryPnlRealized changes in the pool's gross realized result, for P&L reporting. Sum
them with realizedPnlRaw.
Every queue event, tagged, in chain order: feed it to queue.reduceOrderEvents.
RecordFundsParked and RecordFundsClaimed: USDC a record keeps until it can be sent.
ReadonlyreadWhich trade path the network is on, from ProtocolConfig.version_watermark and whether
this config records delayed execution (the Predict upgrade, the order-flow companion and
its desk). Flip the app between mint* and enqueue* on it, without a redeploy at the
watermark bump.
The fee and exposure policy the market snapshotted at creation, ready to pass to the
cost functions as fees. A market keeps it for its whole life, so it can differ from
the protocol's current template, and neither recorded deployment's template matches
cost.SHIPPED_FEE_POLICY any more. One object read.
The current Pyth Lazer package, for a filler. Read it per batch and never cache it.
One queue record and its display state, or null when missing or cleaned up.
Queue records by record ID, with their display states. The SDK has no indexer: the app supplies record IDs from its enqueue receipts or its indexer.
USDC sent to the owner's account wrapper that the account hasn't settled yet: refunds,
sell proceeds and settled payouts of Open records. Already counted in read.balance; for
display.
Plan a queued mint for a purchase form: the quote at the current price, the payout and
multiple, the order fee read from the desk, the escrow and debit, the balance, the most
the market takes now, the timing and the queue gates, plus the enqueue options that carry
the slippage. amount plans an all-in spend (enqueueMintCost, refunded below the payout
floor), and quantity an exact payout (enqueueMint, capped by probability and cost).
Works for a visitor without an account: the quote then comes from quote_mint.
slippageCents is cents per contract, never a percentage: a 10¢ limit fills while the
all-in price per contract stays within 10¢ of the quote's price without its fee subsidy.
Plan a queued early sell of an Open record: the quote at the current price, net of the
order fee, the floors at the worst price the slippage allows, the timing and the
builder's preflight, plus the enqueueSell options that carry the floors. A record that
isn't Open has no quote, so it throws PredictPreflightError 'record-not-open' instead.
A market's queue in one read: cash, the stuck gate ("pricing delayed"), cohorts, counters
against capacity, the desk's policy, a τ/deadline/cutoff preview, and the largest mint
spare cash admits now. With owner (who must have an account), also the account's
waiting orders and balance. Throws PredictPreflightError 'no-queue' while the market
has no MarketQueue.
Exact pre-trade quote for an exact-quantity mint. Requires a funded account.
Where the config records the delayed-execution upgrade (packages.predictDelayedExecution),
this reads Predict's own quote_mint_for_account (the immediate mint is retired there) and
the order desk's fee, and previews a QUEUED fill at the clock: queued: true, no
congestion penalty in cost, and the order fee in orderFee. The fill itself prices at
its committed Pyth tick. It throws PredictInputError when that config lacks the
order-flow package or its desk. Elsewhere it dry-runs the immediate mint and decodes its
receipt, as before.
Quote the all-in budget mint against current account and market state. Where the config
records the delayed-execution upgrade, it reads quote_mint_exact_cost_for_account at
min(spend, available − fee), the budget enqueue escrows, and previews a queued fill as
quoteMint does (and throws as it does on a partial config). Elsewhere it simulates the
immediate v2 mint.
Exact pre-close quote for an ACCOUNT position: dry-runs the immediate redeem and decodes the receipt.
Quote an early sell of an Open record (the queue's quote_redeem_open) at a fresh live
pricer. proceeds is before the order fee, with no congestion penalty, and net takes the
fee off. Throws ERecordNotOpen when the record isn't Open.
The market's settlement price, or null until a keeper settles it. Unlike market,
price and the quotes, which abort ELivePricingExpired once the market expires, it
keeps working after expiry, when an app shows results. With delayed execution the
keeper settles a market, pays its Open records and cleans them up within about a second
of expiry, so read.order returns null by then. Keep each filled record's
position.orderId and pass it to cost.settledPayout with this price.
Poll a record until it is filled, refunded or closed (pollMs, default 250), or until
timeoutMs (default 30 s). The fullnode a client reads can trail the enqueue's
execution, so a record not seen yet is polled again until the timeout, and ends as
'gone' only then. A record that disappears after it was seen ends as 'gone' at once.
The record's result is enough for the UI; the fee breakdown is in the
QueuedOrderFilled event.
ReadonlytxSend a finished record's parked funds to its receive address (queue::claim_parked): a
refund or change the address couldn't take while it was on USDC's deny list or USDC was
paused (OrderView parkedRaw). A skipped settlement payout isn't parked: pay it with
payOpen. Permissionless, and a no-op returning 0 while
the address is still denied. Needs no account, session or Pyth key.
Pay a settled position held in the ACCOUNT (redeem_settled), in full. Unchanged by delayed
execution, for positions minted before it. It doesn't pay Open queue records: the queue's
settlement walk (settle_step) pays those to the account's wrapper address.
Queue a mint of an exact payout quantity, filled at Pyth's price for its τ. Escrows
min(maxCost, quantity, available − fee) plus the order fee. maxCost and
maxProbability are required caps (see queue.slippageBand). Size against
read.queue(...).maxMint. The record ID is in the enqueue's OrderEnqueued
(decode.enqueue).
Queue a premium-budget mint: sized at τ under spend, at least minQuantity, with the
all-in debit capped by the required maxCost.
Queue an all-in-budget mint (the default mint): sized at τ so the all-in cost fits
spend, at least minQuantity. Escrows min(spend, available − fee) plus the order fee.
Queue the order a read.planMint or read.planSell plan describes, with its limits:
enqueueMintCost, enqueueMint or enqueueSell, by plan.order.builder. Pass the
market the plan was made for: the descriptor a mint plan was planned with, or the
coordinates read.planSell took for a sell plan. Throws the plan's refusal as a
PredictPreflightError, and 'fee' when the balance now escrows less than the plan's
budget.
Queue an early sell of an Open record (enqueue_redeem_open), the only early sell in v4.
The record must be Open and the owner's. Sells are never refused for market cash: when the
sell's cash need is above spare cash the preview sets needsFunding, and by default the
builder adds rebalance_expiry_cash after the enqueue (see fundMarket). A sell the market
still can't cover at the fill is refunded in full (reason 8) and the position returns to an
Open record.
The open filler: verify signed Pyth Lazer payloads, commit them to the market's waiting
cohorts, then resolve up to maxOrders (default 15) records. Reads the current Lazer
package from Lazer's State first (lazerStateId, or config.oracle.pythLazerState).
Immediate exact-quantity mint (mint_exact_quantity).
Retired by delayed execution (DBU-885): Predict v4 always aborts it
(EDelayedExecutionRequired), so it works only while the config calls a pre-v4 package.
Use PredictClient.tx.enqueueMint, and read.executionMode() to know which path a
network is on.
Immediate premium-budget mint (mint_exact_amount).
V2 all-in budget mint; use minQuantity to protect the fill against slippage.
Pay a settled market's Open record that the payout walk skipped (queue::pay_open), for
example while its receive address was denied. Permissionless: the payout goes only to the
record's own receive address. Aborts EMarketNotSettled before settlement.
Immediate close of an account position (redeem_live).
Refund this market's orders past their deadline. For the app's "Refund my order" button
only (OrderView.canRequestRefund), never prepended to other transactions: keepers
refund on their own. Needs no account, session or Pyth key, and works during a freeze.
maxOrders (default 100) bounds the records visited.
The deterministic id of a market's MarketQueue under the config's queue registry, whether
or not it exists yet — no chain read. Throws PredictInputError while the config doesn't
record delayed execution.
The deterministic id of an owner's canonical account wrapper — no chain read.
The trader's
OrderEnqueuedreceipt: the record ID, τ, deadline, escrow and fee.