Skip to content

[LWDM] refactor(LIVE-29443): extract swap transaction status common logic#18862

Merged
philipptpunkt merged 1 commit into
developfrom
feat/LIVE-29443-swap-status-common
Jun 24, 2026
Merged

[LWDM] refactor(LIVE-29443): extract swap transaction status common logic#18862
philipptpunkt merged 1 commit into
developfrom
feat/LIVE-29443-swap-status-common

Conversation

@philipptpunkt

@philipptpunkt philipptpunkt commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Jira: https://ledgerhq.atlassian.net/browse/LIVE-29443

Summary

  • Extract shared swap transaction status modules into @ledgerhq/live-common/exchange/swapTransactionStatus.
  • Add shared controller/display helpers and tests used by Desktop and Mobile.
  • Preserve old exchange/transactionStatus/* package import paths through explicit aliases.
  • Keep Wallet API transaction status imports on non-React modules.

Review Scope

  • Primary: @ledgerhq/ptx for libs/ledger-live-common/src/exchange.
  • Additional: @ledgerhq/coin-integration for libs/ledger-live-common/src/wallet-api import changes.

Validation

  • @ledgerhq/live-common swap status Jest tests passed.
  • pnpm --filter @ledgerhq/live-common unimported passed.
  • pnpm --filter @ledgerhq/live-common typecheck passed.
  • pnpm build:llc passed.

Stack (managed by stac-man)

@philipptpunkt philipptpunkt requested a review from a team as a code owner June 23, 2026 08:18
Copilot AI review requested due to automatic review settings June 23, 2026 08:18
@philipptpunkt philipptpunkt requested a review from a team as a code owner June 23, 2026 08:18
@live-github-bot live-github-bot Bot added the common Has changes in live-common label Jun 23, 2026
@live-github-bot live-github-bot Bot changed the title refactor(LIVE-29443): extract swap transaction status common logic [LWDM] refactor(LIVE-29443): extract swap transaction status common logic Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ E2E tests are required

Changes detected require e2e testing before merge (even before asking for any review).

🖥️ Desktop

-> Run Desktop E2E

  • Select "Run workflow"
  • Branch: feat/LIVE-29443-swap-status-common
  • Device: nanoSP or stax

📱 Mobile

-> Run Mobile E2E

  • Select "Run workflow"
  • Branch: feat/LIVE-29443-swap-status-common
  • Device: nanoX

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Web Tools Build Status

Build Status Deployment
Web Tools Build ✅ Deployed https://web-tools-pm92b9mwg-ledger-hq-prd.vercel.app
Native Storybook Build ⏭️ Skipped
React Storybook Build ⏭️ Skipped

Copilot AI 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.

Pull request overview

This PR refactors swap transaction status logic in @ledgerhq/live-common by extracting the former exchange/transactionStatus implementation into a new exchange/swapTransactionStatus module, while keeping the legacy public import paths working via package.json export mappings.

Changes:

  • Move/centralize swap transaction status primitives (API fetch, params parsing, controller logic, types) under exchange/swapTransactionStatus.
  • Add shared hook + display view-model helpers (and tests) to support desktop/mobile UI parity work in the stacked PRs.
  • Preserve existing exchange/transactionStatus/* consumer import paths via typesVersions + exports remapping.

Reviewed changes

Copilot reviewed 19 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libs/ledger-live-common/src/wallet-api/Exchange/transactionStatus/getTransactionStatus.ts Update internal imports to use the new swapTransactionStatus module.
libs/ledger-live-common/src/wallet-api/Exchange/transactionStatus/getTransactionStatus.test.ts Update mocks/imports for the moved fetch implementation.
libs/ledger-live-common/src/exchange/transactionStatus/index.ts Remove legacy barrel (now replaced by export remapping).
libs/ledger-live-common/src/exchange/swapTransactionStatus/types.ts Add shared param parsing/result types for swap status deeplinks.
libs/ledger-live-common/src/exchange/swapTransactionStatus/transactionStatus.ts New barrel to re-export swap transaction status building blocks.
libs/ledger-live-common/src/exchange/swapTransactionStatus/status/statusValues.ts Add canonical isTransactionStatusValue helper sourced from wallet-api enum.
libs/ledger-live-common/src/exchange/swapTransactionStatus/status/statusController.ts Shared controller state machine + leg status resolution logic.
libs/ledger-live-common/src/exchange/swapTransactionStatus/status/statusController.test.ts Adjust imports / validate controller behavior.
libs/ledger-live-common/src/exchange/swapTransactionStatus/params/parseParams.ts Parse + sanitize deeplink params (swapId/provider/redirectUrl).
libs/ledger-live-common/src/exchange/swapTransactionStatus/params/parseParams.test.ts Add unit tests for redirect sanitization + parsing behavior.
libs/ledger-live-common/src/exchange/swapTransactionStatus/index.ts Public-ish module entry exporting transactionStatus/display/hook.
libs/ledger-live-common/src/exchange/swapTransactionStatus/hooks/useSwapTransactionStatusController.ts New shared hook to poll status + sync accounts and emit view-model.
libs/ledger-live-common/src/exchange/swapTransactionStatus/hooks/useSwapTransactionStatusController.test.tsx Add tests covering polling retry/stop, auto-redirect, leg status updates.
libs/ledger-live-common/src/exchange/swapTransactionStatus/history/fromSwapOperation.ts Move/retarget history-to-params mapping to new module.
libs/ledger-live-common/src/exchange/swapTransactionStatus/history/fromSwapOperation.test.ts Update imports for moved history mapping.
libs/ledger-live-common/src/exchange/swapTransactionStatus/display/index.ts New shared display helpers + useSwapTransactionStatusDisplayViewModel.
libs/ledger-live-common/src/exchange/swapTransactionStatus/display/display.test.ts Add unit tests for display formatting + explorer URL resolution.
libs/ledger-live-common/src/exchange/swapTransactionStatus/api/fetchSwapStatus.ts Move fetch wrapper to new module path.
libs/ledger-live-common/src/exchange/swapTransactionStatus/api/fetchSwapStatus.test.ts Update mocks/imports for moved fetch wrapper.
libs/ledger-live-common/package.json Add exports + typesVersions remaps to preserve legacy exchange/transactionStatus/* paths.
libs/ledger-live-common/.unimportedrc.json Update unimported ignores + normalize some JSON formatting.
.changeset/mobile-swap-status-parity.md Changeset for the extracted shared swap status logic.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 7 projects in monorepo, 7 projects with changes.

📊 Quick Summary
Project Total Size Change
desktop-main 2.6 MB -
desktop-preloader 7.1 KB -
desktop-renderer 81.2 MB -
desktop-webviewDappPreloader 36.9 KB -
desktop-webviewPreloader 200.0 B -
desktop-workers 36.8 KB -
mobile 258.7 MB -
📋 Detailed Reports (Click to expand)

📁 desktop-main

Path: rsdoctor/desktop-main/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.6 MB - -
📄 JavaScript 2.4 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 135.3 KB - -

📁 desktop-preloader

Path: rsdoctor/desktop-preloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 7.1 KB - -
📄 JavaScript 5.3 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 1.8 KB - -

📁 desktop-renderer

Path: rsdoctor/desktop-renderer/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 81.2 MB - -
📄 JavaScript 28.9 MB - -
🎨 CSS 172.6 KB - -
🌐 HTML 1.8 KB - -
📁 Other Assets 52.2 MB - -

📁 desktop-webviewDappPreloader

Path: rsdoctor/desktop-webviewDappPreloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 36.9 KB - -
📄 JavaScript 36.9 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 desktop-webviewPreloader

Path: rsdoctor/desktop-webviewPreloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 200.0 B - -
📄 JavaScript 200.0 B - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 desktop-workers

Path: rsdoctor/desktop-workers/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 36.8 KB - -
📄 JavaScript 36.8 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 mobile

Path: rsdoctor/mobile/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 258.7 MB - -
📄 JavaScript 108.7 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 150.0 MB - -

Generated by Rsdoctor GitHub Action

@philipptpunkt philipptpunkt force-pushed the feat/LIVE-29443-swap-status-common branch from 877a492 to 05b0e6d Compare June 23, 2026 13:21
Justkant
Justkant previously approved these changes Jun 23, 2026

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

LGTM but would be good to cleanup the test file from the react 19 globalThis hack if possible

Copilot AI review requested due to automatic review settings June 23, 2026 16:13
@philipptpunkt philipptpunkt force-pushed the feat/LIVE-29443-swap-status-common branch from 05b0e6d to 5f88a15 Compare June 23, 2026 16:13

Copilot AI 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.

Pull request overview

Copilot reviewed 21 out of 24 changed files in this pull request and generated 3 comments.

Comment thread libs/ledger-live-common/package.json
Comment thread libs/ledger-live-common/package.json
@philipptpunkt philipptpunkt force-pushed the feat/LIVE-29443-swap-status-common branch from 5f88a15 to 8ecbdde Compare June 23, 2026 17:02
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
22.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@philipptpunkt philipptpunkt merged commit aafc996 into develop Jun 24, 2026
143 of 146 checks passed
@philipptpunkt philipptpunkt deleted the feat/LIVE-29443-swap-status-common branch June 24, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Has changes in live-common

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants