useAccount
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
Example
import { function useAccount<TAccount extends SupportedAccountTypes>(params: UseAccountProps<TAccount>): UseAccountResult<TAccount>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
useAccount } from "@account-kit/react"; const { const account: LightAccount<AlchemySigner> | undefinedaccount, const address: `0x${string}` | undefinedaddress, const isLoadingAccount: booleanisLoadingAccount } = useAccount<"LightAccount">(params: UseAccountProps<"LightAccount">): UseAccountResult<"LightAccount">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
useAccount({ type: "LightAccount"type: "LightAccount", });
Type Parameters
Parameters
Returns
UseAccountResult
<TAccount
>
An object containing the account information, address, and loading state. ref