Skip to content

useWalletAuth

Manages wallet connection and linking with SIWE (Sign-In With Ethereum).

Use cases:
  • Connect wallets and authenticate users via SIWE.
  • Link wallets to a user account.
Returns:
  • connectWallet, linkWallet: Connect or link wallet functions.
  • availableWallets: List of wallets available to the user.
  • Status flags: isLoading, isError, isSuccess.
import { useWalletAuth } from "@openfort/react"
 
function SampleComponent() {
  const {
    walletConnectingTo,
    connectWallet, // Connect a wallet to the application.
    linkWallet, // Link a wallet to an existing account.
    availableWallets, // List of available wallets in device for connection.
    isLoading, // Indicates if the hook is currently loading.
    isError, // Indicates if the hook has encountered an error.
    isSuccess, // Indicates if the hook has successfully completed.
    error, // The error object if an error occurred, otherwise null.
  } = useWalletAuth({
    throwOnError, // Whether to throw errors.
    onSuccess, // Callback function to execute on success.
    onError, // Callback function to execute on error.
    onSettled, // Callback function to execute when the operation is settled (either success or error).
  })
  // ...
}