- {noWalletSelected ? (
- renderNoWalletSelected()
- ) : (
- <>
-
-
- {renderSelectedWallet()}
-
- {selectedWallet === WalletName.Bearby && (
-
- )}
-
-
{
- setSelectedWallet(undefined);
- setCurrentWallet();
- }}
+
+
+ {renderSelectedWallet()}
+
+ {currentWallet?.name() === WalletName.Bearby && (
+
-
- {renderWallet()}
- >
- )}
+ )}
+
+ {
+ setCurrentWallet();
+ }}
+ />
+
+
+ {!isFetching && renderWallet()}
);
};
diff --git a/src/lib/ConnectMassaWallets/store/accountStore.ts b/src/lib/ConnectMassaWallets/store/accountStore.ts
index b2e4b43a..2dd724bf 100644
--- a/src/lib/ConnectMassaWallets/store/accountStore.ts
+++ b/src/lib/ConnectMassaWallets/store/accountStore.ts
@@ -1,26 +1,7 @@
-import { Provider } from '@massalabs/massa-web3';
import { create } from 'zustand';
+import { Network, Provider } from '@massalabs/massa-web3';
import { Wallet, WalletName } from '@massalabs/wallet-provider';
-async function handleBearbyAccountChange(
- newAddress: string,
- store: AccountStoreState,
-) {
- const { connectedAccount, currentWallet, setConnectedAccount } = store;
-
- const oldAddress = connectedAccount?.address;
-
- if (newAddress !== oldAddress) {
- const newAccounts = await currentWallet?.accounts();
-
- if (newAccounts?.length) {
- // Bearby returns only one account
- const newAccount = newAccounts[0];
- setConnectedAccount(newAccount);
- }
- }
-}
-
export interface AccountStoreState {
connectedAccount?: Provider;
accounts?: Provider[];
@@ -33,14 +14,12 @@ export interface AccountStoreState {
networkObserver?: {
unsubscribe: () => void;
};
- chainId?: bigint;
- network?: string;
+ network?: Network;
- setCurrentWallet: (wallet?: Wallet) => void;
+ setCurrentWallet: (wallet?: Wallet, account?: Provider) => Promise