Skip to content

SwapClientOptions

relayUrl: string

Relay origin, e.g. http://localhost:4000 (the API is under /api/v2).


appId: string

The integrating app (si-web is the operator's public front-end, no key).


optional apiKey?: string

x-si-app-key, for apps other than the operator's.


optional referrer?: string

An app that referred the user to this front-end (attribution, channel share).


optional pollMs?: number

Status polling interval without a WebSocket (default 1 s); 5× that alongside one.


optional fetch?: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

(input, init?): Promise<Response>

MDN Reference

Parameter Type
input URL | RequestInfo
init? RequestInit

Promise<Response>

(input, init?): Promise<Response>

MDN Reference

Parameter Type
input string | URL | Request
init? RequestInit

Promise<Response>


optional WebSocket?: ({new (url, protocols?): WebSocket; prototype: WebSocket; CONNECTING: 0; OPEN: 1; CLOSING: 2; CLOSED: 3; }) | null

The global one by default; null polls only.


optional maxOfferTtlMs?: number

The longest TTL the SDK lets a user_offer the wallet signs carry (default 15 min): whoever holds the offer can complete it until then.


optional relayPublicKey?: string

The relay's verifying key, which every response's attestation is checked against. Configure it for a relay you do not operate. Left out, the key the relay publishes at /network is fetched once, before the first quote, and held from then on: it is never taken from a response being checked.


optional network?: string

The Midnight network the swaps are on (mainnet, preprod…). Left out: the relay's (/network).


optional checkLeg?: LegChecker

Checks a solver_offer leg before the wallet balances it (LegChecker). Without it the client asks for user_offer quotes only: balancing a leg nobody on the user's side has checked would pay whatever that leg is short of.