Appearance
Documentation / react-auth / useSendTransaction
Function: useSendTransaction()
useSendTransaction(
callbacks
?):Object
Use this hook to send a transaction using the embedded wallet and to attach callbacks for success and errors. Transactions sent from the embedded wallet using transaction functions from non-Privy libraries will not trigger the callbacks.
Parameters
• callbacks?: Object
• callbacks.onError?: (error
) => void
Callback that will execute in the case of a non-successful sendTransaction.
Param [PrivyErrorCode]([object Object]) - the corresponding error code
• callbacks.onSuccess?: (response
) => void
Callback that will execute once a successful sendTransaction
completes. This will not run in the case of a wallet-based authentication or link flow.
Param the response (type TransactionResponse https://docs.ethers.org/v5/api/providers/types/#providers-TransactionResponse) from the successful transaction
Returns
Object
sendTransaction - prompts the user send a transaction using their embedded wallet
sendTransaction
sendTransaction: (
data
,uiOptions
?,fundWalletConfig
?,address
?) =>Promise
<TransactionReceipt
>Parameters
• data:
UnsignedTransactionRequest
• uiOptions?:
SendTransactionModalUIOptions
• fundWalletConfig?:
FundWalletConfig
• address?:
string
Returns
Promise
<TransactionReceipt
>