Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds new fee-estimation utilities and hooks and wires up Vitest so consumers can estimate total EIP-1559 fees and ERC-20 approve costs with test coverage.
Changes:
- Added
estimateTotalFeeutility with a comprehensive Vitest suite. - Added
useEstimateFeesanduseEstimateApproveErc20Feeshooks for fee estimation flows. - Introduced Vitest config/scripts and bumped package version.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Adds Vitest configuration (clear mocks) to support the new test suite. |
| src/utils/fees.ts | Introduces estimateTotalFee utility used by the new hooks to compute total EIP-1559 fees. |
| src/utils/fees.test.ts | Adds unit tests validating fee estimation behavior and edge cases. |
| src/useEstimateFees.ts | Adds a hook that composes wagmi fee data with estimateTotalFee. |
| src/useEstimateApproveTokenFees.ts | Adds a hook to estimate ERC-20 approve gas and total fees. |
| package.json | Adds Vitest scripts/deps and bumps version for release. |
| README.md | Documents the two new hooks in the public API table. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gabmontes
reviewed
Feb 9, 2026
gabmontes
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds 2 extra hooks
useEstimateFees, which is based on the implementation from the portal. There are a few minor differences though: That hook used to default to0nwhen values were still loading or on error. Now, unless there's an exact estimation,undefinedis returned. I think that's the best behaviour, and loading and error states should be handled. The defaultoverEstimationis now1.5(instead of 1) as all usages in the portal were passing1.5. And now thefallbackPriorityFeeis a parameter for the consumer, instead of being hardcoded per chain (we only used it forhemiSepoliain the portal). Tests were added!Screenshots
Checklist