Skip to content

useAccount

useAccount(): object

Defined in: packages/iso-filecoin-react/src/wallet-provider.js:351

Hook to access the current account and its state

Account state

account: undefined | IAccount

Currently connected account

adapter: undefined | WalletAdapter

Currently selected wallet adapter

address: string

Current address

chain: Chain

Current chain

network: Network

Current network (mainnet or testnet)

state: ConnectionState

Current connection state

import {
function useAccount(): UseAccountReturnType

Hook to access the current account and its state

@example

import { useAccount } from 'iso-filecoin-react'
function App() {
const { account, adapter, network, chain, state } = useAccount()
return <div>Current address: {account?.address.toString()}</div>
}

@returnsAccount 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

@example

import { useAccount } from 'iso-filecoin-react'
function App() {
const { account, adapter, network, chain, state } = useAccount()
return <div>Current address: {account?.address.toString()}</div>
}

@returnsAccount 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
>
}