@ledgerhq/live-common 34.47.0 → 34.48.0-nightly.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/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.js +1 -1
- 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/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 +6 -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/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/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.js +1 -1
- 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/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 +6 -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/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/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 +41 -41
- 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 +1 -1
- 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/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/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/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
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.
|
4
|
+
"version": "34.48.0-nightly.0",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
@@ -108,13 +108,14 @@
|
|
108
108
|
"@dfinity/principal": "^0.15.6",
|
109
109
|
"@ledgerhq/device-management-kit": "0.0.0-fix-lns-20250901094837",
|
110
110
|
"@ledgerhq/live-app-sdk": "^0.8.1",
|
111
|
-
"@ledgerhq/wallet-api-client": "^1.
|
112
|
-
"@ledgerhq/wallet-api-core": "^1.
|
113
|
-
"@ledgerhq/wallet-api-server": "^1.
|
111
|
+
"@ledgerhq/wallet-api-client": "^1.10.0",
|
112
|
+
"@ledgerhq/wallet-api-core": "^1.22.0",
|
113
|
+
"@ledgerhq/wallet-api-server": "^1.11.0",
|
114
|
+
"@noble/curves": "^1.9.7",
|
114
115
|
"@reduxjs/toolkit": "2.8.2",
|
115
116
|
"@stellar/stellar-sdk": "^14.0.0",
|
116
117
|
"@stricahq/typhonjs": "^3.0.0",
|
117
|
-
"@taquito/ledger-signer": "^
|
118
|
+
"@taquito/ledger-signer": "^23.0.0-RC.0",
|
118
119
|
"@ton-community/ton-ledger": "^7.2.0",
|
119
120
|
"@ton/core": "^0.60.1",
|
120
121
|
"@ton/crypto": "^3.3.0",
|
@@ -154,7 +155,6 @@
|
|
154
155
|
"reselect": "^4.1.5",
|
155
156
|
"rlp": "^3.0.0",
|
156
157
|
"rxjs": "^7.8.1",
|
157
|
-
"secp256k1": "^4.0.3",
|
158
158
|
"semver": "^7.3.5",
|
159
159
|
"sha.js": "^2.4.11",
|
160
160
|
"triple-beam": "^1.3.0",
|
@@ -165,35 +165,35 @@
|
|
165
165
|
"xstate": "^5.19.2",
|
166
166
|
"yargs": "^17.0.0",
|
167
167
|
"zod": "^3.22.4",
|
168
|
-
"@ledgerhq/coin-algorand": "^0.10.0",
|
169
|
-
"@ledgerhq/coin-aptos": "^3.2.0",
|
170
|
-
"@ledgerhq/coin-bitcoin": "^0.21.0",
|
171
|
-
"@ledgerhq/coin-canton": "^0.4.0",
|
172
|
-
"@ledgerhq/coin-cardano": "^0.12.0",
|
173
|
-
"@ledgerhq/coin-casper": "^2.1.0",
|
174
|
-
"@ledgerhq/coin-celo": "^1.3.0",
|
175
|
-
"@ledgerhq/coin-cosmos": "^0.17.0",
|
176
|
-
"@ledgerhq/coin-evm": "^2.29.0",
|
177
|
-
"@ledgerhq/coin-
|
178
|
-
"@ledgerhq/coin-
|
179
|
-
"@ledgerhq/coin-hedera": "^1.11.0",
|
180
|
-
"@ledgerhq/coin-icon": "^0.12.0",
|
181
|
-
"@ledgerhq/coin-internet_computer": "^1.8.0",
|
182
|
-
"@ledgerhq/coin-mina": "^1.2.0",
|
183
|
-
"@ledgerhq/coin-multiversx": "^0.5.0",
|
184
|
-
"@ledgerhq/coin-near": "^0.13.0",
|
185
|
-
"@ledgerhq/coin-polkadot": "^6.9.0",
|
186
|
-
"@ledgerhq/coin-solana": "^0.32.0",
|
187
|
-
"@ledgerhq/coin-stacks": "^0.9.0",
|
188
|
-
"@ledgerhq/coin-stellar": "^6.3.0",
|
189
|
-
"@ledgerhq/coin-sui": "^0.12.0",
|
190
|
-
"@ledgerhq/coin-tezos": "^6.3.0",
|
191
|
-
"@ledgerhq/coin-ton": "^0.14.0",
|
192
|
-
"@ledgerhq/coin-
|
193
|
-
"@ledgerhq/coin-
|
194
|
-
"@ledgerhq/coin-xrp": "^7.3.0",
|
168
|
+
"@ledgerhq/coin-algorand": "^0.10.1-nightly.0",
|
169
|
+
"@ledgerhq/coin-aptos": "^3.2.1-nightly.0",
|
170
|
+
"@ledgerhq/coin-bitcoin": "^0.21.1-nightly.0",
|
171
|
+
"@ledgerhq/coin-canton": "^0.4.1-nightly.0",
|
172
|
+
"@ledgerhq/coin-cardano": "^0.12.1-nightly.0",
|
173
|
+
"@ledgerhq/coin-casper": "^2.1.1-nightly.0",
|
174
|
+
"@ledgerhq/coin-celo": "^1.3.1-nightly.0",
|
175
|
+
"@ledgerhq/coin-cosmos": "^0.17.1-nightly.0",
|
176
|
+
"@ledgerhq/coin-evm": "^2.29.1-nightly.0",
|
177
|
+
"@ledgerhq/coin-framework": "^6.4.0-nightly.0",
|
178
|
+
"@ledgerhq/coin-filecoin": "^1.11.1-nightly.0",
|
179
|
+
"@ledgerhq/coin-hedera": "^1.11.1-nightly.0",
|
180
|
+
"@ledgerhq/coin-icon": "^0.12.1-nightly.0",
|
181
|
+
"@ledgerhq/coin-internet_computer": "^1.8.1-nightly.0",
|
182
|
+
"@ledgerhq/coin-mina": "^1.2.1-nightly.0",
|
183
|
+
"@ledgerhq/coin-multiversx": "^0.5.1-nightly.0",
|
184
|
+
"@ledgerhq/coin-near": "^0.13.1-nightly.0",
|
185
|
+
"@ledgerhq/coin-polkadot": "^6.9.1-nightly.0",
|
186
|
+
"@ledgerhq/coin-solana": "^0.32.1-nightly.0",
|
187
|
+
"@ledgerhq/coin-stacks": "^0.9.1-nightly.0",
|
188
|
+
"@ledgerhq/coin-stellar": "^6.3.1-nightly.0",
|
189
|
+
"@ledgerhq/coin-sui": "^0.12.1-nightly.0",
|
190
|
+
"@ledgerhq/coin-tezos": "^6.3.1-nightly.0",
|
191
|
+
"@ledgerhq/coin-ton": "^0.14.1-nightly.0",
|
192
|
+
"@ledgerhq/coin-vechain": "^2.9.1-nightly.0",
|
193
|
+
"@ledgerhq/coin-xrp": "^7.3.1-nightly.0",
|
195
194
|
"@ledgerhq/crypto-icons-ui": "^1.18.0",
|
196
195
|
"@ledgerhq/cryptoassets": "^13.27.0",
|
196
|
+
"@ledgerhq/coin-tron": "^5.3.1-nightly.0",
|
197
197
|
"@ledgerhq/device-core": "^0.6.2",
|
198
198
|
"@ledgerhq/devices": "8.5.1",
|
199
199
|
"@ledgerhq/errors": "^6.25.0",
|
@@ -219,18 +219,18 @@
|
|
219
219
|
"@ledgerhq/hw-transport-mocker": "^6.29.10",
|
220
220
|
"@ledgerhq/ledger-cal-service": "^1.3.1",
|
221
221
|
"@ledgerhq/live-config": "^3.2.0",
|
222
|
-
"@ledgerhq/live-countervalues": "^0.7.0",
|
223
|
-
"@ledgerhq/live-countervalues-react": "^0.5.
|
222
|
+
"@ledgerhq/live-countervalues": "^0.7.1-nightly.0",
|
223
|
+
"@ledgerhq/live-countervalues-react": "^0.5.2-nightly.0",
|
224
224
|
"@ledgerhq/live-dmk-shared": "^0.12.3",
|
225
225
|
"@ledgerhq/live-env": "^2.15.0",
|
226
226
|
"@ledgerhq/live-hooks": "0.1.0",
|
227
227
|
"@ledgerhq/live-network": "^2.0.16",
|
228
|
-
"@ledgerhq/live-nft": "^0.8.
|
228
|
+
"@ledgerhq/live-nft": "^0.8.20-nightly.0",
|
229
229
|
"@ledgerhq/live-promise": "^0.1.1",
|
230
|
-
"@ledgerhq/live-signer-canton": "^0.2.
|
231
|
-
"@ledgerhq/live-signer-evm": "^0.7.
|
232
|
-
"@ledgerhq/live-signer-solana": "^0.5.
|
233
|
-
"@ledgerhq/live-wallet": "^0.13.0",
|
230
|
+
"@ledgerhq/live-signer-canton": "^0.2.4-nightly.0",
|
231
|
+
"@ledgerhq/live-signer-evm": "^0.7.5-nightly.0",
|
232
|
+
"@ledgerhq/live-signer-solana": "^0.5.5-nightly.0",
|
233
|
+
"@ledgerhq/live-wallet": "^0.13.1-nightly.0",
|
234
234
|
"@ledgerhq/logs": "^6.13.0",
|
235
235
|
"@ledgerhq/speculos-transport": "^0.2.9",
|
236
236
|
"@ledgerhq/wallet-api-acre-module": "^0.6.0",
|
@@ -307,6 +307,6 @@
|
|
307
307
|
"test-bridge-update": "UPDATE_BACKEND_MOCKS=1 env-cmd -f .ci.integration.env pnpm jest --ci --updateSnapshot --passWithNoTests",
|
308
308
|
"test-account-migration": "tsx src/__tests__/migration/account-migration.ts",
|
309
309
|
"unimported": "unimported",
|
310
|
-
"coverage": "env-cmd -f .ci.unit.env pnpm jest --coverage --ci
|
310
|
+
"coverage": "env-cmd -f .ci.unit.env pnpm jest --coverage --ci"
|
311
311
|
}
|
312
312
|
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { isCALIntegrationEnabled, getCALStore } from "./cal-integration";
|
2
|
+
import { CALStore } from "./cal-store";
|
3
|
+
import { isFeature } from "../../featureFlags/firebaseFeatureFlags";
|
4
|
+
|
5
|
+
jest.mock("../../featureFlags/firebaseFeatureFlags", () => ({
|
6
|
+
isFeature: jest.fn(),
|
7
|
+
}));
|
8
|
+
|
9
|
+
const mockIsFeature = jest.mocked(isFeature);
|
10
|
+
|
11
|
+
describe("CAL Integration", () => {
|
12
|
+
beforeEach(() => {
|
13
|
+
mockIsFeature.mockClear();
|
14
|
+
});
|
15
|
+
|
16
|
+
describe("isCALIntegrationEnabled", () => {
|
17
|
+
it("should return false when feature flag is disabled", () => {
|
18
|
+
mockIsFeature.mockReturnValue(false);
|
19
|
+
|
20
|
+
expect(isCALIntegrationEnabled()).toBe(false);
|
21
|
+
expect(mockIsFeature).toHaveBeenCalledWith("calLedgerService");
|
22
|
+
});
|
23
|
+
|
24
|
+
it("should return true when feature flag is enabled (assuming MOCK is false)", () => {
|
25
|
+
mockIsFeature.mockReturnValue(true);
|
26
|
+
|
27
|
+
const result = isCALIntegrationEnabled();
|
28
|
+
expect(mockIsFeature).toHaveBeenCalledWith("calLedgerService");
|
29
|
+
expect(result).toEqual(true);
|
30
|
+
});
|
31
|
+
|
32
|
+
it("should return false when feature check throws", () => {
|
33
|
+
mockIsFeature.mockImplementation(() => {
|
34
|
+
throw new Error("Feature check error");
|
35
|
+
});
|
36
|
+
|
37
|
+
expect(isCALIntegrationEnabled()).toBe(false);
|
38
|
+
});
|
39
|
+
});
|
40
|
+
|
41
|
+
describe("getCALStore", () => {
|
42
|
+
it("should return a CALStore instance", () => {
|
43
|
+
const store = getCALStore();
|
44
|
+
expect(store).toBeInstanceOf(CALStore);
|
45
|
+
});
|
46
|
+
|
47
|
+
it("should return the same instance on multiple calls", () => {
|
48
|
+
const store1 = getCALStore();
|
49
|
+
const store2 = getCALStore();
|
50
|
+
expect(store1).toBe(store2);
|
51
|
+
});
|
52
|
+
});
|
53
|
+
});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { getEnv } from "@ledgerhq/live-env";
|
2
|
+
import { log } from "@ledgerhq/logs";
|
3
|
+
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
4
|
+
import { CALStore } from "./cal-store";
|
5
|
+
import { isFeature } from "../../featureFlags/firebaseFeatureFlags";
|
6
|
+
|
7
|
+
let calStoreInstance: CALStore | undefined;
|
8
|
+
|
9
|
+
export function isCALIntegrationEnabled(): boolean {
|
10
|
+
try {
|
11
|
+
return !getEnv("MOCK") && isFeature("calLedgerService");
|
12
|
+
} catch (error) {
|
13
|
+
log("cal", "Error checking CAL integration:", error);
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
export function getCALStore(): CryptoAssetsStore {
|
19
|
+
if (!calStoreInstance) {
|
20
|
+
calStoreInstance = new CALStore();
|
21
|
+
}
|
22
|
+
return calStoreInstance;
|
23
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import { CALStore } from "./cal-store";
|
2
|
+
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
3
|
+
|
4
|
+
describe("CALStore", () => {
|
5
|
+
let store: CALStore;
|
6
|
+
|
7
|
+
beforeEach(() => {
|
8
|
+
store = new CALStore();
|
9
|
+
});
|
10
|
+
|
11
|
+
describe("Token cache operations", () => {
|
12
|
+
const token = {
|
13
|
+
id: "ethereum/erc20/usdt",
|
14
|
+
name: "Tether USD",
|
15
|
+
ticker: "USDT",
|
16
|
+
contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
17
|
+
parentCurrency: { id: "ethereum" },
|
18
|
+
type: "TokenCurrency",
|
19
|
+
units: [
|
20
|
+
{
|
21
|
+
name: "USDT",
|
22
|
+
code: "USDT",
|
23
|
+
magnitude: 6,
|
24
|
+
},
|
25
|
+
],
|
26
|
+
} as TokenCurrency;
|
27
|
+
|
28
|
+
it("should store and retrieve tokens by ID", () => {
|
29
|
+
store.addTokens([token]);
|
30
|
+
|
31
|
+
const foundToken = store.findTokenById("ethereum/erc20/usdt");
|
32
|
+
expect(foundToken).toEqual(token);
|
33
|
+
});
|
34
|
+
|
35
|
+
it("should store and retrieve tokens by address", () => {
|
36
|
+
store.addTokens([token]);
|
37
|
+
|
38
|
+
const foundToken = store.findTokenByAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7");
|
39
|
+
expect(foundToken).toEqual(token);
|
40
|
+
});
|
41
|
+
|
42
|
+
it("should store and retrieve tokens by ticker", () => {
|
43
|
+
store.addTokens([token]);
|
44
|
+
|
45
|
+
const foundToken = store.findTokenByTicker("USDT");
|
46
|
+
expect(foundToken).toEqual(token);
|
47
|
+
});
|
48
|
+
|
49
|
+
it("should find token by address in specific currency", () => {
|
50
|
+
store.addTokens([token]);
|
51
|
+
|
52
|
+
const foundToken = store.findTokenByAddressInCurrency(
|
53
|
+
"0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
54
|
+
"ethereum",
|
55
|
+
);
|
56
|
+
expect(foundToken).toEqual(token);
|
57
|
+
});
|
58
|
+
|
59
|
+
it("should not find token by address in different currency", () => {
|
60
|
+
store.addTokens([token]);
|
61
|
+
|
62
|
+
const foundToken = store.findTokenByAddressInCurrency(
|
63
|
+
"0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
64
|
+
"polygon",
|
65
|
+
);
|
66
|
+
expect(foundToken).toBeUndefined();
|
67
|
+
});
|
68
|
+
|
69
|
+
it("should return undefined for non-existent address in findTokenByAddressInCurrency", () => {
|
70
|
+
store.addTokens([token]);
|
71
|
+
|
72
|
+
const foundToken = store.findTokenByAddressInCurrency("0xNONEXISTENT", "ethereum");
|
73
|
+
expect(foundToken).toBeUndefined();
|
74
|
+
});
|
75
|
+
|
76
|
+
it("should return undefined for non-existent tokens", () => {
|
77
|
+
expect(store.findTokenById("non-existent")).toBeUndefined();
|
78
|
+
expect(store.findTokenByAddress("0x0000")).toBeUndefined();
|
79
|
+
expect(store.findTokenByTicker("FAKE")).toBeUndefined();
|
80
|
+
});
|
81
|
+
|
82
|
+
it("should throw error when getting non-existent token by ID", () => {
|
83
|
+
expect(() => store.getTokenById("non-existent")).toThrow("Token not found: non-existent");
|
84
|
+
});
|
85
|
+
|
86
|
+
it("should get existing token by ID", () => {
|
87
|
+
store.addTokens([token]);
|
88
|
+
|
89
|
+
const foundToken = store.getTokenById("ethereum/erc20/usdt");
|
90
|
+
expect(foundToken).toEqual(token);
|
91
|
+
});
|
92
|
+
});
|
93
|
+
});
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
2
|
+
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
3
|
+
|
4
|
+
// Coins with case-sensitive addresses (b58, ...)
|
5
|
+
const CASE_SENSITIVE_COINS = ["solana"];
|
6
|
+
|
7
|
+
export class CALStore implements CryptoAssetsStore {
|
8
|
+
private tokenCache = new Map<string, TokenCurrency>();
|
9
|
+
private addressCache = new Map<string, TokenCurrency>();
|
10
|
+
private tickerCache = new Map<string, TokenCurrency>();
|
11
|
+
|
12
|
+
addTokens(tokens: TokenCurrency[]) {
|
13
|
+
tokens.forEach(token => {
|
14
|
+
this.tokenCache.set(token.id, token);
|
15
|
+
if (token.contractAddress) {
|
16
|
+
const isCaseSensitive = CASE_SENSITIVE_COINS.includes(token.parentCurrency.id);
|
17
|
+
const normalizedAddress = isCaseSensitive
|
18
|
+
? token.contractAddress
|
19
|
+
: token.contractAddress.toLowerCase();
|
20
|
+
this.addressCache.set(normalizedAddress, token);
|
21
|
+
}
|
22
|
+
this.tickerCache.set(token.ticker, token);
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
26
|
+
findTokenByAddress(address: string): TokenCurrency | undefined {
|
27
|
+
const exactMatch = this.addressCache.get(address);
|
28
|
+
if (exactMatch) return exactMatch;
|
29
|
+
|
30
|
+
const lowercaseMatch = this.addressCache.get(address.toLowerCase());
|
31
|
+
return lowercaseMatch;
|
32
|
+
}
|
33
|
+
|
34
|
+
getTokenById(id: string): TokenCurrency {
|
35
|
+
const token = this.tokenCache.get(id);
|
36
|
+
if (!token) {
|
37
|
+
throw new Error(`Token not found: ${id}`);
|
38
|
+
}
|
39
|
+
return token;
|
40
|
+
}
|
41
|
+
|
42
|
+
findTokenById(id: string): TokenCurrency | undefined {
|
43
|
+
return this.tokenCache.get(id);
|
44
|
+
}
|
45
|
+
|
46
|
+
findTokenByAddressInCurrency(address: string, currencyId: string): TokenCurrency | undefined {
|
47
|
+
const isCaseSensitive = CASE_SENSITIVE_COINS.includes(currencyId);
|
48
|
+
|
49
|
+
if (isCaseSensitive) {
|
50
|
+
const token = this.addressCache.get(address);
|
51
|
+
if (token && token.parentCurrency.id === currencyId) return token;
|
52
|
+
return undefined;
|
53
|
+
}
|
54
|
+
|
55
|
+
const token = this.addressCache.get(address.toLowerCase());
|
56
|
+
if (token && token.parentCurrency.id === currencyId) return token;
|
57
|
+
return undefined;
|
58
|
+
}
|
59
|
+
|
60
|
+
findTokenByTicker(ticker: string): TokenCurrency | undefined {
|
61
|
+
return this.tickerCache.get(ticker);
|
62
|
+
}
|
63
|
+
}
|
@@ -2,8 +2,22 @@ import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
2
2
|
import { getCryptoAssetsStore, setCryptoAssetsStore } from ".";
|
3
3
|
import * as legacy from "@ledgerhq/cryptoassets/tokens";
|
4
4
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
5
|
+
import * as calIntegration from "./cal-integration";
|
5
6
|
|
6
7
|
describe("Testing CryptoAssetStore", () => {
|
8
|
+
let isCALIntegrationEnabledSpy: jest.SpyInstance;
|
9
|
+
let getCALStoreSpy: jest.SpyInstance;
|
10
|
+
|
11
|
+
beforeEach(() => {
|
12
|
+
isCALIntegrationEnabledSpy = jest
|
13
|
+
.spyOn(calIntegration, "isCALIntegrationEnabled")
|
14
|
+
.mockReturnValue(false);
|
15
|
+
getCALStoreSpy = jest.spyOn(calIntegration, "getCALStore");
|
16
|
+
});
|
17
|
+
|
18
|
+
afterEach(() => {
|
19
|
+
jest.restoreAllMocks();
|
20
|
+
});
|
7
21
|
it("should return the default methods from cryptoassets libs when feature flag does not exists", () => {
|
8
22
|
LiveConfig.setConfig({
|
9
23
|
some_other_feature: {
|
@@ -68,4 +82,37 @@ describe("Testing CryptoAssetStore", () => {
|
|
68
82
|
const store = getCryptoAssetsStore();
|
69
83
|
expect(store).toBe(newStore);
|
70
84
|
});
|
85
|
+
|
86
|
+
it("should return CAL store when CAL integration is enabled", () => {
|
87
|
+
isCALIntegrationEnabledSpy.mockReturnValue(true);
|
88
|
+
|
89
|
+
const mockCALStore = {} as unknown as CryptoAssetsStore;
|
90
|
+
getCALStoreSpy.mockReturnValue(mockCALStore);
|
91
|
+
|
92
|
+
const store = getCryptoAssetsStore();
|
93
|
+
|
94
|
+
expect(isCALIntegrationEnabledSpy).toHaveBeenCalled();
|
95
|
+
expect(getCALStoreSpy).toHaveBeenCalled();
|
96
|
+
expect(store).toBe(mockCALStore);
|
97
|
+
});
|
98
|
+
|
99
|
+
it("should prioritize CAL integration over feature flags", () => {
|
100
|
+
isCALIntegrationEnabledSpy.mockReturnValue(true);
|
101
|
+
|
102
|
+
LiveConfig.setConfig({
|
103
|
+
feature_cal_lazy_loading: {
|
104
|
+
type: "boolean",
|
105
|
+
default: true,
|
106
|
+
},
|
107
|
+
});
|
108
|
+
|
109
|
+
const mockCALStore = {} as unknown as CryptoAssetsStore;
|
110
|
+
getCALStoreSpy.mockReturnValue(mockCALStore);
|
111
|
+
|
112
|
+
const store = getCryptoAssetsStore();
|
113
|
+
|
114
|
+
expect(store).toBe(mockCALStore);
|
115
|
+
expect(isCALIntegrationEnabledSpy).toHaveBeenCalled();
|
116
|
+
expect(getCALStoreSpy).toHaveBeenCalled();
|
117
|
+
});
|
71
118
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
2
2
|
import * as legacy from "@ledgerhq/cryptoassets/tokens";
|
3
3
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
4
|
+
import { isCALIntegrationEnabled, getCALStore } from "./cal-integration";
|
4
5
|
|
5
6
|
const legacyStore: CryptoAssetsStore = {
|
6
7
|
findTokenByAddress: legacy.findTokenByAddress,
|
@@ -17,6 +18,10 @@ export function setCryptoAssetsStore(store: CryptoAssetsStore) {
|
|
17
18
|
}
|
18
19
|
|
19
20
|
export function getCryptoAssetsStore(): CryptoAssetsStore {
|
21
|
+
if (isCALIntegrationEnabled()) {
|
22
|
+
return getCALStore();
|
23
|
+
}
|
24
|
+
|
20
25
|
const featureEnabled =
|
21
26
|
LiveConfig.isConfigSet() && LiveConfig.getValueByKey("feature_cal_lazy_loading");
|
22
27
|
if (!featureEnabled) {
|
@@ -1,16 +1,19 @@
|
|
1
1
|
import { createApi as createXrpApi } from "@ledgerhq/coin-xrp/api/index";
|
2
2
|
import { createApi as createStellarApi } from "@ledgerhq/coin-stellar/api/index";
|
3
|
+
import { createApi as createCantonApi } from "@ledgerhq/coin-canton/api/index";
|
4
|
+
import { createApi as createTronApi } from "@ledgerhq/coin-tron/api/index";
|
3
5
|
import { getCurrencyConfiguration } from "../../../config";
|
4
6
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
5
7
|
import { getNetworkAlpacaApi } from "./network/network-alpaca";
|
6
8
|
import { Api } from "@ledgerhq/coin-framework/api/types";
|
7
9
|
import { XrpCoinConfig } from "@ledgerhq/coin-xrp/config";
|
8
10
|
import { StellarCoinConfig } from "@ledgerhq/coin-stellar/config";
|
11
|
+
import { CantonCoinConfig } from "@ledgerhq/coin-canton/config";
|
12
|
+
import { TronCoinConfig } from "@ledgerhq/coin-tron/config";
|
9
13
|
|
10
14
|
export function getAlpacaApi(network, kind): Api<any> {
|
11
15
|
if (kind === "local") {
|
12
16
|
switch (network) {
|
13
|
-
case "ripple":
|
14
17
|
case "xrp":
|
15
18
|
return createXrpApi(
|
16
19
|
getCurrencyConfiguration<XrpCoinConfig>(getCryptoCurrencyById("ripple")),
|
@@ -19,6 +22,16 @@ export function getAlpacaApi(network, kind): Api<any> {
|
|
19
22
|
return createStellarApi(
|
20
23
|
getCurrencyConfiguration<StellarCoinConfig>(getCryptoCurrencyById("stellar")),
|
21
24
|
) as Api<any>;
|
25
|
+
case "canton":
|
26
|
+
return createCantonApi(
|
27
|
+
getCurrencyConfiguration<CantonCoinConfig>(
|
28
|
+
getCryptoCurrencyById("canton_network_devnet"),
|
29
|
+
),
|
30
|
+
) as Api<any>;
|
31
|
+
case "tron":
|
32
|
+
return createTronApi(
|
33
|
+
getCurrencyConfiguration<TronCoinConfig>(getCryptoCurrencyById("tron")),
|
34
|
+
) as Api<any>;
|
22
35
|
}
|
23
36
|
}
|
24
37
|
return getNetworkAlpacaApi(network) satisfies Partial<Api<any>> as Api<any>;
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import { getAlpacaApi } from "./index";
|
2
|
+
import * as xrpModule from "@ledgerhq/coin-xrp/api/index";
|
3
|
+
import * as stellarModule from "@ledgerhq/coin-stellar/api/index";
|
4
|
+
import * as cantonModule from "@ledgerhq/coin-canton/api/index";
|
5
|
+
import * as tronModule from "@ledgerhq/coin-tron/api/index";
|
6
|
+
import * as config from "../../../config";
|
7
|
+
import * as networkApi from "./network/network-alpaca";
|
8
|
+
import * as cryptoAssets from "@ledgerhq/cryptoassets/currencies";
|
9
|
+
|
10
|
+
const mockApiInstance = { mock: "api" };
|
11
|
+
|
12
|
+
jest.mock("@ledgerhq/cryptoassets/currencies", () => ({
|
13
|
+
getCryptoCurrencyById: jest.fn(),
|
14
|
+
}));
|
15
|
+
|
16
|
+
jest.mock("../../../config", () => ({
|
17
|
+
getCurrencyConfiguration: jest.fn(),
|
18
|
+
}));
|
19
|
+
|
20
|
+
jest.mock("@ledgerhq/coin-xrp/api/index", () => ({
|
21
|
+
createApi: jest.fn(),
|
22
|
+
}));
|
23
|
+
|
24
|
+
jest.mock("@ledgerhq/coin-stellar/api/index", () => ({
|
25
|
+
createApi: jest.fn(),
|
26
|
+
}));
|
27
|
+
|
28
|
+
jest.mock("@ledgerhq/coin-canton/api/index", () => ({
|
29
|
+
createApi: jest.fn(),
|
30
|
+
}));
|
31
|
+
|
32
|
+
jest.mock("@ledgerhq/coin-tron/api/index", () => ({
|
33
|
+
createApi: jest.fn(),
|
34
|
+
}));
|
35
|
+
|
36
|
+
jest.mock("./network/network-alpaca", () => ({
|
37
|
+
getNetworkAlpacaApi: jest.fn(),
|
38
|
+
}));
|
39
|
+
|
40
|
+
describe("getAlpacaApi", () => {
|
41
|
+
const mockCurrency = { id: "mock-currency" };
|
42
|
+
|
43
|
+
beforeEach(() => {
|
44
|
+
jest.clearAllMocks();
|
45
|
+
|
46
|
+
// Common mocks
|
47
|
+
(cryptoAssets.getCryptoCurrencyById as jest.Mock).mockReturnValue(mockCurrency);
|
48
|
+
(config.getCurrencyConfiguration as jest.Mock).mockReturnValue({ config: true });
|
49
|
+
|
50
|
+
// API mocks
|
51
|
+
jest.spyOn(xrpModule, "createApi").mockReturnValue(mockApiInstance as any);
|
52
|
+
jest.spyOn(stellarModule, "createApi").mockReturnValue(mockApiInstance as any);
|
53
|
+
jest.spyOn(cantonModule, "createApi").mockReturnValue(mockApiInstance as any);
|
54
|
+
jest.spyOn(tronModule, "createApi").mockReturnValue(mockApiInstance as any);
|
55
|
+
jest.spyOn(networkApi, "getNetworkAlpacaApi").mockReturnValue(mockApiInstance as any);
|
56
|
+
});
|
57
|
+
|
58
|
+
const testCases = [
|
59
|
+
{ network: "xrp", module: xrpModule, label: "XRP" },
|
60
|
+
{ network: "stellar", module: stellarModule, label: "Stellar" },
|
61
|
+
{ network: "tron", module: tronModule, label: "Tron" },
|
62
|
+
{ network: "canton", module: cantonModule, label: "Canton" },
|
63
|
+
];
|
64
|
+
|
65
|
+
testCases.forEach(({ network, module, label }) => {
|
66
|
+
it(`should return ${label} API for network "${network}" and kind "local"`, () => {
|
67
|
+
const result = getAlpacaApi(network, "local");
|
68
|
+
expect(result).toEqual(mockApiInstance);
|
69
|
+
expect(module.createApi).toHaveBeenCalledWith({ config: true });
|
70
|
+
});
|
71
|
+
});
|
72
|
+
|
73
|
+
it("should return network API for kind !== 'local'", () => {
|
74
|
+
const result = getAlpacaApi("xrp", "remote");
|
75
|
+
expect(networkApi.getNetworkAlpacaApi).toHaveBeenCalledWith("xrp");
|
76
|
+
expect(result).toEqual(mockApiInstance);
|
77
|
+
});
|
78
|
+
});
|
@@ -134,7 +134,7 @@ const buildGetSequence = (networkFamily: string) =>
|
|
134
134
|
const buildListOperations = networkFamily =>
|
135
135
|
async function listOperations(
|
136
136
|
address: string,
|
137
|
-
pagination: Pagination = { minHeight: 0 },
|
137
|
+
pagination: Pagination = { minHeight: 0, order: "asc" },
|
138
138
|
): Promise<[Operation<any>[], string]> {
|
139
139
|
const { data } = await network<{ operations: Operation<any>[] }, unknown>({
|
140
140
|
method: "GET",
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import BigNumber from "bignumber.js";
|
2
|
-
import { emptyHistoryCache } from "@ledgerhq/coin-framework/account/index";
|
2
|
+
import { emptyHistoryCache, encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
|
3
3
|
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
4
4
|
import type { Operation, SyncConfig, TokenAccount } from "@ledgerhq/types-live";
|
5
5
|
import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
|
6
6
|
import { listTokensForCryptoCurrency } from "@ledgerhq/cryptoassets";
|
7
7
|
import { AssetInfo, Balance } from "@ledgerhq/coin-framework/api/types";
|
8
|
-
import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
9
8
|
|
10
9
|
export interface OperationCommon extends Operation {
|
11
10
|
extra: Record<string, any>;
|
@@ -13,11 +12,6 @@ export interface OperationCommon extends Operation {
|
|
13
12
|
|
14
13
|
export const getAssetIdFromTokenId = (tokenId: string): string => tokenId.split("/")[2];
|
15
14
|
|
16
|
-
export const getAssetIdFromAsset = (asset: AssetInfo) =>
|
17
|
-
asset.type !== "native" && "assetReference" in asset && "assetOwner" in asset
|
18
|
-
? `${asset.assetReference}:${asset.assetOwner}`
|
19
|
-
: "";
|
20
|
-
|
21
15
|
function buildTokenAccount({
|
22
16
|
parentAccountId,
|
23
17
|
assetBalance,
|
@@ -29,8 +23,7 @@ function buildTokenAccount({
|
|
29
23
|
token: TokenCurrency;
|
30
24
|
operations: OperationCommon[];
|
31
25
|
}): TokenAccount {
|
32
|
-
const
|
33
|
-
const id = `${parentAccountId}+${assetId}`;
|
26
|
+
const id = encodeTokenAccountId(parentAccountId, token);
|
34
27
|
const balance = new BigNumber(assetBalance.value.toString() || "0");
|
35
28
|
|
36
29
|
// TODO: recheck this logic
|
@@ -68,12 +61,14 @@ export function buildSubAccounts({
|
|
68
61
|
assetsBalance,
|
69
62
|
syncConfig,
|
70
63
|
operations,
|
64
|
+
getTokenFromAsset,
|
71
65
|
}: {
|
72
66
|
currency: CryptoCurrency;
|
73
67
|
accountId: string;
|
74
68
|
assetsBalance: Balance[];
|
75
69
|
syncConfig: SyncConfig;
|
76
70
|
operations: OperationCommon[];
|
71
|
+
getTokenFromAsset?: (asset: AssetInfo) => TokenCurrency | undefined;
|
77
72
|
}): TokenAccount[] | undefined {
|
78
73
|
const { blacklistedTokenIds = [] } = syncConfig;
|
79
74
|
const allTokens = listTokensForCryptoCurrency(currency);
|
@@ -85,7 +80,7 @@ export function buildSubAccounts({
|
|
85
80
|
assetsBalance
|
86
81
|
.filter(b => b.asset.type !== "native") // NOTE: this could be removed, keeping here while fixing things up
|
87
82
|
.map(balance => {
|
88
|
-
const token =
|
83
|
+
const token = getTokenFromAsset && getTokenFromAsset(balance.asset);
|
89
84
|
// NOTE: for future tokens, will need to check over currencyName/standard(erc20,trc10,trc20, etc)/id
|
90
85
|
if (token && !blacklistedTokenIds.includes(token.id)) {
|
91
86
|
tokenAccounts.push(
|
@@ -104,7 +99,3 @@ export function buildSubAccounts({
|
|
104
99
|
});
|
105
100
|
return tokenAccounts;
|
106
101
|
}
|
107
|
-
|
108
|
-
export function findToken(currency: CryptoCurrency, balance: Balance): TokenCurrency | undefined {
|
109
|
-
return findTokenById(`${currency.family}/asset/${getAssetIdFromAsset(balance.asset)}`);
|
110
|
-
}
|