Skip to content

Commit

Permalink
Fix/live 14403 (#8040)
Browse files Browse the repository at this point in the history
* feat(LIVE-14367): Add operation id for thorswap history

* feat(LIVE-14367): changeset

* fix(LIVE-14403): Fix crash demo 0

* fix(LIVE-14403): changeset
  • Loading branch information
lpaquet-ledger authored Oct 8, 2024
1 parent 0a16ae4 commit b0d535b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-sheep-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/live-common": patch
---

Add operationID for thorswap history
5 changes: 5 additions & 0 deletions .changeset/popular-flies-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/live-common": patch
---

fix crash demo 0
1 change: 1 addition & 0 deletions libs/ledger-live-common/src/exchange/swap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ type ValidSwapStatus = "pending" | "onhold" | "expired" | "finished" | "refunded
export type SwapStatusRequest = {
provider: string;
swapId: string;
operationId?: string;
};
export type SwapStatus = {
provider: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ const maybeGetUpdatedSwapHistory = async (
const pendingSwapIds: SwapStatusRequest[] = [];
let accountNeedsUpdating = false;
let consolidatedSwapHistory: SwapOperation[] = [];

if (swapHistory) {
for (const { provider, swapId, status } of swapHistory) {
for (const { provider, swapId, status, operationId } of swapHistory) {
if (isSwapOperationPending(status)) {
pendingSwapIds.push({
provider,
swapId,
...(provider === "thorswap" && { operationId }),
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ledger-live-common/src/exchange/swap/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const isRegistrationRequired = async (provider: string): Promise<boolean>
};

export const getProviderName = (provider: string): string => {
const { displayName } = SWAP_DATA_CDN[provider];
const { displayName } = provider ? SWAP_DATA_CDN[provider] : { displayName: "" };
return displayName;
};

Expand Down

0 comments on commit b0d535b

Please sign in to comment.