Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lochie committed Jan 16, 2024
1 parent 5d1927b commit 6d065fa
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@tanstack/react-query": "^5.17.10",
"connectkit": "workspace:packages/connectkit",
"next": "12.3.0",
"react": "^18.0.0",
Expand Down
17 changes: 11 additions & 6 deletions examples/nextjs/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import '../styles/globals.css';
import type { AppProps } from 'next/app';

import { WagmiConfig, createConfig } from 'wagmi';
import { WagmiProvider, createConfig } from 'wagmi';
import { mainnet, polygon, optimism, arbitrum } from 'wagmi/chains';
import { ConnectKitProvider, getDefaultConfig } from 'connectkit';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

const config = createConfig(
getDefaultConfig({
Expand All @@ -15,13 +16,17 @@ const config = createConfig(
})
);

const queryClient = new QueryClient();

function MyApp({ Component, pageProps }: AppProps) {
return (
<WagmiConfig config={config}>
<ConnectKitProvider debugMode>
<Component {...pageProps} />
</ConnectKitProvider>
</WagmiConfig>
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<ConnectKitProvider debugMode>
<Component {...pageProps} />
</ConnectKitProvider>
</QueryClientProvider>
</WagmiProvider>
);
}

Expand Down
4 changes: 3 additions & 1 deletion examples/testbench/src/pages/chains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const Home: NextPage = () => {
<h2>Connected to</h2>
<ChainIcon
id={chain?.id}
unsupported={chains.some((x) => x.id === chain?.id)}
unsupported={Boolean(
chain && !chains.some((x) => x.id !== chain?.id)
)}
/>
<h2>Configured/Supported Chains</h2>
<div style={{ display: 'flex', gap: 8 }}>
Expand Down
11 changes: 8 additions & 3 deletions examples/testbench/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ const AccountInfo = () => {
<tr>
<td>Chain Supported</td>
<td>
{!chain || chains.some((x) => x.id === chain?.id)
{!chain ||
Boolean(chain && !chains.some((x) => x.id !== chain?.id))
? 'No'
: 'Yes'}
</td>
Expand Down Expand Up @@ -319,7 +320,9 @@ const Home: NextPage = () => {
<div style={{ display: 'flex', gap: 8 }}>
<ChainIcon
id={chain?.id}
unsupported={chains.some((x) => x.id === chain?.id)}
unsupported={Boolean(
chain && !chains.some((x) => x.id !== chain?.id)
)}
/>
<ChainIcon id={1} size={64} radius={6} />
<ChainIcon id={1337} size={32} radius={0} />
Expand Down Expand Up @@ -363,7 +366,9 @@ const Home: NextPage = () => {
{chain?.name}
<ChainIcon
id={chain?.id}
unsupported={chains.some((x) => x.id === chain?.id)}
unsupported={Boolean(
chain && !chains.some((x) => x.id !== chain?.id)
)}
/>
<Avatar address={address} size={12} />
{ensName ?? address}
Expand Down

0 comments on commit 6d065fa

Please sign in to comment.