Skip to content

Conversation

@gndelia
Copy link
Contributor

@gndelia gndelia commented Feb 9, 2026

Description

This PR adds 2 extra hooks

  • 892b508 Adds useEstimateFees, which is based on the implementation from the portal. There are a few minor differences though: That hook used to default to 0n when values were still loading or on error. Now, unless there's an exact estimation, undefined is returned. I think that's the best behaviour, and loading and error states should be handled. The default overEstimation is now 1.5 (instead of 1) as all usages in the portal were passing 1.5. And now the fallbackPriorityFee is a parameter for the consumer, instead of being hardcoded per chain (we only used it for hemiSepolia in the portal). Tests were added!
  • 1dc0a50 Adds the hook to estimate approve operation for erc20 tokens.
  • 99edfaa Bumps the version

Screenshots

Checklist

  • Manual testing passed.
  • Automated tests added, or N/A.
  • Documentation updated, or N/A.
  • Environment variables set in CI, or N/A.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 estimateTotalFee utility with a comprehensive Vitest suite.
  • Added useEstimateFees and useEstimateApproveErc20Fees hooks 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.

@gndelia gndelia requested a review from gabmontes February 9, 2026 14:58
@gndelia gndelia enabled auto-merge February 9, 2026 14:59
Copy link
Contributor

@ArturDolzan ArturDolzan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@gndelia gndelia merged commit 4766ae5 into master Feb 9, 2026
11 checks passed
@gndelia gndelia deleted the add-estimation-hooks branch February 9, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants