Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: wallet connect account name #84

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -33,7 +33,7 @@
];

export const connectWalletConnect = async(ident:string,setSelExtensionName:any,setWcPreloader:any)=>{
setWcPreloader({

Check warning on line 36 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Missing return type on function

Check failure on line 36 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Missing return type on function

Check warning on line 36 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Argument 'setSelExtensionName' should be typed with a non-any type

Check failure on line 36 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Unexpected any. Specify a different type

Check warning on line 36 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Argument 'setWcPreloader' should be typed with a non-any type

Check failure on line 36 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Unexpected any. Specify a different type
value:true,
message:"initializing mobile app connection"
});
Expand All @@ -59,12 +59,24 @@
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 All @@ -88,7 +100,7 @@
history.push(SNAP_URL);
}
}, [extension, error]);

Check warning on line 103 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

React Hook useEffect has missing dependencies: 'history' and 'selExtensionName'. Either include them or remove the dependency array
const[errorToast,setErrorToast] = useState<{
message:String;
type:String;
Expand All @@ -97,7 +109,7 @@
useEffect(()=>{
if(errorToast){
if(errorToast.type == "danger"){
Uik.notify.danger(errorToast.message.toString());

Check failure on line 112 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Expected '===' and instead saw '=='
}else{
Uik.notify.danger({
message:errorToast.message.toString(),
Expand All @@ -109,7 +121,7 @@
onClick={() => window.location.reload()}
/>
</>
})

Check failure on line 124 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Expected indentation of 10 space characters but found 20
}
}
},[errorToast])
Expand Down Expand Up @@ -146,9 +158,9 @@
})
}
},[signers])

Check warning on line 161 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

React Hook useEffect has missing dependencies: 'reefState', 'setWcPreloader', and 'wcPreloader.value'. Either include them or remove the dependency array


Check failure on line 163 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

Missing return type on function
const onExtensionSelected = async(ident: string) => {
console.log('onExtensionSelected', ident);
try {
Expand All @@ -156,7 +168,7 @@
await connectWalletConnect(ident,setSelExtensionName,setWcPreloader);
} else {
setSelExtensionName(ident);
}

Check failure on line 171 in src/App.tsx

View workflow job for this annotation

GitHub Actions / unit-lint

'error' is already declared in the upper scope
} catch (error) {
console.log(error);
}
Expand Down Expand Up @@ -194,8 +206,8 @@
<>
<OptionContext.Provider value={{ ...defaultOptions, back: history.goBack, notify }}>
<ReefSignersContext.Provider value={{
accounts: signers,
selectedSigner: selectedReefSigner,
accounts,
selectedSigner,
network,
reefState,
provider,
Expand Down
Loading