useContractWrite
Generic hook for calling any smart contract function that requires a transaction to take place.
Provide your smart contract instance returned from the useContract
hook, along with the name of the function you wish to call on your smart contract as arguments to the hook.
Then call the mutate
or mutateAsync
function returned by the hook, providing an array of arguments to send to your smart contract function.
If you provide too many or too few arguments, the error
property will be populated with an error message.
If your function has no arguments, provide an empty array by calling the function with { args: [] }
If you have cached the ABI of your smart contract using thirdweb generate , the functionName and args parameters are strongly typed according to your smart contract’s ABI.