@ledgerhq/live-common 34.37.0-nightly.2 → 34.37.0-nightly.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/lib/e2e/index.d.ts +2 -0
  2. package/lib/e2e/index.d.ts.map +1 -1
  3. package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
  4. package/lib/exchange/swap/completeExchange.js +0 -7
  5. package/lib/exchange/swap/completeExchange.js.map +1 -1
  6. package/lib/families/evm/config.js +2 -2
  7. package/lib/families/evm/config.js.map +1 -1
  8. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  9. package/lib/featureFlags/defaultFeatures.js +6 -0
  10. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  11. package/lib/featureFlags/useFeature.d.ts +1 -1
  12. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  13. package/lib/hooks/useShowProviderLoadingTransition.d.ts +9 -0
  14. package/lib/hooks/useShowProviderLoadingTransition.d.ts.map +1 -0
  15. package/lib/hooks/useShowProviderLoadingTransition.js +46 -0
  16. package/lib/hooks/useShowProviderLoadingTransition.js.map +1 -0
  17. package/lib/hooks/useShowProviderLoadingTransition.test.d.ts +5 -0
  18. package/lib/hooks/useShowProviderLoadingTransition.test.d.ts.map +1 -0
  19. package/lib/hooks/useShowProviderLoadingTransition.test.js +83 -0
  20. package/lib/hooks/useShowProviderLoadingTransition.test.js.map +1 -0
  21. package/lib/wallet-api/Exchange/server.d.ts +2 -0
  22. package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
  23. package/lib/wallet-api/Exchange/server.js +6 -0
  24. package/lib/wallet-api/Exchange/server.js.map +1 -1
  25. package/lib-es/e2e/index.d.ts +2 -0
  26. package/lib-es/e2e/index.d.ts.map +1 -1
  27. package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
  28. package/lib-es/exchange/swap/completeExchange.js +0 -7
  29. package/lib-es/exchange/swap/completeExchange.js.map +1 -1
  30. package/lib-es/families/evm/config.js +2 -2
  31. package/lib-es/families/evm/config.js.map +1 -1
  32. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  33. package/lib-es/featureFlags/defaultFeatures.js +6 -0
  34. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  35. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  36. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  37. package/lib-es/hooks/useShowProviderLoadingTransition.d.ts +9 -0
  38. package/lib-es/hooks/useShowProviderLoadingTransition.d.ts.map +1 -0
  39. package/lib-es/hooks/useShowProviderLoadingTransition.js +41 -0
  40. package/lib-es/hooks/useShowProviderLoadingTransition.js.map +1 -0
  41. package/lib-es/hooks/useShowProviderLoadingTransition.test.d.ts +5 -0
  42. package/lib-es/hooks/useShowProviderLoadingTransition.test.d.ts.map +1 -0
  43. package/lib-es/hooks/useShowProviderLoadingTransition.test.js +81 -0
  44. package/lib-es/hooks/useShowProviderLoadingTransition.test.js.map +1 -0
  45. package/lib-es/wallet-api/Exchange/server.d.ts +2 -0
  46. package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
  47. package/lib-es/wallet-api/Exchange/server.js +6 -0
  48. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  49. package/package.json +62 -62
  50. package/src/exchange/swap/completeExchange.ts +0 -15
  51. package/src/families/evm/config.ts +2 -2
  52. package/src/featureFlags/defaultFeatures.ts +7 -0
  53. package/src/hooks/useShowProviderLoadingTransition.test.ts +112 -0
  54. package/src/hooks/useShowProviderLoadingTransition.ts +57 -0
  55. package/src/wallet-api/Exchange/server.ts +8 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ledgerhq/live-common",
3
3
  "description": "Common ground for the Ledger Live apps",
4
- "version": "34.37.0-nightly.2",
4
+ "version": "34.37.0-nightly.4",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/LedgerHQ/ledger-live.git"
@@ -162,72 +162,72 @@
162
162
  "xstate": "^5.19.2",
163
163
  "yargs": "^17.0.0",
164
164
  "zod": "^3.22.4",
