@ledgerhq/live-common 34.12.0-nightly.2 → 34.12.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 (98) hide show
  1. package/lib/csvExport.d.ts.map +1 -1
  2. package/lib/csvExport.js +3 -6
  3. package/lib/csvExport.js.map +1 -1
  4. package/lib/e2e/index.d.ts +2 -0
  5. package/lib/e2e/index.d.ts.map +1 -1
  6. package/lib/e2e/speculos.d.ts.map +1 -1
  7. package/lib/e2e/speculos.js +0 -17
  8. package/lib/e2e/speculos.js.map +1 -1
  9. package/lib/exchange/providers/index.d.ts +0 -1
  10. package/lib/exchange/providers/index.d.ts.map +1 -1
  11. package/lib/exchange/providers/index.js +3 -7
  12. package/lib/exchange/providers/index.js.map +1 -1
  13. package/lib/exchange/providers/swap.d.ts.map +1 -1
  14. package/lib/exchange/providers/swap.js +0 -6
  15. package/lib/exchange/providers/swap.js.map +1 -1
  16. package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
  17. package/lib/exchange/swap/completeExchange.js +1 -19
  18. package/lib/exchange/swap/completeExchange.js.map +1 -1
  19. package/lib/exchange/swap/utils/index.js +1 -2
  20. package/lib/exchange/swap/utils/index.js.map +1 -1
  21. package/lib/exchange/testCurrencyConfig/data/coins.d.ts.map +1 -1
  22. package/lib/exchange/testCurrencyConfig/data/coins.js +0 -5
  23. package/lib/exchange/testCurrencyConfig/data/coins.js.map +1 -1
  24. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  25. package/lib/featureFlags/defaultFeatures.js +1 -1
  26. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  27. package/lib/featureFlags/firebaseFeatureFlags.d.ts +1 -0
  28. package/lib/featureFlags/firebaseFeatureFlags.d.ts.map +1 -1
  29. package/lib/featureFlags/useFeature.d.ts +1 -1
  30. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  31. package/lib/generated/exchange.d.ts +0 -5
  32. package/lib/generated/exchange.d.ts.map +1 -1
  33. package/lib/generated/exchange.js +4 -6
  34. package/lib/generated/exchange.js.map +1 -1
  35. package/lib/platform/types.d.ts +0 -1
  36. package/lib/platform/types.d.ts.map +1 -1
  37. package/lib/platform/types.js.map +1 -1
  38. package/lib-es/csvExport.d.ts.map +1 -1
  39. package/lib-es/csvExport.js +3 -6
  40. package/lib-es/csvExport.js.map +1 -1
  41. package/lib-es/e2e/index.d.ts +2 -0
  42. package/lib-es/e2e/index.d.ts.map +1 -1
  43. package/lib-es/e2e/speculos.d.ts.map +1 -1
  44. package/lib-es/e2e/speculos.js +0 -17
  45. package/lib-es/e2e/speculos.js.map +1 -1
  46. package/lib-es/exchange/providers/index.d.ts +0 -1
  47. package/lib-es/exchange/providers/index.d.ts.map +1 -1
  48. package/lib-es/exchange/providers/index.js +2 -5
  49. package/lib-es/exchange/providers/index.js.map +1 -1
  50. package/lib-es/exchange/providers/swap.d.ts.map +1 -1
  51. package/lib-es/exchange/providers/swap.js +0 -6
  52. package/lib-es/exchange/providers/swap.js.map +1 -1
  53. package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
  54. package/lib-es/exchange/swap/completeExchange.js +1 -19
  55. package/lib-es/exchange/swap/completeExchange.js.map +1 -1
  56. package/lib-es/exchange/swap/utils/index.js +1 -2
  57. package/lib-es/exchange/swap/utils/index.js.map +1 -1
  58. package/lib-es/exchange/testCurrencyConfig/data/coins.d.ts.map +1 -1
  59. package/lib-es/exchange/testCurrencyConfig/data/coins.js +0 -5
  60. package/lib-es/exchange/testCurrencyConfig/data/coins.js.map +1 -1
  61. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  62. package/lib-es/featureFlags/defaultFeatures.js +1 -1
  63. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  64. package/lib-es/featureFlags/firebaseFeatureFlags.d.ts +1 -0
  65. package/lib-es/featureFlags/firebaseFeatureFlags.d.ts.map +1 -1
  66. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  67. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  68. package/lib-es/generated/exchange.d.ts +0 -5
  69. package/lib-es/generated/exchange.d.ts.map +1 -1
  70. package/lib-es/generated/exchange.js +0 -2
  71. package/lib-es/generated/exchange.js.map +1 -1
  72. package/lib-es/platform/types.d.ts +0 -1
  73. package/lib-es/platform/types.d.ts.map +1 -1
  74. package/lib-es/platform/types.js.map +1 -1
  75. package/package.json +32 -32
  76. package/src/csvExport.ts +4 -6
  77. package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +177 -7
  78. package/src/e2e/speculos.ts +0 -18
  79. package/src/exchange/providers/index.ts +3 -9
  80. package/src/exchange/providers/swap.ts +1 -16
  81. package/src/exchange/swap/completeExchange.ts +1 -24
  82. package/src/exchange/swap/utils/index.ts +1 -1
  83. package/src/exchange/testCurrencyConfig/data/coins.ts +0 -5
  84. package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +670 -3
  85. package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +95 -3
  86. package/src/families/tron/__snapshots__/bridge.integration.test.ts.snap +361 -2733
  87. package/src/featureFlags/defaultFeatures.ts +1 -0
  88. package/src/generated/exchange.ts +0 -2
  89. package/src/platform/types.ts +0 -1
  90. package/lib/families/ton/exchange.d.ts +0 -8
  91. package/lib/families/ton/exchange.d.ts.map +0 -1
  92. package/lib/families/ton/exchange.js +0 -13
  93. package/lib/families/ton/exchange.js.map +0 -1
  94. package/lib-es/families/ton/exchange.d.ts +0 -8
  95. package/lib-es/families/ton/exchange.d.ts.map +0 -1
  96. package/lib-es/families/ton/exchange.js +0 -11
  97. package/lib-es/families/ton/exchange.js.map +0 -1
  98. package/src/families/ton/exchange.ts +0 -16
