React
Get started with React
Mount the React provider and reconnect an existing Protocol wallet.
Use this guide for a React app that already has Protocol wallets. For new wallets, start with the TypeScript quickstart.
Install
npm install @lazorkit/wallet@3.4.1 @solana/web3.js@^1.99.0Configure the provider
Put the provider in a client component. Pass your app's existing Protocol paymaster URL and the portal origin used to register the passkey.
'use client';
import type { ReactNode } from 'react';
import { LazorkitProvider } from '@lazorkit/wallet';
export function ProtocolProvider({ children, portalUrl, protocolPaymasterUrl }: {
children: ReactNode;
portalUrl: string;
protocolPaymasterUrl: string;
}) {
const paymaster = { paymasterUrl: protocolPaymasterUrl };
return (
<LazorkitProvider
cluster="mainnet"
rpcUrl="https://api.mainnet-beta.solana.com"
portalUrl={portalUrl}
paymasterConfig={paymaster}
v1PaymasterConfig={paymaster}
>
{children}
</LazorkitProvider>
);
}Reconnect and send
Call useWallet().connect() from a user action in your returning-user flow. 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.