LazorKit LogoLazorKit
React Native SDK

LazorKitProvider

Provider component — initialises config, RPC, and the wallet store.

Wrap your app once at the root with LazorKitProvider. It sets up the Zustand store, builds the Connection, installs Buffer polyfills, and holds the portal / paymaster config.

import { LazorKitProvider } from '@lazorkit/wallet-mobile-adapter';

Minimum setup

<LazorKitProvider>
  <App />
</LazorKitProvider>

Devnet defaults

With no props, the provider connects to Solana Devnet through portal.lazor.sh and the public Kora paymaster at kora.devnet.lazorkit.com. Perfect for demos and local development.

Production setup

<LazorKitProvider
  rpcUrl={process.env.EXPO_PUBLIC_RPC_URL}
  portalUrl="https://portal.lazor.sh"
  configPaymaster={{
    paymasterUrl: process.env.EXPO_PUBLIC_PAYMASTER_URL!,
    apiKey: process.env.EXPO_PUBLIC_PAYMASTER_KEY,
  }}
  rpId="portal.lazor.sh"
  isDebug={__DEV__}
>
  <App />
</LazorKitProvider>

Props

PropTypeDefaultRequired
rpcUrlstringhttps://api.devnet.solana.comno
portalUrlstringhttps://portal.lazor.shno
configPaymaster{ paymasterUrl: string; apiKey?: string }Devnet Korano
rpIdstringportal.lazor.shno
isDebugbooleanfalseno
childrenReactNodeyes

Prop details

rpId must match

rpId is the WebAuthn Relying Party ID baked into each passkey at registration time. Changing it between connect calls invalidates existing passkeys. Keep it stable in production.

  • rpcUrl — Any Solana RPC. Falsy values fall back to the Devnet default.
  • portalUrl — The WebAuthn-enabled web page the SDK opens via expo-web-browser. Self-hosters can point this at their own portal.
  • configPaymaster — Kora JSON-RPC endpoint. apiKey is sent as x-api-key on every request.
  • isDebug — Enables verbose logs via the built-in logger.

Recipes

Switch networks at runtime

const [network, setNetwork] = useState<'devnet' | 'mainnet'>('devnet');

const rpcUrl = network === 'devnet'
  ? 'https://api.devnet.solana.com'
  : 'https://api.mainnet-beta.solana.com';

return (
  <LazorKitProvider rpcUrl={rpcUrl}>
    <App />
  </LazorKitProvider>
);

Changing rpcUrl recreates the Connection. The persisted wallet record is untouched — it continues to work on whichever cluster holds the on-chain wallet account.

Hide behind an env-driven config

const isProd = !__DEV__;

<LazorKitProvider
  rpcUrl={isProd
    ? process.env.EXPO_PUBLIC_MAINNET_RPC!
    : 'https://api.devnet.solana.com'}
  configPaymaster={{
    paymasterUrl: isProd
      ? process.env.EXPO_PUBLIC_MAINNET_PAYMASTER!
      : 'https://kora.devnet.lazorkit.com',
  }}
>
  <App />
</LazorKitProvider>

Runtime notes

  • Memoizes the Connection on rpcUrl, so rebuilds are cheap.
  • Persists { wallet, config } to AsyncStorage under key lazor-wallet-store.
  • Runs a state migration on v0 → v1 to move smartWallet from the wallet PDA to the vault PDA. Users who connected before v2 keep their wallet transparently.