Skip to content
docs

RemoteProviderOptions

Defined in: protocol-swap2-core/src/remote.ts:26

HTTP-proxied CrossChainProvider: forwards every provider call to a backend that runs the real provider. This is how a BROWSER context (e.g. a wallet’s signing worker) executes the full swap2 layer — account binding, approvals, cell-body guards, id/status lifecycle — while provider secrets (API JWTs, affiliate config) and non-CORS REST endpoints stay server-side.

Wire protocol: POST {baseUrl}/{action} with a JSON body, one action per provider method: quote {provider, params: QuoteParams} → Quote | null build {provider, quote: Quote} → UnsignedTx preflight {provider, quote: Quote, tx: UnsignedTx} → {} track {provider, ref: IntentRef} → IntentStatus notify {provider, intentId, txHash} → {} register {provider, intentId, signature} → {} claim {provider, ref: IntentRef} → UnsignedTx | null supports {provider, from, to} → {supported: boolean}

supportsRoute/enabled need a SYNC answer, so they are config: pass the routes the backend advertises via supports, or leave the default allow-and-let-quote-decide behavior (a null quote is a clean miss).

optional allowInsecureBaseUrl?: boolean

Defined in: protocol-swap2-core/src/remote.ts:77

Allow a non-https absolute baseUrl (local development only). Quotes, builds and typed orders travel this channel; over plain http anyone on the path can rewrite them (scan 2026-10-27 modules, F4).


baseUrl: string

Defined in: protocol-swap2-core/src/remote.ts:30

Endpoint prefix, e.g. “/api/v2/swap2” (same-origin) or absolute URL.


optional callTargets?: (chain) => readonly string[]

Defined in: protocol-swap2-core/src/remote.ts:53

The contracts this provider’s EVM swaps may call, and the spenders they may be approved for, per chain — the provider package’s pins (lifiPins, fyndPins, uniswapPins…, spread into these options). The app’s lists, not the server’s: without them the engine refuses this stub’s EVM calldata routes and approvals, so a compromised backend cannot name its own contract or spender (scan 2026-10-27 modules, F8/F9/F16). Deposit-address routes need depositAddressRoutes.

string

readonly string[]


optional claimTargets?: (chain) => readonly string[]

Defined in: protocol-swap2-core/src/remote.ts:45

The contracts this provider’s claims may call, per chain (e.g. cctpClaimTargets from @anywalletkit/protocol-swap2-cctp). The app’s list, not the server’s: without it the engine refuses claims from this stub (round 3, M24).

string

readonly string[]


optional depositAddressRoutes?: boolean

Defined in: protocol-swap2-core/src/remote.ts:72

Let this stub’s routes send the input to an address the backend names: a deposit address (NEAR Intents, a THORChain or Chainflip Tron vault) or a plain value send. Off by default: such a route bypasses callTargets, so a compromised backend could name its own address (scan 2026-10-28, F9). Opt in only for a provider whose deposit addresses cannot be pinned, or whose verifyQuote / verifyBuild checks them (thorchainPins, chainflipPins).


optional enabled?: () => boolean

Defined in: protocol-swap2-core/src/remote.ts:34

Optional synchronous dark flag for accurate client-side discovery.

boolean


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

Defined in: protocol-swap2-core/src/remote.ts:79

Defaults to globalThis.fetch — injectable for tests.

(input, init?): Promise<Response>

MDN Reference

URL | RequestInfo

RequestInit

Promise<Response>

(input, init?): Promise<Response>

MDN Reference

string | URL | Request

RequestInit

Promise<Response>


optional headers?: Record<string, string>

Defined in: protocol-swap2-core/src/remote.ts:81

Extra headers (e.g. auth) attached to every call.


name: string

Defined in: protocol-swap2-core/src/remote.ts:28

Provider name the backend multiplexes on (e.g. “near-intents”).


optional spenders?: (chain) => readonly string[]

Defined in: protocol-swap2-core/src/remote.ts:54

string

readonly string[]


optional supportsChain?: (caip2) => boolean

Defined in: protocol-swap2-core/src/remote.ts:36

Optional chain-level discovery hooks mirrored from the backend.

string

boolean


optional supportsChainPair?: (fromChain, toChain) => boolean

Defined in: protocol-swap2-core/src/remote.ts:37

string

string

boolean


optional supportsRoute?: (from, to) => boolean

Defined in: protocol-swap2-core/src/remote.ts:32

Sync capability gate; defaults to true (the backend quote decides).

Asset

Asset

boolean


optional supportsSameChain?: boolean

Defined in: protocol-swap2-core/src/remote.ts:39

Explicit opt-in when the backend can execute same-chain swaps.


optional timeoutMs?: number

Defined in: protocol-swap2-core/src/remote.ts:83

Per-request fail-closed timeout. Defaults to 12 seconds.


optional verifyBuild?: (quote, tx, params?) => string | Promise<string | null> | null

Defined in: protocol-swap2-core/src/remote.ts:65

The provider’s own check of a build on the client — a typed order, a cell body — against the quote it was built for: the reason it fails, or null. A build it refuses is never approved or signed.

Quote

UnsignedTx

QuoteParams

string | Promise<string | null> | null


optional verifyQuote?: (params, quote) => string | null

Defined in: protocol-swap2-core/src/remote.ts:60

The provider’s own check of a quote’s transaction, run here on the client against the request the app sent (shipped with the pins, e.g. fyndPins): a quote it refuses never reaches the auction. The backend runs the same check, but the backend is what this guards against.

QuoteParams

Quote

string | null