Skip to content

Create staking migration widget with Fuse approval flow, unified migration journey states, coverage, and demo app integration#43

Open
Copilot wants to merge 27 commits into
mainfrom
copilot/create-staking-migration-widget
Open

Create staking migration widget with Fuse approval flow, unified migration journey states, coverage, and demo app integration#43
Copilot wants to merge 27 commits into
mainfrom
copilot/create-staking-migration-widget

Conversation

Copilot AI commented May 28, 2026

Copy link
Copy Markdown

Implements the staking migration widget now that the issue is in executable [PLAN] state (draft removed), replacing the previous governance-only block.

What was added

  • New package: @goodwidget/staking-migration-widget
    • Standard widget package shape with index, element, and register exports
    • Runtime contract/types for host config, statuses, steps, events, and adapter actions
    • React widget UI and state-driven rendering
    • Feature-local components for summary, timeline, step row, and status notices
  • Adapter flow using provider-first architecture (GoodWidgetProvider + useWallet()):
    • Reads user Fuse sG$ staking balance
    • Validates required config (migrationApiBaseUrl, migrationOperator, optional token)
    • Validates network (Fuse / chain id 122)
    • Executes approval on Fuse before any migration API call
    • Submits approval tx hash to migration API and polls progress
    • Renders unstake → bridge sent → bridge received → stake with one active spinner
    • Preserves completed steps when later steps fail
    • Handles approval-failed and backend error with retry paths
  • UX refinement to unify state experience into a single migration journey card:
    • Keeps summary, progress timeline, and state messaging in one consistent card layout
    • Treats wrong-network, approval pending/failed, migrating, success, and error as stages of the same journey
    • Adds clearer visual hierarchy with status badges and explicit step state indicators (completed / in progress / failed), including approval as the first journey step
  • Follow-up UX refinements from PR feedback:
    • Implemented state-driven CTA progression:
      • Wrong network → Switch to Fuse
      • Ready → Approve and Migrate
      • Approval pending / migrating → disabled CTA
      • Success → Refresh balance
      • Error / approval-failed → Retry migration
    • Added wallet action wiring for Fuse network switching (wallet_switchEthereumChain) in adapter actions/runtime contract
    • Empty-balance state no longer shows an enabled migration CTA; it now avoids actionable migrate button until balance exists
    • Restored the summary card’s original visual emphasis (removed the “Migration Journey dominant” visual-weight adjustment) based on latest PR feedback
    • Added a persistent Current action block inside the migration journey so the active step/action remains visible without scrolling
    • Increased active step prominence in the stepper (highlighted active row + stronger active state marker)
    • Removed duplicated terminal success/error messaging outside the journey by surfacing outcome details directly in the timeline
  • Demo app integration:
    • Added @goodwidget/staking-migration-widget to examples/react-web dependencies
    • Rendered StakingMigrationWidget in examples/react-web/src/App.tsx (default demo view) alongside the existing claim widget showcase
  • Storybook coverage added under widget-specific folder:
    • examples/storybook/src/stories/staking-migration-widget/StakingMigrationWidget.stories.tsx
    • States: empty balance, wrong-network, approval-pending, migrating, success, error
  • Playwright widget smoke coverage added:
    • tests/widgets/staking-migration-widget/states.spec.ts
    • Includes CTA/state assertions for empty balance, wrong network, approval pending, success, and error
    • Updated terminal-state assertions to match guided flow labels and timeline-driven outcome messaging
  • Storybook workspace wiring updated to include the new widget package dependency.

Domain/source alignment

  • Fuse staking contract source is aligned to GoodProtocol deployment mapping (production.FuseStaking), with Fuse/Celo migration context implemented in the widget’s adapter and state machine behavior.

Validation performed

  • pnpm --filter @goodwidget/staking-migration-widget run lint
  • pnpm --filter @goodwidget/staking-migration-widget run build
  • pnpm --filter @goodwidget/storybook run build-storybook
  • pnpm --filter @goodwidget/example-react-web run lint ✅ (with existing warning)
  • pnpm --filter @goodwidget/example-react-web run build
  • pnpm run build
  • pnpm exec playwright test tests/widgets/staking-migration-widget/states.spec.ts --list

Note: full Playwright execution in this environment is currently blocked by missing Chromium headless-shell binary installation (playwright install hangs), so screenshot-producing runs could not complete here.

Copilot AI linked an issue May 28, 2026 that may be closed by this pull request
26 tasks
Copilot AI changed the title [WIP] Create staking migration widget Block implementation for draft issue and request execution clarification May 28, 2026
Copilot AI requested a review from blueogin May 28, 2026 17:19
@blueogin

Copy link
Copy Markdown

@copilot I removed [DRAFT] from issue
please make code changes

Copilot AI commented May 28, 2026

Copy link
Copy Markdown
Author

@copilot I removed [DRAFT] from issue
please make code changes

Implemented in commit 25ae9bc.

This adds the new @goodwidget/staking-migration-widget package (adapter + widget + element/register/index), Storybook state stories under examples/storybook/src/stories/staking-migration-widget/, and Playwright smoke coverage under tests/widgets/staking-migration-widget/states.spec.ts.

