AlchemyAccountProvider

Provider for Alchemy accounts.

Import

1import { AlchemyAccountProvider } from "@account-kit/react";

Usage

1import { AlchemyAccountProvider, createConfig } from "@account-kit/react";
2import { sepolia } from "@account-kit/infra";
3import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
5const config = createConfig({
6 apiKey: "your-api-key",
7 chain: sepolia,
8});
9
10const queryClient = new QueryClient();
11
12function App({ children }: React.PropsWithChildren) {
13 return (
14 <QueryClientProvider queryClient={queryClient}>
15 <AlchemyAccountProvider config={config} queryClient={queryClient}>
16 {children}
17 </AlchemyAccountProvider>
18 </QueryClientProvider>
19 );
20}

Parameters

props

React.PropsWithChildren<AlchemyAccountsProviderProps> alchemy accounts provider props

props.config

AlchemyAccountsConfig the acccount config generated using createConfig

props.queryClient

QueryClient the react-query query client to use

props.uiConfig

AlchemyAccountsUIConfig optional UI configuration

props.children

React.ReactNode | undefined react components that should have this accounts context

Returns

React.JSX.Element The element to wrap your application in for Alchemy Accounts context.