LazorKit LogoLazorKit
React Native

Get started with React Native

Mount the mobile provider and reconnect an existing Protocol wallet.

Use this guide for a React Native app that already has Protocol wallets. For new wallets, start with the TypeScript quickstart.

Install

npm install @lazorkit/wallet-mobile-adapter@2.4.0 @solana/web3.js@^1.99.0

Configure the provider

Pass your app's existing Protocol paymaster URL and the portal origin used to register the passkey.

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

export function ProtocolProvider({ children, portalUrl, protocolPaymasterUrl }: {
  children: ComponentProps<typeof LazorKitProvider>['children'];
  portalUrl: string;
  protocolPaymasterUrl: string;
}) {
  const paymaster = { paymasterUrl: protocolPaymasterUrl };

  return (
    <LazorKitProvider
      cluster="mainnet"
      rpcUrl="https://api.mainnet-beta.solana.com"
      portalUrl={portalUrl}
      configPaymaster={paymaster}
      v1ConfigPaymaster={paymaster}
    >
      {children}
    </LazorKitProvider>
  );
}

Reconnect and send

Register your app's redirect scheme and allow its callback with the portal. In your returning-user flow, call useWallet().connect({ redirectUrl: 'myapp://wallet-callback' }) with your own callback. Confirm the result is the Protocol wallet your app already knows. Read vaultPubkey to display a receive address.

Next, send a transaction or check provider options.