165
- "@ledgerhq/coin-algorand": "^0.9.9-nightly.1",
166
- "@ledgerhq/coin-aptos": "^2.2.0-nightly.1",
167
- "@ledgerhq/coin-bitcoin": "^0.15.9-nightly.1",
168
- "@ledgerhq/coin-cardano": "^0.8.9-nightly.1",
169
- "@ledgerhq/coin-casper": "^1.7.4-nightly.1",
170
- "@ledgerhq/coin-celo": "^1.1.7-nightly.1",
171
- "@ledgerhq/coin-cosmos": "^0.15.1-nightly.1",
172
- "@ledgerhq/coin-evm": "^2.22.3-nightly.1",
173
- "@ledgerhq/coin-filecoin": "^1.9.9-nightly.1",
174
- "@ledgerhq/coin-framework": "^5.3.0-nightly.1",
175
- "@ledgerhq/coin-hedera": "^1.7.1-nightly.1",
176
- "@ledgerhq/coin-icon": "^0.10.9-nightly.1",
177
- "@ledgerhq/coin-internet_computer": "^1.7.9-nightly.1",
178
- "@ledgerhq/coin-mina": "^1.1.8-nightly.1",
179
- "@ledgerhq/coin-multiversx": "^0.4.9-nightly.1",
180
- "@ledgerhq/coin-near": "^0.11.9-nightly.1",
181
- "@ledgerhq/coin-polkadot": "^6.1.3-nightly.1",
182
- "@ledgerhq/coin-solana": "^0.25.1-nightly.1",
183
- "@ledgerhq/coin-stacks": "^0.8.9-nightly.1",
184
- "@ledgerhq/coin-stellar": "^5.1.2-nightly.1",
185
- "@ledgerhq/coin-sui": "^0.4.2-nightly.1",
186
- "@ledgerhq/coin-tezos": "^5.2.2-nightly.1",
187
- "@ledgerhq/coin-ton": "^0.12.1-nightly.1",
188
- "@ledgerhq/coin-tron": "^4.2.0-nightly.2",
189
- "@ledgerhq/coin-vechain": "^2.7.9-nightly.1",
190
- "@ledgerhq/coin-xrp": "^6.1.4-nightly.1",
165
+ "@ledgerhq/coin-algorand": "^0.9.9-nightly.3",
166
+ "@ledgerhq/coin-aptos": "^2.2.0-nightly.3",
167
+ "@ledgerhq/coin-bitcoin": "^0.15.9-nightly.3",
168
+ "@ledgerhq/coin-cardano": "^0.8.9-nightly.3",
169
+ "@ledgerhq/coin-casper": "^1.7.4-nightly.3",
170
+ "@ledgerhq/coin-celo": "^1.1.7-nightly.3",
171
+ "@ledgerhq/coin-cosmos": "^0.15.1-nightly.3",
172
+ "@ledgerhq/coin-evm": "^2.22.3-nightly.3",
173
+ "@ledgerhq/coin-filecoin": "^1.9.9-nightly.3",
174
+ "@ledgerhq/coin-framework": "^5.3.0-nightly.3",
175
+ "@ledgerhq/coin-hedera": "^1.7.1-nightly.3",
176
+ "@ledgerhq/coin-icon": "^0.10.9-nightly.3",
177
+ "@ledgerhq/coin-internet_computer": "^1.7.9-nightly.3",
178
+ "@ledgerhq/coin-mina": "^1.1.8-nightly.3",
179
+ "@ledgerhq/coin-multiversx": "^0.4.9-nightly.3",
180
+ "@ledgerhq/coin-near": "^0.11.9-nightly.3",
181
+ "@ledgerhq/coin-polkadot": "^6.1.3-nightly.3",
182
+ "@ledgerhq/coin-solana": "^0.26.0-nightly.3",
183
+ "@ledgerhq/coin-stacks": "^0.8.9-nightly.3",
184
+ "@ledgerhq/coin-stellar": "^5.1.2-nightly.3",
185
+ "@ledgerhq/coin-sui": "^0.4.2-nightly.3",
186
+ "@ledgerhq/coin-tezos": "^5.2.2-nightly.3",
187
+ "@ledgerhq/coin-ton": "^0.12.1-nightly.3",
188
+ "@ledgerhq/coin-tron": "^4.2.0-nightly.4",
189
+ "@ledgerhq/coin-vechain": "^2.7.9-nightly.3",
190
+ "@ledgerhq/coin-xrp": "^6.1.4-nightly.3",
191
191
  "@ledgerhq/crypto-icons-ui": "^1.15.0-nightly.0",
