Skip to content

Commit

Permalink
upd: deconstructed alchemy â�â�#190
Browse files Browse the repository at this point in the history
  • Loading branch information
habdevs committed Sep 5, 2023
1 parent 2890d8b commit 381b77a
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
import type { AppProps } from 'next/app'
import Head from 'next/head'
import { RainbowKitProvider, getDefaultWallets } from '@rainbow-me/rainbowkit'
import { configureChains, createClient, WagmiConfig } from 'wagmi'
import { polygon } from 'wagmi/chains'
import { ApolloProvider, ApolloClient, InMemoryCache } from '@apollo/client'
import { Layout } from 'components'
import { WalletContextProvider } from 'contexts/WalltetContext'
import { XmtpContextProvider } from 'contexts/XmtpContext'
import 'i18n/index'
import '@rainbow-me/rainbowkit/styles.css'
import 'styles/globals.css'
import XmtpProvider from '../contexts/XmtpProvider'
import type { AppProps } from 'next/app';
import Head from 'next/head';
import { RainbowKitProvider, getDefaultWallets } from '@rainbow-me/rainbowkit';
import { configureChains, createClient, WagmiConfig } from 'wagmi';
import { polygon } from 'wagmi/chains';
import { ApolloProvider, ApolloClient, InMemoryCache } from '@apollo/client';
import { Layout } from 'components';
import { WalletContextProvider } from 'contexts/WalltetContext';
import { XmtpContextProvider } from 'contexts/XmtpContext';
import 'i18n/index';
import '@rainbow-me/rainbowkit/styles.css';
import 'styles/globals.css';
import XmtpProvider from '../contexts/XmtpProvider';
// TODO: don't forget to bring back alchemy instead of publicProvider. @habdevs #190
// import {alchemyProvider} from 'wagmi/providers/alchemy';
import { GameStateContextProvider } from 'contexts/GameStateContext'
import { publicProvider } from 'wagmi/providers/public'
import { alchemyProvider } from 'wagmi/providers/alchemy';
import { publicProvider } from 'wagmi/providers/public';
import { GameStateContextProvider } from 'contexts/GameStateContext';

const { chains, provider, webSocketProvider } = configureChains([polygon],
[publicProvider()],
// [alchemyProvider({apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY!})]
)
const { chains, provider, webSocketProvider } = configureChains(
[polygon],
// [publicProvider()],
[alchemyProvider({ apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY! }), publicProvider()],
);

const { connectors } = getDefaultWallets({
appName: 'GameJutsu App',
chains,
projectId: 'efa8ae30b8b72991a9630a636d6d0411',
})
});

const wagmiClient = createClient({
autoConnect: true, connectors, provider, webSocketProvider,
})
autoConnect: true,
connectors,
provider,
webSocketProvider,
});

const cache = new InMemoryCache()
const cache = new InMemoryCache();
const client = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/chainhackers/gamejutsu-subgraph',
cache,
})
});

const version = 'v1.2.38'
const version = 'v1.2.38';

function MyApp ({ Component, pageProps }: AppProps) {
const props = { ...pageProps, version }
return (<WagmiConfig client={wagmiClient}>
function MyApp({ Component, pageProps }: AppProps) {
const props = { ...pageProps, version };
return (
<WagmiConfig client={wagmiClient}>
<GameStateContextProvider>
<ApolloProvider client={client}>
<WalletContextProvider>
Expand All @@ -50,10 +55,7 @@ function MyApp ({ Component, pageProps }: AppProps) {
<XmtpProvider>
<Layout version={version}>
<Head>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
/>
<meta name='viewport' content='width=device-width, initial-scale=1' />
</Head>
<Component {...props} />
</Layout>
Expand All @@ -63,7 +65,8 @@ function MyApp ({ Component, pageProps }: AppProps) {
</WalletContextProvider>
</ApolloProvider>
</GameStateContextProvider>
</WagmiConfig>)
</WagmiConfig>
);
}

export default MyApp
export default MyApp;

0 comments on commit 381b77a

Please sign in to comment.