Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
geolffreym committed Dec 4, 2024
1 parent b583acd commit b6e0916
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
37 changes: 31 additions & 6 deletions src/auth/context/web3Auth/authProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AuthContextProvider } from './authContext';
import { web3AuthConnectorFactory } from "./config/web3AuthSettings";
import { polygonAmoy } from "wagmi/chains";

import { getConnectorClient } from '@wagmi/core'
/**
* AuthProvider is a higher-order component that wraps the application with necessary providers
* for state management, wallet connection, and Lens Protocol integration.
Expand All @@ -17,26 +18,50 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {

const queryClient = new QueryClient();
const [web3Auth, web3AuthConnector] = web3AuthConnectorFactory()

const wagmiConfig = createConfig({
syncConnectedChain: true,
chains: [polygonAmoy],
connectors: [web3AuthConnector],
transports: { [polygonAmoy.id]: http(), }
transports: { [polygonAmoy.id]: http() }
})

const lensConfig: LensConfig = {
environment: development,
bindings: bindings(wagmiConfig),
debug: true,
storage: localStorage,
logger: {
info(message: string, data?: unknown) {
console.log(message)
console.log(data)
},
warn(message: string, data?: unknown){
console.log(message)
console.log(data)
},
error(error: Error, message?: string, data?: unknown){
console.log(message)
console.log(data)
},
fatal(error: Error, message?: string, data?: unknown){
console.log(message)
console.log(data)
}
}
};

(async ()=>(
console.log(await getConnectorClient(wagmiConfig))
))()

return (
<QueryClientProvider client={queryClient}>
<WagmiProvider config={wagmiConfig}>
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={queryClient}>
<LensProvider config={lensConfig}>
<AuthContextProvider web3Auth={web3Auth}>{children}</AuthContextProvider>
</LensProvider>
</WagmiProvider>
</QueryClientProvider>
</QueryClientProvider>
</WagmiProvider>
);
};
5 changes: 3 additions & 2 deletions src/components/loginModal/profileSelectView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// REACT IMPORTS
import React, { useCallback, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';

// MUI IMPORTS
import {
Expand All @@ -16,6 +16,7 @@ import { UserItem } from '../user-item';
import { Profile, ProfileSession, useLogin, useSession } from '@lens-protocol/react-web';
// @ts-ignore
import { ReadResult } from '@lens-protocol/react/dist/declarations/src/helpers/reads';

import { useDispatch } from 'react-redux';
import Snackbar from '@mui/material/Snackbar';
import Alert from '@mui/material/Alert';
Expand Down Expand Up @@ -50,7 +51,7 @@ export const ProfileSelectView: React.FC<ProfileSelectionProps> = ({
if (data !== undefined && !error) dispatch(setAuthLoading({ isAuthLoading: false }));
if (error) setErrorMessage(error.message);
}, [data, error])

const login = async (profile?: Profile) => {

if (!profile) {
Expand Down

0 comments on commit b6e0916

Please sign in to comment.