account-kit/react

Classes

ClassDescription
NoAlchemyAccountContextErrorError thrown when a hook is called without a AlchemyAccountProvider.

Interfaces

InterfaceDescription
ConfigForExternalWalletsParams-
SendVerificationCodeParams-
SolanaConnectionReturned from the solana connection.
SolanaTransactionWe wanted to make sure that this will be using the same useMutation that the useSendUserOperation does. We are going to flatten it to make sure that we are abstracting it, and that we have the flattened version here for readability.
UseChainResult-
UseWaitForCallsStatusParams-

Type Aliases

Type AliasDescription
AlchemyAccountContextProps-
AlchemyAccountsConfigWithUI-
AlchemyAccountsProviderProps-
AlchemyAccountsUIConfig-
AuthType-
ChainType-
ClientActionParameters-
ConnectedUser-
CreateConfigProps-
ExecutableFunctionArgs-
ExecutableFunctionName-
ExecuteableFunctionResult-
ExportAccountComponentPropsProps for the ExportAccountComponent component. This component is returned from the useExportAccount hook and should be rendered in the parent component to display the account recovery details in an iframe.
SendUserOperationWithEOA-
SetEmailParams-
SignMessageArgs-
SignTypedDataArgs-
UiConfigStore-
UseAccountMutationArgs-
UseAccountProps-
UseAccountResult-
UseAddOauthProviderMutationArgs-
UseAddOauthProviderResult-
UseAddPasskeyMutationArgs-
UseAddPasskeyResult-
UseAuthenticateMutationArgs-
UseAuthenticateResult-
UseAuthErrorResult-
UseBundlerClientResult-
UseCallsStatusParams-
UseCallsStatusResult-
UseChainParams-
UseClientActionsProps-
UseClientActionsResult-
UseConnectedUserResult-
UseDropAndReplaceUserOperationArgs-
UseDropAndReplaceUserOperationMutationArgs-
UseDropAndReplaceUserOperationResult-
UseExportAccountMutationArgs-
UseExportAccountResult-
UseGrantPermissionsParams-
UseGrantPermissionsResult-
UseLogoutMutationArgs-
UseLogoutResult-
UseMFAResult-
UsePrepareCallsParams-
UsePrepareCallsResult-
UseRemoveEmailMutationArgs-
UseRemoveEmailResult-
UseRemoveOauthProviderMutationArgs-
UseRemoveOauthProviderResult-
UseRemovePasskeyMutationArgs-
UseRemovePasskeyResult-
UseSendCallsParams-
UseSendCallsResult-
UseSendPreparedCallsParams-
UseSendPreparedCallsResult-
UseSendUserOperationArgs-
UseSendUserOperationMutationArgs-
UseSendUserOperationResult-
UseSendVerificationCodeMutationArgs-
UseSendVerificationCodeResult-
UseSetEmailMutationArgs-
UseSetEmailResult-
UseSignerStatusResult-
UseSignMessageArgs-
UseSignMessagedMutationArgs-
UseSignMessageResult-
UseSignTypedDataArgs-
UseSignTypedDataMutationArgs-
UseSignTypedDataResult-
UseSmartAccountClientProps-
UseSmartAccountClientResult-
UseUserResult-
UseWaitForCallsStatusResult-
UseWaitForUserOperationTransactionArgs-
UseWaitForUserOperationTransactionMutationArgs-
UseWaitForUserOperationTransactionResult-

Variables

VariableDescription
AlchemyAccountContext-
cookieStorageFunction to create cookie based Storage
DEFAULT_UI_CONFIG-

Functions

