@ledgerhq/live-common 34.50.0-nightly.2 → 34.50.0-nightly.3
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/e2e/enum/Account.d.ts +4 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +4 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +2 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +2 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +1 -0
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +1 -0
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/enum/TokenType.d.ts +2 -1
- package/lib/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib/e2e/enum/TokenType.js +1 -0
- package/lib/e2e/enum/TokenType.js.map +1 -1
- package/lib/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib/e2e/enum/TransactionStatus.js +3 -0
- package/lib/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +2 -0
- package/lib/e2e/families/sui.d.ts.map +1 -0
- package/lib/e2e/families/sui.js +11 -0
- package/lib/e2e/families/sui.js.map +1 -0
- package/lib/e2e/speculos.d.ts +1 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +23 -1
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.js +4 -0
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +224 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
- package/lib/modularDrawer/utils/index.d.ts +3 -4
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -5
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/wallet-api/constants.d.ts +1 -1
- package/lib/wallet-api/constants.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +4 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +4 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +2 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +2 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +1 -0
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +1 -0
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/enum/TokenType.d.ts +2 -1
- package/lib-es/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib-es/e2e/enum/TokenType.js +1 -0
- package/lib-es/e2e/enum/TokenType.js.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts +4 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.js +3 -0
- package/lib-es/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +2 -0
- package/lib-es/e2e/families/sui.d.ts.map +1 -0
- package/lib-es/e2e/families/sui.js +7 -0
- package/lib-es/e2e/families/sui.js.map +1 -0
- package/lib-es/e2e/speculos.d.ts +1 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +21 -0
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js +4 -0
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +217 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts +3 -4
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +3 -4
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/wallet-api/constants.d.ts +1 -1
- package/lib-es/wallet-api/constants.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/e2e/enum/Account.ts +31 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +10 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/enum/TokenType.ts +1 -0
- package/src/e2e/enum/TransactionStatus.ts +3 -0
- package/src/e2e/families/sui.ts +7 -0
- package/src/e2e/speculos.ts +22 -0
- package/src/exchange/swap/getIncompatibleCurrencyKeys.ts +4 -0
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +231 -0
- package/src/modularDrawer/utils/index.ts +4 -9
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts +0 -2
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts.map +0 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js +0 -46
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonAsset.d.ts +0 -11
- package/lib/modularDrawer/utils/haveOneCommonAsset.d.ts.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonAsset.js +0 -29
- package/lib/modularDrawer/utils/haveOneCommonAsset.js.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts +0 -2
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js +0 -44
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.d.ts +0 -11
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.js +0 -25
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.js.map +0 -1
- package/src/modularDrawer/utils/__tests__/haveOneCommonAsset.test.ts +0 -49
- package/src/modularDrawer/utils/haveOneCommonAsset.ts +0 -32
@@ -1,44 +0,0 @@
|
|
1
|
-
import { haveOneCommonAsset } from "../haveOneCommonAsset";
|
2
|
-
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/lib/currencies";
|
3
|
-
const MOCK_ASSETS_SORTED = [
|
4
|
-
{
|
5
|
-
asset: {
|
6
|
-
id: "ethereum",
|
7
|
-
ticker: "ETH",
|
8
|
-
name: "Ethereum",
|
9
|
-
assetsIds: {
|
10
|
-
ethereum: "ethereum",
|
11
|
-
arbitrum: "arbitrum",
|
12
|
-
},
|
13
|
-
metaCurrencyId: "urn:crypto:meta-currency:ethereum",
|
14
|
-
},
|
15
|
-
networks: [getCryptoCurrencyById("ethereum"), getCryptoCurrencyById("arbitrum")],
|
16
|
-
},
|
17
|
-
{
|
18
|
-
asset: {
|
19
|
-
id: "bitcoin",
|
20
|
-
ticker: "BTC",
|
21
|
-
name: "Bitcoin",
|
22
|
-
assetsIds: {
|
23
|
-
bitcoin: "bitcoin",
|
24
|
-
},
|
25
|
-
metaCurrencyId: "bitcoin",
|
26
|
-
},
|
27
|
-
networks: [getCryptoCurrencyById("bitcoin")],
|
28
|
-
},
|
29
|
-
];
|
30
|
-
describe("haveOneCommonAsset", () => {
|
31
|
-
it("should return false for an empty array", () => {
|
32
|
-
expect(haveOneCommonAsset([], [])).toBe(false);
|
33
|
-
});
|
34
|
-
it("should return true for a single currency with one provider", () => {
|
35
|
-
expect(haveOneCommonAsset(["bitcoin"], MOCK_ASSETS_SORTED)).toBe(true);
|
36
|
-
});
|
37
|
-
it("should return false for multiple currencies with different providers", () => {
|
38
|
-
expect(haveOneCommonAsset(["bitcoin", "ethereum"], MOCK_ASSETS_SORTED)).toBe(false);
|
39
|
-
});
|
40
|
-
it("should return true for multiple currencies with the same provider", () => {
|
41
|
-
expect(haveOneCommonAsset(["ethereum", "arbitrum"], MOCK_ASSETS_SORTED)).toBe(true);
|
42
|
-
});
|
43
|
-
});
|
44
|
-
//# sourceMappingURL=haveOneCommonAsset.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/haveOneCommonAsset.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,MAAM,kBAAkB,GAAgB;IACtC;QACE,KAAK,EAAE;YACL,EAAE,EAAE,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CAAC,IAAI,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { AssetData } from "./type";
|
2
|
-
/**
|
3
|
-
* This function checks if all currencies in the provided array
|
4
|
-
* it stopped at the first currency that does not match to prevent unnecessary iterations.
|
5
|
-
*
|
6
|
-
* @param currenciesIdsArray array of currency IDs to check
|
7
|
-
* @param currenciesByProvider array of currencies grouped by provider
|
8
|
-
* @returns boolean indicating whether all currencies in the array have one common provider
|
9
|
-
*/
|
10
|
-
export declare const haveOneCommonAsset: (currenciesIdsArray: string[], currenciesByProvider: AssetData[]) => boolean;
|
11
|
-
//# sourceMappingURL=haveOneCommonAsset.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AAEH,eAAO,MAAM,kBAAkB,uBACT,MAAM,EAAE,wBACN,SAAS,EAAE,KAChC,OAiBF,CAAC"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* This function checks if all currencies in the provided array
|
3
|
-
* it stopped at the first currency that does not match to prevent unnecessary iterations.
|
4
|
-
*
|
5
|
-
* @param currenciesIdsArray array of currency IDs to check
|
6
|
-
* @param currenciesByProvider array of currencies grouped by provider
|
7
|
-
* @returns boolean indicating whether all currencies in the array have one common provider
|
8
|
-
*/
|
9
|
-
export const haveOneCommonAsset = (currenciesIdsArray, currenciesByProvider) => {
|
10
|
-
if (currenciesIdsArray.length === 0)
|
11
|
-
return false;
|
12
|
-
const providerIds = new Set();
|
13
|
-
for (const currencyId of currenciesIdsArray) {
|
14
|
-
for (const provider of currenciesByProvider) {
|
15
|
-
if (provider.networks.some(currency => currency.id === currencyId)) {
|
16
|
-
providerIds.add(provider.asset.id);
|
17
|
-
if (providerIds.size > 1) {
|
18
|
-
return false;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
return true;
|
24
|
-
};
|
25
|
-
//# sourceMappingURL=haveOneCommonAsset.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonAsset.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonAsset.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,kBAA4B,EAC5B,oBAAiC,EACxB,EAAE;IACX,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAElD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IAEtC,KAAK,MAAM,UAAU,IAAI,kBAAkB,EAAE;QAC3C,KAAK,MAAM,QAAQ,IAAI,oBAAoB,EAAE;YAC3C,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,UAAU,CAAC,EAAE;gBAClE,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACnC,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE;oBACxB,OAAO,KAAK,CAAC;iBACd;aACF;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { haveOneCommonAsset } from "../haveOneCommonAsset";
|
2
|
-
import { AssetData } from "../type";
|
3
|
-
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/lib/currencies";
|
4
|
-
|
5
|
-
const MOCK_ASSETS_SORTED: AssetData[] = [
|
6
|
-
{
|
7
|
-
asset: {
|
8
|
-
id: "ethereum",
|
9
|
-
ticker: "ETH",
|
10
|
-
name: "Ethereum",
|
11
|
-
assetsIds: {
|
12
|
-
ethereum: "ethereum",
|
13
|
-
arbitrum: "arbitrum",
|
14
|
-
},
|
15
|
-
metaCurrencyId: "urn:crypto:meta-currency:ethereum",
|
16
|
-
},
|
17
|
-
networks: [getCryptoCurrencyById("ethereum"), getCryptoCurrencyById("arbitrum")],
|
18
|
-
},
|
19
|
-
{
|
20
|
-
asset: {
|
21
|
-
id: "bitcoin",
|
22
|
-
ticker: "BTC",
|
23
|
-
name: "Bitcoin",
|
24
|
-
assetsIds: {
|
25
|
-
bitcoin: "bitcoin",
|
26
|
-
},
|
27
|
-
metaCurrencyId: "bitcoin",
|
28
|
-
},
|
29
|
-
networks: [getCryptoCurrencyById("bitcoin")],
|
30
|
-
},
|
31
|
-
];
|
32
|
-
|
33
|
-
describe("haveOneCommonAsset", () => {
|
34
|
-
it("should return false for an empty array", () => {
|
35
|
-
expect(haveOneCommonAsset([], [])).toBe(false);
|
36
|
-
});
|
37
|
-
|
38
|
-
it("should return true for a single currency with one provider", () => {
|
39
|
-
expect(haveOneCommonAsset(["bitcoin"], MOCK_ASSETS_SORTED)).toBe(true);
|
40
|
-
});
|
41
|
-
|
42
|
-
it("should return false for multiple currencies with different providers", () => {
|
43
|
-
expect(haveOneCommonAsset(["bitcoin", "ethereum"], MOCK_ASSETS_SORTED)).toBe(false);
|
44
|
-
});
|
45
|
-
|
46
|
-
it("should return true for multiple currencies with the same provider", () => {
|
47
|
-
expect(haveOneCommonAsset(["ethereum", "arbitrum"], MOCK_ASSETS_SORTED)).toBe(true);
|
48
|
-
});
|
49
|
-
});
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { AssetData } from "./type";
|
2
|
-
|
3
|
-
/**
|
4
|
-
* This function checks if all currencies in the provided array
|
5
|
-
* it stopped at the first currency that does not match to prevent unnecessary iterations.
|
6
|
-
*
|
7
|
-
* @param currenciesIdsArray array of currency IDs to check
|
8
|
-
* @param currenciesByProvider array of currencies grouped by provider
|
9
|
-
* @returns boolean indicating whether all currencies in the array have one common provider
|
10
|
-
*/
|
11
|
-
|
12
|
-
export const haveOneCommonAsset = (
|
13
|
-
currenciesIdsArray: string[],
|
14
|
-
currenciesByProvider: AssetData[],
|
15
|
-
): boolean => {
|
16
|
-
if (currenciesIdsArray.length === 0) return false;
|
17
|
-
|
18
|
-
const providerIds = new Set<string>();
|
19
|
-
|
20
|
-
for (const currencyId of currenciesIdsArray) {
|
21
|
-
for (const provider of currenciesByProvider) {
|
22
|
-
if (provider.networks.some(currency => currency.id === currencyId)) {
|
23
|
-
providerIds.add(provider.asset.id);
|
24
|
-
if (providerIds.size > 1) {
|
25
|
-
return false;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
return true;
|
32
|
-
};
|