import { QueryClient } from '@tanstack/react-query'; import { ReactNode } from 'react'; import { Config, ResolvedRegister } from 'wagmi'; import { GraphAuthKitProps } from './types'; export type GraphAuthKitState = { /** Opens the GraphAuthKit connect modal to allow user to go through wallet connect flow */ openConnectModal(props?: { title?: ReactNode; subtitle?: ReactNode; afterConnectUrl?: string; }): void; /** Closes the GraphAuthKit connect modal */ closeConnectModal(): void; /** Disconnect the GraphAuthKit state. Wraps the disconnect from the useDisconnect() hook */ disconnect(): void | Promise; }; export declare const GraphAuthKitContext: import('react').Context; export declare function useGraphAuthKit(): GraphAuthKitState; export type GraphAuthKitProviderProps = GraphAuthKitProps & { /** * [Required]. The instantiated wagmi config instance. */ config: config; /** * [Optional]. An instantiated @tanstack/react-query `QueryClient` instance. * If null, will instantiate a `QueryClient` and pass to the `QueryClientProvider`. */ queryClient?: QueryClient; safeApiKey?: string; } & Readonly<{ children: ReactNode; }>; /** * Builds and renders a wagmi config instance wrapped in a `WagmiProvider` context. * This then wraps the `GraphAuthKitContext.Provider` which provides the connect modal state for app users to connect their wallet. * * @example Configure and render the GraphAuthKit for explorer * ```tsx * // _app.tsx * * import { QueryClient } from '@tanstack/react-query' * import { AppProps } from 'next' * import { useRef } from 'react' * import { createClient } from 'viem' * import { cookieStorage, createConfig, createStorage } from 'wagmi' * import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors' * * import { * AUTH_STORAGE_KEY, * buildInfuraHttpTransport, * chainIsSupportedChain, * DefChain, * GraphAuthKitProvider, * L1Chain, * L2Chain, * } from '@edgeandnode/graph-auth-kit' * * const infuraKey = process.env.INFURA_KEY! * const walletConnectProjectID = process.env.WALLETCONNECT_PROJECT_ID! * const gatewayApiKey = process.env.GATEWAY_API_KEY * const safeApiKey = process.env.SAFE_API_KEY * * const config = createConfig({ * chains: [L2Chain, L1Chain] as const, * ssr: typeof window !== 'undefined', * client(params) { * const chain = chainIsSupportedChain(params.chain) ? params.chain : DefChain * const transport = buildInfuraHttpTransport({ * chain: chain.id, * infuraKey * }) * * return createClient({ chain, transport }) * }, * connectors: [ * injected(), * coinbaseWallet({ * appName: 'The Graph Explorer', * appLogoUrl: 'https://storage.googleapis.com/graph-website/seo/graph-explorer.jpg' * }), * walletConnect({ * projectId: walletConnectProjectID, * metadata: { * name: 'The Graph Explorer', * description: `See what’s happening on The Graph Network and participate as a Delegator, Curator, Indexer, or Developer.`, * url: 'https://thegraph.com/explorer', * icons: ['https://storage.googleapis.com/graph-website/seo/graph-explorer.jpg'], * }, * qrModalOptions: { * themeMode: 'dark' * } * }) * ], * storage: createStorage({ storage: cookieStorage, key: AUTH_STORAGE_KEY }) * }) * * export default function App({ Component, router, pageProps }: AppProps) { * const queryClient = useRef() * if (!queryClient.current) { * queryClient.current = new QueryClient({ * defaultOptions: { * queries: { * staleTime: 60 * 1000 * } * } * }) * } * * declare module 'wagmi' { * interface Register { * config: typeof config * } * } * * return ( * * * * ) * } * ``` */ export declare function GraphAuthKitProvider(props: GraphAuthKitProviderProps): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=GraphAuthKit.context.d.ts.map