createConfig

1function createConfig(props, ui?): AlchemyAccountsConfigWithUI;

Defined in: account-kit/react/src/createConfig.ts:52

Wraps the createConfig that is exported from @aa-sdk/core to allow passing an additional argument, the configuration object for the Auth Components UI (the modal and AuthCard).

Example

1import { sepolia, alchemy } from "@account-kit/infra"
2import { AlchemyAccountsUIConfig, createConfig } from "@account-kit/react"
3import { QueryClient } from "@tanstack/react-query";
4
5const uiConfig: AlchemyAccountsUIConfig = {
6 illustrationStyle: "linear",
7 auth: {
8 sections: [[{ type: "email" }], [{ type: "passkey" }]],
9 addPasskeyOnSignup: true,
10 },
11}
12
13const config = createConfig({
14 transport: alchemy({ apiKey: "your_api_key" })
15 chain: sepolia,
16 ssr: true,
17 sessionConfig: {
18 expirationTimeMs: 1000 * 60 * 60, // 1 hour (defaults to 15 min)
19 },
20}, uiConfig)
21
22export const queryClient = new QueryClient();

Parameters

ParameterTypeDescription

props

CreateConfigProps

for creating an alchemy account config

ui?

any

(optional) configuration to use for the Auth Components UI

Returns

AlchemyAccountsConfigWithUI

an alchemy account config object containing the core and client store, as well as the UI config