Skip to main content

Interface: GdexStreamConfig

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / GdexStreamConfig

Interface: GdexStreamConfig

Defined in: packages/gswap-sdk/dist/index.d.ts:1664

Options for GdexStreamService.

Properties​

apiKey?​

optional apiKey?: string

Defined in: packages/gswap-sdk/dist/index.d.ts:1691

Presents x-api-key on the WebSocket upgrade request, which the swap backend uses to serve the PRIVILEGED view (shadow swaps with the wallet unredacted). Without it, or with a wrong key, the connection is simply public: the server never says whether a privileged mode exists.

It must travel as an HTTP header, because the server reads no other credential, and a browser WebSocket cannot set headers. So this option needs a constructor that accepts them as its third argument ({ headers }): the ws package on Node.js, or React Native's built-in WebSocket. It therefore REQUIRES webSocketImpl (the platform default is never assumed to honor headers, and a key that is silently dropped would look like a working privileged connection); the constructor throws otherwise. Use it from server-side code only: a key shipped inside a browser or app bundle is not a secret. Browser clients stay public.


reconnectAttempts?​

optional reconnectAttempts?: number

Defined in: packages/gswap-sdk/dist/index.d.ts:1668

Reconnect attempts after an unexpected close. Default 5.


reconnectDelayMs?​

optional reconnectDelayMs?: number

Defined in: packages/gswap-sdk/dist/index.d.ts:1670

Delay before the first reconnect attempt; doubles each attempt. Default 2000 ms.


requestTimeoutMs?​

optional requestTimeoutMs?: number

Defined in: packages/gswap-sdk/dist/index.d.ts:1672

How long a request waits for its response. Default 15000 ms.


url?​

optional url?: string

Defined in: packages/gswap-sdk/dist/index.d.ts:1666

Stream endpoint. Defaults to production (wss://dex-backend-prod1.defi.gala.com/ws).


webSocketImpl?​

optional webSocketImpl?: unknown

Defined in: packages/gswap-sdk/dist/index.d.ts:1677

A standards-compatible WebSocket constructor. Required on Node.js older than 22, which has no global WebSocket (pass the one from the ws package).