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

chore: remove providers from cli template #1668

Merged
merged 1 commit into from
Nov 26, 2024
Merged
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
51 changes: 10 additions & 41 deletions create-onchain/templates/next/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,21 @@
'use client';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { base } from 'wagmi/chains';
import { http, cookieStorage, createConfig, createStorage } from 'wagmi';
import { coinbaseWallet } from 'wagmi/connectors';
import { OnchainKitProvider } from '@coinbase/onchainkit';
import { type ReactNode, useState } from 'react';
import { type State, WagmiProvider } from 'wagmi';

const config = createConfig({
chains: [base],
connectors: [
coinbaseWallet({
appName: process.env.NEXT_PUBLIC_ONCHAINKIT_PROJECT_NAME,
preference: process.env.NEXT_PUBLIC_ONCHAINKIT_WALLET_CONFIG as
| 'smartWalletOnly'
| 'all',
}),
],
storage: createStorage({
storage: cookieStorage,
}),
ssr: true,
transports: {
[base.id]: http(),
},
});

export function Providers(props: {
children: ReactNode;
initialState?: State;
}) {
const [queryClient] = useState(() => new QueryClient());
import type { ReactNode } from 'react';

export function Providers(props: { children: ReactNode }) {
return (
<WagmiProvider config={config} initialState={props.initialState}>
<QueryClientProvider client={queryClient}>
<OnchainKitProvider
apiKey={process.env.NEXT_PUBLIC_ONCHAINKIT_API_KEY}
<OnchainKitProvider
apiKey={process.env.NEXT_PUBLIC_ONCHAINKIT_API_KEY}
chain={base}
config={{ appearance: {
mode: 'auto',
theme: 'base',
} }}
>
{props.children}
</OnchainKitProvider>
</QueryClientProvider>
</WagmiProvider>
}
}}
>
{props.children}
</OnchainKitProvider>
);
}