Skip to content
Starknet Start

useAccount

Access metadata for the currently connected account, if any.

Usage

import {  } from "@starknetfoundation/starknet-start-react";
 
const { ,  } = ();

useAccount returns wallet connection metadata such as address, connector, chainId, and status. It does not return the raw Starknet.js account object. If you previously used account.execute(...), send transactions with useSendTransaction instead — its "Replacing account.execute" section has a full example.

For lower-level wallet RPC methods that are not covered by a dedicated hook, use useWalletRequest.

Listening for changes

You can listen for the connection/disconnection events using the useEffect hook.

import {  } from "react";
import {  } from "@starknetfoundation/starknet-start-react";
 
const { ,  } = ();
 
(() => {
  if ( === "disconnected") {
    // on disconnect
  } else if ( === "connected") {
    // on connect
  }
}, [, ]);

Returns

address

  • Type: 0x${string} | undefined

The address of the currently connected account.

connector

  • Type: WalletWithStarknetFeatures | undefined

The wallet used to connect the account.

chainId

  • Type: bigint | undefined

The account's chain id.

status

  • Type: "connected" | "disconnected" | "connecting" | "reconnecting"

Account connection status.

isConnecting

  • Type: boolean | undefined

Derived from status.

isReconnecting

  • Type: boolean | undefined

Derived from status.

isConnected

  • Type: boolean | undefined

Derived from status.

isDisconnected

  • Type: boolean | undefined

Derived from status.