Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wagmi: remove connectkit default config #212

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Viewport } from "next/types"
import { MAX_ORDERS } from "@renegade-fi/react/constants"
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
import { Analytics } from "@vercel/analytics/react"
import { cookieToInitialState } from "wagmi"

import { ClearCookie } from "@/app/components/clear-cookie"
import { LazyDatadog } from "@/app/components/datadog"
Expand All @@ -31,6 +32,7 @@ import { SolanaProvider } from "@/providers/solana-provider"
import { ClientStoreProvider } from "@/providers/state-provider/client-store-provider.tsx"
import { ServerStoreProvider } from "@/providers/state-provider/server-store-provider"
import { ThemeProvider } from "@/providers/theme-provider"
import { getConfig } from "@/providers/wagmi-provider/config"
import { WagmiProvider } from "@/providers/wagmi-provider/wagmi-provider"

import "./globals.css"
Expand Down Expand Up @@ -93,6 +95,8 @@ export default async function RootLayout({
? decodeURIComponent(headersList.get("cookie") ?? "")
: ""

const initialState = cookieToInitialState(getConfig(), cookieString)

const cookieStore = await cookies()
const defaultOpen = cookieStore.get("sidebar:state")?.value === "true"

Expand All @@ -114,7 +118,7 @@ export default async function RootLayout({
<ClientStoreProvider>
<RenegadeProvider cookieString={cookieString}>
<SolanaProvider>
<WagmiProvider cookieString={cookieString}>
<WagmiProvider initialState={initialState}>
<SidebarProvider defaultOpen={defaultOpen}>
<TrackLastVisit />
<WalletSidebarSync />
Expand Down
8 changes: 7 additions & 1 deletion components/dialogs/transfer/usdc-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useQueryClient } from "@tanstack/react-query"
import { AlertCircle, Check, Loader2 } from "lucide-react"
import { UseFormReturn, useWatch } from "react-hook-form"
import { toast } from "sonner"
import invariant from "tiny-invariant"
import { useDebounceValue } from "usehooks-ts"
import { formatUnits, isAddress, parseUnits } from "viem"
import { mainnet } from "viem/chains"
Expand Down Expand Up @@ -202,10 +203,15 @@ export function USDCForm({
? combinedBalance - parseUnits(amount, USDC_L2_TOKEN.decimals)
: usdceL2Balance ?? BigInt(0)

const switchChainAndInvoke = async (chainId: number, fn: () => void) =>
const switchChainAndInvoke = async (chainId: number, fn: () => void) => {
invariant(
chainId === 1 || chainId === 42161 || chainId === 421614,
"Invalid chainId",
)
switchChainAsync({ chainId })
.then(fn)
.catch((error) => catchError(error, "Couldn't switch chain"))
}

// Fetch bridge quote
const bridgeRequired = React.useMemo(() => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"usehooks-ts": "^3.1.0",
"vaul": "0.9.1",
"viem": "~2.15.1",
"wagmi": "~2.12.11",
"wagmi": "~2.13.3",
"zod": "^3.23.8",
"zustand": "^5.0.1"
},
Expand Down
Loading
Loading