@ledgerhq/live-common 34.50.0-nightly.1 → 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/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 +6 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +8 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +2 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +2 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +4 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +6 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +3 -1
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +2 -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/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/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 +35 -1
- 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 +8 -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/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/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/currencyUtils.d.ts.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib/modularDrawer/utils/index.d.ts +3 -6
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +3 -12
- 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/wallet-api/constants.d.ts +1 -1
- package/lib/wallet-api/constants.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 +6 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +8 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +2 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +2 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +4 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +6 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +3 -1
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +2 -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/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/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 +33 -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 +8 -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/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/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/currencyUtils.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.d.ts +3 -6
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +3 -10
- 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/lib-es/wallet-api/constants.d.ts +1 -1
- package/lib-es/wallet-api/constants.d.ts.map +1 -1
- package/package.json +45 -43
- 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 +41 -0
- package/src/e2e/enum/AppInfos.ts +4 -0
- package/src/e2e/enum/Currency.ts +21 -0
- package/src/e2e/enum/Network.ts +2 -0
- package/src/e2e/enum/TokenType.ts +1 -0
- package/src/e2e/enum/TransactionStatus.ts +3 -0
- package/src/e2e/families/hedera.ts +7 -0
- package/src/e2e/families/sui.ts +7 -0
- package/src/e2e/speculos.ts +34 -0
- package/src/exchange/platform/types.ts +2 -0
- package/src/exchange/swap/completeExchange.ts +32 -2
- package/src/exchange/swap/getIncompatibleCurrencyKeys.ts +8 -0
- package/src/families/hedera/exchange.ts +48 -0
- package/src/hw/actions/completeExchange.ts +3 -0
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +231 -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/currencyUtils.ts +0 -1
- package/src/modularDrawer/utils/index.test.ts +1 -32
- package/src/modularDrawer/utils/index.ts +4 -23
- 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 +0 -11
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonProvider.js +0 -29
- 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 +0 -11
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.js +0 -25
- 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
- package/src/modularDrawer/utils/haveOneCommonProvider.ts +0 -31
@@ -1,26 +0,0 @@
|
|
1
|
-
import { haveOneCommonProvider } from "../haveOneCommonProvider";
|
2
|
-
import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
|
3
|
-
jest.mock("../../../deposit/useGroupedCurrenciesByProvider.hook", () => ({
|
4
|
-
useGroupedCurrenciesByProvider: () => useGroupedCurrenciesByProvider(),
|
5
|
-
}));
|
6
|
-
describe("haveOneCommonProvider", () => {
|
7
|
-
it("should return false for an empty array", () => {
|
8
|
-
expect(haveOneCommonProvider([], [])).toBe(false);
|
9
|
-
});
|
10
|
-
it("should return true for a single currency with one provider", () => {
|
11
|
-
const { result } = useGroupedCurrenciesByProvider(true);
|
12
|
-
const { currenciesByProvider } = result;
|
13
|
-
expect(haveOneCommonProvider(["bitcoin"], currenciesByProvider)).toBe(true);
|
14
|
-
});
|
15
|
-
it("should return false for multiple currencies with different providers", () => {
|
16
|
-
const { result } = useGroupedCurrenciesByProvider(true);
|
17
|
-
const { currenciesByProvider } = result;
|
18
|
-
expect(haveOneCommonProvider(["bitcoin", "ethereum"], currenciesByProvider)).toBe(false);
|
19
|
-
});
|
20
|
-
it("should return true for multiple currencies with the same provider", () => {
|
21
|
-
const { result } = useGroupedCurrenciesByProvider(true);
|
22
|
-
const { currenciesByProvider } = result;
|
23
|
-
expect(haveOneCommonProvider(["ethereum", "arbitrum"], currenciesByProvider)).toBe(true);
|
24
|
-
});
|
25
|
-
});
|
26
|
-
//# sourceMappingURL=haveOneCommonProvider.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonProvider.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AAGrG,IAAI,CAAC,IAAI,CAAC,sDAAsD,EAAE,GAAG,EAAE,CAAC,CAAC;IACvE,8BAA8B,EAAE,GAAG,EAAE,CAAC,8BAA8B,EAAE;CACvE,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,8BAA8B,CAAC,IAAI,CAAkC,CAAC;QACzF,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAExC,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,8BAA8B,CAAC,IAAI,CAAkC,CAAC;QACzF,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAExC,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,8BAA8B,CAAC,IAAI,CAAkC,CAAC;QACzF,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QAExC,MAAM,CAAC,qBAAqB,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
export declare const buildProviderCurrenciesMap: (currenciesByProvider?: Array<{
|
3
|
-
providerId: string;
|
4
|
-
currenciesByNetwork?: CryptoOrTokenCurrency[];
|
5
|
-
}>) => Map<string, {
|
6
|
-
mainCurrency: CryptoOrTokenCurrency;
|
7
|
-
currencies: CryptoOrTokenCurrency[];
|
8
|
-
}> | null;
|
9
|
-
//# sourceMappingURL=buildProviderCurrenciesMap.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"buildProviderCurrenciesMap.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/buildProviderCurrenciesMap.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,eAAO,MAAM,0BAA0B,0BACd,MAAM;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,qBAAqB,EAAE,CAAC;CAC/C,CAAC;kBAMgB,qBAAqB;gBAAc,qBAAqB,EAAE;SAY7E,CAAC"}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
export const buildProviderCurrenciesMap = (currenciesByProvider) => {
|
2
|
-
if (!currenciesByProvider?.length)
|
3
|
-
return null;
|
4
|
-
const map = new Map();
|
5
|
-
currenciesByProvider.forEach(({ providerId, currenciesByNetwork = [] }) => {
|
6
|
-
if (currenciesByNetwork.length > 0) {
|
7
|
-
const mainCurrency = currenciesByNetwork.find(c => c.id === providerId) ?? currenciesByNetwork[0];
|
8
|
-
map.set(providerId, { mainCurrency, currencies: currenciesByNetwork });
|
9
|
-
}
|
10
|
-
});
|
11
|
-
return map;
|
12
|
-
};
|
13
|
-
//# sourceMappingURL=buildProviderCurrenciesMap.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"buildProviderCurrenciesMap.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/buildProviderCurrenciesMap.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,oBAGE,EACF,EAAE;IACF,IAAI,CAAC,oBAAoB,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IAE/C,MAAM,GAAG,GAAG,IAAI,GAAG,EAGhB,CAAC;IAEJ,oBAAoB,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,mBAAmB,GAAG,EAAE,EAAE,EAAE,EAAE;QACxE,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;YAClC,MAAM,YAAY,GAChB,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAC/E,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,CAAC,CAAC;SACxE;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getProviderCurrency.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getProviderCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,eAAO,MAAM,mBAAmB,iBAChB,qBAAqB,cACvB,qBAAqB,EAAE,0BAOpC,CAAC"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { getTokenOrCryptoCurrencyById } from "../../deposit/helper";
|
2
|
-
export const getProviderCurrency = (mainCurrency, currencies) => {
|
3
|
-
try {
|
4
|
-
return getTokenOrCryptoCurrencyById(mainCurrency.id);
|
5
|
-
}
|
6
|
-
catch {
|
7
|
-
return getTokenOrCryptoCurrencyById(currencies[0].id);
|
8
|
-
}
|
9
|
-
};
|
10
|
-
//# sourceMappingURL=getProviderCurrency.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"getProviderCurrency.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getProviderCurrency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,YAAmC,EACnC,UAAmC,EACnC,EAAE;IACF,IAAI;QACF,OAAO,4BAA4B,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;KACtD;IAAC,MAAM;QACN,OAAO,4BAA4B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KACvD;AACH,CAAC,CAAC"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { CurrenciesByProviderId } from "../../deposit/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 haveOneCommonProvider: (currenciesIdsArray: string[], currenciesByProvider: CurrenciesByProviderId[]) => boolean;
|
11
|
-
//# sourceMappingURL=haveOneCommonProvider.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonProvider.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,uBACZ,MAAM,EAAE,wBACN,sBAAsB,EAAE,KAC7C,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 haveOneCommonProvider = (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.currenciesByNetwork.some(currency => currency.id === currencyId)) {
|
16
|
-
providerIds.add(provider.providerId);
|
17
|
-
if (providerIds.size > 1) {
|
18
|
-
return false;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
return true;
|
24
|
-
};
|
25
|
-
//# sourceMappingURL=haveOneCommonProvider.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"haveOneCommonProvider.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/haveOneCommonProvider.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,kBAA4B,EAC5B,oBAA8C,EACrC,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,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,UAAU,CAAC,EAAE;gBAC7E,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;gBACrC,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE;oBACxB,OAAO,KAAK,CAAC;iBACd;aACF;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import { haveOneCommonProvider } from "../haveOneCommonProvider";
|
2
|
-
import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
|
3
|
-
import { LoadingBasedGroupedCurrencies } from "../../../deposit/type";
|
4
|
-
|
5
|
-
jest.mock("../../../deposit/useGroupedCurrenciesByProvider.hook", () => ({
|
6
|
-
useGroupedCurrenciesByProvider: () => useGroupedCurrenciesByProvider(),
|
7
|
-
}));
|
8
|
-
|
9
|
-
describe("haveOneCommonProvider", () => {
|
10
|
-
it("should return false for an empty array", () => {
|
11
|
-
expect(haveOneCommonProvider([], [])).toBe(false);
|
12
|
-
});
|
13
|
-
|
14
|
-
it("should return true for a single currency with one provider", () => {
|
15
|
-
const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
|
16
|
-
const { currenciesByProvider } = result;
|
17
|
-
|
18
|
-
expect(haveOneCommonProvider(["bitcoin"], currenciesByProvider)).toBe(true);
|
19
|
-
});
|
20
|
-
|
21
|
-
it("should return false for multiple currencies with different providers", () => {
|
22
|
-
const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
|
23
|
-
const { currenciesByProvider } = result;
|
24
|
-
|
25
|
-
expect(haveOneCommonProvider(["bitcoin", "ethereum"], currenciesByProvider)).toBe(false);
|
26
|
-
});
|
27
|
-
|
28
|
-
it("should return true for multiple currencies with the same provider", () => {
|
29
|
-
const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
|
30
|
-
const { currenciesByProvider } = result;
|
31
|
-
|
32
|
-
expect(haveOneCommonProvider(["ethereum", "arbitrum"], currenciesByProvider)).toBe(true);
|
33
|
-
});
|
34
|
-
});
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
|
3
|
-
export const buildProviderCurrenciesMap = (
|
4
|
-
currenciesByProvider?: Array<{
|
5
|
-
providerId: string;
|
6
|
-
currenciesByNetwork?: CryptoOrTokenCurrency[];
|
7
|
-
}>,
|
8
|
-
) => {
|
9
|
-
if (!currenciesByProvider?.length) return null;
|
10
|
-
|
11
|
-
const map = new Map<
|
12
|
-
string,
|
13
|
-
{ mainCurrency: CryptoOrTokenCurrency; currencies: CryptoOrTokenCurrency[] }
|
14
|
-
>();
|
15
|
-
|
16
|
-
currenciesByProvider.forEach(({ providerId, currenciesByNetwork = [] }) => {
|
17
|
-
if (currenciesByNetwork.length > 0) {
|
18
|
-
const mainCurrency =
|
19
|
-
currenciesByNetwork.find(c => c.id === providerId) ?? currenciesByNetwork[0];
|
20
|
-
map.set(providerId, { mainCurrency, currencies: currenciesByNetwork });
|
21
|
-
}
|
22
|
-
});
|
23
|
-
|
24
|
-
return map;
|
25
|
-
};
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
import { getTokenOrCryptoCurrencyById } from "../../deposit/helper";
|
3
|
-
|
4
|
-
export const getProviderCurrency = (
|
5
|
-
mainCurrency: CryptoOrTokenCurrency,
|
6
|
-
currencies: CryptoOrTokenCurrency[],
|
7
|
-
) => {
|
8
|
-
try {
|
9
|
-
return getTokenOrCryptoCurrencyById(mainCurrency.id);
|
10
|
-
} catch {
|
11
|
-
return getTokenOrCryptoCurrencyById(currencies[0].id);
|
12
|
-
}
|
13
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { CurrenciesByProviderId } from "../../deposit/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
|
-
export const haveOneCommonProvider = (
|
12
|
-
currenciesIdsArray: string[],
|
13
|
-
currenciesByProvider: CurrenciesByProviderId[],
|
14
|
-
): boolean => {
|
15
|
-
if (currenciesIdsArray.length === 0) return false;
|
16
|
-
|
17
|
-
const providerIds = new Set<string>();
|
18
|
-
|
19
|
-
for (const currencyId of currenciesIdsArray) {
|
20
|
-
for (const provider of currenciesByProvider) {
|
21
|
-
if (provider.currenciesByNetwork.some(currency => currency.id === currencyId)) {
|
22
|
-
providerIds.add(provider.providerId);
|
23
|
-
if (providerIds.size > 1) {
|
24
|
-
return false;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
return true;
|
31
|
-
};
|