Admin and relayer actions require the envelope signer’s derived address to be on the engine’s on-chain allowlist. Unauthorized signers receiveDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Proof-labs/trading-sdk/llms.txt
Use this file to discover all available pages before exploring further.
UnauthorizedRelayer. These actions control oracle feeds, market creation, live parameter updates, and event resolution — operations that affect the exchange state globally rather than a single account. All type signatures are drawn directly from src/types.ts.
OracleUpdate
Relayer-only.
signer must be an authorized oracle signer for the target market.publishTimeMs field must be strictly greater than the last accepted update for that market — the engine rejects stale or replayed updates with OracleTimestampNotMonotonic (error code 30). This monotonicity requirement was added per audit B3 (2026-04-23) as replay protection for the relayer-signed oracle feed.
Market identifier to update.
New oracle price in integer cents (2 decimal places). For example,
6675234n represents $66,752.34.Authorized oracle signer address (20 bytes). Must be the signer registered as the primary oracle for this market.
Oracle publish timestamp in milliseconds since Unix epoch. Must be strictly greater than the last accepted oracle update timestamp for this market. Violating this constraint returns error code 30 (
OracleTimestampNotMonotonic).CreateMarket
Admin-only.
signer must be on the admin allowlist.szDecimals and ticker — are mandatory on the wire: the engine’s Rust struct has no serde(default) for them, so a payload omitting either is rejected at decode time. Both fields are fixed at creation and immutable thereafter.
Market identifier (unique integer). Must not already exist on the chain.
Initial margin requirement in basis points (e.g.,
1000 = 10% = 10x maximum leverage).Maintenance margin requirement in basis points (e.g.,
500 = 5%). Must be less than imBps.Taker fee rate in basis points (e.g.,
5 = 0.05%).Maker fee rate in basis points (e.g.,
2 = 0.02%). May be negative for a maker rebate.Authorized admin signer address (20 bytes).
Funding interval in milliseconds. Pass
0n to disable periodic funding for this market.Maximum absolute funding rate per interval in basis points. The engine clamps the computed rate to this value.
Insurance-fund pool ID. Markets in different pools are insulated from each other’s liquidation cascades. Omitting this field (or passing
0) places the market in the shared default pool (pool 0).Published size scale: order and position
quantity is in units of 10^-szDecimals of the base asset. This is display and metadata only — the engine never reads it at runtime. Mandatory on the wire. Use 0 for integer-unit sizing.Human-readable ticker / short symbol (e.g.,
"BTC"). Display and metadata only — the engine never reads it at runtime. Mandatory on the wire; capped at 24 bytes by the engine. An empty string is accepted. Fixed at creation and immutable thereafter.UpdateMarketFees
Relayer-only. Updates live market config tunables without a chain rebase.
MarketConfig fields on an existing live market. Every tunable is optional; omitting a field (or passing null) leaves the current engine value untouched. Fields deliberately absent from this update path include imBps, mmBps, and kind — changing those on a live market would require re-margining every open position.
Market identifier to update.
Authorized relayer signer address (20 bytes).
New taker fee in basis points. Omit to leave unchanged.
New maker fee in basis points. Omit to leave unchanged. May be negative for a maker rebate.
New maximum absolute funding rate cap in basis points per interval. Pass
0 to disable funding.New funding interval in milliseconds. Omit to leave unchanged.
New per-account absolute position cap in contracts. Pass
0n to disable the cap.New default order TTL in milliseconds. Pass
0n to disable the end-of-block order-expiry sweep for this market. Useful for auto-cancelling stale MM quotes.Flip net-delta portfolio margin on this market.
true = firing legs with the same underlying group into a single net position for MM/IM; false = per-leg scenario margin. Safe to flip on at any time; flipping off can push accounts under MM.New tick size in microUSDC. Pass
0n to disable the tick gate (any price accepted).New lot size in contracts. Pass
0n to disable the lot gate (any quantity accepted).New primary oracle signer for this market (20 bytes). Pass an all-zero 20-byte address to clear the primary signer while preserving the staleness threshold. Omit to leave unchanged.
Oracle staleness threshold in milliseconds. Only consulted when
primaryOracleSigner is set on the market. Pass 0n to disable the gate.Mark-price source mode.
0 = OracleOnly (legacy); 1 = Median (oracle + book-mid). Has no effect on impact-family child markets — those always mark off the EWMA.Thin-book spread cap in basis points for the median guard. Pass
0 to reset to the engine default (100 bps). Ignored unless markSourceMode === 1.Maximum age in milliseconds for the composite-CEX price source. Pass
0n to reset to the engine default (30 seconds).Enable partial liquidation for this market.
true closes one position at a time and rechecks MM before continuing.Replace the rolling-volume fee-tier table. Omit to leave unchanged; pass
[] to clear volume tiers and fall back to flat taker/maker fees.CreateImpactMarket
Admin-only. Creates a 5-book impact-market family (CPY/CPN/EBY/EBN child markets + parent).
oracleSource field controls how the YES/NO outcome is verified at resolution: omitting it (or passing undefined) defaults to RelayerAttested, where the resolver supplies the outcome and the engine trusts it. Setting UnderlyingPriceVsStrike or MarketOracle makes resolution self-verifying — the engine recomputes the outcome from the named oracle and rejects any ResolveEvent that does not match.
Unique identifier for this impact-market family.
Market ID of the underlying perpetual (used by auto-resolve oracle modes).
Base market ID for the four child books; the engine assigns IDs
childMarketBase, childMarketBase+1, childMarketBase+2, childMarketBase+3.Event question text displayed to traders (e.g.,
"Will BTC close above $70,000 on 2025-06-30?").Event deadline in milliseconds since Unix epoch. After this timestamp the event enters the pre-resolution window.
Duration in milliseconds of the resolution window after
deadlineMs during which the resolver may submit ResolveEvent.Initial margin requirement for child books in basis points.
Maintenance margin requirement for child books in basis points.
Taker fee rate for child books in basis points.
Maker fee rate for child books in basis points.
Funding interval for child books in milliseconds.
Maximum absolute funding rate per interval for child books in basis points.
Authorized admin signer address (20 bytes).
Optional auto-resolve oracle source.
undefined (wire nil) defaults to RelayerAttested. Set UnderlyingPriceVsStrike or MarketOracle for self-verifying resolution. Use RelayerAttested for events with no on-chain price oracle (e.g., “Did Apple announce X?”).Optional event body text for frontend detail pages. Encodes as
"" when absent.Optional resolution criteria text. Encodes as
"" when absent.Branch
Used to identify which side of a binary event a child market belongs to. TheMarketKind variants encode this as the string literal "Yes" or "No", which maps directly to the Branch enum values.
EventOracleSource
Controls how the YES/NO outcome of an impact market is determined at deadline.| Variant | Description |
|---|---|
UnderlyingPriceVsStrike | Resolves YES iff underlyingMarket.oraclePrice <comparison> strikePrice at deadline |
MarketOracle | Resolves YES iff the named market’s oracle price <comparison> strikePrice at deadline |
RelayerAttested | The relayer supplies the outcome and the engine trusts it (legacy default) |
PriceComparison
oracle_price <comparison> strike_price. For example, "GreaterThan" means the event resolves YES when the oracle reading is strictly greater than the strike price.
ResolveEvent
Relayer-only. If
oracleSource is set to an auto-resolve mode, the engine recomputes the outcome and rejects a mismatched outcome. Outcome.Void overrides auto-derivation in either mode (operator escape hatch).Resolved.
Impact-market family ID to resolve.
Final outcome.
Outcome.Yes (1), Outcome.No (2), or Outcome.Void (3). For auto-resolve markets, the engine verifies Yes or No against the oracle; Void always passes as an operator override.Authorized relayer signer address (20 bytes).
Outcome Enum
FeeTier
TheFeeTier interface defines one row in the rolling-volume fee schedule used by UpdateMarketFees.feeTiers and stored in MarketConfig.feeTiers.
Minimum 30-day rolling taker volume in microUSDC required to qualify for this tier. The engine selects the highest tier for which the account’s
volume30dMicroUsdc >= min30dVolumeMicroUsdc.Maker fee in tenth-basis-points. A negative value represents a maker rebate. For example,
-5 = −0.005% rebate; 20 = 0.02% fee.Taker fee in tenth-basis-points. For example,
50 = 0.05%.MarketKind
TheMarketKind discriminated union identifies what kind of market a MarketConfig represents. The wire shape mirrors the Rust MarketKind enum exactly.
| Variant | Wire Shape | Description |
|---|---|---|
"Perp" | Bare string "Perp" | Standard perpetual futures market |
{ ConditionalPerp: [id, branch] } | Object with impactMarketId and branch | Conditional perpetual child of an impact-market family |
{ PredictionBinary: [id, branch] } | Object with impactMarketId and branch | Binary prediction child of an impact-market family |
MarketConfig
MarketConfig is the full on-chain configuration record for a market, returned by market query endpoints. The wire format is a MessagePack positional array; indices mirror the Rust struct field order.
serde(default) so older on-chain records decode cleanly without those fields. The markSourceMode type alias is: