diff --git a/packages/frontend/package.json b/packages/frontend/package.json index bc520ce1..deeb821e 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -39,7 +39,7 @@ "sonner": "^1.4.41", "styled-components": "^6.1.8", "viem": "^2.9.3", - "wagmi": "^2.7.1", + "wagmi": "^2.10.2", "zod": "^3.22.4" }, "devDependencies": { diff --git a/packages/frontend/src/config/wagmiConfig.ts b/packages/frontend/src/config/wagmiConfig.ts index 7c3e5a9c..165bde89 100644 --- a/packages/frontend/src/config/wagmiConfig.ts +++ b/packages/frontend/src/config/wagmiConfig.ts @@ -1,9 +1,13 @@ -import { createConfig, webSocket } from 'wagmi' +import { cookieStorage, createConfig, createStorage, webSocket } from 'wagmi' import { arbitrum, arbitrumSepolia, hardhat } from 'wagmi/chains' import { coinbaseWallet, walletConnect } from 'wagmi/connectors' import { environment } from '@/config/environment' import { SupportedChains } from '@/blockchain/chain' +const storage = createStorage({ + storage: cookieStorage, +}) + export const wagmiConfig = createConfig({ chains: SupportedChains, ssr: true, @@ -16,6 +20,7 @@ export const wagmiConfig = createConfig({ walletConnect({ projectId: environment.walletConnectProjectId }), coinbaseWallet({ appName: 'Devcon Auction/Raffle' }), ], + storage, }) declare module 'wagmi' { diff --git a/packages/frontend/src/pages/_app.tsx b/packages/frontend/src/pages/_app.tsx index 531c87bb..c0319e67 100644 --- a/packages/frontend/src/pages/_app.tsx +++ b/packages/frontend/src/pages/_app.tsx @@ -1,15 +1,19 @@ import { GlobalStyles } from '@/styles/GobalStyles' -import type { AppProps } from 'next/app' +import type { AppContext, AppProps } from 'next/app' import { BlockchainProviders } from '@/providers/wagmi' import { BidsProvider } from '@/providers/BidsProvider/provider' import { ReactNode } from 'react' import { TopBar } from '@/components/topBar/TopBar' import { Footer } from '@/components/footer/Footer' import { Toaster } from 'sonner' +import { cookieToInitialState } from 'wagmi' +import { wagmiConfig } from '@/config/wagmiConfig' + +export default function App({ Component, pageProps, cookie }: AppProps & CustomProps) { + const initialState = cookieToInitialState(wagmiConfig, cookie) -export default function App({ Component, pageProps }: AppProps) { return ( - + @@ -28,3 +32,11 @@ const Layout = ({ children }: { children: ReactNode }) => (