diff --git a/.changeset/unlucky-buttons-mix.md b/.changeset/unlucky-buttons-mix.md
new file mode 100644
index 0000000..9b1a031
--- /dev/null
+++ b/.changeset/unlucky-buttons-mix.md
@@ -0,0 +1,5 @@
+---
+"@everipedia/iq-login": patch
+---
+
+update api back to passing cookie to provider
diff --git a/README.md b/README.md
index 1a2673b..5ea901f 100644
--- a/README.md
+++ b/README.md
@@ -49,26 +49,21 @@ export default config;
// app/layout.tsx
import { IqLoginProvider } from "@everipedia/iq-login/client";
-import { getWagmiConfig } from "@everipedia/iq-login";
import { headers } from "next/headers";
-import { cookieToInitialState } from "wagmi";
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
- const initialStates = cookieToInitialState(
- getWagmiConfig(),
- (await headers()).get("cookie")
- );
+ const cookie = (await headers()).get("cookie")
return (
{children}
diff --git a/src/components/iq-login-provider.tsx b/src/components/iq-login-provider.tsx
index b310ab3..406a9cc 100644
--- a/src/components/iq-login-provider.tsx
+++ b/src/components/iq-login-provider.tsx
@@ -4,7 +4,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { structuralSharing } from "@wagmi/core/query";
import type React from "react";
import { createContext, useState } from "react";
-import { type State, WagmiProvider } from "wagmi";
+import { cookieToInitialState, type State, WagmiProvider } from "wagmi";
import {
getWagmiConfig,
web3AuthInstance,
@@ -14,14 +14,14 @@ import { Web3AuthProvider } from "./web3-auth-provider";
interface IqLoginProviderProps {
children: React.ReactNode;
projectName: string;
- initialState?: State;
+ cookie?: string | null;
}
export const ProjectContext = createContext("");
export function IqLoginProvider({
children,
- initialState,
+ cookie,
projectName,
}: IqLoginProviderProps) {
const [wagmiConfig] = useState(() => getWagmiConfig());
@@ -37,6 +37,8 @@ export function IqLoginProvider({
}),
);
+ const initialState = cookieToInitialState(wagmiConfig, cookie);
+
return (