AvaCloud API
AvaCloud App
AvaCloud Wallet as a Service
AvaCloud Wallet as a Service
  • AvaCloud Wallet as a Service SDK
  • 🚀Getting Started
    • Quickstart
  • ⚙️USAGE
    • 🪝Hooks
      • useAvaCloudWallet
      • useAuth
      • useSignMessage
      • useSignTransaction
      • useTransferTokens
      • useUserWallets
      • useChainId
    • UI Components
      • LoginButton
      • WalletButton
      • WalletDisplay
      • UserProfile
      • WalletCard
      • TokensView
      • SendView
      • ReceiveView
      • ExportView
    • 🛠️Advanced Usage
Powered by GitBook

© 2025 Ava Labs, Inc.

On this page

Was this helpful?

  1. USAGE
  2. Hooks

useAvaCloudWallet

The primary hook for handling authentication and basic wallet functionality.

import { useAvaCloudWallet } from '@avalabs/avacloud-waas-react';

function WalletComponent() {
  const {
    isAuthenticated,
    isLoading,
    user,
    wallet,
    login,
    logout,
    addAccount,
  } = useAvaCloudWallet();
  
  if (isLoading) {
    return <div>Loading...</div>;
  }

  return (
    <div>
      {isAuthenticated ? (
        <button onClick={logout}>Logout</button>
      ) : (
        <button onClick={login}>Login</button>
      )}
    </div>
  );
}

Returns

  • isAuthenticated: boolean - Current authentication status

  • isLoading: boolean - Loading state of authentication

  • user: User | null - User information

  • wallet: Wallet | null - Current wallet information

  • login: () => Promise - Trigger login flow

  • logout: () => Promise - Trigger logout flow

  • addAccount: () => Promise - Add a new account to the wallet

PreviousHooksNextuseAuth

Last updated 28 days ago

Was this helpful?

⚙️
🪝