* Basic setup for react native web * Comment unsupported react-native code * Add interface for keychain methods * Fix storeNetworkData method * Use mui dialog component * Modify key store file name * Fix add network and edit network screens * Fix sign message screen * Use light theme --------- Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
24 lines
591 B
TypeScript
24 lines
591 B
TypeScript
import { useCallback, useEffect, useState } from 'react';
|
|
import { createWeb3Wallet } from '../utils/wallet-connect/WalletConnectUtils';
|
|
|
|
export default function useInitialization() {
|
|
const [initialized, setInitialized] = useState(false);
|
|
|
|
const onInitialize = useCallback(async () => {
|
|
try {
|
|
await createWeb3Wallet();
|
|
setInitialized(true);
|
|
} catch (err: unknown) {
|
|
console.error('Error for initializing', err);
|
|
}
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
if (!initialized) {
|
|
onInitialize();
|
|
}
|
|
}, [initialized, onInitialize]);
|
|
|
|
return initialized;
|
|
}
|