{s}omniamarkets

@somnia-chain/markets-sdk


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

Interface: ClientConfig

Defined in: config.ts:105

Configuration for a SomniaMarketsClient. indexerUrl is always required. chain + wsRpcUrl power the live tail, on-chain reads, and writes — they're required by those features, but the WebSocket socket is opened lazily, so an indexer-only client (e.g. server-side GraphQL reads) that never touches the chain never opens one.

Properties

indexerUrl

indexerUrl: string

Defined in: config.ts:107

Envio/Hasura GraphQL endpoint (HTTP). Same-origin relative paths are fine.


indexerHeaders?

optional indexerHeaders?: Record<string, string>

Defined in: config.ts:113

Extra headers sent with every indexer request — e.g. a Hasura role / admin-secret for SERVER-side reads that need privileges the public role lacks (notably _aggregate fields, which envio hides from the public role). MUST stay server-only; never construct a browser client with a secret here.


chain

chain: Chain

Defined in: config.ts:115

viem chain the markets live on.


wsRpcUrl

wsRpcUrl: string

Defined in: config.ts:119

Chain WebSocket RPC — the single chain transport. The live tail subscribes to logs + new heads over it, and all on-chain reads/writes use it too. There is no HTTP fallback: the SDK assumes a healthy WebSocket.


fees?

optional fees?: FixedFees

Defined in: config.ts:122

Fixed fees for SDK-signed writes (default DEFAULT_FEES). Override for a chain whose base fee can exceed the default ceiling.


addresses?

optional addresses?: SomniaMarketsAddresses

Defined in: config.ts:125

Protocol contract addresses — used by the write client, the live tail's factory watch, and /system reads.


priceFeed?

optional priceFeed?: PriceFeedConfig

Defined in: config.ts:130

The realtime price-feed endpoint (see PriceFeedConfig). One endpoint serves every asset; callers filter by asset. Required only for the price-feed methods (watchPrice, getLivePrice, fetchPrices, …); a client that never touches prices needs none.