Skip to content

Harden unstake pending settlement and staking UI refresh - #1469

Merged
osyed merged 5 commits into
mainfrom
fix/1466-unstake-settlement
Aug 6, 2026
Merged

Harden unstake pending settlement and staking UI refresh#1469
osyed merged 5 commits into
mainfrom
fix/1466-unstake-settlement

Conversation

@dnlbui

@dnlbui dnlbui commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What Changed

This PR makes withdraw_stake settlement reliable across modal navigation and every receipt outcome while clearly separating pending-operation status from confirmed staking data.

  • ValidatorStakingModal derives pending UI and action state from myData.pending, revalidates controls after the submission cooldown, and blocks duplicate stake or unstake actions while confirmation is pending.
  • Accepted stake and unstake submissions show an accessible status banner directly below the modal header while the rest of the modal continues to display the latest confirmed network state.
  • Accepted unstake injection records provisional wallet history and shows Unstake submitted — pending confirmation without closing and reopening the modal.
  • Confirmed receipts clear pending state, update the provisional unstake amount from the receipt, refresh active balances, and show a final success toast.
  • Failed receipts clear pending state and provisional history, preserve the server-provided reason, and restore eligible controls.
  • An empty collector result after 30 seconds clears the timed-out unstake and provisional history, tells the user to retry, and stops further receipt polling.
  • Pending UI reconciliation now runs only after validator data loads successfully, so a load failure keeps incomplete details hidden.
  • Settlement refreshes the validator modal only when it is already open; background settlement never opens or navigates UI.

Fixed Flow

  1. The user confirms an unstake, and the existing cooldown disables stake, unstake, and back controls while signing and injection run.
  2. After injection is accepted, the transaction remains in global pending state and the modal shows a top-level submitted — pending confirmation banner.
  3. The latest confirmed stake information remains visible beneath the banner, and the user can close or leave the modal.
  4. Reopening the modal reads the same global pending state and blocks duplicate stake or unstake submission.
  5. Receipt polling settles the transaction as confirmed or failed, or treats an empty collector result after 30 seconds as a terminal timeout.
  6. Success updates provisional history; failure and timeout remove it. All terminal outcomes clear pending state and refresh active balances.
  7. An open modal refreshes in place, a closed modal stays closed, and a failed modal load preserves its error-only details state.

Why

Previously, accepted injection immediately closed and reopened the staking modal, which blurred submission versus confirmation and coupled settlement feedback to modal navigation. The pending indicator also lived inside Your Stake Info and could force the details container visible after a load error. Using global pending state as the source of truth and a separate top-level status banner keeps operation status, confirmed staking data, navigation, and error rendering independent.

Validation

  • node --check app.js
  • git diff --check

Closes #1466

@dnlbui
dnlbui marked this pull request as draft July 23, 2026 17:01
@dnlbui

dnlbui commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

close for now. Can rebase and use this branch when we want to pick up the issue again.

@dnlbui dnlbui closed this Aug 3, 2026
@dnlbui dnlbui reopened this Aug 6, 2026
dnlbui and others added 2 commits August 6, 2026 12:45
Keep unstake settlement independent of the staking modal, show pending
confirmation instead of premature success, and treat receipt timeouts as
unresolved rather than silent terminal outcomes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Eliminate the unstake.settlement.js file and its associated functions, streamlining the ValidatorStakingModal by directly handling pending transactions and UI updates. Adjusted the modal's state management to improve clarity and responsiveness during stake and unstake operations. This change enhances the user experience by simplifying the codebase and ensuring consistent handling of transaction states.
@dnlbui
dnlbui force-pushed the fix/1466-unstake-settlement branch from 3ef64be to 63e12bb Compare August 6, 2026 17:49
Simplify the display logic for pending transactions by consolidating the text assignment for stake and unstake operations. Update comments for clarity regarding the refresh of pending transactions. This change enhances code readability and maintains consistent user feedback during transaction processing.
@dnlbui

dnlbui commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1184880a53

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app.js Outdated
Reintroduce the logic to refresh pending transactions and update the UI after fetching validator details. This change ensures that the latest pending transactions are accurately reflected in the user interface, enhancing the responsiveness and clarity of the staking modal. The previous redundant code in the finally block has been removed for cleaner execution flow.
@dnlbui

dnlbui commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: dc86aaafb2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dnlbui
dnlbui marked this pull request as ready for review August 6, 2026 22:12
Update the ValidatorStakingModal to improve the display of pending transaction statuses. Change comments for clarity and modify the text content for stake and unstake confirmations. Introduce a new CSS class for pending status elements, ensuring a more user-friendly experience during transaction processing. This refactor streamlines the UI and enhances responsiveness.
@osyed
osyed merged commit c3c0f0c into main Aug 6, 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.

Harden unstake pending settlement and staking UI refresh

2 participants