Skip to content

Commit 1d8a4ba

Browse files
authored
fix: account in readonly [skip cypress] (#2304)
1 parent 5147f80 commit 1d8a4ba

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/libs/web3-data-provider/Web3Provider.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const Web3ContextProvider: React.FC<{ children: ReactElement }> = ({ chil
4343
const { switchChainAsync } = useSwitchChain();
4444
const { watchAssetAsync } = useWatchAsset();
4545
const { chainId, address } = useAccount();
46-
// const { disconnect } = useDisconnect();
4746
const { connect, connectors } = useConnect();
4847

4948
const [readOnlyModeAddress, setReadOnlyModeAddress] = useState<string | undefined>();
@@ -57,22 +56,10 @@ export const Web3ContextProvider: React.FC<{ children: ReactElement }> = ({ chil
5756
currentAccount = readOnlyModeAddress;
5857
}
5958

60-
// console.log('isConnecting', isConnecting);
61-
// console.log('isConnected', isConnected);
62-
6359
useEffect(() => {
6460
if (didInit) {
6561
return;
6662
}
67-
// if (didInit) {
68-
// // If user connects a wallet after the app is loaded, then we need to reset the readOnlyModeAddress
69-
// if (isConnected && readOnlyMode) {
70-
// localStorage.removeItem('readOnlyModeAddress');
71-
// setReadOnlyModeAddress(undefined);
72-
// }
73-
74-
// return;
75-
// }
7663

7764
// If the app loads in readOnlyMode, then we disconnect the wallet if it auto connected
7865
const storedReadOnlyAddress = localStorage.getItem('readOnlyModeAddress');
@@ -188,7 +175,7 @@ export const Web3ContextProvider: React.FC<{ children: ReactElement }> = ({ chil
188175

189176
useEffect(() => {
190177
if (readOnlyModeAddress) {
191-
setAccount(readOnlyModeAddress);
178+
setAccount(readOnlyModeAddress.toLowerCase());
192179
}
193180
}, [readOnlyModeAddress, setAccount]);
194181

0 commit comments

Comments
 (0)