Skip to content

@swapped/connect-sdk / core / SwappedConnectClient

Type Alias: SwappedConnectClient

SwappedConnectClient = object

Defined in: src/client.ts:67

Framework-agnostic Swapped Connect client.

Created by createSwappedConnectClient. Owns session lifecycle, payment methods, Exchange Pay, and event subscriptions.

Properties

coinbase

coinbase: Coinbase

Defined in: src/client.ts:95

Coinbase exchange OAuth module. Always available for event subscriptions and connection-state reads; connect/withdraw actions require a loaded session.


destroy

destroy: () => void

Defined in: src/client.ts:112

Tear down the client and release internal resources.

Returns

void


exchangePay

exchangePay: ExchangePay

Defined in: src/client.ts:90

Exchange Pay module. Always available for event subscriptions and reads; order/create actions require a loaded session.


getMaintenanceStatus

getMaintenanceStatus: () => MaintenanceStatusPayload | null

Defined in: src/client.ts:79

Return the current maintenance status, or null if none has been received.

Returns

MaintenanceStatusPayload | null


getSession

getSession: () => SessionData | null

Defined in: src/client.ts:73

Return the last loaded session payload, or null if none.

Returns

SessionData | null


getSessionId

getSessionId: () => string

Defined in: src/client.ts:77

Return the active session id.

Returns

string


getSessionView

getSessionView: () => SessionView

Defined in: src/client.ts:75

Return the classified session view for the current session state.

Returns

SessionView


getState

getState: () => SwappedConnectState

Defined in: src/client.ts:81

Return a snapshot of public client state.

Returns

SwappedConnectState


loadSession

loadSession: (sessionId?) => Promise<SessionData>

Defined in: src/client.ts:69

Load (or reload) the session for the given or configured sessionId.

Parameters

sessionId?

string

Returns

Promise<SessionData>


off

off: <E>(event, handler) => void

Defined in: src/client.ts:107

Remove a previously registered event handler.

Type Parameters

E

E extends keyof SwappedConnectEventMap

Parameters

event

E

handler

(payload) => void

Returns

void


on

on: <E>(event, handler) => () => void

Defined in: src/client.ts:102

Subscribe to a lifecycle event; returns an unsubscribe function.

Type Parameters

E

E extends keyof SwappedConnectEventMap

Parameters

event

E

handler

(payload) => void

Returns

() => void


paymentMethods

paymentMethods: PaymentMethods

Defined in: src/client.ts:85

Payment methods module for the current session.


restartSession

restartSession: (sessionId?) => Promise<SessionData>

Defined in: src/client.ts:71

Start a new transaction for the same merchant flow; clears Exchange Pay state.

Parameters

sessionId?

string

Returns

Promise<SessionData>


subscribe

subscribe: (listener) => () => void

Defined in: src/client.ts:83

Subscribe to public state changes; returns an unsubscribe function.

Parameters

listener

(state) => void

Returns

() => void


wallets

wallets: Wallets

Defined in: src/client.ts:100

Browser wallets module. Always available for reads/subscriptions; connect and balances require a loaded session (and the gateway host iframe).