192
- "@ledgerhq/cryptoassets": "^13.18.1-nightly.0",
193
- "@ledgerhq/device-core": "^0.4.27-nightly.1",
194
- "@ledgerhq/devices": "8.4.6",
195
- "@ledgerhq/errors": "^6.21.0",
196
- "@ledgerhq/hw-app-algorand": "^6.31.2",
197
- "@ledgerhq/hw-app-aptos": "^6.34.2",
198
- "@ledgerhq/hw-app-btc": "^10.9.2",
199
- "@ledgerhq/hw-app-celo": "^6.33.5-nightly.1",
200
- "@ledgerhq/hw-app-cosmos": "^6.32.2",
201
- "@ledgerhq/hw-app-eth": "^6.45.7-nightly.1",
202
- "@ledgerhq/hw-app-exchange": "^0.10.2",
203
- "@ledgerhq/hw-app-hedera": "^1.2.2",
204
- "@ledgerhq/hw-app-icon": "^1.3.2",
205
- "@ledgerhq/hw-app-multiversx": "^6.24.2",
206
- "@ledgerhq/hw-app-near": "^6.31.2",
207
- "@ledgerhq/hw-app-polkadot": "^6.34.2",
208
- "@ledgerhq/hw-app-str": "^7.2.2",
192
+ "@ledgerhq/cryptoassets": "^13.19.0-nightly.1",
193
+ "@ledgerhq/device-core": "^0.4.27-nightly.3",
194
+ "@ledgerhq/devices": "8.4.7-nightly.0",
195
+ "@ledgerhq/errors": "^6.22.0-nightly.0",
196
+ "@ledgerhq/hw-app-algorand": "^6.31.3-nightly.0",
197
+ "@ledgerhq/hw-app-aptos": "^6.34.3-nightly.0",
198
+ "@ledgerhq/hw-app-btc": "^10.9.3-nightly.0",
199
+ "@ledgerhq/hw-app-celo": "^6.33.5-nightly.3",
200
+ "@ledgerhq/hw-app-cosmos": "^6.32.3-nightly.0",
201
+ "@ledgerhq/hw-app-eth": "^6.45.7-nightly.3",
202
+ "@ledgerhq/hw-app-exchange": "^0.10.3-nightly.0",
203
+ "@ledgerhq/hw-app-hedera": "^1.2.3-nightly.0",
204
+ "@ledgerhq/hw-app-icon": "^1.3.3-nightly.0",
205
+ "@ledgerhq/hw-app-multiversx": "^6.24.3-nightly.0",
206
+ "@ledgerhq/hw-app-near": "^6.31.3-nightly.0",
207
+ "@ledgerhq/hw-app-polkadot": "^6.34.3-nightly.0",
208
+ "@ledgerhq/hw-app-str": "^7.2.3-nightly.0",
209
209
  "@ledgerhq/hw-app-sui": "^1.1.0",
210
- "@ledgerhq/hw-app-tezos": "^6.31.2",
211
- "@ledgerhq/hw-app-trx": "^6.31.2",
212
- "@ledgerhq/hw-app-vet": "^0.5.5",
213
- "@ledgerhq/hw-app-xrp": "^6.31.2",
214
- "@ledgerhq/hw-transport": "^6.31.6",
215
- "@ledgerhq/hw-transport-mocker": "^6.29.6",
216
- "@ledgerhq/ledger-cal-service": "^0.6.0-nightly.0",
210
+ "@ledgerhq/hw-app-tezos": "^6.31.3-nightly.0",
211
+ "@ledgerhq/hw-app-trx": "^6.31.3-nightly.0",
212
+ "@ledgerhq/hw-app-vet": "^0.5.6-nightly.1",
213
+ "@ledgerhq/hw-app-xrp": "^6.31.3-nightly.0",
214
+ "@ledgerhq/hw-transport": "^6.31.7-nightly.0",
215
+ "@ledgerhq/hw-transport-mocker": "^6.29.7-nightly.0",
216
+ "@ledgerhq/ledger-cal-service": "^1.0.0-nightly.2",
217
217
  "@ledgerhq/live-config": "^3.1.0",
218
- "@ledgerhq/live-countervalues": "^0.5.9-nightly.1",
219
- "@ledgerhq/live-dmk-shared": "^0.9.0",
220
- "@ledgerhq/live-countervalues-react": "^0.2.38-nightly.1",
218
+ "@ledgerhq/live-countervalues": "^0.5.9-nightly.3",
219
+ "@ledgerhq/live-dmk-shared": "^0.9.1-nightly.0",
220
+ "@ledgerhq/live-countervalues-react": "^0.2.38-nightly.3",
221
221
  "@ledgerhq/live-env": "^2.9.1-nightly.0",
