Replies: 1 comment
-
Yes, you can achieve this by defining a single instance of usePrepareContractWrite and useContractWrite hooks and then dynamically passing different function names and arguments based on the button clicked. Here's how you can do it: `import { usePrepareContractWrite, useContractWrite } from 'yourContractLibrary'; const YourComponent = () => { // Define a single instance of useContractWrite // Function to handle staking // Function to handle withdrawing return ( Stake Withdraw ); };` |
Beta Was this translation helpful? Give feedback.
-
I have 2 buttons one is staking and other is withdrawing on same page adjacent to each other. Both calling same contract, but with different function and different argument value.
Is it possible to define
usePrepareContractWrite
anduseContractWrite
only one time but providing different function name with their argument in the click event handler of these 2 buttons? If possible then how? Or I have to define both of them 2 times for my use case?Beta Was this translation helpful? Give feedback.
All reactions