Appearance
@swapped/connect-sdk / core / createSwappedConnectClient
Function: createSwappedConnectClient()
createSwappedConnectClient(
config):SwappedConnectClient
Defined in: src/client.ts:218
Create a Swapped Connect client.
Browser only — do not call this on the server (Node.js, SSR, RSC). Create a sessionId on your backend, then instantiate the client in the browser.
Parameters
config
Client configuration (sessionId, optional environment, apiBaseUrl, widgetBaseUrl, modules).
Returns
A SwappedConnectClient instance.
Throws
ConnectSdkError with ConnectSdkErrorCode.BROWSER_REQUIRED when called outside a browser (no window / document).
Throws
ConnectSdkError with ConnectSdkErrorCode.SESSION_ALREADY_IN_USE when another live client already has this sessionId.
Example
ts
const client = createSwappedConnectClient({
sessionId: 'your-session-id',
environment: 'staging',
// Optional: skip the hidden /gateway iframe when wallets/Coinbase
// are not needed
modules: ['exchangePay', 'cashApp'],
});
await client.loadSession();