@txnlab/use-wallet
A framework-agnostic Algorand wallet integration library (v4.x) with reactive adapters for React, Vue, SolidJS, and Svelte. Requires algosdk v3.
Packages
| Package |
Purpose |
@txnlab/use-wallet |
Core library (framework-agnostic) |
@txnlab/use-wallet-react |
React adapter (hooks + WalletProvider) |
@txnlab/use-wallet-vue |
Vue adapter (composables + plugin) |
@txnlab/use-wallet-solid |
SolidJS adapter (primitives + WalletProvider) |
@txnlab/use-wallet-svelte |
Svelte adapter (primitives + context) |
@txnlab/use-wallet-ui-react |
React UI components (WalletButton, menus) |
Routing Guide
Read the reference file that matches the developer's task:
Setup & Configuration
- Getting started (any framework): references/getting-started.md — Installation, WalletManager config, supported wallets table, webpack fallbacks
Framework-Specific Integration
- Vanilla JS/TS (no framework): references/vanilla.md — WalletManager direct usage, BaseWallet subscribe, no provider wrapper
- React: references/react.md — WalletProvider, useWallet, useNetwork hooks
- Vue: references/vue.md — WalletManagerPlugin, useWallet/useNetwork composables
- SolidJS: references/solid.md — WalletProvider, useWallet/useNetwork primitives (signals)
- Svelte: references/svelte.md — useWalletContext, useWallet/useNetwork primitives (.current)
Features & Guides
- Signing transactions: references/signing-transactions.md — signTransactions, transactionSigner with ATC, AlgoKit Utils
- Signing data (ARC-60/SIWA): references/signing-data.md — Sign In With Algorand, Lute wallet, verification
- Network switching & custom networks: references/network-configuration.md — NetworkConfigBuilder, custom AVM networks (Voi), runtime node config, useNetwork
- Pre-built UI components: references/wallet-ui.md — @txnlab/use-wallet-ui-react: WalletButton, menus, theming, Tailwind setup
- Testing: references/testing.md — Mnemonic wallet provider for dev/testing/E2E
- Custom wallet provider: references/custom-provider.md — Implementing CustomProvider interface
Reference
- Full API reference: references/api-reference.md — WalletManager, useWallet, useNetwork, enums, types
- Migration from v3: references/migration-v3.md — algosdk v3, network config changes, useNetwork extraction
Quick Reference: Supported Wallets
| Wallet |
WalletId |
Required Package |
| Pera |
PERA |
@perawallet/connect |
| Defly |
DEFLY |
@blockshake/defly-connect |
| Defly Web (beta) |
DEFLY_WEB |
@agoralabs-sh/avm-web-provider |
| Exodus |
EXODUS |
— |
| Kibisis |
KIBISIS |
@agoralabs-sh/avm-web-provider |
| Lute |
LUTE |
lute-connect |
| WalletConnect |
WALLETCONNECT |
@walletconnect/sign-client, @walletconnect/modal |
| Magic |
MAGIC |
magic-sdk, @magic-ext/algorand |
| Web3Auth |
WEB3AUTH |
@web3auth/modal, @web3auth/base, @web3auth/base-provider |
| W3 Wallet |
W3_WALLET |
— |
| KMD |
KMD |
— (dev only) |
| Mnemonic |
MNEMONIC |
— (test only, never MainNet) |
| Custom |
CUSTOM |
— (implement CustomProvider) |
Wallets that require no extra package use built-in browser APIs or AVM web provider.
Key Patterns
Minimal Setup (React)
import {
WalletProvider,
WalletManager,
NetworkId,
WalletId,
} from '@txnlab/use-wallet-react'
const manager = new WalletManager({
wallets: [WalletId.PERA, WalletId.DEFLY, WalletId.LUTE],
defaultNetwork: NetworkId.TESTNET,
})
function App() {
return (
<WalletProvider manager={manager}>
<YourApp />
</WalletProvider>
)
}
Accessing Wallet State
const {
wallets,
activeAddress,
isReady,
signTransactions,
transactionSigner,
algodClient,
} = useWallet()
const {
activeNetwork,
setActiveNetwork,
updateAlgodConfig,
resetNetworkConfig,
} = useNetwork()
Important Notes
- v4.x requires algosdk v3 — see migration guide if upgrading from v3.x
- In v4.0.0, network features moved from
useWallet to a separate useNetwork hook/composable/primitive
- Default networks (MainNet, TestNet, BetaNet, LocalNet) use Nodely's free API
- Some wallet providers require signature requests from direct user interaction (button clicks)
- Only Lute supports ARC-60 data signing (
signData)
1---2name: use-wallet3description: Integrate Algorand/AVM wallet connections using @txnlab/use-wallet v4.x. Use when building dApps that need wallet connectivity (Pera, Defly, Lute, Kibisis, Exodus, WalletConnect, etc.), transaction signing, data signing (ARC-60/SIWA), network switching, or wallet state management in vanilla JS/TS, React, Vue, SolidJS, or Svelte applications. Also covers the companion UI component library @txnlab/use-wallet-ui-react for drop-in wallet buttons and menus.4---5
6# @txnlab/use-wallet
7
8A framework-agnostic Algorand wallet integration library (v4.x) with reactive adapters for React, Vue, SolidJS, and Svelte. Requires **algosdk v3**.
9
10## Packages
11
12| Package | Purpose |
13| ----------------------------- | --------------------------------------------- |
14| `@txnlab/use-wallet` | Core library (framework-agnostic) |
15| `@txnlab/use-wallet-react` | React adapter (hooks + WalletProvider) |
16| `@txnlab/use-wallet-vue` | Vue adapter (composables + plugin) |
17| `@txnlab/use-wallet-solid` | SolidJS adapter (primitives + WalletProvider) |
18| `@txnlab/use-wallet-svelte` | Svelte adapter (primitives + context) |
19| `@txnlab/use-wallet-ui-react` | React UI components (WalletButton, menus) |
20
21## Routing Guide
22
23Read the reference file that matches the developer's task:
24
25### Setup & Configuration
26
27- **Getting started (any framework)**: [references/getting-started.md](references/getting-started.md) — Installation, WalletManager config, supported wallets table, webpack fallbacks
28
29### Framework-Specific Integration
30
31- **Vanilla JS/TS (no framework)**: [references/vanilla.md](references/vanilla.md) — WalletManager direct usage, BaseWallet subscribe, no provider wrapper
32- **React**: [references/react.md](references/react.md) — WalletProvider, useWallet, useNetwork hooks
33- **Vue**: [references/vue.md](references/vue.md) — WalletManagerPlugin, useWallet/useNetwork composables
34- **SolidJS**: [references/solid.md](references/solid.md) — WalletProvider, useWallet/useNetwork primitives (signals)
35- **Svelte**: [references/svelte.md](references/svelte.md) — useWalletContext, useWallet/useNetwork primitives (.current)
36
37### Features & Guides
38
39- **Signing transactions**: [references/signing-transactions.md](references/signing-transactions.md) — signTransactions, transactionSigner with ATC, AlgoKit Utils
40- **Signing data (ARC-60/SIWA)**: [references/signing-data.md](references/signing-data.md) — Sign In With Algorand, Lute wallet, verification
41- **Network switching & custom networks**: [references/network-configuration.md](references/network-configuration.md) — NetworkConfigBuilder, custom AVM networks (Voi), runtime node config, useNetwork
42- **Pre-built UI components**: [references/wallet-ui.md](references/wallet-ui.md) — @txnlab/use-wallet-ui-react: WalletButton, menus, theming, Tailwind setup
43- **Testing**: [references/testing.md](references/testing.md) — Mnemonic wallet provider for dev/testing/E2E
44- **Custom wallet provider**: [references/custom-provider.md](references/custom-provider.md) — Implementing CustomProvider interface
45
46### Reference
47
48- **Full API reference**: [references/api-reference.md](references/api-reference.md) — WalletManager, useWallet, useNetwork, enums, types
49- **Migration from v3**: [references/migration-v3.md](references/migration-v3.md) — algosdk v3, network config changes, useNetwork extraction
50
51## Quick Reference: Supported Wallets
52
53| Wallet | WalletId | Required Package |
54| ---------------- | --------------- | -------------------------------------------------------------- |
55| Pera | `PERA` | `@perawallet/connect` |
56| Defly | `DEFLY` | `@blockshake/defly-connect` |
57| Defly Web (beta) | `DEFLY_WEB` | `@agoralabs-sh/avm-web-provider` |
58| Exodus | `EXODUS` | — |
59| Kibisis | `KIBISIS` | `@agoralabs-sh/avm-web-provider` |
60| Lute | `LUTE` | `lute-connect` |
61| WalletConnect | `WALLETCONNECT` | `@walletconnect/sign-client`, `@walletconnect/modal` |
62| Magic | `MAGIC` | `magic-sdk`, `@magic-ext/algorand` |
63| Web3Auth | `WEB3AUTH` | `@web3auth/modal`, `@web3auth/base`, `@web3auth/base-provider` |
64| W3 Wallet | `W3_WALLET` | — |
65| KMD | `KMD` | — (dev only) |
66| Mnemonic | `MNEMONIC` | — (test only, never MainNet) |
67| Custom | `CUSTOM` | — (implement CustomProvider) |
68
69Wallets that require no extra package use built-in browser APIs or AVM web provider.
70
71## Key Patterns
72
73### Minimal Setup (React)
74
75```tsx
76import {
77 WalletProvider,
78 WalletManager,
79 NetworkId,
80 WalletId,
81} from '@txnlab/use-wallet-react'
82
83const manager = new WalletManager({
84 wallets: [WalletId.PERA, WalletId.DEFLY, WalletId.LUTE],
85 defaultNetwork: NetworkId.TESTNET,
86})
87
88function App() {
89 return (
90 <WalletProvider manager={manager}>
91 <YourApp />
92 </WalletProvider>
93 )
94}
95```
96
97### Accessing Wallet State
98
99```tsx
100const {
101 wallets,
102 activeAddress,
103 isReady,
104 signTransactions,
105 transactionSigner,
106 algodClient,
107} = useWallet()
108const {
109 activeNetwork,
110 setActiveNetwork,
111 updateAlgodConfig,
112 resetNetworkConfig,
113} = useNetwork()
114```
115
116## Important Notes
117
118- v4.x requires **algosdk v3** — see migration guide if upgrading from v3.x
119- In v4.0.0, network features moved from `useWallet` to a separate `useNetwork` hook/composable/primitive
120- Default networks (MainNet, TestNet, BetaNet, LocalNet) use Nodely's free API
121- Some wallet providers require signature requests from direct user interaction (button clicks)
122- Only Lute supports ARC-60 data signing (`signData`)