UNPKG

@buddy-link/react

Version:

Buddy SDK - React components and hooks for wallet integration

62 lines (46 loc) 1.09 kB
# Buddy SDK React components and hooks for wallet integration with the Buddy platform. ## Installation ```bash npm install @buddy-link/react # or yarn add @buddy-link/react # or bun add @buddy-link/react ``` ## Usage ```jsx import { Buddy, useBuddy, useBuddyState } from '@buddy-link/react'; function Layout() { return ( <Buddy apiKey="your-api-key" appId="your-app-id"/> <YourComponent /> ); } function YourComponent() { const { connect, wallet } = useBuddy(); return ( <div> {wallet ? ( <p>Connected: {wallet.address}</p> ) : ( <button onClick={connect}>Connect Wallet</button> )} </div> ); } ``` ## Components - `Buddy` - Main provider component - `BuddyState` - State management component (initialized inside Buddy already) ## Hooks - `useBuddy` - Main hook for wallet operations - `useBuddyState` - Hook for accessing Buddy state ## Changelog ### [1.0.0] - 2025-06-02 - Initial release - Basic wallet connection functionality - React hooks for state management - TypeScript support ## License Apache-2.0