Skip to content

AlchemyAccountProvider

Provider for Alchemy accounts.

Import

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

Usage

import { AlchemyAccountProvider, createConfig } from "@account-kit/react";
import { sepolia } from "@account-kit/infra";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
 
const config = createConfig({
  apiKey: "your-api-key",
  chain: sepolia,
});
 
const queryClient = new QueryClient();
 
function App({ children }: React.PropsWithChildren) {
  return (
    <QueryClientProvider queryClient={queryClient}>
      <AlchemyAccountProvider config={config} queryClient={queryClient}>
        {children}
      </AlchemyAccountProvider>
    </QueryClientProvider>
  );
}

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.