@txnlab/use-wallet-react package provides React-specific bindings for use-wallet, including a context provider and hooks that enable reactive wallet integration in React applications.
Installation
- npm
- yarn
- pnpm
Setup
Configure wallet manager
Create aWalletManager instance with your desired wallet providers and network configuration, then wrap your app with the WalletProvider component.
Using the wallet hook
TheuseWallet hook provides access to wallet state and signing methods.
Basic usage
Return values
TheuseWallet hook returns the following properties:
Wallet interface
Each wallet object in thewallets array has the following properties:
Signing transactions
ThetransactionSigner method is compatible with the Algorand SDK’s AtomicTransactionComposer.
Network management
TheuseNetwork hook provides methods for managing network configuration.
Return values
Managing accounts
Switch between accounts for a connected wallet:Signing arbitrary data
For wallets that support it, you can sign arbitrary data for authentication:TypeScript support
The package includes full TypeScript definitions. All hooks and components are fully typed:Next steps
Configuration
Learn about wallet and network configuration options
Wallets
Explore supported wallet providers and their options