Migrates to call useAllowance lib#1844
Closed
arielmergen wants to merge 2 commits intoreplace-hooks-allowancefrom
Closed
Migrates to call useAllowance lib#1844arielmergen wants to merge 2 commits intoreplace-hooks-allowancefrom
arielmergen wants to merge 2 commits intoreplace-hooks-allowancefrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Portal stake flow to use the shared @hemilabs/react-hooks useAllowance hook instead of the Portal-local implementation.
Changes:
- Switch
useAllowanceimport fromhooks/useAllowanceto@hemilabs/react-hooks/useAllowance. - Update the
useAllowancecall site to the new hook API shape (owner/spender/token + react-queryqueryoptions). - Add local typing (
AllowanceQuery) to constrain/shape thequeryoptions passed into the hook.
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
Migrates
stakeOperation.tsxto call@hemilabs/react-hooks/useAllowancedirectly, removing the dependency on the local wrapperhooks/useAllowance.Scope
This PR is intentionally limited to one file only:
portal/app/[locale]/stake/_components/manageStake/stakeOperation.tsxWhat changed
import { useAllowance } from 'hooks/useAllowance'with@hemilabs/react-hooks/useAllowance(lib direct call).query: { enabled: !operatesNativeToken }.AllowanceQuerytype defined locally to handle theenabledfield, which the lib omits from its query type signature but supports at runtime.UseQueryOptionsandAddressimported astypeonly — no runtime impact.What did not change
StakeOperationcomponent public API is unchanged.allowanceandisPendingfields preserve the same semantics for consumers.Architecture notes
AllowanceQueryis duplicated between this file andhooks/useAllowance.ts. This is intentional and temporary — the local wrapper will be removed in PR 4.4 once all callers are migrated.@tanstack/react-querywas already a project dependency.Validation
portalbuild and type-check passes.Related issue(s)
Related to #1843
Checklist