Documentation
    Preparing search index...

    Interface MarketQueueView

    read.queue: a market's queue state plus the derived figures the app shows.

    interface MarketQueueView {
        acceptingMints: boolean;
        acceptingSells: boolean;
        account:
            | { accountId: string; availableRaw: bigint; waitingOrders: bigint }
            | null;
        backingBufferLambda: bigint;
        cashBalance: bigint;
        cohorts: {
            count: bigint;
            oldestUncommittedTauAboveCommittedMs: bigint | null;
            oldestUncommittedTauMs: bigint | null;
        };
        desk: {
            id: string;
            policy: queue.DelayedExecutionPolicy;
            versionWatermark: bigint;
        };
        expiryMs: bigint;
        heads: QueueHeads;
        marketId: string;
        maxMint: { budget: MaxMintNow; exactQuantity: MaxMintNow };
        minEntryProbability: bigint;
        mintPaused: boolean;
        mode: ExecutionMode;
        payout: { completed: boolean; cursor: bigint; nextId: bigint };
        payoutTreeNodeCount: bigint;
        pending: { mints: bigint; sells: bigint };
        protocol: {
            feeIncentiveSubsidyRate: bigint;
            frozen: boolean;
            noTradeWindowMs: bigint;
            orderFlowEnabled: boolean;
            tradingPaused: boolean;
            versionWatermark: bigint;
        };
        queueId: string;
        records: (
            | {
                account_id: string;
                escrow: {
                    budget: bigint;
                    cash_need: bigint;
                    order_fee: bigint;
                    subsidy_bound: bigint;
                    subsidy_reserved: bigint;
                };
                funds: bigint;
                kind: number;
                position: { opened_at_ms: bigint; order_id: bigint; root_id: bigint };
                price: { generation_us: bigint; spot: bigint; tick_ms: bigint };
                receipt_stage: number;
                receive_address: string;
                request: {
                    higher_tick: bigint;
                    lower_tick: bigint;
                    max_cost: bigint;
                    max_premium: bigint;
                    max_probability: bigint;
                    min_probability: bigint;
                    min_proceeds: bigint;
                    min_quantity: bigint;
                    quantity: bigint;
                };
                result: {
                    amount: bigint;
                    finished_at_ms: bigint;
                    quantity: bigint;
                    reason: number;
                };
                status: number;
                timing: {
                    cutoff_ms: bigint;
                    deadline_ms: bigint;
                    earliest_price_ms: bigint;
                    placed_at_ms: bigint;
                    pyth_channel: number;
                    tau_ms: bigint;
                };
            }
            | null
        )[];
        refusal: {
            mint: PredictPreflightCode
            | null;
            sell: PredictPreflightCode | null;
        };
        requiredCash: bigint;
        spareCash: bigint;
        stuck: boolean;
        timing: TimingPreview;
        waitingCashNeed: bigint;
    }

    Hierarchy (View Summary)

    Index
    acceptingMints: boolean

    Whether a new mint would pass the queue gates now: the same gates enqueueMint* checks before its fee and cash checks (the order-flow allowlist, the cutover, pauses, stuck, mint capacity, the cutoff, and the account cap when an owner was given). One side can be full while the other is open.

    acceptingSells: boolean

    Whether a new sell would pass the queue gates now (sells skip the mint pauses).

    account:
        | { accountId: string; availableRaw: bigint; waitingOrders: bigint }
        | null

    Present when an owner was given.

    Type Declaration

    • { accountId: string; availableRaw: bigint; waitingOrders: bigint }
      • accountId: string
      • availableRaw: bigint

        account::balance<USDC>, unsettled accumulator funds included.

      • waitingOrders: bigint

        Unfinished orders the account holds in this market, against per_account_cap. Stale after expiry: the settlement drain refunds without lowering it.

    • null
    backingBufferLambda: bigint

    1e9-scaled λ. The sell cash-need formula takes it.

    cashBalance: bigint
    cohorts: {
        count: bigint;
        oldestUncommittedTauAboveCommittedMs: bigint | null;
        oldestUncommittedTauMs: bigint | null;
    }

    Type Declaration

    • count: bigint
    • oldestUncommittedTauAboveCommittedMs: bigint | null

      The cohort the stuck gate's first rule watches.

    • oldestUncommittedTauMs: bigint | null
    desk: {
        id: string;
        policy: queue.DelayedExecutionPolicy;
        versionWatermark: bigint;
    }

    The companion's OrderDesk: the policy every queue runs under, and its version floor.

    expiryMs: bigint
    heads: QueueHeads
    marketId: string
    maxMint: { budget: MaxMintNow; exactQuantity: MaxMintNow }

    The largest mint the market's spare cash admits now.

    minEntryProbability: bigint

    1e9-scaled. The mint cash-need formulas take it.

    mintPaused: boolean
    payout: { completed: boolean; cursor: bigint; nextId: bigint }

    The settlement payout walk (settle_step): it resumes at cursor, and completed is set by the call that emits MarketPayoutsCompleted.

    payoutTreeNodeCount: bigint

    Sizes a filler's resolve batch.

    pending: { mints: bigint; sells: bigint }

    Unfinished mints and sells, against the policy capacities.

    protocol: {
        feeIncentiveSubsidyRate: bigint;
        frozen: boolean;
        noTradeWindowMs: bigint;
        orderFlowEnabled: boolean;
        tradingPaused: boolean;
        versionWatermark: bigint;
    }

    Type Declaration

    • feeIncentiveSubsidyRate: bigint

      The admin-set mint fee subsidy rate, 1e9-scaled (20% when unset).

    • frozen: boolean
    • noTradeWindowMs: bigint
    • orderFlowEnabled: boolean

      Whether Predict allowlists this companion's OrderFlow witness (protocol_config::set_order_flow). Predict's admission, commit and fill refuse it until then (EOrderFlowNotAllowed).

    • tradingPaused: boolean
    • versionWatermark: bigint

      Predict's version floor. Enqueue needs it at DELAYED_EXECUTION_VERSION.

    queueId: string

    The market's MarketQueue.

    records: (
        | {
            account_id: string;
            escrow: {
                budget: bigint;
                cash_need: bigint;
                order_fee: bigint;
                subsidy_bound: bigint;
                subsidy_reserved: bigint;
            };
            funds: bigint;
            kind: number;
            position: { opened_at_ms: bigint; order_id: bigint; root_id: bigint };
            price: { generation_us: bigint; spot: bigint; tick_ms: bigint };
            receipt_stage: number;
            receive_address: string;
            request: {
                higher_tick: bigint;
                lower_tick: bigint;
                max_cost: bigint;
                max_premium: bigint;
                max_probability: bigint;
                min_probability: bigint;
                min_proceeds: bigint;
                min_quantity: bigint;
                quantity: bigint;
            };
            result: {
                amount: bigint;
                finished_at_ms: bigint;
                quantity: bigint;
                reason: number;
            };
            status: number;
            timing: {
                cutoff_ms: bigint;
                deadline_ms: bigint;
                earliest_price_ms: bigint;
                placed_at_ms: bigint;
                pyth_channel: number;
                tau_ms: bigint;
            };
        }
        | null
    )[]

    One entry per requested record ID: the record, or null when missing or deleted.

    Type Declaration

    • {
          account_id: string;
          escrow: {
              budget: bigint;
              cash_need: bigint;
              order_fee: bigint;
              subsidy_bound: bigint;
              subsidy_reserved: bigint;
          };
          funds: bigint;
          kind: number;
          position: { opened_at_ms: bigint; order_id: bigint; root_id: bigint };
          price: { generation_us: bigint; spot: bigint; tick_ms: bigint };
          receipt_stage: number;
          receive_address: string;
          request: {
              higher_tick: bigint;
              lower_tick: bigint;
              max_cost: bigint;
              max_premium: bigint;
              max_probability: bigint;
              min_probability: bigint;
              min_proceeds: bigint;
              min_quantity: bigint;
              quantity: bigint;
          };
          result: {
              amount: bigint;
              finished_at_ms: bigint;
              quantity: bigint;
              reason: number;
          };
          status: number;
          timing: {
              cutoff_ms: bigint;
              deadline_ms: bigint;
              earliest_price_ms: bigint;
              placed_at_ms: bigint;
              pyth_channel: number;
              tau_ms: bigint;
          };
      }
      • account_id: string
      • escrow: {
            budget: bigint;
            cash_need: bigint;
            order_fee: bigint;
            subsidy_bound: bigint;
            subsidy_reserved: bigint;
        }
        • budget: bigint

          USDC locked for the premium and fees, and the fill's all-in cost cap. Sells lock none.

        • cash_need: bigint

          Worst-case market cash the fill can consume, counted in Predict's waiting cash need while the order waits.

        • order_fee: bigint

          Flat fee charged at placement.

        • subsidy_bound: bigint

          The admission dry run's pre-subsidy trading fee, capped at the budget. Bounds the subsidy commit reserves.

        • subsidy_reserved: bigint

          The incentives commit reserved for the order, held with its escrow.

      • funds: bigint

        USDC the record holds now: escrow while unfinished, parked funds after.

      • kind: number
      • position: { opened_at_ms: bigint; order_id: bigint; root_id: bigint }
      • price: { generation_us: bigint; spot: bigint; tick_ms: bigint }
        • generation_us: bigint

          The feed's own update time, in µs.

        • spot: bigint

          Pyth price normalized to 1e9.

        • tick_ms: bigint

          The update's envelope in ms: τ, or a later backup tick. The fill prices at it.

      • receipt_stage: number

        The receipt's Predict stage (constants::receipt_stage_*), 0 when the record holds none.

      • receive_address: string
      • request: {
            higher_tick: bigint;
            lower_tick: bigint;
            max_cost: bigint;
            max_premium: bigint;
            max_probability: bigint;
            min_probability: bigint;
            min_proceeds: bigint;
            min_quantity: bigint;
            quantity: bigint;
        }
      • result: { amount: bigint; finished_at_ms: bigint; quantity: bigint; reason: number }
        • amount: bigint

          Cost paid (mint) or proceeds (sell). Zero on a refund.

        • finished_at_ms: bigint

          Sui clock of the finishing transaction.

        • quantity: bigint

          Filled quantity (mint) or closed quantity (sell).

        • reason: number

          0 for a fill, or a REASON_* code.

      • status: number
      • timing: {
            cutoff_ms: bigint;
            deadline_ms: bigint;
            earliest_price_ms: bigint;
            placed_at_ms: bigint;
            pyth_channel: number;
            tau_ms: bigint;
        }
        • cutoff_ms: bigint

          expiry - max(no_trade_window_ms, stall_timeout_ms + 5_000); placement requires τ below it.

        • deadline_ms: bigint

          At or past it the order is refunded, never filled.

        • earliest_price_ms: bigint

          τ itself: a price generated before it never commits the order.

        • placed_at_ms: bigint

          t₀, the Sui clock of the placement transaction.

        • pyth_channel: number

          The policy channel at placement. Commit accepts only updates on it.

        • tau_ms: bigint

          The channel tick the order is priced on.

    • null
    refusal: {
        mint: PredictPreflightCode | null;
        sell: PredictPreflightCode | null;
    }

    Why each side refuses now, or null: the PredictPreflightError code the builder would throw for the queue gates.

    requiredCash: bigint
    spareCash: 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).

    stuck: boolean

    queue_stuck: enqueue would refuse as stuck right now ("pricing delayed").

    τ, deadline and cutoff for an order placed now, from the local clock.

    waitingCashNeed: bigint

    Summed cash need of the admitted orders; rebalance_expiry_cash funds it.