@@ -232,22 +232,6 @@ export const specs: Specs = {
232
232
  },
233
233
  dependency: "",
234
234
  },
235
- Multiverse_X: {
236
- currency: getCryptoCurrencyById("elrond"),
237
- appQuery: {
238
- model: DeviceModelId.nanoSP,
239
- appName: "MultiversX",
240
- },
241
- dependency: "",
242
- },
243
- Osmosis: {
244
- currency: getCryptoCurrencyById("osmo"),
245
- appQuery: {
246
- model: DeviceModelId.nanoSP,
247
- appName: "Cosmos",
248
- },
249
- dependency: "",
250
- },
251
235
  };
252
236
 
253
237
  export async function startSpeculos(
@@ -376,8 +360,6 @@ export async function pressRightUntil(text: string, maxAttempts: number = 10): P
376
360
  action: "press-and-release",
377
361
  });
378
362
  attempts++;
379
-
380
- await waitForTimeOut(200);
381
363
  }
382
364
 
383
365
  if (attempts === maxAttempts) {
@@ -56,14 +56,11 @@ type TestProvider = {
56
56
  curve: "secp256k1" | "secp256r1";
57
57
  data: string;
58
58
  };
59
- service: {
60
- appVersion: number;
61
- name: "swap" | "sell" | "fund";
62
- };
63
59
  signature: string;
60
+ version: number;
64
61
  };
