To send a transaction from a wallet using the React SDK, use the signTransaction method from the useSignTransaction hook:
signTransaction: (input: UnsignedTransactionRequest, options?: SendTransactionOptions) => Promise<{ signature: HexString }>

Usage

import {useSignTransaction, useWallets} from '@privy-io/react-auth';

const {signTransaction} = useSignTransaction();
const {wallets} = useWallets();

signTransaction(
  {
    to: '0xE3070d3e4309afA3bC9a6b057685743CF42da77C',
    value: 100000
  },
  {
    address: wallets[0].address // Optional: Specify the wallet to use for signing. If not provided, the first wallet will be used.
  }
);

Parameters

input
UnsignedTransactionRequest
required
The details of the transaction to sign.
options.uiOptions
SendTransactionModalUIOptions
The options for the UI of the send transaction modal. Learn more.
To hide confirmation modals, set options.uiOptions.showWalletUIs to false. Learn more about configuring modal prompts here.
options.fundWalletConfig
FundWalletConfig
The configuration for funding the wallet.
options.address
string
The address of the wallet to use for signing the transaction. Recommended when working with external wallets to ensure reliable functionality. If not provided, the first wallet will be used.

Returns

signature
HexString
The signed transaction hash.