useAccount
useAccount():
object
Defined in: packages/iso-filecoin-react/src/wallet-provider.js:351
Hook to access the current account and its state
Returns
Section titled “Returns”Account state
account
Section titled “account”account:
undefined
|IAccount
Currently connected account
adapter
Section titled “adapter”adapter:
undefined
|WalletAdapter
Currently selected wallet adapter
address
Section titled “address”address:
string
Current address
chain:
Chain
Current chain
network
Section titled “network”network:
Network
Current network (mainnet or testnet)
state:
ConnectionState
Current connection state
Example
Section titled “Example”import { function useAccount(): UseAccountReturnType
Hook to access the current account and its state
useAccount } from 'iso-filecoin-react'
function function App(): React.JSX.Element
App() { const { const account: IAccount | undefined
Currently connected account
account, const adapter: WalletAdapter | undefined
Currently selected wallet adapter
adapter, const network: Network
Current network (mainnet or testnet)
network, const chain: Chain
Current chain
chain, const state: ConnectionState
Current connection state
state } = function useAccount(): UseAccountReturnType
Hook to access the current account and its state
useAccount()
return <React.JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div>Current address: {const account: IAccount | undefined
Currently connected account
account?.IAccount.address: IAddress
address.IAddress.toString: () => string
toString()}</React.JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div>}