65
62
  export function setTestProviderInfo(provider: string) {
66
- const { name, publicKey, signature, service } = JSON.parse(provider) as TestProvider;
63
+ const { name, publicKey, signature, version } = JSON.parse(provider) as TestProvider;
67
64
  testProvider = {
68
65
  name,
69
66
  publicKey: {
@@ -71,9 +68,6 @@ export function setTestProviderInfo(provider: string) {
71
68
  data: Buffer.from(publicKey.data, "hex"),
72
69
  },
73
70
  signature: Buffer.from(signature, "hex"),
74
- version: service.appVersion,
71
+ version,
75
72
  };
76
73
  }
77
- export function getTestProviderInfo(): ExchangeProviderNameAndSignature | undefined {
78
- return testProvider;
79
- }
@@ -1,5 +1,4 @@
1
- import { getEnv } from "@ledgerhq/live-env";
2
- import { ExchangeProviderNameAndSignature, getTestProviderInfo } from ".";
1
+ import { ExchangeProviderNameAndSignature } from ".";
3
2
  import { isIntegrationTestEnv } from "../swap/utils/isIntegrationTestEnv";
4
3
  import { getProvidersData } from "./getProvidersData";
5
4
  import network from "@ledgerhq/live-network";
@@ -227,20 +226,6 @@ let providerDataCache: Record<string, ProviderConfig & AdditionalProviderConfig>
227
226
  export const getSwapProvider = async (
228
227
  providerName: string,
229
228
  ): Promise<ProviderConfig & AdditionalProviderConfig> => {
230
- const testProviderInfo = getTestProviderInfo();
231
- if (getEnv("MOCK_EXCHANGE_TEST_CONFIG") && testProviderInfo) {
232
- return {
233
- needsKYC: false,
234
- needsBearerToken: false,
235
- type: "CEX",
236
- termsOfUseUrl: "https://example.com",
237
- supportUrl: "https://example.com",
238
- mainUrl: "https://example.com",
239
- displayName: providerName,
240
- ...testProviderInfo,
241
- };
242
- }
243
-
244
229
  const res = await fetchAndMergeProviderData();
245
230
 
246
231
  if (!res[providerName.toLowerCase()]) {
@@ -24,7 +24,6 @@ import { getSwapProvider } from "../providers";
24
24
  import { convertToAppExchangePartnerKey } from "../providers";
25
25
  import { CompleteExchangeStep, convertTransportError } from "../error";
26
26
  import { getDefaultAccountName } from "@ledgerhq/live-wallet/accountName";
27
- import BigNumber from "bignumber.js";
28
27
 
29
28
  const withDevicePromise = (deviceId, fn) =>
30
29
  firstValueFrom(withDevice(deviceId)(transport => from(fn(transport))));
@@ -66,29 +65,7 @@ const completeExchange = (
66
65
  if (mainRefundCurrency.type !== "CryptoCurrency")
67
66
  throw new Error("This should be a cryptocurrency");
68
67
 
69
- // Thorswap ERC20 token exception hack:
70
- // - We remove subAccountId to prevent EVM calldata swap during prepareTransaction.
71
- // - Set amount to 0 to ensure correct handling of the transaction
72
- // (this is adjusted during prepareTransaction before signing the actual EVM transaction for tokens but we skip it).
73
- // - Since it's an ERC20 token transaction (not ETH), amount is set to 0 ETH
74
- // because no ETH is being sent, only tokens.
75
- // - This workaround can't be applied earlier in the flow as the amount is used for display purposes and checks.
76
- // We must set the amount to 0 at this stage to avoid issues during the transaction.
77
- // - This ensures proper handling of Thorswap-ERC20-specific transactions.
78
- if (
79
- provider.toLocaleLowerCase() === "thorswap" &&
80
- transaction.subAccountId &&
81
- transaction.family === "evm"
82
- ) {
83
- const transactionFixed = {
84
- ...transaction,
85
- subAccountId: undefined,
86
- amount: BigNumber(0),
87
- };
88
- transaction = await accountBridge.prepareTransaction(refundAccount, transactionFixed);
89
- } else {
90
- transaction = await accountBridge.prepareTransaction(refundAccount, transaction);
91
- }
68
+ transaction = await accountBridge.prepareTransaction(refundAccount, transaction);
92
69
  if (unsubscribed) return;
93
70
 
94
71
  const { errors, estimatedFees } = await accountBridge.getTransactionStatus(
@@ -61,7 +61,7 @@ export const isRegistrationRequired = async (provider: string): Promise<boolean>
61
61
  };
62
62
 
63
63
  export const getProviderName = (provider: string): string => {
64
- const { displayName } = SWAP_DATA_CDN[provider] ?? { displayName: "" };
64
+ const { displayName } = provider ? SWAP_DATA_CDN[provider] : { displayName: "" };
65
65
  return displayName;
66
66
  };
67
67
 
@@ -29,11 +29,6 @@ const coins = [
29
29
  0x82, 0x90, 0x4, 0xfe, 0x6f, 0x1d, 0x0, 0x3a, 0x58,
30
30
  ]).toString("hex"),
31
31
  ],
32
- [
33
- "ton",
34
- "03544f4e03544f4e00",
35
- "3045022100fe1b854d275796f89a7e24ef118767f0660b1883a27834e126ddd22ebb7fccc3022010806932659ea8bf2f46d3d9bac5fb288c2ba7e36ca690f2961a19f7b7f66a43",
36
- ],
37
32
  ];
38
33
 
39
34
  export default coins;