Skip to content

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 ​

OptionDefaultNotes
apiKey-Config mode. Public session API key (WALLET_VERIFICATION_API_KEY_REQUIRED if empty)
client-Client mode. Pre-created WalletVerificationClient
destroyOnUnmountfalse (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
apiBaseUrlenvironment defaultOverride the API host (official production / staging only)
widgetBaseUrlenvironment defaultOverride the host that serves /gateway (official hosts or localhost)
persistVerificationtrueCoinbase 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() ​

FieldMeaning
customerId / setCustomerIdYour id for the end user. Setter throws WALLET_VERIFICATION_IN_PROGRESS while a run is in flight
network / setNetworkChain family (evm / solana / bitcoin). Same setter lock
address / setAddressClaimed address. Same setter lock
selectedWallet / setSelectedWalletWallet the UI currently has selected (you store this; the SDK does not pick one)
verificationLast WalletVerification stored on the provider, or null
isBusytrue while any prepare() / verify() or Coinbase start / open / complete is running. Disable identity inputs
clientThe shared WalletVerificationClient

useWalletVerificationClient() returns that same client when you need a method that is not wrapped by a hook.

Errors ​

CodeWhenWhat to do
REACT_WALLET_VERIFICATION_PROVIDER_REQUIREDHook used outside the providerWrap the tree
REACT_CLIENT_ALREADY_PROVIDEDSame client in two providersOne provider per client
WALLET_VERIFICATION_IN_PROGRESSsetCustomerId / setNetwork / setAddress called while a run is in flightWait or cancel(), then change. Updating the provider prop still applies for the next run
WALLET_VERIFICATION_API_KEY_REQUIREDConfig mode with a blank keyPass apiKey or a client
BROWSER_REQUIREDClient created outside the browserClient component / browser-only module