Events & State Changes
The useWallet hook provides reactive state that updates automatically when the user changes their network, switches accounts, or disconnects. There is no need to register manual event listeners.
import { useWallet } from "@aptos-labs/wallet-adapter-react";
function WalletStatus() {
const { connected, network, account } = useWallet();
if (!connected) {
return <p>Not connected</p>;
}
return (
<div>
<p>Network: {network?.name}</p>
<p>Address: {account?.address}</p>
</div>
);
}Available State
| Property | Type | Description |
|---|---|---|
connected | boolean | Whether a wallet is currently connected |
network | NetworkInfo | null | Current network (Mainnet, Testnet, Devnet, etc.) |
account | AccountInfo | null | Current account address and public key |
wallet | WalletInfo | null | Info about the connected wallet |
All of these values re-render your component automatically when the underlying state changes — for example, when the user switches accounts or changes networks in Petra.
Because the Wallet Adapter is built on React context, any component inside your AptosWalletAdapterProvider
can access the current wallet state via useWallet().