How to specify ETH value for a transaction that's made by using "useContractWrite" hook? I want to send ETH + ERC20 tokens.
Struggling with nesting stuff, async calls... reallydon't know hoe to manage this in wagmi.
How to specify ETH value for a transaction that's made by using "useContractWrite" hook? I want to send ETH + ERC20 tokens.
Struggling with nesting stuff, async calls... reallydon't know hoe to manage this in wagmi.
Wagmi useContractWrite accepts value: as parameter to send ETH along with write contract transaction.
In the example above, "myContract" has a function called "transferFunction" that manages to spend user's erc20 tokens, so by calling the function, user sends erc20 tokens. Along with that, the "value" paramenter lets user send ETH along with the write tx. Mind to use
BigInt(amount)to format the amounts before sending.