Skip to content

useWallet

Read the current active wallet returned by useWallets().

Request

type Request = {
  hook: 'useWallet',
  params: []
}

Response

type Response = UserWallet | undefined
 
type UserWallet = {
  address: import("viem").Hex
  connectorType?: string
  walletClientType?: string
  connector?: import("wagmi").Connector
  id: string
  isAvailable: boolean
  isActive?: boolean
  isConnecting?: boolean
  recoveryMethod?: import("@openfort/openfort-js").RecoveryMethod
  accountId?: string
  accountType?: import("@openfort/openfort-js").AccountTypeEnum
  ownerAddress?: import("viem").Hex
  implementationType?: string
  createdAt?: number
  salt?: string
}

Example

import { useWallet } from "@openfort/react"
 
function WalletManager() {
  const wallet = useWallet()
 
  if (!wallet) return <span>No wallet connected</span>
 
  return <span>Active wallet: {wallet.address}</span>
}