Skip to main content
The same wallet-adapter integration as the Next.js example, in a React app built with Vite. Vite does not polyfill Node built-ins, and the Solana and proving libraries need Buffer, process and events, so the config adds them. Built with vite build against @cloak.dev/sdk 0.2.20 and loaded in a browser without errors.

Install

.env

Vite config

vite.config.ts
Without the polyfills the app builds but renders a blank page with ReferenceError: Buffer is not defined in the console.

Providers and entry point

src/providers.tsx
src/main.tsx

The hook and the component

src/hooks/use-cloak.ts
src/components/private-balance.tsx

Run it

The behaviour and expected output are the same as in the Next.js example.