Reference · @novakoracle/sdk
The TypeScript SDK
Method groups
8
42 rows below
Feeds bundled
53
Chainlink Robinhood mainnet
Networks
2
46630 testnet · 31337 anvil
Tests
18
vitest: ABIs, codec, source specs, ladders
Install
The SDK is a pnpm workspace package in this repo (not on npm yet). Inside the monorepo it is linked automatically; build it before anything that imports it:
pnpm install
pnpm --filter @novakoracle/sdk build # → sdk/dist
# after any contract change:
forge build && pnpm --filter @novakoracle/sdk gen && pnpm --filter @novakoracle/sdk buildQuickstart
import { createPublicClient, http } from "viem";
import { NovakClient, getDeployment, robinhoodTestnet } from "@novakoracle/sdk";
const publicClient = createPublicClient({ chain: robinhoodTestnet, transport: http() });
const client = new NovakClient(publicClient, undefined, getDeployment(robinhoodTestnet.id));
// Pending | Available | Voided — "not yet" vs "never"
const availability = await client.getAvailability(eventId);
const { available, outcome } = await client.resolveOutcome(eventId);Method reference
Events (EventRegistry)
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| createEvent(spec, account) | write | tx hash |
| createEvents(specs[], account) | write | tx hash — up to 16 in one transaction |
| getCreatedEventId(txHash) · getCreatedEventIds(txHash) | read | Hex · Hex[] (waits for the receipt) |
| getEventStatus(eventId) | read | EventStatus number |
| getEventSpec(eventId) | read | EventSpecInput |
| isFinalized(eventId) | read | boolean |
| finalize(eventId, account) | write | tx hash (after the dispute window) |
| listEvents(fromBlock) | read | { eventId, sourceId, specVersion, blockNumber }[] |
Reading outcomes (EventBus / Settlement)
The consumer path — use these to settle anything.
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| getAvailability(eventId) | read | Availability: 0 Pending · 1 Available · 2 Voided |
| isAvailable(eventId) | read | boolean |
| readOutcome(eventId) | read | Outcome { outcomeData, finalizedAt, … } |
| resolveOutcome(eventId) | read | { available, outcome } via Settlement |
| waitForOutcome(eventId, { intervalMs, timeoutMs }) | read | { voided: false, outcome, outcomeData } | { voided: true } |
Composites (EventComposer)
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| createComposite(spec, account) | write | tx hash |
| tryResolveComposite(compositeId, account) | write | tx hash |
| getResolvedComposite(compositeId) | read | { resolved, outcome } |
Range markets (DistributionMarket)
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| createDistributionMarket(question, boundaryIds, tradingClosesAt, b, account) | write | tx hash |
| getCreatedDistributionMarketId(txHash) | read | Hex |
| distributionSubsidy(b, nBuckets) | helper | bigint — approve this much first |
| distributionBuy(id, bucket, usdgIn, minShares, account) | write | tx hash |
| distributionSell(id, bucket, shares, minUsdgOut, account) | write | tx hash |
| distributionQuoteBuy(id, bucket, usdgIn) | read | { shares, fee } |
| distributionQuoteSell(id, bucket, shares) | read | { collateralOut, fee } |
| distributionPrices(id) | read | number[] (sum to 1) |
| getDistributionMarket(id) · listDistributionMarkets() | read | market info (+ boundaries, prices) |
| distributionSharesOf(id, trader) · distributionPayoutOf(id, trader) | read | bigint[] · bigint |
| distributionSettle(id, account) · distributionRedeem(id, account) | write | tx hash |
Yes/no markets (Market)
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| createMarket(eventId, tradingClosesAt, question, account) | write | tx hash |
| getCreatedMarketId(txHash) | read | Hex |
| depositCollateral(marketId, backingYes, amount, account) | write | tx hash — approve first |
| closePosition(marketId, backingYes, amount, account) | write | tx hash — before tradingClosesAt only |
| settleMarket(marketId, account) · claim(marketId, account) | write | tx hash |
| getMarket(marketId) · listMarkets() · listMarketIds() | read | MarketDef(s) — on-chain enumeration |
| payoutOf(marketId, trader) | read | bigint |
TreasuryVault
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| vaultClaimable(eventId, who) | read | { resolver, committee } |
| vaultBalances() | read | { treasury, insurance } |
| vaultPendingFees(eventId) | read | bigint (not yet allocated) |
Collateral (USDG / MockUSDG) & lending guard
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| collateralBalance(owner) · collateralAllowance(owner) · collateralAllowanceFor(owner, spender) | read | bigint (6 decimals) |
| approveCollateral(amount, account) · approveCollateralFor(spender, amount, account) | write | tx hash |
| mintTestCollateral(to, amount, account) | write | tx hash — testnet MockUSDG only |
| canLiquidate(stockToken) | read | { allowed, blockingEventId } — StockLendingGuard |
Subscriptions (stub)
Push delivery is deliberately deferred — consumers pull.
Method
Kind
Returns
| Method | Kind | Returns |
|---|---|---|
| subscribe · unsubscribe · isSubscribed | write | SubscriptionManager stub |
Other exports
Export
What it is
Export
What it is
Export
What it is
Export
What it is
Export
What it is
Export
What it is
Export
What it is
Export
What it is
Export
What it is
| Export | What it is |
|---|---|
| SOURCES · sourceId(name) · sourceName(id) | The 4 source names and their keccak256 IDs |
| encodePriceAtSpec · decodePriceAtSpec · Comparator | chainlink.price-at.v1 specs (feed, threshold, ≥/≤, at, maxStaleness) |
| buildPriceLadderSpecs · ladderBucketLabels | N−1 boundary specs for a range market, and their labels |
| encodeCorporateActionSpec · encodeTradingStatusSpec · encodeFedRateSpec (+ decoders) | The other three sources |
| CHAINLINK_FEED_CATALOG · feedBySymbol · feedByAddress | All 53 Chainlink Robinhood feeds (symbol, name, class, address, decimals) |
| encodeBoolOutcome · encodeOutcomeV2 · decodeOutcome · encodeOutcomeForVersion | Outcome payload codec (v1 bool, v2 bool + occurredAt) |
| deployments · getDeployment(chainId) · explorerUrl(chainId) | Generated addresses (46630, 31337) and Blockscout URLs |
| robinhoodTestnet · robinhood · ROBINHOOD_TESTNET_ID · TESTNET_FAUCET_URL | Chain definitions |
| eventBusAbi · eventRegistryAbi · disputeManagerAbi · distributionMarketAbi · treasuryVaultAbi · … | Generated ABIs for every contract (never hand-edited) |
Not wrapped on purpose
submitObservation, dispute, submitTier1Vote / submitTier2Vote, escalateTier2, voidAfterTier2Timeout — aren't part of the consumer client. The resolver node calls them directly with the generated eventRegistryAbi / disputeManagerAbi. Anyone can call them from a wallet or script the same way.