import { DelayedExecutionPolicy, QueueHeads, QueuedOrder } from "../queue.mjs"; import { OrdersGeneratedConfig } from "../config/generated.mjs"; import "../tx/trade.mjs"; import "../tx/queue.mjs"; import "./inspect.mjs"; import { ClientWithCoreApi } from "@mysten/sui/client"; //#region src/predict/reads/queue.d.ts /** The companion's `order_flow::OrderFlow` witness type, which Predict's allowlist names. */ declare function orderFlowWitnessType(config: Pick): string; /** Everything the queued-order preflight and the app's queue view read, from one simulate. */ interface MarketQueueState { marketId: string; /** The market's `MarketQueue`. */ queueId: string; expiryMs: bigint; mintPaused: boolean; cashBalance: bigint; requiredCash: bigint; /** * Cash above required cash, 0 when below: the largest cash need a new queued mint may have * now (Predict's admission refuses a larger one). */ spareCash: bigint; /** Summed cash need of the admitted orders; `rebalance_expiry_cash` funds it. */ waitingCashNeed: bigint; /** 1e9-scaled. The mint cash-need formulas take it. */ minEntryProbability: bigint; /** 1e9-scaled λ. The sell cash-need formula takes it. */ backingBufferLambda: bigint; /** Sizes a filler's resolve batch. */ payoutTreeNodeCount: bigint; /** `queue_stuck`: enqueue would refuse as stuck right now ("pricing delayed"). */ stuck: boolean; cohorts: { count: bigint; oldestUncommittedTauMs: bigint | null; /** The cohort the stuck gate's first rule watches. */ oldestUncommittedTauAboveCommittedMs: bigint | null; }; heads: QueueHeads; /** Unfinished mints and sells, against the policy capacities. */ pending: { mints: bigint; sells: bigint; }; /** * The settlement payout walk (`settle_step`): it resumes at `cursor`, and `completed` is set * by the call that emits `MarketPayoutsCompleted`. */ payout: { cursor: bigint; nextId: bigint; completed: boolean; }; /** The companion's `OrderDesk`: the policy every queue runs under, and its version floor. */ desk: { id: string; policy: DelayedExecutionPolicy; versionWatermark: bigint; }; protocol: { noTradeWindowMs: bigint; /** The admin-set mint fee subsidy rate, 1e9-scaled (20% when unset). */ feeIncentiveSubsidyRate: bigint; tradingPaused: boolean; frozen: boolean; /** Predict's version floor. Enqueue needs it at `DELAYED_EXECUTION_VERSION`. */ versionWatermark: bigint; /** * Whether Predict allowlists this companion's `OrderFlow` witness * (`protocol_config::set_order_flow`). Predict's admission, commit and fill refuse it until * then (`EOrderFlowNotAllowed`). */ orderFlowEnabled: boolean; }; /** Present when an owner was given. */ account: { accountId: string; /** * Unfinished orders the account holds in this market, against `per_account_cap`. Stale * after expiry: the settlement drain refunds without lowering it. */ waitingOrders: bigint; /** `account::balance`, unsettled accumulator funds included. */ availableRaw: bigint; } | null; /** One entry per requested record ID: the record, or `null` when missing or deleted. */ records: (QueuedOrder | null)[]; } /** * Which trade path a network is on: * - `'immediate'`: the watermark isn't raised and this SDK has no delayed-execution record, so * its call target is a pre-v4 Predict package. Use the immediate `mint*` / `redeem` builders. * - `'awaiting-cutover'`: the config records delayed execution but the watermark isn't raised. * Nothing trades: enqueue aborts `ECutoverNotReached`, and the immediate builders abort in the * v4 package the config calls (`EDelayedExecutionRequired`). Trading stays paused through the * cutover. * - `'delayed'`: the watermark is raised. Use the `enqueue*` builders; the immediate ones abort * `EDelayedExecutionRequired`. * - `'unsupported'`: the watermark is raised but this SDK's config has no delayed-execution * record for the network. Upgrade the SDK, or pass a config that records it. * - `'retired'`: the watermark is above the Predict code version the config calls * (`packages.predictCurrentVersion`, else `PREDICT_PACKAGE_VERSION`), so every version-gated * call aborts `EPackageVersionDisabled`. * Upgrade the SDK. */ type ExecutionMode = 'immediate' | 'awaiting-cutover' | 'delayed' | 'unsupported' | 'retired'; //#endregion export { ExecutionMode, MarketQueueState, orderFlowWitnessType }; //# sourceMappingURL=queue.d.mts.map