@ledgerhq/live-common 34.37.0 → 34.38.0-next.0

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 (105) hide show
  1. package/lib/e2e/index.d.ts +4 -0
  2. package/lib/e2e/index.d.ts.map +1 -1
  3. package/lib/e2e/speculos.d.ts.map +1 -1
  4. package/lib/e2e/speculos.js +3 -0
  5. package/lib/e2e/speculos.js.map +1 -1
  6. package/lib/e2e/speculosCI.js +1 -1
  7. package/lib/exchange/providers/swap.d.ts +1 -0
  8. package/lib/exchange/providers/swap.d.ts.map +1 -1
  9. package/lib/exchange/providers/swap.integration.test.js +26 -12
  10. package/lib/exchange/providers/swap.integration.test.js.map +1 -1
  11. package/lib/exchange/providers/swap.js +25 -0
  12. package/lib/exchange/providers/swap.js.map +1 -1
  13. package/lib/families/evm/config.js +2 -2
  14. package/lib/families/evm/config.js.map +1 -1
  15. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  16. package/lib/featureFlags/defaultFeatures.js +10 -0
  17. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  18. package/lib/featureFlags/stakePrograms/index.d.ts +8 -2
  19. package/lib/featureFlags/stakePrograms/index.d.ts.map +1 -1
  20. package/lib/featureFlags/stakePrograms/index.js +3 -2
  21. package/lib/featureFlags/stakePrograms/index.js.map +1 -1
  22. package/lib/featureFlags/stakePrograms/index.test.js +4 -4
  23. package/lib/featureFlags/stakePrograms/index.test.js.map +1 -1
  24. package/lib/featureFlags/useFeature.d.ts +1 -1
  25. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  26. package/lib/hooks/useOFACGeoBlockCheck.js +1 -1
  27. package/lib/hooks/useOFACGeoBlockCheck.js.map +1 -1
  28. package/lib/hooks/useShowProviderLoadingTransition.d.ts +9 -0
  29. package/lib/hooks/useShowProviderLoadingTransition.d.ts.map +1 -0
  30. package/lib/hooks/useShowProviderLoadingTransition.js +46 -0
  31. package/lib/hooks/useShowProviderLoadingTransition.js.map +1 -0
  32. package/lib/hooks/useShowProviderLoadingTransition.test.d.ts +5 -0
  33. package/lib/hooks/useShowProviderLoadingTransition.test.d.ts.map +1 -0
  34. package/lib/hooks/useShowProviderLoadingTransition.test.js +83 -0
  35. package/lib/hooks/useShowProviderLoadingTransition.test.js.map +1 -0
  36. package/lib/wallet-api/Exchange/server.d.ts +2 -0
  37. package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
  38. package/lib/wallet-api/Exchange/server.js +6 -0
  39. package/lib/wallet-api/Exchange/server.js.map +1 -1
  40. package/lib/wallet-api/ModularDrawer/types.d.ts +30 -25
  41. package/lib/wallet-api/ModularDrawer/types.d.ts.map +1 -1
  42. package/lib/wallet-api/ModularDrawer/types.js +15 -11
  43. package/lib/wallet-api/ModularDrawer/types.js.map +1 -1
  44. package/lib/wallet-api/ModularDrawer/utils.js +1 -1
  45. package/lib/wallet-api/ModularDrawer/utils.js.map +1 -1
  46. package/lib-es/e2e/index.d.ts +4 -0
  47. package/lib-es/e2e/index.d.ts.map +1 -1
  48. package/lib-es/e2e/speculos.d.ts.map +1 -1
  49. package/lib-es/e2e/speculos.js +3 -0
  50. package/lib-es/e2e/speculos.js.map +1 -1
  51. package/lib-es/e2e/speculosCI.js +1 -1
  52. package/lib-es/exchange/providers/swap.d.ts +1 -0
  53. package/lib-es/exchange/providers/swap.d.ts.map +1 -1
  54. package/lib-es/exchange/providers/swap.integration.test.js +27 -13
  55. package/lib-es/exchange/providers/swap.integration.test.js.map +1 -1
  56. package/lib-es/exchange/providers/swap.js +25 -0
  57. package/lib-es/exchange/providers/swap.js.map +1 -1
  58. package/lib-es/families/evm/config.js +2 -2
  59. package/lib-es/families/evm/config.js.map +1 -1
  60. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  61. package/lib-es/featureFlags/defaultFeatures.js +10 -0
  62. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  63. package/lib-es/featureFlags/stakePrograms/index.d.ts +8 -2
  64. package/lib-es/featureFlags/stakePrograms/index.d.ts.map +1 -1
  65. package/lib-es/featureFlags/stakePrograms/index.js +3 -2
  66. package/lib-es/featureFlags/stakePrograms/index.js.map +1 -1
  67. package/lib-es/featureFlags/stakePrograms/index.test.js +4 -4
  68. package/lib-es/featureFlags/stakePrograms/index.test.js.map +1 -1
  69. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  70. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  71. package/lib-es/hooks/useOFACGeoBlockCheck.js +1 -1
  72. package/lib-es/hooks/useOFACGeoBlockCheck.js.map +1 -1
  73. package/lib-es/hooks/useShowProviderLoadingTransition.d.ts +9 -0
  74. package/lib-es/hooks/useShowProviderLoadingTransition.d.ts.map +1 -0
  75. package/lib-es/hooks/useShowProviderLoadingTransition.js +41 -0
  76. package/lib-es/hooks/useShowProviderLoadingTransition.js.map +1 -0
  77. package/lib-es/hooks/useShowProviderLoadingTransition.test.d.ts +5 -0
  78. package/lib-es/hooks/useShowProviderLoadingTransition.test.d.ts.map +1 -0
  79. package/lib-es/hooks/useShowProviderLoadingTransition.test.js +81 -0
  80. package/lib-es/hooks/useShowProviderLoadingTransition.test.js.map +1 -0
  81. package/lib-es/wallet-api/Exchange/server.d.ts +2 -0
  82. package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
  83. package/lib-es/wallet-api/Exchange/server.js +6 -0
  84. package/lib-es/wallet-api/Exchange/server.js.map +1 -1
  85. package/lib-es/wallet-api/ModularDrawer/types.d.ts +30 -25
  86. package/lib-es/wallet-api/ModularDrawer/types.d.ts.map +1 -1
  87. package/lib-es/wallet-api/ModularDrawer/types.js +9 -5
  88. package/lib-es/wallet-api/ModularDrawer/types.js.map +1 -1
  89. package/lib-es/wallet-api/ModularDrawer/utils.js +1 -1
  90. package/lib-es/wallet-api/ModularDrawer/utils.js.map +1 -1
  91. package/package.json +68 -68
  92. package/src/e2e/speculos.ts +3 -0
  93. package/src/e2e/speculosCI.ts +1 -1
  94. package/src/exchange/providers/swap.integration.test.ts +33 -16
  95. package/src/exchange/providers/swap.ts +32 -0
  96. package/src/families/evm/config.ts +2 -2
  97. package/src/featureFlags/defaultFeatures.ts +12 -0
  98. package/src/featureFlags/stakePrograms/index.test.ts +4 -4
  99. package/src/featureFlags/stakePrograms/index.ts +5 -6
  100. package/src/hooks/useOFACGeoBlockCheck.ts +1 -1
  101. package/src/hooks/useShowProviderLoadingTransition.test.ts +112 -0
  102. package/src/hooks/useShowProviderLoadingTransition.ts +57 -0
  103. package/src/wallet-api/Exchange/server.ts +8 -0
  104. package/src/wallet-api/ModularDrawer/types.ts +9 -5
  105. package/src/wallet-api/ModularDrawer/utils.ts +1 -1
