Skip to content

Improve unstake scene error handling#6098

Closed
j0ntz wants to merge 1 commit into
developfrom
jon/improve-unstake-error
Closed

Improve unstake scene error handling#6098
j0ntz wants to merge 1 commit into
developfrom
jon/improve-unstake-error

Conversation

@j0ntz

@j0ntz j0ntz commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Description

Asana: https://app.asana.com/1/9976422036640/project/1200382638405084/task/1211086099095860

Improves the unstake error experience on the StakeModify scene (repro: unstake an asset with no native balance to pay the network fee, e.g. LTC with no LTC).

Per the task and RJ's review note ("do not show the error alert at this scene since we already have an error field; fish out and properly display the error correctly if possible") and Michael's note ("give a message stating that the wallet needs balance to unstake"):

  • Removed the showError popup (the scary red alert) from the quote-fetch and approve error paths. The scene already has an on-scene error field (ErrorTile); it is now the single error surface.
  • Replaced the generic "Unknown error occurred" with the real error message, fished out via a small getDisplayErrorMessage helper (src/util/stakeErrorUtils.ts).
  • For an InsufficientFundsError during an unstake, the error field now shows a clear message ("This wallet needs a <currency> balance to cover the network fee for unstaking.") instead of a bare "Insufficient Funds".

Testing

  • tsc --noEmit, eslint, and the full jest suite pass (verify-repo.sh).
  • New unit test src/__tests__/stakeErrorUtils.test.ts (4 cases) covers the fish-out logic: real message passthrough, edge-core-js error subclasses, empty-message fallback, and non-Error fallback.
  • iOS sim (edge-funds): the organic trigger could not be driven because the staking-provider RPC is unreachable from this environment ("could not detect network / NETWORK_ERROR"), so no staking position loads. The new error rendering was hack-verified instead: a temporary uncommitted edit forced the real StakeModify scene to render the real ErrorTile with the new copy and no popup. See the attached 🩹 hack-forced screenshot. The hack was reverted (clean tree); the string-selection and no-popup logic are also covered by the unit test.

Replace the popup error alert and generic "unknown error occurred" on the
StakeModify scene with the real error surfaced in the existing on-scene error
field. When the failure is insufficient funds during an unstake, show a clear
message that the wallet needs a native-asset balance to cover the network fee.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@j0ntz

j0ntz commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

📸🩹 Test evidence (hack-forced)

🩹 Some screenshots below are HACK-FORCED. The marked frames show a state forced by a temporary uncommitted local edit (the natural trigger could not be reproduced on the sim). The hack is not in this PR's diff; the pixels prove the rendering, not the trigger.

🩹 HACK-FORCED: unstake insufficient funds

🩹 HACK-FORCED: unstake insufficient funds

Captured by the agent's in-app test run (build-and-test).

@j0ntz

j0ntz commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #6105, which consolidates this and 11 other small GUI task branches into one PR/branch per the umbrella task's instructions.

@j0ntz j0ntz closed this Jul 24, 2026
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.

1 participant