222
222
  "@ledgerhq/live-hooks": "0.1.0",
223
- "@ledgerhq/live-network": "^2.0.9",
224
- "@ledgerhq/live-nft": "^0.8.9-nightly.1",
223
+ "@ledgerhq/live-network": "^2.0.10-nightly.0",
224
+ "@ledgerhq/live-nft": "^0.8.9-nightly.3",
225
225
  "@ledgerhq/live-promise": "^0.1.1",
226
- "@ledgerhq/live-signer-evm": "^0.5.2-nightly.1",
227
- "@ledgerhq/live-signer-solana": "^0.2.1-nightly.1",
228
- "@ledgerhq/live-wallet": "^0.10.12-nightly.1",
226
+ "@ledgerhq/live-signer-evm": "^0.5.2-nightly.3",
227
+ "@ledgerhq/live-signer-solana": "^0.3.0-nightly.3",
228
+ "@ledgerhq/live-wallet": "^0.10.12-nightly.3",
229
229
  "@ledgerhq/logs": "^6.13.0",
230
- "@ledgerhq/speculos-transport": "^0.2.2",
230
+ "@ledgerhq/speculos-transport": "^0.2.3-nightly.0",
231
231
  "@ledgerhq/wallet-api-acre-module": "^0.5.0",
232
232
  "@ledgerhq/wallet-api-exchange-module": "^0.13.0"
233
233
  },
@@ -277,10 +277,10 @@
277
277
  "undici": "6.19.2",
278
278
  "uuid": "^8.3.2",
279
279
  "ws": "7",
280
- "@ledgerhq/device-react": "^0.2.33-nightly.1",
280
+ "@ledgerhq/device-react": "^0.2.33-nightly.3",
281
281
  "@ledgerhq/types-cryptoassets": "^7.23.0",
282
282
  "@ledgerhq/types-devices": "^6.25.3",
283
- "@ledgerhq/types-live": "^6.73.0-nightly.1"
283
+ "@ledgerhq/types-live": "^6.73.0-nightly.2"
284
284
  },
285
285
  "scripts": {
286
286
  "build": "zx ./scripts/build-ts.mjs",
@@ -25,8 +25,6 @@ import { CompleteExchangeStep, convertTransportError } from "../error";
25
25
  import type { CompleteExchangeInputSwap, CompleteExchangeRequestEvent } from "../platform/types";
26
26
  import { convertToAppExchangePartnerKey, getSwapProvider } from "../providers";
27
27
  import { CEXProviderConfig } from "../providers/swap";
28
- import { isAddressSanctioned } from "../../sanction";
29
- import { RecipientAddressSanctionedError } from "../../sanction/errors";
30
28
 
31
29
  const COMPLETE_EXCHANGE_LOG = "SWAP-CompleteExchange";
32
30
 
@@ -66,19 +64,6 @@ const completeExchange = (
66
64
  const payoutCurrency = getAccountCurrency(toAccount);
67
65
  const refundCurrency = getAccountCurrency(fromAccount);
68
66
  const mainRefundCurrency = getAccountCurrency(refundAccount);
69
-
70
- const isPayoutSanctioned = await isAddressSanctioned(
71
- payoutAccount.currency,
72
- payoutAccount.freshAddress,
73
- );
74
- const isRefundSanctioned = await isAddressSanctioned(
75
- refundAccount.currency,
76
- refundAccount.freshAddress,
77
- );
78
-
79
- if (isPayoutSanctioned || isRefundSanctioned) {
80
- throw new RecipientAddressSanctionedError();
81
- }
82
67
  if (mainPayoutCurrency.type !== "CryptoCurrency")
83
68
  throw new Error("This should be a cryptocurrency");
84
69
  if (mainRefundCurrency.type !== "CryptoCurrency")
@@ -104,7 +104,7 @@ const evmConfig: CurrencyLiveConfigDefinition = {
104
104
  type: "ledger",
105
105
  explorerId: "eth",
106
106
  },
107
- showNfts: true,
107
+ showNfts: false,
108
108
  },
109
109
  },
110
110
  config_currency_sonic: {
@@ -266,7 +266,7 @@ const evmConfig: CurrencyLiveConfigDefinition = {
266
266
  type: "ledger",
267
267
  explorerId: "matic",
268
268
  },
269
- showNfts: true,
269
+ showNfts: false,
270
270
  },
271
271
  },