Copilot AI changed the title Block implementation for draft issue and request execution clarification Create staking migration widget with Fuse approval flow, migration progress states, and coverage May 28, 2026

@blueogin blueogin 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.

  • The migration flow covers the main states (wrong network, approval pending, migrating, success, and failed), which is good.
  • However, the overall experience feels fragmented. Each state appears as a separate card rather than different stages of a single migration journey.
  • The "Wrong Network" card feels isolated from the migration flow. It looks more like a standalone alert than the first step of the migration process.
  • The "Migration Complete" and "Migration Failed" states also feel disconnected. They appear as separate notifications rather than a natural continuation of the migration progress state.
  • I would expect the migration card to evolve through the different states (wrong network → approval pending → migrating → success/failure) while keeping a consistent layout and context.
  • The migration progress screen is the strongest part of the design because it clearly shows what is happening. I would make that progress view the primary focus and have all other states build on top of it.
  • The UI is also quite text-heavy. Users should be able to understand the current status immediately through stronger visual indicators, progress states, and clearer hierarchy.

@blueogin

Copy link
Copy Markdown

@copilot The migration flow covers the main states (wrong network, approval pending, migrating, success, and failed), which is good.
However, the overall experience feels fragmented. Each state appears as a separate card rather than different stages of a single migration journey.
The "Wrong Network" card feels isolated from the migration flow. It looks more like a standalone alert than the first step of the migration process.
The "Migration Complete" and "Migration Failed" states also feel disconnected. They appear as separate notifications rather than a natural continuation of the migration progress state.
I would expect the migration card to evolve through the different states (wrong network → approval pending → migrating → success/failure) while keeping a consistent layout and context.
The migration progress screen is the strongest part of the design because it clearly shows what is happening. I would make that progress view the primary focus and have all other states build on top of it.
The UI is also quite text-heavy. Users should be able to understand the current status immediately through stronger visual indicators, progress states, and clearer hierarchy.

Copilot AI commented May 29, 2026

Copy link
Copy Markdown
Author

@copilot The migration flow covers the main states (wrong network, approval pending, migrating, success, and failed), which is good.
However, the overall experience feels fragmented. Each state appear...

Addressed in commit ce66e76.

The widget now stays as a single evolving migration journey card across wrong-network, approval-pending/failed, migrating, success, and failure. I moved summary + progress + state feedback into one consistent layout, added stronger status/progress indicators (badge + step states), and kept recovery actions inline with the same journey context.

Copilot AI changed the title Create staking migration widget with Fuse approval flow, migration progress states, and coverage Create staking migration widget with Fuse approval flow, unified migration journey states, and coverage May 29, 2026
@blueogin

Copy link
Copy Markdown

@copilot The top card ("Migrate Fuse staking to Celo savings") becomes somewhat redundant once migration starts.
During Approval Pending, Migrating, Success, and Error states, I'd consider reducing its visual weight.
The Migration Journey section should become the dominant element since it contains the most important information for the user.
The CTA button should evolve with the current state:
Wrong Network → "Switch to Fuse"
Ready → "Approve and Migrate"
Approval Pending → Disabled / Loading
Migrating → Disabled
Success → "Refresh Balance" or "View Savings"
Error → "Retry Migration"
In the Success and Error states, the colored status section feels slightly duplicated.
The Migration Journey already communicates the outcome.
Consider merging the sections or making the bottom status area more compact.
For the Empty Balance state:
I wouldn't show an enabled-looking "Approve and Migrate" button.
The button should either be hidden or clearly disabled with an explanation.

@blueogin blueogin requested a review from a team June 1, 2026 20:18
blueogin added 14 commits June 1, 2026 16:54
…d and update action handling in StakingMigrationWidget

@sirpy sirpy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove unrequired commits

@blueogin

blueogin commented Jun 10, 2026

Copy link
Copy Markdown

I removed the unnecessary parts.
It now uses VITE_MIGRATION_API_BASE_URL as the base URL for the migration API, and I removed the authentication token.

@blueogin blueogin requested a review from sirpy June 10, 2026 19:37
@L03TJ3

L03TJ3 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@copilot can you make sure the test run and the expected screenshots are produced and commited

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Author

@copilot can you make sure the test run and the expected screenshots are produced and commited

Done in 9c09ff6.

I reran pnpm exec playwright test tests/widgets/staking-migration-widget/states.spec.ts, committed the 7 generated screenshots under tests/widgets/staking-migration-widget/test-results/, and tightened two exact-text assertions in the spec so it passes against the current UI.

pnpm test:storybook still reports the existing unrelated Primitives/Drawer story failure.

Copilot AI requested a review from L03TJ3 June 11, 2026 06:41
@github-project-automation github-project-automation Bot moved this to In Progress in GoodBounties Jun 12, 2026
@L03TJ3 L03TJ3 moved this from In Progress to Blocked in GoodBounties Jun 12, 2026
@L03TJ3 L03TJ3 moved this from Blocked to In Review in GoodBounties Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

[PLAN] Create staking migration widget

4 participants