Appearance
WalletVerificationProvider
WalletVerificationProvider shares one WalletVerificationClient and the current identity (customerId, network, address, selected wallet, last result).
This SDK is browser only. Creating a client throws BROWSER_REQUIRED on the server (Node.js, SSR, RSC). In Next.js, mount the provider in a client component ('use client').
Do not use SwappedConnectProvider or Connect client.wallets / client.coinbase here.
Config mode
The provider creates the client for you:
tsx
import { WalletVerificationProvider } from '@swapped/connect-sdk/wallet-verification/react'
function App() {
return (
<WalletVerificationProvider
apiKey="your-public-api-key"
environment="staging"
customerId="user-1234"
network="evm"
>
<VerifyPage />
</WalletVerificationProvider>
)
}When apiKey, environment, or host overrides change, the provider destroys the previous client and creates a new one. It always destroy()s an owned client on unmount.
Client mode
Create the client yourself and pass it in. You own its lifetime unless you set destroyOnUnmount.
tsx
import { createWalletVerification } from '@swapped/connect-sdk/wallet-verification'
import { WalletVerificationProvider } from '@swapped/connect-sdk/wallet-verification/react'
const client = createWalletVerification({
apiKey: 'your-public-api-key',
environment: 'staging',
})
function App() {
return (
<WalletVerificationProvider client={client} customerId="user-1234">
<VerifyPage />
</WalletVerificationProvider>
)
}destroyOnUnmount defaults to false in client mode. A client instance may be passed to only one provider at a time (REACT_CLIENT_ALREADY_PROVIDED).
Config
| Option | Default | Notes |
|---|---|---|
apiKey | - | Config mode. Public session API key (WALLET_VERIFICATION_API_KEY_REQUIRED if empty) |
client | - | Client mode. Pre-created WalletVerificationClient |
destroyOnUnmount | false (client mode) | Destroy a passed-in client on unmount. Always true for provider-created clients |
environment | 'production' | 'production' or 'staging' - picks default API, WebSocket, and gateway hosts |
apiBaseUrl | environment default | Override the API host (official production / staging only) |
widgetBaseUrl | environment default | Override the host that serves /gateway (official hosts or localhost) |
persistVerification | true | Coinbase mode: 'redirect' only. Stores the pending id in this tab so completeVerification() can recover after Coinbase sends the browser back |
customerId | '' | Your id for the end user (not a Swapped id). A new prop value updates provider state; the next verify() uses it |
network | 'evm' | Chain family for the address (evm / solana / bitcoin). A new prop value updates provider state |
address | '' | Address the user claims to control. Required for prepare() / deeplink / Coinbase. A new prop value updates provider state |
Auth is the public API key only. There is no HMAC, session secret, or sessionId. Sites with a Content-Security-Policy must allow the hidden /gateway iframe and the API WebSocket - see Browser requirements.
Identity
customerId, network, and address on the provider update shared state when those props change. The next verify() / Coinbase start uses the latest values. You can also read and update them with useWalletVerification().
Setters throw WALLET_VERIFICATION_IN_PROGRESS while verify or a Coinbase start / wait / complete is running. A new prop value still applies so the next run picks it up.
tsx
import { useWalletVerification } from '@swapped/connect-sdk/wallet-verification/react'
function Identity() {
const {
customerId,
setCustomerId,
network,
setNetwork,
address,
setAddress,
verification,
isBusy,
} = useWalletVerification()
return (
<input
value={customerId}
disabled={isBusy}
onChange={event => setCustomerId(event.target.value)}
/>
)
}useWalletVerification()
| Field | Meaning |
|---|---|
customerId / setCustomerId | Your id for the end user. Setter throws WALLET_VERIFICATION_IN_PROGRESS while a run is in flight |
network / setNetwork | Chain family (evm / solana / bitcoin). Same setter lock |
address / setAddress | Claimed address. Same setter lock |
selectedWallet / setSelectedWallet | Wallet the UI currently has selected (you store this; the SDK does not pick one) |
verification | Last WalletVerification stored on the provider, or null |
isBusy | true while any prepare() / verify() or Coinbase start / open / complete is running. Disable identity inputs |
client | The shared WalletVerificationClient |
useWalletVerificationClient() returns that same client when you need a method that is not wrapped by a hook.
Errors
| Code | When | What to do |
|---|---|---|
REACT_WALLET_VERIFICATION_PROVIDER_REQUIRED | Hook used outside the provider | Wrap the tree |
REACT_CLIENT_ALREADY_PROVIDED | Same client in two providers | One provider per client |
WALLET_VERIFICATION_IN_PROGRESS | setCustomerId / setNetwork / setAddress called while a run is in flight | Wait or cancel(), then change. Updating the provider prop still applies for the next run |
WALLET_VERIFICATION_API_KEY_REQUIRED | Config mode with a blank key | Pass apiKey or a client |
BROWSER_REQUIRED | Client created outside the browser | Client component / browser-only module |