272
272
  config_currency_reosc: {
@@ -396,6 +396,13 @@ export const DEFAULT_FEATURES: Features = {
396
396
  },
397
397
  },
398
398
 
399
+ buySellLoader: {
400
+ enabled: false,
401
+ params: {
402
+ durationMs: 0,
403
+ },
404
+ },
405
+
399
406
  buySellShortcut: {
400
407
  enabled: false,
401
408
  },
@@ -0,0 +1,112 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
+ import { renderHook } from "@testing-library/react";
6
+ import { LiveAppManifest } from "../platform/types";
7
+ import { INTERNAL_APP_IDS } from "../wallet-api/constants";
8
+ import { useFeature } from "../featureFlags";
9
+ import { useInternalAppIds } from "./useInternalAppIds";
10
+
11
+ import { useShowProviderLoadingTransition } from "./useShowProviderLoadingTransition";
12
+
13
+ jest.mock("../featureFlags", () => ({
14
+ useFeature: jest.fn(),
15
+ }));
16
+ jest.mock("../wallet-api/constants", () => ({
17
+ INTERNAL_APP_IDS: ["internal-app-id-1", "internal-app-id-2"],
18
+ }));
19
+ jest.mock("./useInternalAppIds", () => ({
20
+ useInternalAppIds: jest.fn(),
21
+ }));
22
+
23
+ describe("useShowProviderLoadingTransition", () => {
24
+ const mockUseFeature = useFeature as jest.Mock;
25
+ const mockUseInternalAppIds = useInternalAppIds as jest.Mock;
26
+
27
+ beforeEach(() => {
28
+ jest.clearAllMocks();
29
+ });
30
+
31
+ it("should return false when feature is disabled", () => {
32
+ mockUseFeature.mockReturnValue({ enabled: false, params: {} });
33
+ const { result } = renderHook(() =>
34
+ useShowProviderLoadingTransition({
35
+ manifest: { id: "test-app-id" } as LiveAppManifest,
36
+ isLoading: true,
37
+ }),
38
+ );
39
+ expect(result.current).toBe(false);
40
+ });
41
+
42
+ it("should return false for internal apps", () => {
43
+ mockUseFeature.mockReturnValue({ enabled: true, params: {} });
44
+ mockUseInternalAppIds.mockReturnValue(INTERNAL_APP_IDS);
45
+ const { result } = renderHook(() =>
46
+ useShowProviderLoadingTransition({
47
+ manifest: { id: "internal-app-id-1" } as LiveAppManifest,
48
+ isLoading: true,
49
+ }),
50
+ );
51
+ expect(result.current).toBe(false);
52
+ });
53
+
54
+ it("should return true when loading and feature is enabled", () => {
55
+ mockUseFeature.mockReturnValue({ enabled: true, params: {} });
56
+ mockUseInternalAppIds.mockReturnValue([]);
57
+ const { result } = renderHook(() =>
58
+ useShowProviderLoadingTransition({
59
+ manifest: { id: "test-app-id" } as LiveAppManifest,
60
+ isLoading: true,
61
+ }),
62
+ );
63
+ expect(result.current).toBe(true);
64
+ });
65
+
66
+ it("should handle extended loading state", () => {
67
+ jest.useFakeTimers();
68
+ mockUseFeature.mockReturnValue({ enabled: true, params: { durationMs: 1000 } });
69
+ mockUseInternalAppIds.mockReturnValue([]);
70
+
71
+ const { result, rerender } = renderHook(
72
+ ({ isLoading }) =>
73
+ useShowProviderLoadingTransition({
74
+ manifest: { id: "test-app-id" } as LiveAppManifest,
75
+ isLoading,
76
+ }),
77
+ {
78
+ initialProps: { isLoading: true },
79
+ },
80
+ );
81
+
82
+ expect(result.current).toBe(true);
83
+
84
+ // Simulate the timeout
85
+ jest.advanceTimersByTime(1000);
86
+
87
+ rerender({ isLoading: false });
88
+
89
+ expect(result.current).toBe(false);
90
+
91
+ jest.useRealTimers();
92
+ });
93
+ it("should clear timeout on unmount", () => {
94
+ jest.useFakeTimers();
95
+ mockUseFeature.mockReturnValue({ enabled: true, params: { durationMs: 1000 } });
96
+ mockUseInternalAppIds.mockReturnValue([]);
97
+
98
+ const { unmount } = renderHook(() =>
99
+ useShowProviderLoadingTransition({
100
+ manifest: { id: "test-app-id" } as LiveAppManifest,
101
+ isLoading: true,
102
+ }),
103
+ );
104
+
105
+ unmount();
106
+
107
+ // Advance timers to ensure no memory leaks
108
+ jest.advanceTimersByTime(1000);
109
+
110
+ jest.useRealTimers();
111
+ });
112
+ });
@@ -0,0 +1,57 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+
3
+ import { useFeature } from "../featureFlags/index";
4
+ import { INTERNAL_APP_IDS } from "../wallet-api/constants";
5
+ import { useInternalAppIds } from "./useInternalAppIds";
6
+ import { LiveAppManifest } from "../platform/types";
7
+
8
+ export function useShowProviderLoadingTransition({
9
+ isLoading,
10
+ manifest,
11
+ }: {
12
+ manifest: LiveAppManifest;
13
+ isLoading: boolean;
14
+ }) {
15
+ const isEnabled = useProviderInterstitalEnabled({ manifest });
16
+ const [extendedInitialLoading, setExtendedInitialLoading] = useState(false);
17
+
18
+ const timeoutRef = useRef<NodeJS.Timeout | null>(null);
19
+ const buySellLoaderFF = useFeature("buySellLoader");
20
+ const durationMs = buySellLoaderFF?.params?.durationMs ?? 0;
21
+ const internalAppIds = useInternalAppIds() || INTERNAL_APP_IDS;
22
+ const isAppInternal = internalAppIds.includes(manifest.id);
23
+
24
+ useEffect(() => {
25
+ if (isEnabled && isLoading && !extendedInitialLoading) {
26
+ setExtendedInitialLoading(true);
27
+
28
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
29
+
30
+ timeoutRef.current = setTimeout(() => {
31
+ setExtendedInitialLoading(false);
32
+ }, durationMs);
33
+ }
34
+ }, [durationMs, extendedInitialLoading, isAppInternal, isEnabled, isLoading]);
35
+
36
+ useEffect(() => {
37
+ return () => {
38
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
39
+ };
40
+ }, []);
41
+
42
+ return isEnabled && (isLoading || extendedInitialLoading);
43
+ }
44
+
45
+ export function useProviderInterstitalEnabled({ manifest }: { manifest?: LiveAppManifest }) {
46
+ const buySellLoaderFF = useFeature("buySellLoader");
47
+ const internalAppIds = useInternalAppIds() || INTERNAL_APP_IDS;
48
+
49
+ if (!manifest) {
50
+ return false;
51
+ }
52
+
53
+ const isAppInternal = internalAppIds.includes(manifest.id);
54
+ const isEnabled = buySellLoaderFF?.enabled && !isAppInternal;
55
+
56
+ return isEnabled;
57
+ }
@@ -65,6 +65,8 @@ export type CompleteExchangeUiRequest = {
65
65
  swapId?: string;
66
66
  amountExpectedTo?: number;
67
67
  magnitudeAwareRate?: BigNumber;
68
+ refundAddress?: string;
69
+ payoutAddress?: string;
68
70
  };
