@ledgerhq/live-common 34.47.0 → 34.48.0-nightly.1
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/crypto-assets/cal-integration.d.ts +4 -0
- package/lib/bridge/crypto-assets/cal-integration.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-integration.js +26 -0
- package/lib/bridge/crypto-assets/cal-integration.js.map +1 -0
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts +2 -0
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-integration.test.js +45 -0
- package/lib/bridge/crypto-assets/cal-integration.test.js.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.d.ts +14 -0
- package/lib/bridge/crypto-assets/cal-store.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.js +58 -0
- package/lib/bridge/crypto-assets/cal-store.js.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.test.d.ts +2 -0
- package/lib/bridge/crypto-assets/cal-store.test.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.test.js +70 -0
- package/lib/bridge/crypto-assets/cal-store.test.js.map +1 -0
- package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +4 -0
- package/lib/bridge/crypto-assets/index.js.map +1 -1
- package/lib/bridge/crypto-assets/index.test.js +36 -0
- package/lib/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +6 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.unit.test.d.ts +2 -0
- package/lib/bridge/generic-alpaca/alpaca/index.unit.test.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/alpaca/index.unit.test.js +89 -0
- package/lib/bridge/generic-alpaca/alpaca/index.unit.test.js.map +1 -0
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +2 -2
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +2 -3
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.js +4 -14
- 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 -4
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +0 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +14 -3
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +21 -5
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +6 -5
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/utils.test.js +123 -0
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -0
- package/lib/e2e/enum/DeviceLabels.d.ts +9 -6
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +8 -5
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +2 -0
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/index.d.ts +7 -6
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +2 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +25 -17
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/exchange/platform/transfer/completeExchange.d.ts.map +1 -1
- package/lib/exchange/platform/transfer/completeExchange.js +3 -5
- package/lib/exchange/platform/transfer/completeExchange.js.map +1 -1
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +5 -2
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/exchange/swap/initSwap.d.ts.map +1 -1
- package/lib/exchange/swap/initSwap.js +5 -2
- package/lib/exchange/swap/initSwap.js.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +4 -0
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/solana/setup.d.ts.map +1 -1
- package/lib/families/solana/setup.js +9 -0
- package/lib/families/solana/setup.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -2
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/modularDrawer/__mocks__/dada.mock.d.ts +3336 -0
- package/lib/modularDrawer/__mocks__/dada.mock.d.ts.map +1 -0
- package/lib/modularDrawer/__mocks__/dada.mock.js +3879 -0
- package/lib/modularDrawer/__mocks__/dada.mock.js.map +1 -0
- package/lib/modularDrawer/data/entities/interestRateSelectors.d.ts +16 -0
- package/lib/modularDrawer/data/entities/interestRateSelectors.d.ts.map +1 -0
- package/lib/modularDrawer/data/entities/interestRateSelectors.js +21 -0
- package/lib/modularDrawer/data/entities/interestRateSelectors.js.map +1 -0
- package/lib/modularDrawer/data/state-manager/api.d.ts +727 -37
- package/lib/modularDrawer/data/state-manager/api.d.ts.map +1 -1
- package/lib/modularDrawer/data/state-manager/api.js +38 -17
- package/lib/modularDrawer/data/state-manager/api.js.map +1 -1
- package/lib/modularDrawer/data/state-manager/types.d.ts +24 -0
- package/lib/modularDrawer/data/state-manager/types.d.ts.map +1 -0
- package/lib/modularDrawer/data/state-manager/types.js +13 -0
- package/lib/modularDrawer/data/state-manager/types.js.map +1 -0
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.js +134 -78
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.js.map +1 -1
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +206 -0
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +3 -3
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.js +43 -10
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
- package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.d.ts → useAssetAccountCounts.d.ts} +1 -1
- package/lib/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.js → useAssetAccountCounts.js} +1 -1
- package/lib/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -0
- package/lib/modularDrawer/hooks/useAssetsData.d.ts +10 -6
- package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useAssetsData.js +40 -17
- package/lib/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts +3 -0
- package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.js +23 -0
- package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.js.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.d.ts +13 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.js +15 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.js.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.d.ts +4 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.js +30 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -0
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js +29 -0
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +57 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +87 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +63 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +66 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts +4 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.js +41 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +6 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.js +54 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js +36 -0
- package/lib/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js.map +1 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js +17 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
- package/lib/modularDrawer/utils/getInterestRateForAsset.d.ts +13 -0
- package/lib/modularDrawer/utils/getInterestRateForAsset.d.ts.map +1 -0
- package/lib/modularDrawer/utils/getInterestRateForAsset.js +20 -0
- package/lib/modularDrawer/utils/getInterestRateForAsset.js.map +1 -0
- package/lib/modularDrawer/utils/getLoadingStatus.d.ts +9 -0
- package/lib/modularDrawer/utils/getLoadingStatus.d.ts.map +1 -0
- package/lib/modularDrawer/utils/getLoadingStatus.js +18 -0
- package/lib/modularDrawer/utils/getLoadingStatus.js.map +1 -0
- package/lib/modularDrawer/utils/sortByBalance.d.ts +6 -0
- package/lib/modularDrawer/utils/sortByBalance.d.ts.map +1 -0
- package/lib/modularDrawer/utils/sortByBalance.js +32 -0
- package/lib/modularDrawer/utils/sortByBalance.js.map +1 -0
- package/lib/modularDrawer/utils/type.d.ts +90 -1
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +2 -2
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/ModularDrawer/types.d.ts +6 -6
- package/lib/wallet-api/ModularDrawer/types.d.ts.map +1 -1
- package/lib/wallet-api/ModularDrawer/types.js +1 -1
- package/lib/wallet-api/ModularDrawer/types.js.map +1 -1
- package/lib/wallet-api/react.d.ts +2 -0
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +3 -1
- package/lib/wallet-api/react.js.map +1 -1
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts +4 -0
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-integration.js +21 -0
- package/lib-es/bridge/crypto-assets/cal-integration.js.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts +2 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.js +43 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.js.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.d.ts +14 -0
- package/lib-es/bridge/crypto-assets/cal-store.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.js +54 -0
- package/lib-es/bridge/crypto-assets/cal-store.js.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts +2 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.js +68 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.js.map +1 -0
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +4 -0
- package/lib-es/bridge/crypto-assets/index.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.test.js +36 -0
- package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js +6 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.js +64 -0
- package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +2 -2
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +2 -3
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +4 -12
- 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 +3 -3
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +0 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +14 -3
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +21 -5
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +6 -5
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/utils.test.js +118 -0
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -0
- package/lib-es/e2e/enum/DeviceLabels.d.ts +9 -6
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +8 -5
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +2 -0
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/index.d.ts +7 -6
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +2 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +23 -16
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/exchange/platform/transfer/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/platform/transfer/completeExchange.js +3 -2
- package/lib-es/exchange/platform/transfer/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +5 -2
- package/lib-es/exchange/swap/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/initSwap.d.ts.map +1 -1
- package/lib-es/exchange/swap/initSwap.js +5 -2
- package/lib-es/exchange/swap/initSwap.js.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +4 -0
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/solana/setup.d.ts.map +1 -1
- package/lib-es/families/solana/setup.js +9 -0
- package/lib-es/families/solana/setup.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -2
- package/lib-es/featureFlags/defaultFeatures.js.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/modularDrawer/__mocks__/dada.mock.d.ts +3336 -0
- package/lib-es/modularDrawer/__mocks__/dada.mock.d.ts.map +1 -0
- package/lib-es/modularDrawer/__mocks__/dada.mock.js +3876 -0
- package/lib-es/modularDrawer/__mocks__/dada.mock.js.map +1 -0
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.d.ts +16 -0
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.d.ts.map +1 -0
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.js +18 -0
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.js.map +1 -0
- package/lib-es/modularDrawer/data/state-manager/api.d.ts +727 -37
- package/lib-es/modularDrawer/data/state-manager/api.d.ts.map +1 -1
- package/lib-es/modularDrawer/data/state-manager/api.js +35 -14
- package/lib-es/modularDrawer/data/state-manager/api.js.map +1 -1
- package/lib-es/modularDrawer/data/state-manager/types.d.ts +24 -0
- package/lib-es/modularDrawer/data/state-manager/types.d.ts.map +1 -0
- package/lib-es/modularDrawer/data/state-manager/types.js +10 -0
- package/lib-es/modularDrawer/data/state-manager/types.js.map +1 -0
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.js +135 -79
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.js.map +1 -1
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +204 -0
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +3 -3
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.js +21 -8
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
- package/lib-es/modularDrawer/hooks/{modules/useAssetAccountCounts.d.ts → useAssetAccountCounts.d.ts} +1 -1
- package/lib-es/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/{modules/useAssetAccountCounts.js → useAssetAccountCounts.js} +1 -1
- package/lib-es/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +10 -6
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.js +42 -19
- package/lib-es/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts +3 -0
- package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.js +19 -0
- package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.d.ts +13 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.js +11 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.d.ts +4 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js +26 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js +25 -0
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +57 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +83 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +63 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +62 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts +4 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js +39 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +6 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +48 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js +34 -0
- package/lib-es/modularDrawer/utils/__tests__/getInterestRateForAsset.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js +13 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
- package/lib-es/modularDrawer/utils/getInterestRateForAsset.d.ts +13 -0
- package/lib-es/modularDrawer/utils/getInterestRateForAsset.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/getInterestRateForAsset.js +16 -0
- package/lib-es/modularDrawer/utils/getInterestRateForAsset.js.map +1 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.d.ts +9 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.js +14 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.js.map +1 -0
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts +6 -0
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/sortByBalance.js +25 -0
- package/lib-es/modularDrawer/utils/sortByBalance.js.map +1 -0
- package/lib-es/modularDrawer/utils/type.d.ts +90 -1
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +2 -2
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/ModularDrawer/types.d.ts +6 -6
- package/lib-es/wallet-api/ModularDrawer/types.d.ts.map +1 -1
- package/lib-es/wallet-api/ModularDrawer/types.js +1 -1
- package/lib-es/wallet-api/ModularDrawer/types.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts +2 -0
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +3 -1
- package/lib-es/wallet-api/react.js.map +1 -1
- package/package.json +51 -51
- package/src/bridge/crypto-assets/cal-integration.test.ts +53 -0
- package/src/bridge/crypto-assets/cal-integration.ts +23 -0
- package/src/bridge/crypto-assets/cal-store.test.ts +93 -0
- package/src/bridge/crypto-assets/cal-store.ts +63 -0
- package/src/bridge/crypto-assets/index.test.ts +47 -0
- package/src/bridge/crypto-assets/index.ts +5 -0
- package/src/bridge/generic-alpaca/alpaca/index.ts +14 -1
- package/src/bridge/generic-alpaca/alpaca/index.unit.test.ts +78 -0
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +5 -4
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +5 -14
- package/src/bridge/generic-alpaca/getAccountShape.ts +3 -4
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +0 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +44 -17
- package/src/bridge/generic-alpaca/signOperation.ts +1 -1
- package/src/bridge/generic-alpaca/utils.test.ts +133 -0
- package/src/bridge/generic-alpaca/utils.ts +7 -5
- package/src/e2e/enum/DeviceLabels.ts +8 -5
- package/src/e2e/families/tezos.ts +2 -0
- package/src/e2e/speculos.ts +24 -17
- package/src/exchange/platform/transfer/completeExchange.ts +3 -2
- package/src/exchange/swap/completeExchange.ts +5 -2
- package/src/exchange/swap/initSwap.ts +5 -4
- package/src/families/canton/config.ts +5 -0
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +27 -7
- package/src/families/solana/setup.ts +9 -0
- package/src/featureFlags/defaultFeatures.ts +1 -2
- package/src/modularDrawer/__mocks__/dada.mock.ts +3890 -0
- package/src/modularDrawer/data/entities/interestRateSelectors.ts +39 -0
- package/src/modularDrawer/data/state-manager/api.ts +42 -27
- package/src/modularDrawer/data/state-manager/types.ts +28 -0
- package/src/modularDrawer/hooks/__test__/useAssetsData.test.ts +141 -80
- package/src/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.ts +251 -0
- package/src/modularDrawer/hooks/modules/useLeftApyModule.tsx +27 -9
- package/src/modularDrawer/hooks/{modules/useAssetAccountCounts.tsx → useAssetAccountCounts.tsx} +2 -2
- package/src/modularDrawer/hooks/useAssetsData.ts +59 -22
- package/src/modularDrawer/hooks/useInterestRatesByCurrencies.ts +23 -0
- package/src/modularDrawer/hooks/useLeftAccounts.tsx +23 -0
- package/src/modularDrawer/hooks/useLeftAccountsApy.tsx +44 -0
- package/src/modularDrawer/hooks/useModularDrawerConfiguration.ts +33 -0
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +140 -0
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +116 -0
- package/src/modularDrawer/modules/createAssetConfiguration.ts +62 -0
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +87 -0
- package/src/modularDrawer/utils/__tests__/getInterestRateForAsset.test.ts +58 -0
- package/src/modularDrawer/utils/buildProviderCurrenciesMap.tsx +25 -0
- package/src/modularDrawer/utils/getInterestRateForAsset.ts +32 -0
- package/src/modularDrawer/utils/getLoadingStatus.ts +24 -0
- package/src/modularDrawer/utils/sortByBalance.tsx +32 -0
- package/src/modularDrawer/utils/type.ts +98 -0
- package/src/wallet-api/Exchange/server.ts +2 -2
- package/src/wallet-api/ModularDrawer/types.ts +1 -1
- package/src/wallet-api/react.ts +5 -1
- package/lib/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
- package/lib/bridge/generic-alpaca/tests/utils.test.js +0 -20
- package/lib/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
- package/lib/modularDrawer/hooks/modules/useAssetAccountCounts.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/modules/useAssetAccountCounts.js.map +0 -1
- package/lib/modularDrawer/types.d.ts +0 -2
- package/lib/modularDrawer/types.d.ts.map +0 -1
- package/lib/modularDrawer/types.js +0 -3
- package/lib/modularDrawer/types.js.map +0 -1
- package/lib-es/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
- package/lib-es/bridge/generic-alpaca/tests/utils.test.js +0 -18
- package/lib-es/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
- package/lib-es/modularDrawer/hooks/modules/useAssetAccountCounts.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/modules/useAssetAccountCounts.js.map +0 -1
- package/lib-es/modularDrawer/types.d.ts +0 -2
- package/lib-es/modularDrawer/types.d.ts.map +0 -1
- package/lib-es/modularDrawer/types.js +0 -2
- package/lib-es/modularDrawer/types.js.map +0 -1
- package/src/bridge/generic-alpaca/tests/utils.test.ts +0 -19
- package/src/modularDrawer/types.ts +0 -1
- /package/lib/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
- /package/lib-es/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
import { createSelector } from "@reduxjs/toolkit";
|
2
|
+
import { InterestRate } from "../entities";
|
3
|
+
|
4
|
+
interface ApiState {
|
5
|
+
assetsDataApi?: {
|
6
|
+
queries?: Record<string, QueryCacheEntry>;
|
7
|
+
};
|
8
|
+
}
|
9
|
+
|
10
|
+
interface QueryCacheEntry {
|
11
|
+
data?: {
|
12
|
+
pages?: Array<{
|
13
|
+
interestRates?: Record<string, InterestRate>;
|
14
|
+
}>;
|
15
|
+
};
|
16
|
+
}
|
17
|
+
|
18
|
+
export const selectInterestRateByCurrency: (
|
19
|
+
state: ApiState,
|
20
|
+
currencyId: string,
|
21
|
+
) => InterestRate | undefined = createSelector(
|
22
|
+
[
|
23
|
+
(state: ApiState) => state.assetsDataApi?.queries ?? {},
|
24
|
+
(_state: ApiState, currencyId: string) => currencyId,
|
25
|
+
],
|
26
|
+
(queries, currencyId): InterestRate | undefined => {
|
27
|
+
for (const query of Object.values(queries)) {
|
28
|
+
const pages = query.data?.pages;
|
29
|
+
if (!pages) continue;
|
30
|
+
|
31
|
+
for (const page of pages) {
|
32
|
+
const rate = page.interestRates?.[currencyId];
|
33
|
+
if (rate) return rate;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
return undefined;
|
38
|
+
},
|
39
|
+
);
|
@@ -1,23 +1,14 @@
|
|
1
1
|
import { createApi, fetchBaseQuery, FetchBaseQueryMeta } from "@reduxjs/toolkit/query/react";
|
2
2
|
import { convertApiAssets } from "@ledgerhq/cryptoassets";
|
3
|
-
import {
|
3
|
+
import { RawApiResponse } from "../entities";
|
4
4
|
import { getEnv } from "@ledgerhq/live-env";
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
search?: string;
|
13
|
-
currencyIds?: string[];
|
14
|
-
}
|
15
|
-
|
16
|
-
export interface AssetsDataWithPagination extends AssetsData {
|
17
|
-
pagination: {
|
18
|
-
nextCursor?: string;
|
19
|
-
};
|
20
|
-
}
|
5
|
+
import {
|
6
|
+
AssetsAdditionalData,
|
7
|
+
AssetsDataTags,
|
8
|
+
AssetsDataWithPagination,
|
9
|
+
GetAssetsDataParams,
|
10
|
+
PageParam,
|
11
|
+
} from "./types";
|
21
12
|
|
22
13
|
function transformAssetsResponse(
|
23
14
|
response: RawApiResponse,
|
@@ -43,20 +34,44 @@ export const assetsDataApi = createApi({
|
|
43
34
|
}),
|
44
35
|
tagTypes: [AssetsDataTags.Assets],
|
45
36
|
endpoints: build => ({
|
46
|
-
getAssetsData: build.
|
47
|
-
query: ({
|
48
|
-
|
49
|
-
params: {
|
50
|
-
...(cursor && { cursor }),
|
51
|
-
...(search && { search }),
|
52
|
-
// ...(currencyIds && currencyIds.length > 0 && { currencyIds }),
|
37
|
+
getAssetsData: build.infiniteQuery<AssetsDataWithPagination, GetAssetsDataParams, PageParam>({
|
38
|
+
query: ({ pageParam, queryArg }) => {
|
39
|
+
const params = {
|
53
40
|
pageSize: 100,
|
54
|
-
|
55
|
-
|
41
|
+
...(pageParam?.cursor && { cursor: pageParam.cursor }),
|
42
|
+
...(queryArg?.useCase && { transaction: queryArg.useCase }),
|
43
|
+
...(queryArg?.currencyIds &&
|
44
|
+
queryArg?.currencyIds.length > 0 &&
|
45
|
+
!queryArg?.useCase && { currencyIds: queryArg.currencyIds }),
|
46
|
+
...(queryArg?.search && { search: queryArg.search }),
|
47
|
+
product: queryArg.product,
|
48
|
+
minVersion: queryArg.version,
|
49
|
+
additionalData: [AssetsAdditionalData.Apy, AssetsAdditionalData.MarketTrend],
|
50
|
+
};
|
51
|
+
|
52
|
+
return {
|
53
|
+
url: "assets",
|
54
|
+
params,
|
55
|
+
};
|
56
|
+
},
|
56
57
|
providesTags: [AssetsDataTags.Assets],
|
57
58
|
transformResponse: transformAssetsResponse,
|
59
|
+
infiniteQueryOptions: {
|
60
|
+
initialPageParam: {
|
61
|
+
cursor: "",
|
62
|
+
},
|
63
|
+
getNextPageParam: lastPage => {
|
64
|
+
if (lastPage.pagination.nextCursor) {
|
65
|
+
return {
|
66
|
+
cursor: lastPage.pagination.nextCursor,
|
67
|
+
};
|
68
|
+
} else {
|
69
|
+
return undefined;
|
70
|
+
}
|
71
|
+
},
|
72
|
+
},
|
58
73
|
}),
|
59
74
|
}),
|
60
75
|
});
|
61
76
|
|
62
|
-
export const {
|
77
|
+
export const { useGetAssetsDataInfiniteQuery } = assetsDataApi;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { AssetsData } from "../entities";
|
2
|
+
|
3
|
+
export enum AssetsDataTags {
|
4
|
+
Assets = "Assets",
|
5
|
+
}
|
6
|
+
|
7
|
+
export enum AssetsAdditionalData {
|
8
|
+
Apy = "apy",
|
9
|
+
MarketTrend = "marketTrend",
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface GetAssetsDataParams {
|
13
|
+
search?: string;
|
14
|
+
currencyIds?: string[];
|
15
|
+
useCase?: string;
|
16
|
+
product: "llm" | "lld";
|
17
|
+
version: string;
|
18
|
+
}
|
19
|
+
|
20
|
+
export interface PageParam {
|
21
|
+
cursor?: string;
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface AssetsDataWithPagination extends AssetsData {
|
25
|
+
pagination: {
|
26
|
+
nextCursor?: string;
|
27
|
+
};
|
28
|
+
}
|
@@ -4,21 +4,27 @@
|
|
4
4
|
|
5
5
|
import { renderHook } from "@testing-library/react";
|
6
6
|
import { useAssetsData } from "../useAssetsData";
|
7
|
-
import {
|
7
|
+
import { useGetAssetsDataInfiniteQuery } from "../../data/state-manager/api";
|
8
8
|
|
9
9
|
jest.mock("../../data/state-manager/api", () => ({
|
10
|
-
|
10
|
+
useGetAssetsDataInfiniteQuery: jest.fn(),
|
11
11
|
}));
|
12
12
|
|
13
|
-
const
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
const mockuseGetAssetsDataInfiniteQuery = jest.mocked(useGetAssetsDataInfiniteQuery);
|
14
|
+
|
15
|
+
const defaultMockValues = {
|
16
|
+
data: undefined,
|
17
|
+
isLoading: false,
|
18
|
+
error: undefined,
|
19
|
+
fetchNextPage: jest.fn(),
|
20
|
+
isSuccess: true,
|
21
|
+
isFetching: false,
|
22
|
+
isError: false,
|
23
|
+
fetchPreviousPage: jest.fn(),
|
24
|
+
isFetchingPreviousPage: false,
|
25
|
+
refetch: jest.fn(),
|
26
|
+
status: "success",
|
27
|
+
};
|
22
28
|
|
23
29
|
describe("useAssetsData", () => {
|
24
30
|
beforeEach(() => {
|
@@ -26,114 +32,169 @@ describe("useAssetsData", () => {
|
|
26
32
|
});
|
27
33
|
|
28
34
|
it("should return loading state when API is loading", () => {
|
29
|
-
|
30
|
-
|
35
|
+
mockuseGetAssetsDataInfiniteQuery.mockReturnValue({
|
36
|
+
...defaultMockValues,
|
31
37
|
isLoading: true,
|
32
|
-
|
33
|
-
refetch: jest.fn(),
|
34
|
-
isFetching: false,
|
35
|
-
isSuccess: false,
|
36
|
-
isError: false,
|
37
|
-
currentData: undefined,
|
38
|
+
status: "pending",
|
38
39
|
});
|
39
40
|
|
40
|
-
const { result } = renderHook(() => useAssetsData({}));
|
41
|
+
const { result } = renderHook(() => useAssetsData({ product: "lld", version: "1.0.0" }));
|
41
42
|
|
42
43
|
expect(result.current.isLoading).toBe(true);
|
43
44
|
expect(result.current.data).toBe(undefined);
|
44
|
-
expect(result.current.hasMore).toBe(false);
|
45
45
|
});
|
46
46
|
|
47
|
-
it("should return data
|
48
|
-
const
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
47
|
+
it("should return combined data from multiple pages", () => {
|
48
|
+
const mockPages = [
|
49
|
+
{
|
50
|
+
cryptoAssets: { bitcoin: { id: "bitcoin", name: "Bitcoin" } },
|
51
|
+
networks: { bitcoin: { id: "bitcoin", name: "Bitcoin" } },
|
52
|
+
cryptoOrTokenCurrencies: { bitcoin: { id: "bitcoin" } },
|
53
|
+
interestRates: {},
|
54
|
+
markets: {},
|
55
|
+
currenciesOrder: {
|
56
|
+
currenciesIds: ["bitcoin"],
|
57
|
+
metaCurrencyIds: ["bitcoin"],
|
58
|
+
key: "marketCap",
|
59
|
+
order: "desc",
|
60
|
+
},
|
61
|
+
pagination: { nextCursor: "cursor-2" },
|
62
|
+
},
|
63
|
+
{
|
64
|
+
cryptoAssets: { ethereum: { id: "ethereum", name: "Ethereum" } },
|
65
|
+
networks: { ethereum: { id: "ethereum", name: "Ethereum" } },
|
66
|
+
cryptoOrTokenCurrencies: { ethereum: { id: "ethereum" } },
|
67
|
+
interestRates: {},
|
68
|
+
markets: {},
|
69
|
+
currenciesOrder: {
|
70
|
+
currenciesIds: ["ethereum"],
|
71
|
+
metaCurrencyIds: ["ethereum"],
|
72
|
+
key: "marketCap",
|
73
|
+
order: "desc",
|
74
|
+
},
|
75
|
+
pagination: { nextCursor: undefined },
|
76
|
+
},
|
77
|
+
];
|
78
|
+
|
79
|
+
mockuseGetAssetsDataInfiniteQuery.mockReturnValue({
|
80
|
+
...defaultMockValues,
|
81
|
+
data: { pages: mockPages, pageParams: [{ cursor: "" }, { cursor: "cursor-2" }] },
|
61
82
|
});
|
62
83
|
|
63
|
-
const { result } = renderHook(() => useAssetsData({}));
|
84
|
+
const { result } = renderHook(() => useAssetsData({ product: "lld", version: "1.0.0" }));
|
64
85
|
|
65
|
-
expect(result.current.data).
|
86
|
+
expect(result.current.data).toEqual({
|
87
|
+
cryptoAssets: {
|
88
|
+
bitcoin: { id: "bitcoin", name: "Bitcoin" },
|
89
|
+
ethereum: { id: "ethereum", name: "Ethereum" },
|
90
|
+
},
|
91
|
+
networks: {
|
92
|
+
bitcoin: { id: "bitcoin", name: "Bitcoin" },
|
93
|
+
ethereum: { id: "ethereum", name: "Ethereum" },
|
94
|
+
},
|
95
|
+
cryptoOrTokenCurrencies: {
|
96
|
+
bitcoin: { id: "bitcoin" },
|
97
|
+
ethereum: { id: "ethereum" },
|
98
|
+
},
|
99
|
+
interestRates: {},
|
100
|
+
markets: {},
|
101
|
+
currenciesOrder: {
|
102
|
+
currenciesIds: ["bitcoin", "ethereum"],
|
103
|
+
metaCurrencyIds: ["bitcoin", "ethereum"],
|
104
|
+
key: "marketCap",
|
105
|
+
order: "desc",
|
106
|
+
},
|
107
|
+
pagination: { nextCursor: undefined },
|
108
|
+
});
|
66
109
|
expect(result.current.isLoading).toBe(false);
|
67
|
-
expect(result.current.hasMore).toBe(true);
|
68
110
|
});
|
69
111
|
|
70
112
|
it("should return error when API has error", () => {
|
71
113
|
const mockError = new Error("API Error");
|
72
|
-
|
114
|
+
mockuseGetAssetsDataInfiniteQuery.mockReturnValue({
|
115
|
+
...defaultMockValues,
|
73
116
|
data: undefined,
|
74
|
-
isLoading: false,
|
75
117
|
error: mockError,
|
76
|
-
refetch: jest.fn(),
|
77
|
-
isFetching: false,
|
78
118
|
isSuccess: false,
|
79
119
|
isError: true,
|
80
|
-
|
120
|
+
status: "error",
|
81
121
|
});
|
82
122
|
|
83
|
-
const { result } = renderHook(() => useAssetsData({}));
|
123
|
+
const { result } = renderHook(() => useAssetsData({ product: "lld", version: "1.0.0" }));
|
84
124
|
|
85
125
|
expect(result.current.error).toBe(mockError);
|
86
126
|
expect(result.current.isLoading).toBe(false);
|
87
127
|
});
|
88
128
|
|
89
|
-
it("should
|
90
|
-
const
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
pagination: { nextCursor },
|
129
|
+
it("should provide loadNext function when there's a nextCursor", () => {
|
130
|
+
const mockFetchNextPage = jest.fn();
|
131
|
+
const mockPages = [
|
132
|
+
{
|
133
|
+
cryptoAssets: {},
|
134
|
+
networks: {},
|
135
|
+
cryptoOrTokenCurrencies: {},
|
136
|
+
interestRates: {},
|
137
|
+
markets: {},
|
138
|
+
currenciesOrder: {
|
139
|
+
currenciesIds: [],
|
140
|
+
metaCurrencyIds: [],
|
141
|
+
key: "marketCap",
|
142
|
+
order: "desc",
|
143
|
+
},
|
144
|
+
pagination: { nextCursor: "next-cursor-456" },
|
105
145
|
},
|
146
|
+
];
|
147
|
+
|
148
|
+
mockuseGetAssetsDataInfiniteQuery.mockReturnValue({
|
149
|
+
...defaultMockValues,
|
150
|
+
data: { pages: mockPages, pageParams: [{ cursor: "" }] },
|
151
|
+
fetchNextPage: mockFetchNextPage,
|
106
152
|
});
|
107
153
|
|
108
|
-
const { result } = renderHook(() => useAssetsData({}));
|
154
|
+
const { result } = renderHook(() => useAssetsData({ product: "lld", version: "1.0.0" }));
|
109
155
|
|
110
|
-
result.current.loadNext();
|
156
|
+
expect(result.current.loadNext).toBeDefined();
|
157
|
+
result.current.loadNext?.();
|
111
158
|
|
112
|
-
expect(
|
159
|
+
expect(mockFetchNextPage).toHaveBeenCalled();
|
113
160
|
});
|
114
161
|
|
115
|
-
it("should not
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
162
|
+
it("should not provide loadNext function when there's no nextCursor", () => {
|
163
|
+
const mockPages = [
|
164
|
+
{
|
165
|
+
cryptoAssets: {},
|
166
|
+
networks: {},
|
167
|
+
cryptoOrTokenCurrencies: {},
|
168
|
+
interestRates: {},
|
169
|
+
markets: {},
|
170
|
+
currenciesOrder: {
|
171
|
+
currenciesIds: [],
|
172
|
+
metaCurrencyIds: [],
|
173
|
+
key: "marketCap",
|
174
|
+
order: "desc",
|
175
|
+
},
|
129
176
|
pagination: { nextCursor: undefined },
|
130
177
|
},
|
178
|
+
];
|
179
|
+
|
180
|
+
mockuseGetAssetsDataInfiniteQuery.mockReturnValue({
|
181
|
+
...defaultMockValues,
|
182
|
+
data: { pages: mockPages, pageParams: [{ cursor: "" }] },
|
131
183
|
});
|
132
184
|
|
133
|
-
const { result } = renderHook(() => useAssetsData({}));
|
185
|
+
const { result } = renderHook(() => useAssetsData({ product: "lld", version: "1.0.0" }));
|
186
|
+
|
187
|
+
expect(result.current.loadNext).toBeUndefined();
|
188
|
+
});
|
189
|
+
|
190
|
+
it("should return undefined data when no pages exist", () => {
|
191
|
+
mockuseGetAssetsDataInfiniteQuery.mockReturnValue({
|
192
|
+
...defaultMockValues,
|
193
|
+
});
|
134
194
|
|
135
|
-
result.
|
195
|
+
const { result } = renderHook(() => useAssetsData({ product: "lld", version: "1.0.0" }));
|
136
196
|
|
137
|
-
expect(
|
197
|
+
expect(result.current.data).toBeUndefined();
|
198
|
+
expect(result.current.loadNext).toBeUndefined();
|
138
199
|
});
|
139
200
|
});
|
@@ -0,0 +1,251 @@
|
|
1
|
+
/**
|
2
|
+
* @jest-environment jsdom
|
3
|
+
*/
|
4
|
+
import { renderHook } from "@testing-library/react";
|
5
|
+
import { useFeature } from "../../../featureFlags";
|
6
|
+
import { EnhancedModularDrawerConfiguration } from "../../../wallet-api/ModularDrawer/types";
|
7
|
+
import { useModularDrawerConfiguration } from "../useModularDrawerConfiguration";
|
8
|
+
|
9
|
+
jest.mock("../../../featureFlags", () => ({ useFeature: jest.fn() }));
|
10
|
+
|
11
|
+
const mockUseFeature = jest.mocked(useFeature);
|
12
|
+
|
13
|
+
describe("useModularDrawerConfiguration", () => {
|
14
|
+
beforeEach(() => {
|
15
|
+
jest.clearAllMocks();
|
16
|
+
});
|
17
|
+
|
18
|
+
describe("when modularization is disabled", () => {
|
19
|
+
beforeEach(() => {
|
20
|
+
mockUseFeature.mockReturnValue({
|
21
|
+
enabled: true,
|
22
|
+
params: {
|
23
|
+
enableModularization: false,
|
24
|
+
},
|
25
|
+
});
|
26
|
+
});
|
27
|
+
|
28
|
+
it("should return disabled configurations when no drawer configuration is provided", () => {
|
29
|
+
const { result } = renderHook(() => useModularDrawerConfiguration("lldModularDrawer"));
|
30
|
+
|
31
|
+
expect(result.current.assetsConfiguration).toEqual({
|
32
|
+
rightElement: "undefined",
|
33
|
+
leftElement: "undefined",
|
34
|
+
filter: "undefined",
|
35
|
+
});
|
36
|
+
expect(result.current.networkConfiguration).toEqual({
|
37
|
+
rightElement: "undefined",
|
38
|
+
leftElement: "undefined",
|
39
|
+
});
|
40
|
+
});
|
41
|
+
|
42
|
+
it("should return disabled configurations even when drawer configuration is provided", () => {
|
43
|
+
const drawerConfiguration: EnhancedModularDrawerConfiguration = {
|
44
|
+
assets: {
|
45
|
+
rightElement: "balance",
|
46
|
+
leftElement: "apy",
|
47
|
+
filter: "topNetworks",
|
48
|
+
},
|
49
|
+
networks: {
|
50
|
+
rightElement: "balance",
|
51
|
+
leftElement: "numberOfAccounts",
|
52
|
+
},
|
53
|
+
};
|
54
|
+
|
55
|
+
const { result } = renderHook(() =>
|
56
|
+
useModularDrawerConfiguration("lldModularDrawer", drawerConfiguration),
|
57
|
+
);
|
58
|
+
|
59
|
+
expect(result.current.assetsConfiguration).toEqual({
|
60
|
+
rightElement: "undefined",
|
61
|
+
leftElement: "undefined",
|
62
|
+
filter: "undefined",
|
63
|
+
});
|
64
|
+
expect(result.current.networkConfiguration).toEqual({
|
65
|
+
rightElement: "undefined",
|
66
|
+
leftElement: "undefined",
|
67
|
+
});
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
describe("when modularization is enabled", () => {
|
72
|
+
beforeEach(() => {
|
73
|
+
mockUseFeature.mockReturnValue({
|
74
|
+
enabled: true,
|
75
|
+
params: {
|
76
|
+
enableModularization: true,
|
77
|
+
},
|
78
|
+
});
|
79
|
+
});
|
80
|
+
|
81
|
+
it("should return undefined configurations when no drawer configuration is provided", () => {
|
82
|
+
const { result } = renderHook(() => useModularDrawerConfiguration("lldModularDrawer"));
|
83
|
+
|
84
|
+
expect(result.current.assetsConfiguration).toBeUndefined();
|
85
|
+
expect(result.current.networkConfiguration).toBeUndefined();
|
86
|
+
});
|
87
|
+
|
88
|
+
it("should return the provided drawer configuration when modularization is enabled", () => {
|
89
|
+
const drawerConfiguration: EnhancedModularDrawerConfiguration = {
|
90
|
+
assets: {
|
91
|
+
rightElement: "balance",
|
92
|
+
leftElement: "apy",
|
93
|
+
filter: "topNetworks",
|
94
|
+
},
|
95
|
+
networks: {
|
96
|
+
rightElement: "balance",
|
97
|
+
leftElement: "numberOfAccounts",
|
98
|
+
},
|
99
|
+
};
|
100
|
+
|
101
|
+
const { result } = renderHook(() =>
|
102
|
+
useModularDrawerConfiguration("lldModularDrawer", drawerConfiguration),
|
103
|
+
);
|
104
|
+
|
105
|
+
expect(result.current.assetsConfiguration).toEqual(drawerConfiguration.assets);
|
106
|
+
expect(result.current.networkConfiguration).toEqual(drawerConfiguration.networks);
|
107
|
+
});
|
108
|
+
|
109
|
+
it("should handle partial drawer configuration", () => {
|
110
|
+
const drawerConfiguration: EnhancedModularDrawerConfiguration = {
|
111
|
+
assets: {
|
112
|
+
rightElement: "balance",
|
113
|
+
leftElement: "marketTrend",
|
114
|
+
filter: "topNetworks",
|
115
|
+
},
|
116
|
+
};
|
117
|
+
|
118
|
+
const { result } = renderHook(() =>
|
119
|
+
useModularDrawerConfiguration("lldModularDrawer", drawerConfiguration),
|
120
|
+
);
|
121
|
+
|
122
|
+
expect(result.current.assetsConfiguration).toEqual(drawerConfiguration.assets);
|
123
|
+
expect(result.current.networkConfiguration).toBeUndefined();
|
124
|
+
});
|
125
|
+
|
126
|
+
it("should handle configuration with undefined values", () => {
|
127
|
+
const drawerConfiguration: EnhancedModularDrawerConfiguration = {
|
128
|
+
assets: undefined,
|
129
|
+
networks: {
|
130
|
+
rightElement: "balance",
|
131
|
+
leftElement: "numberOfAccountsAndApy",
|
132
|
+
},
|
133
|
+
};
|
134
|
+
|
135
|
+
const { result } = renderHook(() =>
|
136
|
+
useModularDrawerConfiguration("lldModularDrawer", drawerConfiguration),
|
137
|
+
);
|
138
|
+
|
139
|
+
expect(result.current.assetsConfiguration).toBeUndefined();
|
140
|
+
expect(result.current.networkConfiguration).toEqual(drawerConfiguration.networks);
|
141
|
+
});
|
142
|
+
});
|
143
|
+
|
144
|
+
describe("when feature flag is not available", () => {
|
145
|
+
beforeEach(() => {
|
146
|
+
mockUseFeature.mockReturnValue(null);
|
147
|
+
});
|
148
|
+
|
149
|
+
it("should default to disabled configuration when feature flag returns null", () => {
|
150
|
+
const drawerConfiguration: EnhancedModularDrawerConfiguration = {
|
151
|
+
assets: {
|
152
|
+
rightElement: "balance",
|
153
|
+
leftElement: "apy",
|
154
|
+
filter: "topNetworks",
|
155
|
+
},
|
156
|
+
networks: {
|
157
|
+
rightElement: "balance",
|
158
|
+
leftElement: "numberOfAccounts",
|
159
|
+
},
|
160
|
+
};
|
161
|
+
|
162
|
+
const { result } = renderHook(() =>
|
163
|
+
useModularDrawerConfiguration("lldModularDrawer", drawerConfiguration),
|
164
|
+
);
|
165
|
+
|
166
|
+
expect(result.current.assetsConfiguration).toEqual({
|
167
|
+
rightElement: "undefined",
|
168
|
+
leftElement: "undefined",
|
169
|
+
filter: "undefined",
|
170
|
+
});
|
171
|
+
expect(result.current.networkConfiguration).toEqual({
|
172
|
+
rightElement: "undefined",
|
173
|
+
leftElement: "undefined",
|
174
|
+
});
|
175
|
+
});
|
176
|
+
});
|
177
|
+
|
178
|
+
describe("when feature flag params are not available", () => {
|
179
|
+
beforeEach(() => {
|
180
|
+
mockUseFeature.mockReturnValue({
|
181
|
+
enabled: true,
|
182
|
+
params: undefined,
|
183
|
+
});
|
184
|
+
});
|
185
|
+
|
186
|
+
it("should default to disabled configuration when params are undefined", () => {
|
187
|
+
const drawerConfiguration: EnhancedModularDrawerConfiguration = {
|
188
|
+
assets: {
|
189
|
+
rightElement: "balance",
|
190
|
+
leftElement: "apy",
|
191
|
+
filter: "topNetworks",
|
192
|
+
},
|
193
|
+
networks: {
|
194
|
+
rightElement: "balance",
|
195
|
+
leftElement: "numberOfAccounts",
|
196
|
+
},
|
197
|
+
};
|
198
|
+
|
199
|
+
const { result } = renderHook(() =>
|
200
|
+
useModularDrawerConfiguration("lldModularDrawer", drawerConfiguration),
|
201
|
+
);
|
202
|
+
|
203
|
+
expect(result.current.assetsConfiguration).toEqual({
|
204
|
+
rightElement: "undefined",
|
205
|
+
leftElement: "undefined",
|
206
|
+
filter: "undefined",
|
207
|
+
});
|
208
|
+
expect(result.current.networkConfiguration).toEqual({
|
209
|
+
rightElement: "undefined",
|
210
|
+
leftElement: "undefined",
|
211
|
+
});
|
212
|
+
});
|
213
|
+
});
|
214
|
+
|
215
|
+
describe("when enableModularization param is not available", () => {
|
216
|
+
beforeEach(() => {
|
217
|
+
mockUseFeature.mockReturnValue({
|
218
|
+
enabled: true,
|
219
|
+
params: {},
|
220
|
+
});
|
221
|
+
});
|
222
|
+
|
223
|
+
it("should default to disabled configuration when enableModularization is not in params", () => {
|
224
|
+
const drawerConfiguration: EnhancedModularDrawerConfiguration = {
|
225
|
+
assets: {
|
226
|
+
rightElement: "balance",
|
227
|
+
leftElement: "apy",
|
228
|
+
filter: "topNetworks",
|
229
|
+
},
|
230
|
+
networks: {
|
231
|
+
rightElement: "balance",
|
232
|
+
leftElement: "numberOfAccounts",
|
233
|
+
},
|
234
|
+
};
|
235
|
+
|
236
|
+
const { result } = renderHook(() =>
|
237
|
+
useModularDrawerConfiguration("lldModularDrawer", drawerConfiguration),
|
238
|
+
);
|
239
|
+
|
240
|
+
expect(result.current.assetsConfiguration).toEqual({
|
241
|
+
rightElement: "undefined",
|
242
|
+
leftElement: "undefined",
|
243
|
+
filter: "undefined",
|
244
|
+
});
|
245
|
+
expect(result.current.networkConfiguration).toEqual({
|
246
|
+
rightElement: "undefined",
|
247
|
+
leftElement: "undefined",
|
248
|
+
});
|
249
|
+
});
|
250
|
+
});
|
251
|
+
});
|