useSignTransaction

Hook for signing transactions with the connected wallet.
1import { useSignTransaction } from '@avalabs/avacloud-waas-react';
2
3function TransactionSigner() {
4 const { signTransaction, isLoading, error } = useSignTransaction();
5
6 const handleSignTx = async () => {
7 try {
8 const signedTx = await signTransaction({
9 to: '0x...',
10 value: '0.1',
11 data: '0x...',
12 });
13 console.log('Signed transaction:', signedTx);
14 } catch (error) {
15 console.error('Error signing transaction:', error);
16 }
17 };
18
19 return (
20 <button onClick={handleSignTx}>
21 Sign Transaction
22 </button>
23 );
24}

Returns

  • signTransaction : (transaction: Transaction) => Promise<string> - Function to sign a transaction
  • isLoading : boolean - Loading state during transaction signing
  • error : Error | null - Error state if signing fails

For any additional questions, please view our other knowledge base articles or contact a support team member via the chat button. Examples are for illustrative purposes only.

Learn More About AvaCloud | Download Case Studies | Schedule an AvaCloud Demo