Migrating from v3.x
Version 4.0.0 brings improvements to use-wallet while maintaining the core architecture from v3:
Updated to support algosdk v3
Enhanced network configuration capabilities
Reorganized framework adapter APIs for better separation of concerns
This guide will walk you through the changes needed to upgrade from v3.x. Most applications will require only minor updates to network configuration and imports.
Upgrading Dependencies
Update your use-wallet package:
npm upgrade @txnlab/use-wallet@^4.0.0
# if using React adapter
npm upgrade @txnlab/use-wallet-react@^4.0.0
# if using Vue adapter
npm upgrade @txnlab/use-wallet-vue@^4.0.0
# if using Solid adapter
npm upgrade @txnlab/use-wallet-solid@^4.0.0
# if using Svelte adapter
npm upgrade @txnlab/use-wallet-svelte@^4.0.0yarn upgrade @txnlab/use-wallet@^4.0.0
# if using React adapter
yarn upgrade @txnlab/use-wallet-react@^4.0.0
# if using Vue adapter
yarn upgrade @txnlab/use-wallet-vue@^4.0.0
# if using Solid adapter
yarn upgrade @txnlab/use-wallet-solid@^4.0.0
# if using Svelte adapter
yarn upgrade @txnlab/use-wallet-svelte@^4.0.0pnpm update @txnlab/use-wallet@^4.0.0
# if using React adapter
pnpm update @txnlab/use-wallet-react@^4.0.0
# if using Vue adapter
pnpm update @txnlab/use-wallet-vue@^4.0.0
# if using Solid adapter
pnpm update @txnlab/use-wallet-solid@^4.0.0
# if using Svelte adapter
pnpm update @txnlab/use-wallet-svelte@^4.0.0Update algosdk:
npm upgrade algosdk@^3.0.0yarn upgrade algosdk@^3.0.0pnpm update algosdk@^3.0.0bun update algosdk@^3.0.0Support for algosdk v3
Version 4 upgrades from algosdk v2 to v3. The extent of required changes will depend on how your application uses the SDK. Some applications may need minimal changes, while others may require more extensive updates.
For a complete guide to migrating from algosdk v2 to v3, see the official migration guide.
Network Configuration Changes
Along with algosdk v3 support, v4 includes improvements to network configuration. The new approach is more flexible and allows configuring custom AVM-compatible networks without modifying the library's codebase.
Single Network Configuration
If your application uses a single public Algorand network (MainNet, TestNet, BetaNet), migrate from:
to:
Multiple Network Configuration
If your application supports multiple networks, migrate from:
to using the NetworkConfigBuilder:
Custom Networks
For other AVM networks (like Voi), you can use the NetworkConfigBuilder and its addNetworkmethod:
See the Configuration guide for more details about network configuration options.
Framework Adapter Changes
Network-related functionality has been moved from useWallet to a dedicated useNetwork hook:
Before (v3.x):
After (v4.x):
If your project supports network switching, you'll need to update your imports and split the network functionality between hooks:
Last updated