Options for constructing an O2Client.

Provide either network (to use a pre-configured environment) or config (for custom endpoint configuration). If neither is provided, defaults to Network.TESTNET.

interface O2ClientOptions {
    config?: NetworkConfig;
    marketsCacheTtlMs?: number;
    network?: Network;
    webSocketFactory?: (url: string) => WebSocket;
}

Properties

config?: NetworkConfig

Custom network configuration (overrides network).

marketsCacheTtlMs?: number

Markets cache TTL in milliseconds (default: 60_000).

network?: Network

The network environment to connect to (default: Network.TESTNET).

webSocketFactory?: (url: string) => WebSocket

Optional WebSocket factory for custom runtimes/tests. Defaults to globalThis.WebSocket.