useAccount
Hook to get the current account / address.
Usage
import { useAccount } from "@hyper-gate/react";
export function App() {
const const account: {
address: `r${string}` | undefined;
addresses: readonly [`r${string}`, ...`r${string}`[]] | undefined;
chainId: number | undefined;
chain: Chain | undefined;
connector: {
readonly icon?: string | undefined | undefined;
readonly id: string;
readonly name: string;
readonly supportsSimulation?: boolean | undefined | undefined;
readonly type: string;
readonly provider: ConnectorProvider;
emitter?: Emitter<ConnectorEventMap> | undefined;
uid: string;
setup?: (() => Promise<void>) | undefined;
connect: (parameters?: {
chainId?: number | undefined;
isReconnecting?: boolean | undefined;
} | undefined) => Promise<{
accounts: readonly Address[];
chainId: number;
}>;
disconnect: () => Promise<void>;
getAccounts: () => Promise<readonly Address[]>;
getChainId: () => Promise<number | string>;
isAuthorized: () => Promise<boolean>;
onAccountsChanged: (accounts: readonly Address[]) => void;
onChainChanged: (chainId: string) => void;
onError: (error: Error) => void;
signAndSubmitTransaction: (transaction: Transaction) => Promise<string>;
switchChain: (parameters: {
chainId: number;
}) => Promise<{
id: number;
}>;
} | undefined;
... 4 more ...;
isReconnecting: boolean;
}account = useAccount();
}