[LWDM] feat(LIVE-29443): add swap status wallet api#17456
Conversation
Web Tools Build Status
|
Rsdoctor Bundle Diff AnalysisFound 7 projects in monorepo, 7 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 desktop-mainPath:
📁 desktop-preloaderPath:
📁 desktop-rendererPath:
📁 desktop-webviewDappPreloaderPath:
📁 desktop-webviewPreloaderPath:
📁 desktop-workersPath:
📁 mobilePath:
Generated by Rsdoctor GitHub Action |
b2884e8 to
a2481a2
Compare
1c96d5e to
82e5a53
Compare
a2481a2 to
4f8953a
Compare
82e5a53 to
985f9da
Compare
4f8953a to
32305f4
Compare
985f9da to
55b448d
Compare
32305f4 to
37479da
Compare
55b448d to
658e5c1
Compare
37479da to
ee11db6
Compare
658e5c1 to
37455e8
Compare
ee11db6 to
368bde4
Compare
37455e8 to
2498456
Compare
368bde4 to
5210095
Compare
2498456 to
13411ab
Compare
7281e11 to
76f1854
Compare
76f1854 to
8404e7b
Compare
8404e7b to
c7a9028
Compare
c7a9028 to
049d467
Compare
049d467 to
dc5de56
Compare
| if (parsed.protocol !== "https:" && parsed.protocol !== "ledgerlive:") { | ||
| return undefined; | ||
| } | ||
| return trimmed; | ||
| } |
dc5de56 to
00176c9
Compare
| : undefined; | ||
| } | ||
|
|
||
| function getPositiveAmount(amount: string | undefined): string | undefined { |
There was a problem hiding this comment.
nit It would be more easy to me to do:
| function getPositiveAmount(amount: string | undefined): string | undefined { | |
| function isAmountGreaterThanZero(amount: string | undefined): boolean { | |
| try { | |
| return new BigNumber(amount).isGreaterThan(0); | |
| } finally { | |
| return false; | |
| } |
Because, getPositiveAmount seems like you extract the positive value
But matter of taste actually, what you did is good
| return new BigNumber(positiveFinalAmount).times(new BigNumber(10).pow(toMagnitude)).toFixed(); | ||
| } | ||
|
|
||
| function getTransactionStatusValue(status: string | undefined): TransactionStatusValue | undefined { |
There was a problem hiding this comment.
nit I dont know if TransactionStatus is a enum here, but I so, you can do
function isTransactionStatus(value: string): TransactionStatusValue | undefined {
return value in TransactionStatus ? value : undefined;
}
Plus you wont edit code with new TransactionStatus
There was a problem hiding this comment.
Extracted this check/helper function into a separate file ✅
775a6f2
00176c9 to
775a6f2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
libs/ledger-live-common/src/exchange/swap/index.ts:33
isSwapOperationPendingcurrently treatsexpiredas pending because onlyfinished/refundedare considered terminal. In this PR,exchange/transactionStatus/statusController.tstreatsTransactionStatus.Expiredas terminal, so leaving it pending here causes inconsistent terminal logic and can trigger unnecessary polling/updates for expired swaps.
// A swap operation is considered pending if it is not in a finishedOK or finishedKO state
export const isSwapOperationPending: (status: string) => boolean = status =>
!operationStatusList.finishedOK.includes(status) &&
!operationStatusList.finishedKO.includes(status);
775a6f2 to
0a78795
Compare
|
|
👋 Hi @philipptpunkt — heads up: this PR was merged with code formatting issues that weren't caught before merge. We recently enforced oxfmt (ledger-live) formatting across the repo, but the changes here landed unformatted — most likely because the local setup didn't run the formatter on commit (missing mise, or a hook that didn't fire). No action needed on this PR (the formatting will be/has been corrected separately), but please take a moment to verify your local setup so future PRs format automatically:
ℹ️ For full context and setup details, see this Slack message Thanks! 🙏 |




Jira: https://ledgerhq.atlassian.net/browse/LIVE-29443
Description:
Add Wallet API endpoint for Swap Transaction Status. This is groundwork for new Transaction Status screen/overlay for Swap.
Stack (managed by stac-man)