useTransactor
Use this hook to interact with the chain and give UI feedback on the transaction status.
Use this hook to interact with the chain and give UI feedback on the transaction status.
Any error will instead show a popup with nice error message.
This example tries to send 1 ETH to the address buidlguidl.eth
, prompting the connected WalletClient
for a signature. And in the case of a successful transaction, it will show a popup in the UI with the message: ”🎉 Transaction completed successfully!”.
You can pass in anything that is a valid parameter to Viem’s sendTransaction
function to callback function. It also possible to pass it an promise that resolves in with a transaction hash for example promise from Wagmi’s writeContractAsync
function.
Configuration
useTransactor
callback function
Return Values
useTransactor
- The callback function that is used to initialize the UI feedback flow.
callback function
- A promise that resolves with the transaction hash once the transaction is mined.