Skip to content
Alchemy Logo

useAccount

function useAccount<TAccount>(params): UseAccountResult<TAccount>;

Defined in: account-kit/react/src/hooks/useAccount.ts:54

Hook 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.

If using a smart contract account, returns instance of a smart contract account that the user is connected to. Returns address of smart contract account, not address of the signer.

If using an EOA, returns address of signer

import { useAccount } from "@account-kit/react";
 
const { account, address, isLoadingAccount } = useAccount({
  type: "LightAccount",
});

Type ParameterDescription

TAccount extends SupportedAccountTypes

The type of account to use

ParameterTypeDescription

params

UseAccountProps<TAccount>

The parameters required for account management, including account type, specific account parameters, and optional mutation arguments. ref

UseAccountResult<TAccount>

An object containing the account information, address, and loading state. ref

Was this page helpful?