69
71
 
70
72
  type ExchangeStartParamsUiRequest =
@@ -286,11 +288,15 @@ export const handlers = ({
286
288
 
287
289
  let amountExpectedTo;
288
290
  let magnitudeAwareRate;
291
+ let refundAddress;
292
+ let payoutAddress;
289
293
  if (params.exchangeType === "SWAP") {
290
294
  // Get amountExpectedTo and magnitudeAwareRate from binary payload
291
295
  const decodePayload = await decodeSwapPayload(params.hexBinaryPayload);
292
296
  amountExpectedTo = new BigNumber(decodePayload.amountToWallet.toString());
293
297
  magnitudeAwareRate = tx.amount && amountExpectedTo.dividedBy(tx.amount);
298
+ refundAddress = decodePayload.refundAddress;
299
+ payoutAddress = decodePayload.payoutAddress;
294
300
  }
295
301
 
296
302
  return new Promise((resolve, reject) =>
@@ -306,6 +312,8 @@ export const handlers = ({
306
312
  swapId: params.exchangeType === "SWAP" ? params.swapId : undefined,
307
313
  amountExpectedTo,
308
314
  magnitudeAwareRate,
315
+ refundAddress,
316
+ payoutAddress,
309
317
  },
310
318
  onSuccess: (transactionHash: string) => {
311
319
  tracking.completeExchangeSuccess({