diff --git a/examples/cloud_provider/production_react_netlify/.env.template b/examples/cloud_provider/production_react_netlify/.env.template
index e05d499..eb4b229 100644
--- a/examples/cloud_provider/production_react_netlify/.env.template
+++ b/examples/cloud_provider/production_react_netlify/.env.template
@@ -9,7 +9,7 @@ VITE_ENVIRONMENT=local
VITE_ALGOD_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
VITE_ALGOD_SERVER=http://localhost
VITE_ALGOD_PORT=4001
-VITE_ALGOD_NETWORK=""
+VITE_ALGOD_NETWORK=localnet
# Indexer
VITE_INDEXER_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
diff --git a/examples/cloud_provider/production_react_netlify/package.json b/examples/cloud_provider/production_react_netlify/package.json
index d842893..ea729b2 100644
--- a/examples/cloud_provider/production_react_netlify/package.json
+++ b/examples/cloud_provider/production_react_netlify/package.json
@@ -12,7 +12,7 @@
"npm": ">=9.0"
},
"devDependencies": {
- "@algorandfoundation/algokit-client-generator": "^4.0.0",
+ "@algorandfoundation/algokit-client-generator": "^4.0.6",
"@types/node": "^18.17.14",
"@types/react": "^18.2.11",
"@types/react-dom": "^18.2.4",
@@ -35,12 +35,12 @@
"vite-plugin-node-polyfills": "^0.22.0"
},
"dependencies": {
- "@algorandfoundation/algokit-utils": "^7.0.0",
- "@blockshake/defly-connect": "1.1.6",
- "@daffiwallet/connect": "^1.0.3",
- "@perawallet/connect": "1.3.5",
- "@txnlab/use-wallet": "^2.8.2",
- "algosdk": ">=2.9.0 <3.0",
+ "@algorandfoundation/algokit-utils": "^8.1.0",
+ "@blockshake/defly-connect": "^1.2.1",
+ "@perawallet/connect": "^1.4.1",
+ "@txnlab/use-wallet": "^4.0.0",
+ "@txnlab/use-wallet-react": "^4.0.0",
+ "algosdk": "^3.0.0",
"daisyui": "^4.0.0",
"notistack": "^3.0.1",
"react": "^18.2.0",
diff --git a/examples/cloud_provider/production_react_netlify/src/App.tsx b/examples/cloud_provider/production_react_netlify/src/App.tsx
index 58feddf..f346006 100644
--- a/examples/cloud_provider/production_react_netlify/src/App.tsx
+++ b/examples/cloud_provider/production_react_netlify/src/App.tsx
@@ -1,33 +1,26 @@
-import { DeflyWalletConnect } from '@blockshake/defly-connect'
-import { DaffiWalletConnect } from '@daffiwallet/connect'
-import { PeraWalletConnect } from '@perawallet/connect'
-import { PROVIDER_ID, ProvidersArray, WalletProvider, useInitializeProviders } from '@txnlab/use-wallet'
-import algosdk from 'algosdk'
+import { SupportedWallet, WalletId, WalletManager, WalletProvider } from '@txnlab/use-wallet-react'
import { SnackbarProvider } from 'notistack'
import Home from './Home'
import { getAlgodConfigFromViteEnvironment, getKmdConfigFromViteEnvironment } from './utils/network/getAlgoClientConfigs'
-let providersArray: ProvidersArray
-if (import.meta.env.VITE_ALGOD_NETWORK === '') {
+let supportedWallets: SupportedWallet[]
+if (import.meta.env.VITE_ALGOD_NETWORK === 'localnet') {
const kmdConfig = getKmdConfigFromViteEnvironment()
- providersArray = [
+ supportedWallets = [
{
- id: PROVIDER_ID.KMD,
- clientOptions: {
- wallet: kmdConfig.wallet,
- password: kmdConfig.password,
- host: kmdConfig.server,
+ id: WalletId.KMD,
+ options: {
+ baseServer: kmdConfig.server,
token: String(kmdConfig.token),
port: String(kmdConfig.port),
},
},
]
} else {
- providersArray = [
- { id: PROVIDER_ID.DEFLY, clientStatic: DeflyWalletConnect },
- { id: PROVIDER_ID.PERA, clientStatic: PeraWalletConnect },
- { id: PROVIDER_ID.DAFFI, clientStatic: DaffiWalletConnect },
- { id: PROVIDER_ID.EXODUS },
+ supportedWallets = [
+ { id: WalletId.DEFLY },
+ { id: WalletId.PERA },
+ { id: WalletId.EXODUS },
// If you are interested in WalletConnect v2 provider
// refer to https://github.com/TxnLab/use-wallet for detailed integration instructions
]
@@ -36,20 +29,26 @@ if (import.meta.env.VITE_ALGOD_NETWORK === '') {
export default function App() {
const algodConfig = getAlgodConfigFromViteEnvironment()
- const walletProviders = useInitializeProviders({
- providers: providersArray,
- nodeConfig: {
- network: algodConfig.network,
- nodeServer: algodConfig.server,
- nodePort: String(algodConfig.port),
- nodeToken: String(algodConfig.token),
+ const walletManager = new WalletManager({
+ wallets: supportedWallets,
+ defaultNetwork: algodConfig.network,
+ networks: {
+ [algodConfig.network]: {
+ algod: {
+ baseServer: algodConfig.server,
+ port: algodConfig.port,
+ token: String(algodConfig.token),
+ },
+ },
+ },
+ options: {
+ resetNetwork: true,
},
- algosdkStatic: algosdk,
})
return (
-
+
diff --git a/examples/cloud_provider/production_react_netlify/src/Home.tsx b/examples/cloud_provider/production_react_netlify/src/Home.tsx
index 42128d8..1fd37a1 100644
--- a/examples/cloud_provider/production_react_netlify/src/Home.tsx
+++ b/examples/cloud_provider/production_react_netlify/src/Home.tsx
@@ -1,5 +1,5 @@
// src/components/Home.tsx
-import { useWallet } from '@txnlab/use-wallet'
+import { useWallet } from '@txnlab/use-wallet-react'
import React, { useState } from 'react'
import ConnectWallet from './components/ConnectWallet'
import Transact from './components/Transact'
diff --git a/examples/cloud_provider/production_react_netlify/src/components/Account.tsx b/examples/cloud_provider/production_react_netlify/src/components/Account.tsx
index 8324312..081ce47 100644
--- a/examples/cloud_provider/production_react_netlify/src/components/Account.tsx
+++ b/examples/cloud_provider/production_react_netlify/src/components/Account.tsx
@@ -1,4 +1,4 @@
-import { useWallet } from '@txnlab/use-wallet'
+import { useWallet } from '@txnlab/use-wallet-react'
import { useMemo } from 'react'
import { ellipseAddress } from '../utils/ellipseAddress'
import { getAlgodConfigFromViteEnvironment } from '../utils/network/getAlgoClientConfigs'
diff --git a/examples/cloud_provider/production_react_netlify/src/components/ConnectWallet.tsx b/examples/cloud_provider/production_react_netlify/src/components/ConnectWallet.tsx
index c4225bc..8ff01dc 100644
--- a/examples/cloud_provider/production_react_netlify/src/components/ConnectWallet.tsx
+++ b/examples/cloud_provider/production_react_netlify/src/components/ConnectWallet.tsx
@@ -1,4 +1,4 @@
-import { Provider, useWallet } from '@txnlab/use-wallet'
+import { useWallet, Wallet, WalletId } from '@txnlab/use-wallet-react'
import Account from './Account'
interface ConnectWalletInterface {
@@ -7,9 +7,9 @@ interface ConnectWalletInterface {
}
const ConnectWallet = ({ openModal, closeModal }: ConnectWalletInterface) => {
- const { providers, activeAddress } = useWallet()
+ const { wallets, activeAddress } = useWallet()
- const isKmd = (provider: Provider) => provider.metadata.name.toLowerCase() === 'kmd'
+ const isKmd = (wallet: Wallet) => wallet.id === WalletId.KMD
return (