Fix premature error when approving CAP for staking#162
Open
rebel117 wants to merge 2 commits into
Open
Conversation
added 2 commits
May 15, 2026 22:04
Display the current liquidation price alongside the new calculated price when adding or removing margin, so users can see the impact of their margin adjustment at a glance.
- Add loading state to Approve button in StakeCAP modal - Prevent showing error when user hasn't yet confirmed in wallet - Handle wallet rejection (code 4001/ACTION_REJECTED) gracefully - Return false on rejection instead of showing error modal
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.
Problem
When a user clicks "Approve CAP" in the Stake modal, an error is displayed before the user has confirmed or rejected the approval in their wallet. This is confusing because the wallet confirmation dialog is still open.
Root Cause
approveAsset()function showed errors for wallet rejections (code 4001/ACTION_REJECTED) instead of silently handling themFix
isApprovingloading state to the StakeCAP modal — button shows spinner while waitingapproveAsset()— returns false silently instead of showing errorparseError()already handles "user denied"/"user rejected" strings, this adds the code-level check as a safety netTesting
Closes #32