FunctionDescription
AlchemyAccountProviderProvider for Alchemy accounts.
AuthCardReact component containing an Auth view with configured auth methods and options based on the config passed to the AlchemyAccountProvider
configForExternalWalletsConfigure external wallets for Account Kit with simplified wallet name-based configuration Handles both EVM connectors and Solana adapters, returns config for core and UI
createConfigWraps 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).
createUiConfigStore-
DialogDialog component that renders a modal dialog.
getListAuthMethodsQueryKey-
getSocialProviderDisplayName-
HydrateA react component that can be used to hydrate the client store with the provided initial state. This method will use hydrate to hydrate the client store with the provided initial state if one is provided. If ssr is set on the account config, then it will run the onMount function within a useEffect hook. Otherwise, It will run onMount as soon as the compoonent is rendered.
UiConfigProvider-
useAccountHook to subscribe to account state and interactions, including creation, connection, and status monitoring. It synchronizes with external store updates and provides status-dependent results. The supported account types are: LightAccount, MultiOwnerLightAccount, MultiOwnerModularAccount, and ModularAccountV2. Primarily used to get the smart account address before deployment. Dependent on the signer: if the signer has not been initialized and authenticated, address and isLoadingAccount return null.
useAddOauthProviderA custom hook to handle adding an OAuth provider to an already authenticated account, which includes executing a mutation with optional parameters.
useAddPasskeyA custom hook to handle the addition of a passkey to an already authenticated account, which includes executing a mutation with optional parameters.
useAlchemyAccountContextInternal Only hook used to access the alchemy account context. This hook is meant to be consumed by other hooks exported by this package.
useAuthContextA custom hook that provides the authentication context based on the specified authentication step type. It ensures that the hook is used within an AuthModalProvider and throws an error if the context is not available or if the current auth step type does not match the expected type.
useAuthenticateHook that provides functions and state for authenticating a user using a signer. It includes methods for both synchronous and asynchronous mutations. Useful if building your own UI components and want to control the authentication flow. For authenticate vs authenticateAsync, use authenticate when you want the hook the handle state changes for you, authenticateAsync when you need to wait for the result to finish processing.
useAuthErrorReturns the error returned from the current auth step, if it exists
useAuthModalA hook that returns the open and close functions for the Auth Modal if uiConfig is enabled on the Account Provider
useBundlerClientCustom hook to get a bundler client using the Alchemy account context. It uses useSyncExternalStore to watch for any changes in the bundler client configuration and provides the updated bundler client. React hooks don’t handle their own state management directly, so they rely on external stores, like useSyncExternalStore, to manage state. useBundlerClient’s only job is to call the bundler JSON RPC methods directly; it does not do additional processing, unlike useSmartAccountClient. For example, if you call sendUserOperation, it expects a fully formed user operation. It is an extension of Viem’s Public Client and provides access to public actions, talking to public RPC APIs like getBlock, eth_call, etc. It does not require an account as context. Use cases: connecting with a EOA or checking for gas eligibility.
useCallsStatusHook to retrieve the status of prepared calls from the Wallet API.
useChainA hook that returns the current chain as well as a function to set the chain. Note: when calling setChain the chain that’s passed in must be defined in your initial createConfig call. Calling setChain causes the chain to change across the board. For example, if you use set chain then use useSmartAccountClient, the client will flip to the loading state and address for the account on the changed chain.
useClientActionsA hook that allows you to leverage client decorators to execute actions and await them in your UX. This is particularly useful for using Plugins with Modular Accounts.
useConnectRe-exported wagmi hook for connecting an EOA. This hook uses the internal wagmi config though so that the state is in sync with the rest of the Alchemy Account hook state. Useful if you wnat to connect to an EOA.
useConnectedUserA React hook that returns the currently connected user across external wallets (EVM or Solana) or the smart account user from the client store. It prioritizes the EVM wallet connection, then Solana, and finally the smart account user.
useConnectionA hook that returns the current connection including chain, policy, and transport that you’re currently using.
useDropAndReplaceUserOperationCustom hook that handles the drop and replace user operation for a given client and mutation arguments.
useExportAccountA hook used to export the private key for an account. It returns the mutation functions to kick off the export process, as well as a component to render the account recovery details in an iframe. What is returned is dependent on what you used most recently used to authenticate. If your session was initiated with a passkey, then a private key is returned. Otherwise, a seed phrase.
useGrantPermissionsReact hook for granting permissions on the smart account to a given keypair This enables dapps to request specific permissions from smart accounts, such as spending limits or execution permissions. Returns an error if called with an EOA wallet connection.
useListAuthMethodsA hook to list the authentication methods for a user.
useLogoutProvides a hook to log out a user, disconnecting the signer and triggering the disconnectAsync function. This will disconnect both EVM and Solana wallets.
useMFAHook that provides functions and state for managing multi-factor authentication (MFA) operations. Handles adding, verifying, removing, and getting MFA factors for an authenticated account.
usePrepareCallsHook for preparing calls to a smart account.
useRemoveEmailA custom hook to handle the removal of an email from an already authenticated account, which includes executing a mutation with optional parameters.
useRemoveOauthProviderA custom hook to handle removing an OAuth provider from an already authenticated account, which includes executing a mutation with optional parameters.
useRemovePasskeyA custom hook to handle the addition of a passkey to an already authenticated account, which includes executing a mutation with optional parameters.
useSendCallsHook for sending calls to a smart account or EOA wallet.
useSendPreparedCallsHook for sending prepared calls to a smart account.
useSendUserOperationA hook that returns functions for sending user operations. You can also optionally wait for a user operation to be mined and get the transaction hash before returning using waitForTx. Like any method that takes a smart account client, throws an error if client undefined or is signer not authenticated.
useSendVerificationCodeA custom hook to send OTP verification codes to email or SMS for account verification.
useSetEmailA custom hook to set an email address for an already authenticated account.
useSignerHook for accessing the current Alchemy signer within a React component. It uses a synchronous external store for updates. This is a good use case if you want to use the signer as an EOA, giving you direct access to it. The signer returned from useSigner just does a personal_sign or eth_signTypedData without any additional logic, but a smart contract account might have additional logic for creating signatures for 1271 validation so useSignMessage or useSignTypeData instead.
useSignerStatusHook to get the signer status, optionally using an override configuration, useful if you’re building your own login.
useSignMessageCustom hook to sign a message using the provided client. Provides a way to sign messages within the context of an account using Ethereum-specific signature in EIP-191 format. Uses personal_sign to sign arbitrary messages (usually strings). Accepts any plain message as input.
useSignTypedDataSimilar to useSignMessage, hook for signing typed data, supporting both connected accounts and clients in EIP 712 format.
useSmartAccountClientHook that uses the provided smart account client parameters to create or retrieve an existing smart account client, handling different types of accounts including LightAccount, MultiOwnerLightAccount, and MultiOwnerModularAccount. Under the hood, Smart Account Client takes care of all the necessary middleware operations needed to populate a user operation such as gas estimation and paymaster data.
useSmartWalletClientReact hook that provides a Smart Wallet Client instance. Returns undefined if an EOA wallet is connected via wagmi, as Smart Wallet Clients are only for smart accounts. The hook automatically subscribes to changes in signer status and chain configuration.
useSolanaConnectionThis hook is used for establishing a connection to Solana and returns the connection object and the signer object.
useSolanaSignMessageThis is the hook that will be used to sign a message. It will prioritize external connected Solana wallets, falling back to the internal signer when not connected.
useSolanaTransactionThis is the hook that will be used to send a transaction. It will prioritize external connected Solana wallets, falling back to the internal signer when not connected. Supports sponsorship for both external wallets and internal signers.
useSolanaWalletA React hook that mirrors the behavior and return type of useWallet from @solana/wallet-adapter-react, but safely degrades when Solana is not enabled for your application.
useUiConfigA custom hook for accessing UI configuration from the UiConfigContext. Allows optional selection of specific parts of the UI config state using a selector function. For editing and updating the underlying UI config on the fly.
useUserA React hook that returns the current user information, either from an External Owned Account (EOA) or from the client store. It uses the Alchemy account context and synchronizes with external store updates. The best way to check if user is logged in for both smart account contract users and EOA.
useWaitForCallsStatusHook to wait for calls status to be confirmed. It will poll until the calls reach the desired status or until a timeout occurs.
useWaitForUserOperationTransactionCustom hook to wait for a user operation transaction and manage its state (pending, error, result).