{s}omniamarkets

@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / OracleHubAdmin

Interface: OracleHubAdmin

Defined in: oracleHub.ts:355

Methods

getSchedulingCost()

getSchedulingCost(def): Promise<bigint>

Defined in: oracleHub.ts:358

Marginal scheduling cost for def (0 = would dedup).

Parameters

def

QuestionDefinitionInput

Returns

Promise<bigint>


earmarkedOf()

earmarkedOf(operatorId): Promise<bigint>

Defined in: oracleHub.ts:360

Native LOCKED for an operator's outstanding markets (wei; never withdrawable).

Parameters

operatorId

number

Returns

Promise<bigint>


creditOf()

creditOf(operatorId): Promise<bigint>

Defined in: oracleHub.ts:362

An operator's accrued WITHDRAWABLE surplus credit on the hub (wei).

Parameters

operatorId

number

Returns

Promise<bigint>


outstandingOf()

outstandingOf(operatorId): Promise<bigint>

Defined in: oracleHub.ts:364

Count of an operator's bound-but-unresolved markets.

Parameters

operatorId

number

Returns

Promise<bigint>


withdrawableOf()

withdrawableOf(operatorId): Promise<bigint>

Defined in: oracleHub.ts:366

Wei an operator's owner may withdraw right now (== creditOf).

Parameters

operatorId

number

Returns

Promise<bigint>


payerCreditOf()

payerCreditOf(payer): Promise<bigint>

Defined in: oracleHub.ts:369

A1: withdrawable surplus credited to a reserve-PAYER (open-venue creator or the autonomous MarketCreator), drawn by that account itself.

Parameters

payer

`0x${string}`

Returns

Promise<bigint>


payerOf()

payerOf(marketId): Promise<`0x${string}`>

Defined in: oracleHub.ts:372

A1: the reserve-payer recorded for a market at onBind (surplus recipient); zero-address once settled + swept.

Parameters

marketId

`0x${string}`

Returns

Promise<`0x${string}`>


resolveReserve()

resolveReserve(): Promise<bigint>

Defined in: oracleHub.ts:374

The per-market resolution reserve attached+locked at onBind (wei).

Returns

Promise<bigint>


quoteCreateMarketValue()

quoteCreateMarketValue(def): Promise<bigint>

Defined in: oracleHub.ts:378

THE §8e create-market value rule: getSchedulingCost(def) + resolveReserve() (the reserve is attached to the create; attach exactly this to scheduleAndCreateMarket; excess refunds).

Parameters

def

QuestionDefinitionInput

Returns

Promise<bigint>


getQuestionState()

getQuestionState(def): Promise<HubQuestionState>

Defined in: oracleHub.ts:381

One definition's full dedup state: canonical key, the active question id it resolves to (0n = none), bind count, and the bound-market fan-out list.

Parameters

def

QuestionDefinitionInput

Returns

Promise<HubQuestionState>


getQuestionIdByKey()

getQuestionIdByKey(questionKey): Promise<bigint>

Defined in: oracleHub.ts:383

The ACTIVE question id for a canonical key (0n = never scheduled).

Parameters

questionKey

`0x${string}`

Returns

Promise<bigint>


getBindCount()

getBindCount(oracleQuestionId): Promise<number>

Defined in: oracleHub.ts:385

Lifetime bind count for a question id.

Parameters

oracleQuestionId

bigint

Returns

Promise<number>


getMarketsForQuestion()

getMarketsForQuestion(oracleQuestionId): Promise<`0x${string}`[]>

Defined in: oracleHub.ts:387

Every marketId bound to a question id (the fan-out list).

Parameters

oracleQuestionId

bigint

Returns

Promise<`0x${string}`[]>


isHubApproved()

isHubApproved(): Promise<boolean>

Defined in: oracleHub.ts:391

Whether the module has the hub approved (approvedAdapters(hub)) — the Oracle v2 equivalent of the old per-adapter isAdapterApproved. Needs config.addresses.binaryModule.

Returns

Promise<boolean>


getHubStatus()

getHubStatus(): Promise<HubStatus>

Defined in: oracleHub.ts:394

The hub's full live status (owner / balance / approval / subscription / gas + drain params / resolveReserve + pending drain).

Returns

Promise<HubStatus>


scheduleQuestion()

scheduleQuestion(p): Promise<ScheduleQuestionResult>

Defined in: oracleHub.ts:401

Schedule a question through the hub (content-addressed: an identical template definition returns the EXISTING id and refunds the value). Resolves with the question id decoded from QuestionScheduled / QuestionReused and whether it deduplicated.

Parameters

p

ScheduleQuestionParams

Returns

Promise<ScheduleQuestionResult>


withdraw()

withdraw(p): Promise<TxResult>

Defined in: oracleHub.ts:406

Withdraw an operator's accrued WITHDRAWABLE surplus credit (credit-only; OWNER-gated on-chain: only the operator's owner, read from MarketsCore, may draw it, and only up to withdrawableOf — else InsufficientCredit). The earmark backing live markets is untouchable.

Parameters

p

WithdrawParams

Returns

Promise<TxResult>


withdrawMyCredit()

withdrawMyCredit(p): Promise<TxResult>

Defined in: oracleHub.ts:411

A1: withdraw the CALLER's own accrued payer credit (msg.sender-gated — the connected signer draws only its own surplus, up to payerCreditOf(caller)). This is how an open-venue creator claims their refund, and how the autonomous MarketCreator self-reclaims (via its own on-chain call).

Parameters

p

WithdrawMyCreditParams

Returns

Promise<TxResult>


fundHub()

fundHub(p): Promise<TxResult>

Defined in: oracleHub.ts:414

Send native to the hub's receive() — funds the reactivity bond (hub float; NOT credited to any operator — resolution funding is per-market).

Parameters

p

FundHubParams

Returns

Promise<TxResult>


setGasParams()

setGasParams(p): Promise<TxResult>

Defined in: oracleHub.ts:417

Update the reactivity gas params (OWNER-only). maxFeePerGas also reprices resolveReserve() immediately.

Parameters

p

SetHubGasParams

Returns

Promise<TxResult>


setDrainParams()

setDrainParams(p): Promise<TxResult>

Defined in: oracleHub.ts:421

Update the bounded-drain metering params (OWNER-only): perMarketResolveGas sizes resolveReserve, callbackBaseGas is the attributed overhead term, maxResolvesPerCallback + resolveGasReserve bound one callback's work.

Parameters

p

SetHubDrainParams

Returns

Promise<TxResult>


enableReactivity()

enableReactivity(p?): Promise<TxResult>

Defined in: oracleHub.ts:425

Register the Somnia reactivity subscription (OWNER-only, one-shot). NOTE: calls the reactivity precompile at 0x0100, which does NOT exist on local anvil — testnet/mainnet only.

Parameters

p?

EnableHubReactivityParams

Returns

Promise<TxResult>


migrateSubscription()

migrateSubscription(p?): Promise<TxResult>

Defined in: oracleHub.ts:428

Unsubscribe + re-subscribe with the current topic/gas params (OWNER-only; for upstream event-signature changes). Precompile — testnet/mainnet only.

Parameters

p?

EnableHubReactivityParams

Returns

Promise<TxResult>