Skip to content

Replace useAllowance with lib#1843

Merged
arielmergen merged 11 commits intomainfrom
replace-hooks-allowance
Mar 27, 2026
Merged

Replace useAllowance with lib#1843
arielmergen merged 11 commits intomainfrom
replace-hooks-allowance

Conversation

@arielmergen
Copy link
Copy Markdown
Contributor

@arielmergen arielmergen commented Mar 23, 2026

Description

This PR focuses on useAllowance.
useNeedsApproval now wraps the library implementation to avoid Knip unused hook errors after removing the local hook.
The signature change will be handled in a separate PR.

Screenshots

Related issue(s)

Closes #
Fixes #
Related to #1807

Checklist

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

@arielmergen arielmergen self-assigned this Mar 23, 2026
Copilot AI review requested due to automatic review settings March 23, 2026 17:31
Copy link
Copy Markdown

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

This PR migrates the portal’s useAllowance hook implementation to delegate to the shared @hemilabs/react-hooks/useAllowance hook, while keeping the existing wrapper signature and still exposing a queryKey for cache invalidation.

Changes:

  • Replaced wagmi useReadContract usage with useAllowance from @hemilabs/react-hooks.
  • Preserved the existing enabled guard logic for valid ERC-20 (non-native) addresses and defined owner/spender.
  • Re-exposed queryKey via the shared lib’s allowanceQueryKey.

Comment thread portal/hooks/useAllowance.ts Outdated
Comment thread portal/hooks/useAllowance.ts Outdated
Comment thread portal/hooks/useAllowance.ts Outdated
Copy link
Copy Markdown

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread portal/hooks/useAllowance.ts Outdated
Comment thread portal/hooks/useAllowance.ts Outdated
Copy link
Copy Markdown

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread portal/hooks/useAllowance.ts Outdated
Copy link
Copy Markdown

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@arielmergen arielmergen requested a review from ArturDolzan March 23, 2026 19:56
Comment thread portal/hooks/useAllowance.ts Outdated
Copy link
Copy Markdown

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread portal/hooks/useNeedsApproval.ts
Comment thread portal/app/[locale]/stake/_components/manageStake/stakeOperation.tsx Outdated
Copy link
Copy Markdown

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread portal/app/[locale]/stake/_components/manageStake/stakeOperation.tsx Outdated
Comment thread portal/hooks/useNeedsApproval.ts Outdated
Copy link
Copy Markdown

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown

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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread portal/app/[locale]/stake/_components/manageStake/stakeOperation.tsx Outdated
Comment thread portal/utils/allowanceQueryKey.ts
Comment thread portal/hooks/useNeedsApproval.ts Outdated
Comment thread portal/app/[locale]/stake/_components/manageStake/stakeOperation.tsx Outdated
Comment thread portal/app/[locale]/stake/_components/manageStake/stakeOperation.tsx Outdated
Copy link
Copy Markdown

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@arielmergen arielmergen requested a review from gndelia March 26, 2026 16:10
Comment thread portal/utils/allowanceQueryKey.ts
@arielmergen arielmergen requested a review from gabmontes March 27, 2026 02:22
@arielmergen arielmergen merged commit 63756d8 into main Mar 27, 2026
11 checks passed
@arielmergen arielmergen deleted the replace-hooks-allowance branch March 27, 2026 14:44
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.

4 participants