Alchemy Logo

createConfig

function 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).

import { sepolia, alchemy } from "@account-kit/infra"
import { AlchemyAccountsUIConfig, createConfig } from "@account-kit/react"
import { QueryClient } from "@tanstack/react-query";
 
const uiConfig: AlchemyAccountsUIConfig = {
  illustrationStyle: "linear",
  auth: {
    sections: [[{ type: "email" }], [{ type: "passkey" }]],
    addPasskeyOnSignup: true,
  },
}
 
const config = createConfig({
  transport: alchemy({ apiKey: "your_api_key" })
  chain: sepolia,
  ssr: true,
  sessionConfig: {
    expirationTimeMs: 1000 * 60 * 60, // 1 hour (defaults to 15 min)
  },
}, uiConfig)
 
export const queryClient = new QueryClient();

ParameterTypeDescription

props

CreateConfigProps

for creating an alchemy account config

ui?

any

(optional) configuration to use for the Auth Components UI

AlchemyAccountsConfigWithUI

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

Was this page helpful?