Skip to content

Commit

Permalink
test: add log
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Aug 7, 2023
1 parent 3e1201b commit 3913a3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/dcellar-web-ui/src/context/LoginContext/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function LoginContextProvider(props: PropsWithChildren<LoginContextProvid
const { disconnect } = useDisconnect();

const logout = useCallback(
(removeSpAuth = false) => {
(removeSpAuth = true) => {
console.log('logout === ')

dispatch(resetUploadQueue({loginAccount}))
Expand All @@ -50,6 +50,7 @@ export function LoginContextProvider(props: PropsWithChildren<LoginContextProvid
console.log('=======================')
console.log('wallet:', walletAddress)
console.log('login:', loginAccount)
console.log('connector', connector)

useEffect(() => {
if (pathname === '/' || inline) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useSaveFuncRef } from '@/hooks/useSaveFuncRef';
import { useAsyncEffect } from 'ahooks';
import { useEffect } from 'react';
import { ConnectorData, useAccount } from 'wagmi';

Expand All @@ -23,4 +24,21 @@ export function useWalletSwitchAccount(handler: WalletSwitchAccountHandler) {
connector?.off('change', onChange);
};
}, [address, connector, handlerRef]);

useAsyncEffect(async () => {
const provider: any = await connector?.getProvider()
console.log(provider, '===')

if (provider) {
provider
.request({ method: 'eth_requestAccounts' })
.then((accounts: string[]) => {
console.log('provider accounts', accounts)
})
.catch((err: unknown) => {
console.log('provider: ', err)
});
}

})
}

0 comments on commit 3913a3a

Please sign in to comment.