@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.
- package/lib/csvExport.d.ts.map +1 -1
- package/lib/csvExport.js +3 -6
- package/lib/csvExport.js.map +1 -1
- package/lib/e2e/index.d.ts +2 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +0 -17
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/providers/index.d.ts +0 -1
- package/lib/exchange/providers/index.d.ts.map +1 -1
- package/lib/exchange/providers/index.js +3 -7
- package/lib/exchange/providers/index.js.map +1 -1
- package/lib/exchange/providers/swap.d.ts.map +1 -1
- package/lib/exchange/providers/swap.js +0 -6
- package/lib/exchange/providers/swap.js.map +1 -1
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +1 -19
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/exchange/swap/utils/index.js +1 -2
- package/lib/exchange/swap/utils/index.js.map +1 -1
- package/lib/exchange/testCurrencyConfig/data/coins.d.ts.map +1 -1
- package/lib/exchange/testCurrencyConfig/data/coins.js +0 -5
- package/lib/exchange/testCurrencyConfig/data/coins.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -1
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/firebaseFeatureFlags.d.ts +1 -0
- package/lib/featureFlags/firebaseFeatureFlags.d.ts.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/exchange.d.ts +0 -5
- package/lib/generated/exchange.d.ts.map +1 -1
- package/lib/generated/exchange.js +4 -6
- package/lib/generated/exchange.js.map +1 -1
- package/lib/platform/types.d.ts +0 -1
- package/lib/platform/types.d.ts.map +1 -1
- package/lib/platform/types.js.map +1 -1
- package/lib-es/csvExport.d.ts.map +1 -1
- package/lib-es/csvExport.js +3 -6
- package/lib-es/csvExport.js.map +1 -1
- package/lib-es/e2e/index.d.ts +2 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +0 -17
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/providers/index.d.ts +0 -1
- package/lib-es/exchange/providers/index.d.ts.map +1 -1
- package/lib-es/exchange/providers/index.js +2 -5
- package/lib-es/exchange/providers/index.js.map +1 -1
- package/lib-es/exchange/providers/swap.d.ts.map +1 -1
- package/lib-es/exchange/providers/swap.js +0 -6
- package/lib-es/exchange/providers/swap.js.map +1 -1
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +1 -19
- package/lib-es/exchange/swap/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/utils/index.js +1 -2
- package/lib-es/exchange/swap/utils/index.js.map +1 -1
- package/lib-es/exchange/testCurrencyConfig/data/coins.d.ts.map +1 -1
- package/lib-es/exchange/testCurrencyConfig/data/coins.js +0 -5
- package/lib-es/exchange/testCurrencyConfig/data/coins.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -1
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/firebaseFeatureFlags.d.ts +1 -0
- package/lib-es/featureFlags/firebaseFeatureFlags.d.ts.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/exchange.d.ts +0 -5
- package/lib-es/generated/exchange.d.ts.map +1 -1
- package/lib-es/generated/exchange.js +0 -2
- package/lib-es/generated/exchange.js.map +1 -1
- package/lib-es/platform/types.d.ts +0 -1
- package/lib-es/platform/types.d.ts.map +1 -1
- package/lib-es/platform/types.js.map +1 -1
- package/package.json +32 -32
- package/src/csvExport.ts +4 -6
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +177 -7
- package/src/e2e/speculos.ts +0 -18
- package/src/exchange/providers/index.ts +3 -9
- package/src/exchange/providers/swap.ts +1 -16
- package/src/exchange/swap/completeExchange.ts +1 -24
- package/src/exchange/swap/utils/index.ts +1 -1
- package/src/exchange/testCurrencyConfig/data/coins.ts +0 -5
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +670 -3
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +95 -3
- package/src/families/tron/__snapshots__/bridge.integration.test.ts.snap +361 -2733
- package/src/featureFlags/defaultFeatures.ts +1 -0
- package/src/generated/exchange.ts +0 -2
- package/src/platform/types.ts +0 -1
- package/lib/families/ton/exchange.d.ts +0 -8
- package/lib/families/ton/exchange.d.ts.map +0 -1
- package/lib/families/ton/exchange.js +0 -13
- package/lib/families/ton/exchange.js.map +0 -1
- package/lib-es/families/ton/exchange.d.ts +0 -8
- package/lib-es/families/ton/exchange.d.ts.map +0 -1
- package/lib-es/families/ton/exchange.js +0 -11
- package/lib-es/families/ton/exchange.js.map +0 -1
- package/src/families/ton/exchange.ts +0 -16
package/src/e2e/speculos.ts
CHANGED
|
@@ -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,
|
|
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
|
|
71
|
+
version,
|
|
75
72
|
};
|
|
76
73
|
}
|
|
77
|
-
export function getTestProviderInfo(): ExchangeProviderNameAndSignature | undefined {
|
|
78
|
-
return testProvider;
|
|
79
|
-
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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]
|
|
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;
|