Skip to content

Commit

Permalink
Merge pull request #116 from EveripediaNetwork/fix-make-wagmi-config-…
Browse files Browse the repository at this point in the history
…export-as-function-instead-of-variable

make wagmi config export as function instead of variable
  • Loading branch information
Royal-lobster authored Jan 2, 2025
2 parents e4746b3 + 6b635d4 commit 5f4e5bf
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-sloths-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@everipedia/iq-login": patch
---

make wagmi config export as function instead of variable
3 changes: 2 additions & 1 deletion src/components/iq-login-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type React from "react";
import { createContext } from "react";
import { cookieToInitialState, WagmiProvider } from "wagmi";
import {
wagmiConfig,
getWagmiConfig,
web3AuthInstance,
} from "../lib/integrations/wagmi.config";
import { Web3AuthProvider } from "./web3-auth-provider";
Expand All @@ -22,6 +22,7 @@ export function IqLoginProvider({
cookie,
projectName,
}: IqLoginProviderProps) {
const wagmiConfig = getWagmiConfig();
const initialStates = cookieToInitialState(wagmiConfig, cookie);
const queryClient = getQueryClient();

Expand Down
30 changes: 18 additions & 12 deletions src/lib/integrations/wagmi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,21 @@ export const web3AuthInstance = new Web3AuthModal.Web3Auth({
web3AuthNetwork: Web3AuthBase.WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
});

export const wagmiConfig: Config = createConfig({
chains: [chain],
transports: {
[chain.id]: http(),
},
connectors: [Web3AuthConnector({ web3AuthInstance }), injected(), metaMask()],
storage: createStorage({
storage: cookieStorage,
}),
ssr: true,
multiInjectedProviderDiscovery: false,
});
export function getWagmiConfig(): Config {
return createConfig({
chains: [chain],
transports: {
[chain.id]: http(),
},
connectors: [
Web3AuthConnector({ web3AuthInstance }),
injected(),
metaMask(),
],
storage: createStorage({
storage: cookieStorage,
}),
ssr: true,
multiInjectedProviderDiscovery: false,
});
}

0 comments on commit 5f4e5bf

Please sign in to comment.