Skip to content

useAccount

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, and MultiOwnerModularAccount. 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

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

Usage

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

Parameters

params

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

Returns

UseAccountResult<TAccount> An object containing the account information, address, and loading state. ref