useScaffoldWriteContract
Use this hook to send a transaction to your smart contract to write data or perform an action.
Use this hook to send a transaction to your smart contract to write data or perform an action.
The following configuration options can be passed to the hook:
Configuration
To send the transaction, you can call the writeContractAsync
function returned by the hook (which we instance as writeYourContractAsync
). Here’s an example usage:
This example sends a transaction to the YourContract
smart contract to call the setGreeting
function with the arguments passed in args
. The writeContractAsync
function (writeYourContractAsync
instance) sends the transaction to the smart contract.
Below is the configuration for writeContractAsync
function:
Configuration
You can also pass other arguments accepted by writeContractAsync from wagmi.
Return Values
writeContractAsync
function sends the transaction to the smart contract.isMining
property indicates whether the transaction is currently being mined.- The extended object includes properties inherited from wagmi useWriteContract. You can check the useWriteContract return values documentation to check the types.