auth.andert.me/example/google-auth/src/pages/_app.tsx
2023-07-21 09:24:32 +02:00

66 lines
1.4 KiB
TypeScript

import { AppProps } from 'next/app';
import { WagmiConfig, createClient, configureChains } from 'wagmi';
import { publicProvider } from 'wagmi/providers/public';
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
import { Chain } from 'wagmi/chains';
const chronicleChain: Chain = {
id: 175177,
name: 'Chronicle',
network: 'chronicle',
nativeCurrency: {
decimals: 18,
name: 'Chronicle - Lit Protocol Testnet',
symbol: 'LIT',
},
rpcUrls: {
default: {
http: ['https://chain-rpc.litprotocol.com/http'],
},
public: {
http: ['https://chain-rpc.litprotocol.com/http'],
},
},
blockExplorers: {
default: {
name: 'Chronicle - Lit Protocol Testnet',
url: 'https://chain.litprotocol.com',
},
},
testnet: true,
};
const { provider, chains } = configureChains(
[chronicleChain],
[
jsonRpcProvider({
rpc: chain => ({ http: chain.rpcUrls.default.http[0] }),
}),
publicProvider(),
]
);
const client = createClient({
autoConnect: true,
connectors: [
new WalletConnectConnector({
chains,
options: {
projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID,
},
}),
],
provider,
});
export default function MyApp({ Component, pageProps }: AppProps) {
return (
<WagmiConfig client={client}>
<Component {...pageProps} />
</WagmiConfig>
);
}