@ledgerhq/live-common 34.50.0-nightly.0 → 34.50.0-nightly.2
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/bridge/generic-alpaca/buildSubAccounts.d.ts +4 -4
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.js +7 -9
- package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +4 -6
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +5 -3
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib/e2e/enum/Account.d.ts +2 -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 +4 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +2 -1
- 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/families/hedera.d.ts +2 -0
- package/lib/e2e/families/hedera.d.ts.map +1 -0
- package/lib/e2e/families/hedera.js +11 -0
- package/lib/e2e/families/hedera.js.map +1 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +12 -0
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/platform/types.d.ts +2 -0
- package/lib/exchange/platform/types.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +22 -1
- package/lib/exchange/swap/completeExchange.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/families/hedera/exchange.d.ts +9 -0
- package/lib/families/hedera/exchange.d.ts.map +1 -0
- package/lib/families/hedera/exchange.js +36 -0
- package/lib/families/hedera/exchange.js.map +1 -0
- package/lib/hw/actions/completeExchange.d.ts +2 -0
- package/lib/hw/actions/completeExchange.d.ts.map +1 -1
- package/lib/hw/actions/completeExchange.js +1 -0
- package/lib/hw/actions/completeExchange.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +4 -3
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +13 -47
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +1 -5
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +15 -55
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.js +2 -2
- package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.js +1 -3
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js +46 -0
- package/lib/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js.map +1 -0
- package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib/modularDrawer/utils/{haveOneCommonProvider.d.ts → haveOneCommonAsset.d.ts} +3 -3
- package/lib/modularDrawer/utils/haveOneCommonAsset.d.ts.map +1 -0
- package/lib/modularDrawer/utils/{haveOneCommonProvider.js → haveOneCommonAsset.js} +6 -6
- package/lib/modularDrawer/utils/haveOneCommonAsset.js.map +1 -0
- package/lib/modularDrawer/utils/index.d.ts +2 -4
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -10
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/index.test.js +0 -26
- package/lib/modularDrawer/utils/index.test.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +0 -6
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +4 -4
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +7 -9
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +4 -6
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +5 -3
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +2 -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 +4 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +2 -1
- 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/families/hedera.d.ts +2 -0
- package/lib-es/e2e/families/hedera.d.ts.map +1 -0
- package/lib-es/e2e/families/hedera.js +7 -0
- package/lib-es/e2e/families/hedera.js.map +1 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +12 -0
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/platform/types.d.ts +2 -0
- package/lib-es/exchange/platform/types.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +22 -1
- package/lib-es/exchange/swap/completeExchange.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/families/hedera/exchange.d.ts +9 -0
- package/lib-es/families/hedera/exchange.d.ts.map +1 -0
- package/lib-es/families/hedera/exchange.js +29 -0
- package/lib-es/families/hedera/exchange.js.map +1 -0
- package/lib-es/hw/actions/completeExchange.d.ts +2 -0
- package/lib-es/hw/actions/completeExchange.d.ts.map +1 -1
- package/lib-es/hw/actions/completeExchange.js +1 -0
- package/lib-es/hw/actions/completeExchange.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +4 -3
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +13 -47
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +1 -5
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +15 -55
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js +2 -2
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +1 -3
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js +1 -1
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js +44 -0
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonAsset.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib-es/modularDrawer/utils/{haveOneCommonProvider.d.ts → haveOneCommonAsset.d.ts} +3 -3
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/{haveOneCommonProvider.js → haveOneCommonAsset.js} +4 -4
- package/lib-es/modularDrawer/utils/haveOneCommonAsset.js.map +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts +2 -4
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +2 -8
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.test.js +1 -27
- package/lib-es/modularDrawer/utils/index.test.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +0 -6
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/package.json +37 -35
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +28 -28
- package/src/bridge/generic-alpaca/getAccountShape.ts +9 -12
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +5 -3
- package/src/e2e/enum/Account.ts +10 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +11 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/families/hedera.ts +7 -0
- package/src/e2e/speculos.ts +12 -0
- package/src/exchange/platform/types.ts +2 -0
- package/src/exchange/swap/completeExchange.ts +32 -2
- package/src/exchange/swap/getIncompatibleCurrencyKeys.ts +4 -0
- package/src/families/hedera/exchange.ts +48 -0
- package/src/hw/actions/completeExchange.ts +3 -0
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +16 -76
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +25 -95
- package/src/modularDrawer/modules/createAssetConfiguration.ts +3 -11
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +1 -8
- package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +1 -1
- package/src/modularDrawer/utils/__tests__/haveOneCommonAsset.test.ts +49 -0
- package/src/modularDrawer/utils/currencyUtils.ts +0 -1
- package/src/modularDrawer/utils/{haveOneCommonProvider.ts → haveOneCommonAsset.ts} +6 -5
- package/src/modularDrawer/utils/index.test.ts +1 -32
- package/src/modularDrawer/utils/index.ts +2 -16
- package/src/modularDrawer/utils/type.ts +0 -6
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +0 -2
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +0 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +0 -28
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +0 -1
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +0 -9
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +0 -1
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js +0 -17
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js.map +0 -1
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
- package/lib/modularDrawer/utils/getProviderCurrency.js +0 -14
- package/lib/modularDrawer/utils/getProviderCurrency.js.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonProvider.js.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +0 -2
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +0 -26
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +0 -1
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +0 -9
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js +0 -13
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js.map +0 -1
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/getProviderCurrency.js +0 -10
- package/lib-es/modularDrawer/utils/getProviderCurrency.js.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.js.map +0 -1
- package/src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts +0 -34
- package/src/modularDrawer/utils/buildProviderCurrenciesMap.tsx +0 -25
- package/src/modularDrawer/utils/getProviderCurrency.ts +0 -13
@@ -0,0 +1,44 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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,UAAU;YACd,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE;gBACT,QAAQ,EAAE,UAAU;gBACpB,QAAQ,EAAE,UAAU;aACrB;YACD,cAAc,EAAE,mCAAmC;SACpD;QACD,QAAQ,EAAE,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;KACjF;IACD;QACE,KAAK,EAAE;YACL,EAAE,EAAE,SAAS;YACb,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,SAAS;YACf,SAAS,EAAE;gBACT,OAAO,EAAE,SAAS;aACnB;YACD,cAAc,EAAE,SAAS;SAC1B;QACD,QAAQ,EAAE,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;KAC7C;CACF,CAAC;AAEF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,CAAC,kBAAkB,CAAC,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC9E,MAAM,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"currencyUtils.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"currencyUtils.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC3D,eAAO,MAAM,kBAAkB,OAAQ,MAAM,KAAG,qBAAqB,GAAG,IAMvE,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,qBAAqB,cAAc,MAAM,KAAG,OAErF,CAAC;AAEF,eAAO,MAAM,mBAAmB,aACpB,sBAAsB,KAC/B,qBAAqB,GAAG,IAU1B,CAAC;AAEF,eAAO,MAAM,wBAAwB,cACxB,sBAAsB,EAAE,wBAcpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,cACpB,sBAAsB,EAAE,kBACnB,IAAI,MAAM,CAAC,+CAE1B,sBAAsB,EAgCxB,CAAC;AAEF,eAAO,MAAM,yBAAyB,cACzB,sBAAsB,EAAE,KAClC,qBAAqB,EAIvB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"currencyUtils.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"currencyUtils.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAgC,EAAE;IAC7E,IAAI;QACF,OAAO,4BAA4B,CAAC,EAAE,CAAC,CAAC;KACzC;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AAE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AChF,CAAC,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { AssetData } from "./type";
|
2
2
|
/**
|
3
3
|
* This function checks if all currencies in the provided array
|
4
4
|
* it stopped at the first currency that does not match to prevent unnecessary iterations.
|
@@ -7,5 +7,5 @@ import { CurrenciesByProviderId } from "../../deposit/type";
|
|
7
7
|
* @param currenciesByProvider array of currencies grouped by provider
|
8
8
|
* @returns boolean indicating whether all currencies in the array have one common provider
|
9
9
|
*/
|
10
|
-
export declare const
|
11
|
-
//# sourceMappingURL=
|
10
|
+
export declare const haveOneCommonAsset: (currenciesIdsArray: string[], currenciesByProvider: AssetData[]) => boolean;
|
11
|
+
//# sourceMappingURL=haveOneCommonAsset.d.ts.map
|
@@ -0,0 +1 @@
|
|
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"}
|
@@ -6,14 +6,14 @@
|
|
6
6
|
* @param currenciesByProvider array of currencies grouped by provider
|
7
7
|
* @returns boolean indicating whether all currencies in the array have one common provider
|
8
8
|
*/
|
9
|
-
export const
|
9
|
+
export const haveOneCommonAsset = (currenciesIdsArray, currenciesByProvider) => {
|
10
10
|
if (currenciesIdsArray.length === 0)
|
11
11
|
return false;
|
12
12
|
const providerIds = new Set();
|
13
13
|
for (const currencyId of currenciesIdsArray) {
|
14
14
|
for (const provider of currenciesByProvider) {
|
15
|
-
if (provider.
|
16
|
-
providerIds.add(provider.
|
15
|
+
if (provider.networks.some(currency => currency.id === currencyId)) {
|
16
|
+
providerIds.add(provider.asset.id);
|
17
17
|
if (providerIds.size > 1) {
|
18
18
|
return false;
|
19
19
|
}
|
@@ -22,4 +22,4 @@ export const haveOneCommonProvider = (currenciesIdsArray, currenciesByProvider)
|
|
22
22
|
}
|
23
23
|
return true;
|
24
24
|
};
|
25
|
-
//# sourceMappingURL=
|
25
|
+
//# sourceMappingURL=haveOneCommonAsset.js.map
|
@@ -0,0 +1 @@
|
|
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,9 +1,7 @@
|
|
1
1
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
import {
|
3
|
-
import { haveOneCommonProvider } from "./haveOneCommonProvider";
|
2
|
+
import { haveOneCommonAsset } from "./haveOneCommonAsset";
|
4
3
|
import { getBalanceAndFiatValue } from "./getBalanceAndFiatValue";
|
5
4
|
import { groupCurrenciesByProvider } from "./groupCurrenciesByProvider";
|
6
5
|
declare function isCorrespondingCurrency(elem: CryptoOrTokenCurrency, network: CryptoOrTokenCurrency): boolean;
|
7
|
-
|
8
|
-
export { isCorrespondingCurrency, getEffectiveCurrency, haveOneCommonProvider, getBalanceAndFiatValue, groupCurrenciesByProvider, };
|
6
|
+
export { isCorrespondingCurrency, haveOneCommonAsset, getBalanceAndFiatValue, groupCurrenciesByProvider, };
|
9
7
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,iBAAS,uBAAuB,CAC9B,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAQT;AAED,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,GAC1B,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { haveOneCommonAsset } from "./haveOneCommonAsset";
|
2
2
|
import { getBalanceAndFiatValue } from "./getBalanceAndFiatValue";
|
3
3
|
import { groupCurrenciesByProvider } from "./groupCurrenciesByProvider";
|
4
4
|
function isCorrespondingCurrency(elem, network) {
|
@@ -10,11 +10,5 @@ function isCorrespondingCurrency(elem, network) {
|
|
10
10
|
}
|
11
11
|
return false;
|
12
12
|
}
|
13
|
-
|
14
|
-
const isCurrencyFiltered = currencyIds.includes(currency.id);
|
15
|
-
if (isCurrencyFiltered)
|
16
|
-
return currency;
|
17
|
-
return provider.currenciesByNetwork.find(elem => currencyIds.includes(elem.id)) ?? currency;
|
18
|
-
};
|
19
|
-
export { isCorrespondingCurrency, getEffectiveCurrency, haveOneCommonProvider, getBalanceAndFiatValue, groupCurrenciesByProvider, };
|
13
|
+
export { isCorrespondingCurrency, haveOneCommonAsset, getBalanceAndFiatValue, groupCurrenciesByProvider, };
|
20
14
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,SAAS,uBAAuB,CAC9B,IAA2B,EAC3B,OAA8B;IAE9B,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,EAAE;QACjC,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,KAAK,OAAO,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;KACzE;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE;QAClC,OAAO,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;KAC/B;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,GAC1B,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isCorrespondingCurrency
|
1
|
+
import { isCorrespondingCurrency } from "./index";
|
2
2
|
import { createFixtureCryptoCurrency } from "../../mock/fixtures/cryptoCurrencies";
|
3
3
|
import { cryptocurrenciesById } from "@ledgerhq/cryptoassets";
|
4
4
|
describe("isCorrespondingCurrency", () => {
|
@@ -33,30 +33,4 @@ describe("isCorrespondingCurrency", () => {
|
|
33
33
|
expect(isCorrespondingCurrency(bitcoinCurrency, evmCurrency)).toBe(false);
|
34
34
|
});
|
35
35
|
});
|
36
|
-
describe("getEffectiveCurrency", () => {
|
37
|
-
const parent = createFixtureCryptoCurrency("evm");
|
38
|
-
const token = {
|
39
|
-
type: "TokenCurrency",
|
40
|
-
id: "ethereum/erc20/usdc",
|
41
|
-
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
42
|
-
parentCurrency: parent,
|
43
|
-
tokenType: "erc20",
|
44
|
-
name: "USD Coin",
|
45
|
-
ticker: "USDC",
|
46
|
-
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }],
|
47
|
-
};
|
48
|
-
const provider = {
|
49
|
-
providerId: "provider1",
|
50
|
-
currenciesByNetwork: [parent, token],
|
51
|
-
};
|
52
|
-
it("returns currency if id is in currencyIds", () => {
|
53
|
-
expect(getEffectiveCurrency(token, provider, [token.id])).toBe(token);
|
54
|
-
});
|
55
|
-
it("returns first matching currency from provider if id not in currencyIds", () => {
|
56
|
-
expect(getEffectiveCurrency(token, provider, [parent.id])).toBe(parent);
|
57
|
-
});
|
58
|
-
it("returns currency if no match in provider", () => {
|
59
|
-
expect(getEffectiveCurrency(token, provider, ["notfound"])).toBe(token);
|
60
|
-
});
|
61
|
-
});
|
62
36
|
//# sourceMappingURL=index.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AE,GAAG,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;QAC/E,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,eAAe,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACxD,MAAM,CAAC,uBAAuB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -4,7 +4,6 @@ import { AccountLike } from "@ledgerhq/types-live";
|
|
4
4
|
import { ReactNode } from "react";
|
5
5
|
import { Observable } from "rxjs";
|
6
6
|
import { WalletAPIAccount } from "../../wallet-api/types";
|
7
|
-
import { CurrenciesByProviderId } from "../../deposit/type";
|
8
7
|
import { EnhancedModularDrawerConfiguration } from "../../wallet-api/ModularDrawer/types";
|
9
8
|
import { InterestRate } from "../data/entities";
|
10
9
|
import { MarketItemResponse } from "../../market/utils/types";
|
@@ -65,8 +64,6 @@ export type UseAccountData = (params: AccountModuleParams) => AccountDataItem[];
|
|
65
64
|
export type NetworkHookParams = {
|
66
65
|
assets: CryptoOrTokenCurrency[];
|
67
66
|
networks: CryptoOrTokenCurrency[];
|
68
|
-
selectedAssetId: string;
|
69
|
-
currenciesByProvider: CurrenciesByProviderId[];
|
70
67
|
accounts$?: Observable<WalletAPIAccount[]>;
|
71
68
|
};
|
72
69
|
export type NetworkHook = (params: NetworkHookParams) => Array<CryptoOrTokenCurrency & Network>;
|
@@ -88,13 +85,10 @@ export type Network = {
|
|
88
85
|
};
|
89
86
|
export type CreateNetworkConfigurationHookProps = {
|
90
87
|
networksConfig: EnhancedModularDrawerConfiguration["networks"];
|
91
|
-
currenciesByProvider?: CurrenciesByProviderId[];
|
92
|
-
selectedAssetId: string;
|
93
88
|
accounts$?: Observable<WalletAPIAccount[]>;
|
94
89
|
};
|
95
90
|
type Props = {
|
96
91
|
assetsConfiguration: EnhancedModularDrawerConfiguration["assets"];
|
97
|
-
currenciesByProvider?: CurrenciesByProviderId[];
|
98
92
|
};
|
99
93
|
export type AssetConfigurationDeps = {
|
100
94
|
ApyIndicator: (args: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0B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BAA4B,GAAG,CACzC,sBAAsB,EAAE,sBAAsB,KAC3C,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,MAAM,EAAE,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,GAAG,SAAS,CAAC,EAAE,CAAC;AAElG,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACtC,CAAC"}
|
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.50.0-nightly.
|
4
|
+
"version": "34.50.0-nightly.2",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
@@ -166,34 +166,34 @@
|
|
166
166
|
"xstate": "^5.19.2",
|
167
167
|
"yargs": "^17.0.0",
|
168
168
|
"zod": "^3.22.4",
|
169
|
-
"@ledgerhq/coin-algorand": "^0.10.3-nightly.
|
170
|
-
"@ledgerhq/coin-aptos": "^3.3.2-nightly.
|
171
|
-
"@ledgerhq/coin-bitcoin": "^0.22.2-nightly.
|
172
|
-
"@ledgerhq/coin-canton": "^0.7.0-nightly.
|
173
|
-
"@ledgerhq/coin-cardano": "^0.12.3-nightly.
|
174
|
-
"@ledgerhq/coin-casper": "^2.1.3-nightly.
|
175
|
-
"@ledgerhq/coin-celo": "^1.4.2-nightly.
|
176
|
-
"@ledgerhq/coin-cosmos": "^0.17.3-nightly.
|
177
|
-
"@ledgerhq/coin-evm": "^2.32.0-nightly.
|
178
|
-
"@ledgerhq/coin-filecoin": "^1.12.2-nightly.
|
179
|
-
"@ledgerhq/coin-framework": "^6.6.0-nightly.
|
180
|
-
"@ledgerhq/coin-hedera": "^1.
|
181
|
-
"@ledgerhq/coin-icon": "^0.12.3-nightly.
|
182
|
-
"@ledgerhq/coin-internet_computer": "^1.8.3-nightly.
|
183
|
-
"@ledgerhq/coin-kaspa": "^1.2.0-nightly.
|
184
|
-
"@ledgerhq/coin-mina": "^1.2.3-nightly.
|
185
|
-
"@ledgerhq/coin-multiversx": "^0.5.3-nightly.
|
186
|
-
"@ledgerhq/coin-near": "^0.13.3-nightly.
|
187
|
-
"@ledgerhq/coin-polkadot": "^6.10.2-nightly.
|
188
|
-
"@ledgerhq/coin-solana": "^0.34.1-nightly.
|
189
|
-
"@ledgerhq/coin-stacks": "^0.9.3-nightly.
|
190
|
-
"@ledgerhq/coin-stellar": "^6.
|
191
|
-
"@ledgerhq/coin-sui": "^0.
|
192
|
-
"@ledgerhq/coin-tezos": "^6.6.0-nightly.
|
193
|
-
"@ledgerhq/coin-ton": "^0.14.3-nightly.
|
194
|
-
"@ledgerhq/coin-tron": "^5.4.2-nightly.
|
195
|
-
"@ledgerhq/coin-vechain": "^2.10.1-nightly.
|
196
|
-
"@ledgerhq/coin-xrp": "^7.5.1-nightly.
|
169
|
+
"@ledgerhq/coin-algorand": "^0.10.3-nightly.1",
|
170
|
+
"@ledgerhq/coin-aptos": "^3.3.2-nightly.1",
|
171
|
+
"@ledgerhq/coin-bitcoin": "^0.22.2-nightly.1",
|
172
|
+
"@ledgerhq/coin-canton": "^0.7.0-nightly.1",
|
173
|
+
"@ledgerhq/coin-cardano": "^0.12.3-nightly.1",
|
174
|
+
"@ledgerhq/coin-casper": "^2.1.3-nightly.1",
|
175
|
+
"@ledgerhq/coin-celo": "^1.4.2-nightly.1",
|
176
|
+
"@ledgerhq/coin-cosmos": "^0.17.3-nightly.1",
|
177
|
+
"@ledgerhq/coin-evm": "^2.32.0-nightly.1",
|
178
|
+
"@ledgerhq/coin-filecoin": "^1.12.2-nightly.1",
|
179
|
+
"@ledgerhq/coin-framework": "^6.6.0-nightly.1",
|
180
|
+
"@ledgerhq/coin-hedera": "^1.12.0-nightly.1",
|
181
|
+
"@ledgerhq/coin-icon": "^0.12.3-nightly.1",
|
182
|
+
"@ledgerhq/coin-internet_computer": "^1.8.3-nightly.1",
|
183
|
+
"@ledgerhq/coin-kaspa": "^1.2.0-nightly.1",
|
184
|
+
"@ledgerhq/coin-mina": "^1.2.3-nightly.1",
|
185
|
+
"@ledgerhq/coin-multiversx": "^0.5.3-nightly.1",
|
186
|
+
"@ledgerhq/coin-near": "^0.13.3-nightly.1",
|
187
|
+
"@ledgerhq/coin-polkadot": "^6.10.2-nightly.1",
|
188
|
+
"@ledgerhq/coin-solana": "^0.34.1-nightly.1",
|
189
|
+
"@ledgerhq/coin-stacks": "^0.9.3-nightly.1",
|
190
|
+
"@ledgerhq/coin-stellar": "^6.5.0-nightly.1",
|
191
|
+
"@ledgerhq/coin-sui": "^0.15.0-nightly.2",
|
192
|
+
"@ledgerhq/coin-tezos": "^6.6.0-nightly.1",
|
193
|
+
"@ledgerhq/coin-ton": "^0.14.3-nightly.1",
|
194
|
+
"@ledgerhq/coin-tron": "^5.4.2-nightly.1",
|
195
|
+
"@ledgerhq/coin-vechain": "^2.10.1-nightly.1",
|
196
|
+
"@ledgerhq/coin-xrp": "^7.5.1-nightly.1",
|
197
197
|
"@ledgerhq/crypto-icons-ui": "^1.20.0-nightly.0",
|
198
198
|
"@ledgerhq/cryptoassets": "^13.30.0-nightly.0",
|
199
199
|
"@ledgerhq/device-core": "^0.6.5-nightly.0",
|
@@ -218,21 +218,23 @@
|
|
218
218
|
"@ledgerhq/hw-app-trx": "^6.31.7",
|
219
219
|
"@ledgerhq/hw-app-vet": "^0.6.1-nightly.0",
|
220
220
|
"@ledgerhq/hw-app-xrp": "^6.32.5",
|
221
|
+
"@ledgerhq/hw-bolos": "^6.32.7",
|
221
222
|
"@ledgerhq/hw-transport": "^6.31.11",
|
222
223
|
"@ledgerhq/hw-transport-mocker": "^6.29.11",
|
223
224
|
"@ledgerhq/ledger-cal-service": "^1.5.0",
|
225
|
+
"@ledgerhq/ledger-trust-service": "^0.4.0-nightly.0",
|
224
226
|
"@ledgerhq/live-config": "^3.2.0",
|
225
|
-
"@ledgerhq/live-countervalues": "^0.7.3-nightly.
|
226
|
-
"@ledgerhq/live-countervalues-react": "^0.6.2-nightly.
|
227
|
+
"@ledgerhq/live-countervalues": "^0.7.3-nightly.1",
|
228
|
+
"@ledgerhq/live-countervalues-react": "^0.6.2-nightly.1",
|
227
229
|
"@ledgerhq/live-dmk-shared": "^0.13.0",
|
228
230
|
"@ledgerhq/live-env": "^2.17.0",
|
229
231
|
"@ledgerhq/live-hooks": "0.1.0",
|
230
232
|
"@ledgerhq/live-network": "^2.0.18",
|
231
233
|
"@ledgerhq/live-promise": "^0.1.1",
|
232
|
-
"@ledgerhq/live-signer-canton": "^0.4.1-nightly.
|
233
|
-
"@ledgerhq/live-signer-evm": "^0.8.1-nightly.
|
234
|
-
"@ledgerhq/live-signer-solana": "^0.5.7-nightly.
|
235
|
-
"@ledgerhq/live-wallet": "^0.14.2-nightly.
|
234
|
+
"@ledgerhq/live-signer-canton": "^0.4.1-nightly.1",
|
235
|
+
"@ledgerhq/live-signer-evm": "^0.8.1-nightly.1",
|
236
|
+
"@ledgerhq/live-signer-solana": "^0.5.7-nightly.1",
|
237
|
+
"@ledgerhq/live-wallet": "^0.14.2-nightly.1",
|
236
238
|
"@ledgerhq/logs": "^6.13.0",
|
237
239
|
"@ledgerhq/speculos-transport": "^0.2.11",
|
238
240
|
"@ledgerhq/wallet-api-acre-module": "^0.7.0",
|
@@ -55,47 +55,47 @@ function buildTokenAccount({
|
|
55
55
|
};
|
56
56
|
}
|
57
57
|
|
58
|
-
export function buildSubAccounts({
|
58
|
+
export async function buildSubAccounts({
|
59
59
|
currency,
|
60
60
|
accountId,
|
61
|
-
|
61
|
+
allTokenAssetsBalances,
|
62
62
|
syncConfig,
|
63
63
|
operations,
|
64
64
|
getTokenFromAsset,
|
65
65
|
}: {
|
66
66
|
currency: CryptoCurrency;
|
67
67
|
accountId: string;
|
68
|
-
|
68
|
+
allTokenAssetsBalances: Balance[];
|
69
69
|
syncConfig: SyncConfig;
|
70
70
|
operations: OperationCommon[];
|
71
|
-
getTokenFromAsset?: (asset: AssetInfo) => TokenCurrency | undefined
|
72
|
-
}): TokenAccount[]
|
71
|
+
getTokenFromAsset?: (asset: AssetInfo) => Promise<TokenCurrency | undefined>;
|
72
|
+
}): Promise<TokenAccount[]> {
|
73
73
|
const { blacklistedTokenIds = [] } = syncConfig;
|
74
74
|
const allTokens = listTokensForCryptoCurrency(currency);
|
75
|
+
const tokenAccounts: TokenAccount[] = [];
|
75
76
|
|
76
|
-
if (allTokens.length === 0 ||
|
77
|
-
return
|
77
|
+
if (allTokens.length === 0 || allTokenAssetsBalances.length === 0) {
|
78
|
+
return tokenAccounts;
|
78
79
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
op
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
});
|
80
|
+
|
81
|
+
for (const balance of allTokenAssetsBalances) {
|
82
|
+
const token = getTokenFromAsset && (await getTokenFromAsset(balance.asset));
|
83
|
+
// NOTE: for future tokens, will need to check over currencyName/standard(erc20,trc10,trc20, etc)/id
|
84
|
+
if (token && !blacklistedTokenIds.includes(token.id)) {
|
85
|
+
tokenAccounts.push(
|
86
|
+
buildTokenAccount({
|
87
|
+
parentAccountId: accountId,
|
88
|
+
assetBalance: balance,
|
89
|
+
token,
|
90
|
+
operations: operations.filter(
|
91
|
+
op =>
|
92
|
+
op.extra.assetReference === balance.asset?.["assetReference"] &&
|
93
|
+
op.extra.assetOwner === balance.asset?.["assetOwner"], // NOTE: we could narrow type
|
94
|
+
),
|
95
|
+
}),
|
96
|
+
);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
100
|
return tokenAccounts;
|
101
101
|
}
|
@@ -32,9 +32,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
32
32
|
const balanceRes = await alpacaApi.getBalance(address);
|
33
33
|
const nativeAsset = extractBalance(balanceRes, "native");
|
34
34
|
|
35
|
-
const
|
36
|
-
.filter(b => b.asset.type !== "native")
|
37
|
-
.filter(b => alpacaApi.getTokenFromAsset && alpacaApi.getTokenFromAsset(b.asset));
|
35
|
+
const allTokenAssetsBalances = balanceRes.filter(b => b.asset.type !== "native");
|
38
36
|
const nativeBalance = BigInt(nativeAsset?.value ?? "0");
|
39
37
|
|
40
38
|
const spendableBalance = BigInt(nativeBalance - BigInt(nativeAsset?.locked ?? "0"));
|
@@ -74,15 +72,14 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
74
72
|
}
|
75
73
|
});
|
76
74
|
|
77
|
-
const subAccounts =
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
}) || [];
|
75
|
+
const subAccounts = await buildSubAccounts({
|
76
|
+
currency,
|
77
|
+
accountId,
|
78
|
+
allTokenAssetsBalances,
|
79
|
+
syncConfig,
|
80
|
+
operations: assetOperations,
|
81
|
+
getTokenFromAsset: alpacaApi.getTokenFromAsset,
|
82
|
+
});
|
86
83
|
|
87
84
|
const operations = mergedOps.map(op => {
|
88
85
|
const subOperations = inferSubOperations(op.hash, subAccounts);
|
@@ -117,9 +117,11 @@ describe("genericGetAccountShape (stellar & xrp)", () => {
|
|
117
117
|
lastPagingToken: "pt1",
|
118
118
|
});
|
119
119
|
|
120
|
-
const assetsBalancePassed = buildSubAccountsMock.mock.calls[0][0].
|
121
|
-
expect(assetsBalancePassed).
|
122
|
-
|
120
|
+
const assetsBalancePassed = buildSubAccountsMock.mock.calls[0][0].allTokenAssetsBalances;
|
121
|
+
expect(assetsBalancePassed).toEqual([
|
122
|
+
{ asset: { symbol: "TOK1", type: "token" }, value: "42" },
|
123
|
+
{ asset: { symbol: "TOK_IGNORE", type: "token" }, value: "5" },
|
124
|
+
]);
|
123
125
|
|
124
126
|
const assetOpsPassed = buildSubAccountsMock.mock.calls[0][0].operations;
|
125
127
|
expect(assetOpsPassed).toHaveLength(1);
|
package/src/e2e/enum/Account.ts
CHANGED
@@ -110,6 +110,12 @@ export class Account {
|
|
110
110
|
"0xa1baa625c5E6A9304cB7AcD86d2fee6B710eC3eB",
|
111
111
|
1,
|
112
112
|
);
|
113
|
+
static readonly BSC_POL = new Account(
|
114
|
+
Currency.BSC_POL,
|
115
|
+
"BNB Chain 1",
|
116
|
+
"0x4BE2E2B8872AA298D6d123b9211B53E41f611566",
|
117
|
+
0,
|
118
|
+
);
|
113
119
|
static readonly BSC_SHIBA = new Account(
|
114
120
|
Currency.BSC_SHIBA,
|
115
121
|
"BNB Chain 1",
|
@@ -242,6 +248,8 @@ export class Account {
|
|
242
248
|
undefined,
|
243
249
|
[Nft.ANTITUS, Nft.PODIUM, Nft.NY_LA_MUSE],
|
244
250
|
);
|
251
|
+
// don't use this account as a recipient, it's balance
|
252
|
+
// should stay close to null to allow for error message testing
|
245
253
|
static readonly ETH_2 = new Account(
|
246
254
|
Currency.ETH,
|
247
255
|
"Ethereum 2",
|
@@ -276,6 +284,8 @@ export class Account {
|
|
276
284
|
0,
|
277
285
|
);
|
278
286
|
|
287
|
+
static readonly HEDERA_1 = new Account(Currency.HBAR, "Hedera 1", "0.0.9374930", 0);
|
288
|
+
|
279
289
|
static readonly INJ_1 = new Account(
|
280
290
|
Currency.INJ,
|
281
291
|
"Injective 1",
|
package/src/e2e/enum/AppInfos.ts
CHANGED
package/src/e2e/enum/Currency.ts
CHANGED
@@ -27,6 +27,10 @@ export class Currency {
|
|
27
27
|
|
28
28
|
static readonly KAS = new Currency("Kaspa", "KAS", "kaspa", AppInfos.KASPA, [Network.KASPA]);
|
29
29
|
|
30
|
+
static readonly HBAR = new Currency("Hedera", "HBAR", "hedera", AppInfos.HEDERA, [
|
31
|
+
Network.HEDERA,
|
32
|
+
]);
|
33
|
+
|
30
34
|
static readonly tBTC = new Currency(
|
31
35
|
"Bitcoin Testnet",
|
32
36
|
"𝚝BTC",
|
@@ -152,6 +156,13 @@ export class Currency {
|
|
152
156
|
AppInfos.BNB_CHAIN,
|
153
157
|
[Network.BNB_CHAIN, Network.POLYGON],
|
154
158
|
);
|
159
|
+
static readonly BSC_POL = new Currency(
|
160
|
+
"Matic Token",
|
161
|
+
"MATIC",
|
162
|
+
"bsc/bep20/matic_token",
|
163
|
+
AppInfos.BNB_CHAIN,
|
164
|
+
[Network.BNB_CHAIN],
|
165
|
+
);
|
155
166
|
static readonly BSC_SHIBA = new Currency("Shiba Inu", "SHIB", "bsc", AppInfos.BNB_CHAIN, [
|
156
167
|
Network.BNB_CHAIN,
|
157
168
|
Network.ETHEREUM,
|
package/src/e2e/enum/Network.ts
CHANGED
package/src/e2e/speculos.ts
CHANGED
@@ -28,6 +28,7 @@ import { sendStellar } from "./families/stellar";
|
|
28
28
|
import { delegateCardano, sendCardano } from "./families/cardano";
|
29
29
|
import { sendXRP } from "./families/xrp";
|
30
30
|
import { delegateAptos, sendAptos } from "./families/aptos";
|
31
|
+
import { sendHedera } from "./families/hedera";
|
31
32
|
import { delegateNear } from "./families/near";
|
32
33
|
import { delegateCosmos, sendCosmos } from "./families/cosmos";
|
33
34
|
import { sendKaspa } from "./families/kaspa";
|
@@ -335,6 +336,14 @@ export const specs: Specs = {
|
|
335
336
|
},
|
336
337
|
dependency: "",
|
337
338
|
},
|
339
|
+
Hedera: {
|
340
|
+
currency: getCryptoCurrencyById("hedera"),
|
341
|
+
appQuery: {
|
342
|
+
model: getSpeculosModel(),
|
343
|
+
appName: "Hedera",
|
344
|
+
},
|
345
|
+
dependency: "",
|
346
|
+
},
|
338
347
|
};
|
339
348
|
|
340
349
|
export async function startSpeculos(
|
@@ -709,6 +718,9 @@ export async function signSendTransaction(tx: Transaction) {
|
|
709
718
|
case Currency.KAS:
|
710
719
|
await sendKaspa();
|
711
720
|
break;
|
721
|
+
case Currency.HBAR:
|
722
|
+
await sendHedera();
|
723
|
+
break;
|
712
724
|
default:
|
713
725
|
throw new Error(`Unsupported currency: ${currencyName.ticker}`);
|
714
726
|
}
|