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

useSignMessage

Hook for signing messages with the connected wallet.

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

function MessageSigner() {
  const { signMessage, isLoading, error } = useSignMessage();

  const handleSign = async () => {
    try {
      const signature = await signMessage('Hello, AvaCloud!');
      console.log('Signature:', signature);
    } catch (error) {
      console.error('Error signing message:', error);
    }
  };

  return (
    <button onClick={handleSign}>
      Sign Message
    </button>
  );
}

Returns

  • signMessage: (message: string) => Promise<string> - Function to sign a message

  • isLoading: boolean - Loading state during message signing

  • error: Error | null - Error state if signing fails

PrevioususeAuthNextuseSignTransaction

Last updated 28 days ago

Was this helpful?

⚙️
🪝