diff --git a/src/main.tsx b/src/main.tsx index 83e2b7f..29457a3 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -5,16 +5,25 @@ import { getDefaultConfig } from '@rainbow-me/rainbowkit'; import ReactDOM from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; import { baseSepolia, optimismSepolia } from 'viem/chains'; -import { WagmiProvider } from 'wagmi'; +import { http, WagmiProvider } from 'wagmi'; import App from './App'; +if (!import.meta.env.VITE_PROJECT_ID) { + throw new Error('VITE_PROJECT_ID environment variable is required'); +} const projectID = import.meta.env.VITE_PROJECT_ID; +export const SUPPORTED_CHAINS = [baseSepolia, optimismSepolia]; + const config = getDefaultConfig({ appName: 'Identity on chain platform', projectId: projectID, chains: [optimismSepolia, baseSepolia], + transports: SUPPORTED_CHAINS.reduce( + (obj, chain) => ({ ...obj, [chain.id]: http() }), + {} + ), ssr: false, }); diff --git a/src/services/eas/index.ts b/src/services/eas/index.ts index fa678bf..4886341 100644 --- a/src/services/eas/index.ts +++ b/src/services/eas/index.ts @@ -1,5 +1,3 @@ -import { GraphQLClient } from 'graphql-request'; - export const easBaseUrl = import.meta.env.VITE_API_GRAPHQL_URL; export const chainIdToGraphQLEndpoint: { [key: number]: string } = { @@ -19,9 +17,3 @@ export const chainIdToGraphQLEndpoint: { [key: number]: string } = { }; export const ATTESTER_ADDRESS = import.meta.env.VITE_EAS_ATTESTER_ADDRESS; - -if (!easBaseUrl) { - throw new Error('VITE_API_GRAPHQL_URL is not defined'); -} - -export const graphQLClient = new GraphQLClient(easBaseUrl);