wagmi: usePrepareSendTransaction is no longer returning gas limit
Is there an existing issue for this?
- I have searched the existing issues
Package Version
1.0.2
Current Behavior
I have my wallet connected and the wagmi provider set up. I’m calling this code in a React component:
const { data, config, error } = usePrepareSendTransaction({
to: wallet,
value: 100n,
});
console.log({ data, config, error });
I’m getting this log
Expected Behavior
My expectation is, that gas is filled with the current gas estimation for the transaction. (Similar to gasLimit in the old wagmi version)
Steps To Reproduce
- Setup Wagmi from one of the examples
- Use the code above
Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)
No response
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (12 by maintainers)
Ahh, thanks, now I know how to create the workaround!
As an idea, maybe adding a opt-in flag in
usePrepareContractWritelike.It’s still a bit weird to me that this hook returns all these values that are always
undefined.Hmm yeah fair points. Could be nice to have the Prepare Hook estimate gas for some cases. Will look at adding it back in tomorrow.
An optional parameter to the
preparehook would massively simplify this 🙏Awesome, thanks, @jxom. Also, the same would apply to
usePrepareContractWrite. I’m also not getting a gas estimation from the hook