useAdapter
useAdapter():
Pick<FilecoinContextType,"reconnecting"|"adapter"|"network"|"loading"|"error">
Defined in: packages/iso-filecoin-react/src/wallet-provider.js:310
Hook to access the current wallet adapter and its state
Returns
Section titled “Returns”Pick<FilecoinContextType, "reconnecting" | "adapter" | "network" | "loading" | "error">
Wallet adapter state
Example
Section titled “Example”import { function useAdapter(): Pick<FilecoinContextType, "adapter" | "error" | "loading" | "network" | "reconnecting">
Hook to access the current wallet adapter and its state
useAdapter } from 'iso-filecoin-react'
function function App(): JSX.Element
App() { const { const adapter: WalletAdapter | undefined
Currently selected wallet adapter
adapter, const error: Error | undefined
Last error that occurred on the selected adapter
error, const loading: boolean
Provider is checking adapters support
loading } = function useAdapter(): Pick<FilecoinContextType, "adapter" | "error" | "loading" | "network" | "reconnecting">
Hook to access the current wallet adapter and its state
useAdapter()
if (const loading: boolean
Provider is checking adapters support
loading) return <JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div>Loading...</JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div> if (const error: Error | undefined
Last error that occurred on the selected adapter
error) return <JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div>Error: {const error: Error
Last error that occurred on the selected adapter
error.Error.message: string
message}</JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div>
return <JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div>Current adapter: {const adapter: WalletAdapter | undefined
Currently selected wallet adapter
adapter?.WalletAdapter.name: string | undefined
Human readable wallet name
name}</JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div>}