Skip to content

Commit

Permalink
fix: logic of account name (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
anukulpandey authored Jun 6, 2024
1 parent dcae15e commit 6867911
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaultOptions, hooks } from '@reef-chain/react-lib';
import { ReefSigner, defaultOptions, hooks } from '@reef-chain/react-lib';
import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { toast, ToastContainer } from 'react-toastify';
Expand Down Expand Up @@ -59,12 +59,24 @@ export const connectWalletConnect = async(ident:string,setSelExtensionName:any,s
const App = (): JSX.Element => {
const {selExtensionName,setSelExtensionName} = useConnectedWallet();
const {loading:wcPreloader,setLoading:setWcPreloader} = useWcPreloader()
const [accounts,setAccounts] = useState<ReefSigner[]>([]);
const [selectedSigner,setSelectedSigner] = useState<ReefSigner | undefined>(undefined);
const {
loading, error, signers, selectedReefSigner, network, provider, reefState, extension
} = hooks.useInitReefStateExtension(
'Reef App', selExtensionName, { ipfsHashResolverFn: getIpfsGatewayUrl },
);

useEffect(()=>{
setAccounts([]);
setSelectedSigner(undefined);
},[selExtensionName])

useEffect(()=>{
setAccounts(signers);
setSelectedSigner(selectedReefSigner);
},[selectedReefSigner,signers])

const history = useHistory();
const [isBalanceHidden, setBalanceHidden] = useState(getStoredPref());
const hideBalance = {
Expand Down Expand Up @@ -194,8 +206,8 @@ useEffect(()=>{
<>
<OptionContext.Provider value={{ ...defaultOptions, back: history.goBack, notify }}>
<ReefSignersContext.Provider value={{
accounts: signers,
selectedSigner: selectedReefSigner,
accounts,
selectedSigner,
network,
reefState,
provider,
Expand Down

0 comments on commit 6867911

Please sign in to comment.