@@ -1,19 +1,4 @@
1
- import { fetchAndMergeProviderData, findExchangeCurrencyData } from "./swap";
2
-
3
- describe("findExchangeCurrencyData", () => {
4
- it("returns all data in expected format", async () => {
5
- // When
6
- const currencies = await findExchangeCurrencyData("arbitrum");
7
-
8
- // Then
9
- expect(currencies).toEqual({
10
- config: "0345544808457468657265756d0d0345544812000000000000a4b1",
11
- id: "arbitrum",
12
- signature:
13
- "30450221008ca557e4acc2fa290a6a44c2b0eb5232712ba69b23df93645a320bcff9789fd9022017e6e05582806a9d4b7b2aaaedbcc3471bd26e10ad686e4f313fc0b1068b5d64",
14
- });
15
- });
16
- });
1
+ import { fetchAndMergeProviderData } from "./swap";
17
2
 
18
3
  describe("fetchAndMergeProviderData", () => {
19
4
  it("returns all data in expected format", async () => {
@@ -31,6 +16,11 @@ describe("fetchAndMergeProviderData", () => {
31
16
  mainUrl: "https://changelly.com/",
32
17
  name: "Changelly",
33
18
  needsKYC: false,
19
+ usefulUrls: [
20
+ "https://changelly.com/terms-of-use",
21
+ "https://changelly.com/aml-kyc",
22
+ "https://support.changelly.com/en/support/tickets/new",
23
+ ],
34
24
  publicKey: {
35
25
  curve: "secp256k1",
36
26
  data: Buffer.from(
@@ -47,6 +37,33 @@ describe("fetchAndMergeProviderData", () => {
47
37
  type: "CEX",
48
38
  version: 1,
49
39
  },
40
+ changelly_v2: {
41
+ displayName: "Changelly",
42
+ name: "Changelly",
43
+ useInExchangeApp: true,
44
+ publicKey: {
45
+ curve: "secp256k1",
46
+ data: Buffer.from(
47
+ "0480d7c0d3a9183597395f58dda05999328da6f18fabd5cda0aff8e8e3fc633436a2dbf48ecb23d40df7c3c7d3e774b77b4b5df0e9f7e08cf1cdf2dba788eb085b",
48
+ "hex",
49
+ ),
50
+ },
51
+ signature: Buffer.from(
52
+ "3045022100c2db00da651cfcc84702f75ab5f131a3f037592080ea750a6f665a8cb36797c802200e594938cdf2c836b34717f57487002a0588f2088f64f00a6c4d320fd37db6fa",
53
+ "hex",
54
+ ),
55
+ needsKYC: false,
56
+ type: "CEX",
57
+ usefulUrls: [
58
+ "https://changelly.com/terms-of-use",
59
+ "https://changelly.com/aml-kyc",
60
+ "https://support.changelly.com/en/support/tickets/new",
61
+ ],
62
+ termsOfUseUrl: "https://changelly.com/terms-of-use",
63
+ supportUrl: "https://support.changelly.com/en/support/home",
64
+ mainUrl: "https://changelly.com/",
65
+ version: 2,
66
+ },
50
67
  changenow: {
51
68
  name: "ChangeNOW",
52
69
  publicKey: {
@@ -15,6 +15,7 @@ export type AdditionalProviderConfig = SwapProviderConfig & { type: "DEX" | "CEX
15
15
  version?: number;
16
16
  termsOfUseUrl: string;
17
17
  supportUrl: string;
18
+ usefulUrls?: string[];
18
19
  mainUrl: string;
19
20
  useInExchangeApp: boolean;
20
21
  displayName: string;
@@ -39,10 +40,41 @@ const DEFAULT_SWAP_PROVIDERS: Record<string, ProviderConfig & Partial<Additional
39
40
  needsKYC: false,
40
41
  needsBearerToken: false,
41
42
  type: "CEX",
43
+ usefulUrls: [
44
+ "https://changelly.com/terms-of-use",
45
+ "https://changelly.com/aml-kyc",
46
+ "https://support.changelly.com/en/support/tickets/new",
47
+ ],
42
48
  termsOfUseUrl: "https://changelly.com/terms-of-use",
43
49
  supportUrl: "https://support.changelly.com/en/support/home",
44
50
  mainUrl: "https://changelly.com/",
45
51
  },
52
+ changelly_v2: {
53
+ name: "Changelly",
54
+ publicKey: {
55
+ curve: "secp256k1",
56
+ data: Buffer.from(
57
+ "0480d7c0d3a9183597395f58dda05999328da6f18fabd5cda0aff8e8e3fc633436a2dbf48ecb23d40df7c3c7d3e774b77b4b5df0e9f7e08cf1cdf2dba788eb085b",
58
+ "hex",
59
+ ),
60
+ },
61
+ signature: Buffer.from(
62
+ "3045022100c2db00da651cfcc84702f75ab5f131a3f037592080ea750a6f665a8cb36797c802200e594938cdf2c836b34717f57487002a0588f2088f64f00a6c4d320fd37db6fa",
63
+ "hex",
64
+ ),
65
+ needsKYC: false,
66
+ needsBearerToken: false,
67
+ type: "CEX",
68
+ usefulUrls: [
69
+ "https://changelly.com/terms-of-use",
70
+ "https://changelly.com/aml-kyc",
71
+ "https://support.changelly.com/en/support/tickets/new",
72
+ ],
73
+ termsOfUseUrl: "https://changelly.com/terms-of-use",
74
+ supportUrl: "https://support.changelly.com/en/support/home",
75
+ mainUrl: "https://changelly.com/",
76
+ version: 2,
77
+ },
46
78
  exodus: {
47
79
  name: "exodus",
48
80
  publicKey: {
@@ -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
  },
@@ -422,6 +429,10 @@ export const DEFAULT_FEATURES: Features = {
422
429
  },
423
430
  },
424
431
 
432
+ ptxSwapLiveAppKycWarning: {
433
+ enabled: false,
434
+ },
435
+
425
436
  llmAnalyticsOptInPrompt: {
426
437
  enabled: false,
427
438
  params: {
@@ -605,6 +616,7 @@ export const DEFAULT_FEATURES: Features = {
605
616
  live_app: true,
606
617
  receive_flow: true,
607
618
  send_flow: true,
619
+ enableModularization: false,
608
620
  },
609
621
  },
610
622
  llNftSupport: DEFAULT_FEATURE,
@@ -35,13 +35,13 @@ const feature_stake_programs_json: Feature_StakePrograms = {
35
35
 
36
36
  describe("stakeProgramsToEarnParam", () => {
37
37
  it("should return `undefined` when there are no redirects", () => {
38
- const result = stakeProgramsToEarnParam(feature_stake_programs_empty_json);
39
- expect(result).toEqual(undefined);
38
+ const { stakeProgramsParam } = stakeProgramsToEarnParam(feature_stake_programs_empty_json);
39
+ expect(stakeProgramsParam).toEqual(undefined);
40
40
  });
41
41
 
42
42
  it("should return a record of stake earn params", () => {
43
- const result = stakeProgramsToEarnParam(feature_stake_programs_json);
44
- expect(result).toEqual({
43
+ const { stakeProgramsParam } = stakeProgramsToEarnParam(feature_stake_programs_json);
44
+ expect(stakeProgramsParam).toEqual({
45
45
  "ethereum/erc20/usd__coin": "kiln-widget",
46
46
  "ethereum/erc20/usd_tether__erc20_": "earn",
47
47
  tron: "stakekit",
@@ -1,19 +1,18 @@
1
- import type { Feature_StakePrograms, PlatformManifestId } from "@ledgerhq/types-live";
1
+ import type { Feature_StakePrograms } from "@ledgerhq/types-live";
2
2
 
3
- export const stakeProgramsToEarnParam = (
4
- stakePrograms: Feature_StakePrograms | null,
5
- ): Record<PlatformManifestId, string> | undefined => {
3
+ export const stakeProgramsToEarnParam = (stakePrograms: Feature_StakePrograms | null) => {
4
+ const list = stakePrograms?.params?.list ?? [];
6
5
  const redirects = stakePrograms?.params?.redirects ?? {};
7
6
  const result: Record<string, string> = {};
8
7
  const keys = Object.keys(redirects);
9
8
  if (keys.length === 0) {
10
- return undefined;
9
+ return { stakeProgramsParam: undefined, stakeCurrenciesParam: [] };
11
10
  }
12
11
  keys.forEach(key => {
13
12
  result[key] = redirects[key].platform;
14
13
  });
15
14
 
16
- return result;
15
+ return { stakeProgramsParam: result, stakeCurrenciesParam: list };
17
16
  };
18
17
 
19
18
  type StablecoinYield = "dapp" | "api" | "inactive";
@@ -20,7 +20,7 @@ export const useOFACGeoBlockCheck = ({
20
20
  queryKey: ["ofac-geo-block", geoBlockingFeatureFlagKey],
21
21
  queryFn: async () => {
22
22
  if (!platformOfacGeoBlocking?.enabled) return false;
23
- const res = await fetch(`${baseURL()}/v3/market`);
23
+ const res = await fetch(`${baseURL()}/v3/markets`);
24
24
  return res.status === 451;
25
25
  },
26
26
  });
@@ -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({
@@ -12,11 +12,15 @@ export type ModularDrawerConfiguration = {
12
12
  };
13
13
  };
14
14
 
15
- const filterOptions = ["topNetworks"] as const;
16
- const assetsLeftElementOptions = ["apy", "priceVariation"] as const;
17
- const assetsRightElementOptions = ["balance", "marketTrend"] as const;
18
- const networksLeftElementOptions = ["numberOfAccounts", "numberOfAccountsAndApy"] as const;
19
- const networksRightElementOptions = ["balance"] as const;
15
+ export const filterOptions = ["topNetworks", "undefined"] as const;
16
+ export const assetsLeftElementOptions = ["apy", "priceVariation", "undefined"] as const;
17
+ export const assetsRightElementOptions = ["balance", "marketTrend", "undefined"] as const;
18
+ export const networksLeftElementOptions = [
19
+ "numberOfAccounts",
20
+ "numberOfAccountsAndApy",
21
+ "undefined",
22
+ ] as const;
23
+ export const networksRightElementOptions = ["balance", "undefined"] as const;
20
24
 
21
25
  export const EnhancedModularDrawerConfigurationSchema = z.object({
22
26
  assets: z
@@ -19,7 +19,7 @@ export function validateAndTransformConfigurationWithZod(
19
19
  const result = EnhancedModularDrawerConfigurationSchema.safeParse(config);
20
20
 
21
21
  if (!result.success) {
22
- console.warn("Modulare Drawer invalid configuration received:", result.error);
22
+ console.warn("Modular Drawer invalid configuration received:", result.error);
23
23
  return {};
24
24
  }
25
25