useAccount
Hook for getting current account.
Import
import { useAccount } from "starkweb/react"
Usage
import { useAccount } from "starkweb/react"
function App() {
const account = useAccount()
}
Parameters
import { type UseAccountParameters } from "starkweb/react"
config
Config | undefined
Config
to use instead of retrieving from the nearest StarkwebProvider
.
index.tsx
import { useAccount } from "starkweb/react"
import { config } from "./config"
function App() {
const account = useAccount({
config,
})
}
Return Type
import { type UseAccountReturnType } from "starkweb/react"
address
Address | undefined
- Connected address from connector.
- Defaults to first address in
addresses
.
addresses
readonly Address[] | undefined
Connected addresses from connector.
chain
Chain | undefined
Connected chain from connector. If chain is not configured by config, it will be undefined
.
chainId
number | undefined
Connected chain id from connector.
connector
Connector | undefined
Connected connector.
isConnecting / isReconnecting / isConnected / isDisconnected
boolean
Boolean variables derived from status
.
status
"connecting" | "reconnecting" | "connected" | "disconnected"
"connecting"
attempting to establish connection."reconnecting"
attempting to re-establish connection to one or more connectors."connected"
at least one connector is connected."disconnected"
no connection to any connector.