-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
872f1a8
commit 9e4389a
Showing
2 changed files
with
43 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
'use client' | ||
import { ReactNode } from 'react' | ||
|
||
import React, { ReactNode } from 'react' | ||
import { createWeb3Modal } from '@web3modal/wagmi/react' | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
import { State, WagmiProvider } from 'wagmi' | ||
import { config } from './wagmi' | ||
import { config, projectId } from './wagmi' | ||
|
||
// Setup queryClient | ||
// Initialize React Query Client | ||
const queryClient = new QueryClient() | ||
|
||
const projectId = 'c26b357532f63f7ba31efebac88d0eed' | ||
|
||
if (!projectId) throw new Error('Wallet Connect Project ID is not defined') | ||
if (!projectId) { | ||
throw new Error('Wallet Connect Project ID is not defined') | ||
} | ||
|
||
// Create modal | ||
// Initialize Web3Modal | ||
createWeb3Modal({ | ||
wagmiConfig: config, | ||
projectId, | ||
enableAnalytics: true, // Optional - defaults to your Cloud configuration | ||
enableOnramp: true, // Optional - false as default | ||
wagmiConfig: config, | ||
projectId, | ||
enableAnalytics: true, // Optional - defaults to your Cloud configuration | ||
enableOnramp: true // Optional - false by default | ||
}) | ||
|
||
export default function AppKitProvider({ | ||
children, | ||
initialState, | ||
}: { | ||
children: ReactNode | ||
initialState?: State | ||
}) { | ||
return ( | ||
<WagmiProvider config={config} initialState={initialState}> | ||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider> | ||
</WagmiProvider> | ||
) | ||
interface AppKitProviderProps { | ||
children: ReactNode | ||
initialState?: State | ||
} | ||
|
||
export default function AppKitProvider({ children, initialState }: AppKitProviderProps) { | ||
return ( | ||
<WagmiProvider config={config} initialState={initialState}> | ||
<QueryClientProvider client={queryClient}> | ||
{children} | ||
</QueryClientProvider> | ||
</WagmiProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
"use client"; | ||
import { defaultWagmiConfig } from '@web3modal/wagmi/react/config' | ||
|
||
import { cookieStorage, createStorage } from 'wagmi' | ||
import { createStorage, cookieStorage } from 'wagmi' | ||
import { base } from 'wagmi/chains' | ||
|
||
// Get projectId from https://cloud.walletconnect.com | ||
export const projectId = 'c26b357532f63f7ba31efebac88d0eed' | ||
// Get projectId from environment variables | ||
export const projectId = process.env.NEXT_PUBLIC_PROJECT_ID | ||
|
||
if (!projectId) throw new Error('Project ID is not defined') | ||
if (!projectId) { | ||
throw new Error('Project ID is not defined') | ||
} | ||
|
||
export const metadata = { | ||
name: 'AppKit', | ||
description: 'AppKit Example', | ||
url: 'https://web3modal.com', // origin must match your domain & subdomain | ||
icons: ['https://avatars.githubusercontent.com/u/37784886'] | ||
} | ||
export const metadata = { | ||
name: 'Myriadflow', | ||
description: 'Myriadflow', | ||
url: 'https://webxr.myriadflow.com', // Origin must match your domain & subdomain | ||
icons: ['https://avatars.githubusercontent.com/u/37784886'] | ||
} | ||
|
||
// Create wagmiConfig | ||
// Define supported chains | ||
const chains = [base] as const | ||
|
||
// Create Wagmi configuration | ||
export const config = defaultWagmiConfig({ | ||
chains, | ||
projectId, | ||
metadata, | ||
auth: { | ||
email: true, | ||
socials: ["github", "google", "x", "discord", "apple"], | ||
showWallets: true, // default to true | ||
socials: ['github', 'google', 'x', 'discord', 'apple'], | ||
showWallets: true, // Defaults to true | ||
walletFeatures: true | ||
}, | ||
ssr: true, | ||
storage: createStorage({ | ||
storage: cookieStorage | ||
}) | ||
}); | ||
}) |