@ledgerhq/live-common 34.3.0-nightly.9 → 35.0.0-next.6
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/__tests__/test-helpers/environment.js +4 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/apps/listApps/v2.d.ts +2 -2
- package/lib/apps/listApps/v2.d.ts.map +1 -1
- package/lib/apps/listApps/v2.test.js +122 -0
- package/lib/apps/listApps/v2.test.js.map +1 -1
- package/lib/apps/mock.d.ts +2 -1
- package/lib/apps/mock.d.ts.map +1 -1
- package/lib/apps/mock.js +6 -1
- package/lib/apps/mock.js.map +1 -1
- package/lib/apps/react.test.js +1 -0
- package/lib/apps/react.test.js.map +1 -1
- package/lib/device/use-cases/listAppsUseCase.d.ts.map +1 -1
- package/lib/device/use-cases/listAppsUseCase.js +1 -0
- package/lib/device/use-cases/listAppsUseCase.js.map +1 -1
- package/lib/deviceSDK/actions/getLatestAvailableFirmware.test.js +3 -3
- package/lib/deviceSDK/actions/getLatestAvailableFirmware.test.js.map +1 -1
- package/lib/deviceSDK/tasks/core.js +1 -1
- package/lib/deviceSDK/tasks/core.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/exchange/providers/swap.d.ts.map +1 -1
- package/lib/exchange/providers/swap.js +6 -1
- package/lib/exchange/providers/swap.js.map +1 -1
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyAll.spec.js +2 -1
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyAll.spec.js.map +1 -1
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js +2 -0
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js.map +1 -1
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js +3 -0
- package/lib/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyAll.d.ts +2 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyAll.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyAll.js +1 -2
- package/lib/exchange/swap/api/v5/fetchCurrencyAll.js.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.d.ts +2 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.js +1 -2
- package/lib/exchange/swap/api/v5/fetchCurrencyFrom.js.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.d.ts +2 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.js +1 -2
- package/lib/exchange/swap/api/v5/fetchCurrencyTo.js.map +1 -1
- package/lib/exchange/swap/api/v5/fetchRates.d.ts +2 -2
- package/lib/exchange/swap/api/v5/fetchRates.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/fetchRates.js +1 -5
- package/lib/exchange/swap/api/v5/fetchRates.js.map +1 -1
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +2 -1
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +4 -3
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js +5 -4
- package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.js +4 -0
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyAll.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyFrom.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyFrom.js +4 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyFrom.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyTo.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyTo.js +4 -2
- package/lib/exchange/swap/hooks/v5/useFetchCurrencyTo.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchRates.d.ts +3 -2
- package/lib/exchange/swap/hooks/v5/useFetchRates.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFetchRates.js +12 -9
- package/lib/exchange/swap/hooks/v5/useFetchRates.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useFilteredProviders.d.ts +6 -0
- package/lib/exchange/swap/hooks/v5/useFilteredProviders.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/v5/useFilteredProviders.js +51 -0
- package/lib/exchange/swap/hooks/v5/useFilteredProviders.js.map +1 -0
- package/lib/exchange/swap/hooks/v5/useProviderRates.d.ts +2 -1
- package/lib/exchange/swap/hooks/v5/useProviderRates.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useProviderRates.js +5 -12
- package/lib/exchange/swap/hooks/v5/useProviderRates.js.map +1 -1
- package/lib/exchange/swap/initSwap.d.ts.map +1 -1
- package/lib/exchange/swap/initSwap.js +2 -1
- package/lib/exchange/swap/initSwap.js.map +1 -1
- package/lib/families/cosmos/bridge/mock.js +1 -1
- package/lib/families/evm/config.d.ts.map +1 -1
- package/lib/families/evm/config.js +32 -0
- package/lib/families/evm/config.js.map +1 -1
- package/lib/families/stacks/__tests__/sync.integration.test.js +1 -1
- package/lib/families/stacks/__tests__/sync.integration.test.js.map +1 -1
- package/lib/families/stacks/bridge/utils/api.d.ts.map +1 -1
- package/lib/families/stacks/bridge/utils/api.js +9 -3
- package/lib/families/stacks/bridge/utils/api.js.map +1 -1
- package/lib/families/stacks/bridge/utils/api.types.d.ts +80 -10
- package/lib/families/stacks/bridge/utils/api.types.d.ts.map +1 -1
- package/lib/families/stacks/bridge/utils/misc.d.ts +1 -1
- package/lib/families/stacks/bridge/utils/misc.d.ts.map +1 -1
- package/lib/families/stacks/bridge/utils/misc.js +29 -21
- package/lib/families/stacks/bridge/utils/misc.js.map +1 -1
- package/lib/families/stacks/bridge/utils/misc.unit.test.js +83 -69
- package/lib/families/stacks/bridge/utils/misc.unit.test.js.map +1 -1
- package/lib/families/stacks/synchronization.js +1 -1
- package/lib/families/stacks/synchronization.js.map +1 -1
- package/lib/families/tron/api/index.js +2 -2
- package/lib/families/tron/api/index.js.map +1 -1
- package/lib/families/tron/signOperation.d.ts.map +1 -1
- package/lib/families/tron/signOperation.js +0 -11
- package/lib/families/tron/signOperation.js.map +1 -1
- package/lib/families/tron/synchronization.d.ts.map +1 -1
- package/lib/families/tron/synchronization.js +35 -3
- package/lib/families/tron/synchronization.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +5 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +11 -5
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/firebaseFeatureFlags.d.ts +9 -3
- package/lib/featureFlags/firebaseFeatureFlags.d.ts.map +1 -1
- package/lib/featureFlags/groupedFeatures.d.ts +2 -1
- package/lib/featureFlags/groupedFeatures.d.ts.map +1 -1
- package/lib/featureFlags/groupedFeatures.js +0 -3
- package/lib/featureFlags/groupedFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/deviceTransactionConfig.d.ts +1 -1
- package/lib/generated/transaction.d.ts +2 -2
- package/lib/helpers.d.ts +1 -0
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +5 -1
- package/lib/helpers.js.map +1 -1
- package/lib/hw/getOnboardingStatePolling.js +1 -1
- package/lib/hw/getOnboardingStatePolling.js.map +1 -1
- package/lib/market/api/index.d.ts +8 -0
- package/lib/market/api/index.d.ts.map +1 -0
- package/lib/market/api/index.js +112 -0
- package/lib/market/api/index.js.map +1 -0
- package/lib/market/hooks/useMarketDataProvider.d.ts +13 -0
- package/lib/market/hooks/useMarketDataProvider.d.ts.map +1 -0
- package/lib/market/{v2 → hooks}/useMarketDataProvider.js +36 -39
- package/lib/market/hooks/useMarketDataProvider.js.map +1 -0
- package/lib/market/{v2 → hooks}/useMarketPerformers.d.ts +1 -1
- package/lib/market/hooks/useMarketPerformers.d.ts.map +1 -0
- package/lib/market/{v2 → hooks}/useMarketPerformers.js +3 -3
- package/lib/market/hooks/useMarketPerformers.js.map +1 -0
- package/lib/market/utils/currencyFormatter.d.ts +3 -26
- package/lib/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib/market/utils/currencyFormatter.js +35 -31
- package/lib/market/utils/currencyFormatter.js.map +1 -1
- package/lib/market/utils/index.d.ts +5 -0
- package/lib/market/utils/index.d.ts.map +1 -0
- package/lib/market/utils/index.js +37 -0
- package/lib/market/utils/index.js.map +1 -0
- package/lib/market/utils/queryKeys.d.ts.map +1 -0
- package/lib/market/utils/queryKeys.js.map +1 -0
- package/lib/market/utils/timers.d.ts.map +1 -0
- package/lib/market/utils/timers.js.map +1 -0
- package/lib/market/{types.d.ts → utils/types.d.ts} +35 -53
- package/lib/market/utils/types.d.ts.map +1 -0
- package/lib/market/utils/types.js +19 -0
- package/lib/market/utils/types.js.map +1 -0
- package/lib/platform/converters.d.ts.map +1 -1
- package/lib/platform/converters.js +4 -5
- package/lib/platform/converters.js.map +1 -1
- package/lib/platform/types.d.ts +6 -1
- package/lib/platform/types.d.ts.map +1 -1
- package/lib/platform/types.js +11 -2
- package/lib/platform/types.js.map +1 -1
- package/lib/wallet-api/constants.d.ts +6 -1
- package/lib/wallet-api/constants.d.ts.map +1 -1
- package/lib/wallet-api/constants.js +8 -2
- package/lib/wallet-api/constants.js.map +1 -1
- package/lib/wallet-api/converters.d.ts +1 -1
- package/lib/wallet-api/converters.d.ts.map +1 -1
- package/lib/wallet-api/converters.js +6 -5
- package/lib/wallet-api/converters.js.map +1 -1
- package/lib-es/__tests__/test-helpers/environment.js +4 -0
- package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
- package/lib-es/apps/listApps/v2.d.ts +2 -2
- package/lib-es/apps/listApps/v2.d.ts.map +1 -1
- package/lib-es/apps/listApps/v2.test.js +122 -0
- package/lib-es/apps/listApps/v2.test.js.map +1 -1
- package/lib-es/apps/mock.d.ts +2 -1
- package/lib-es/apps/mock.d.ts.map +1 -1
- package/lib-es/apps/mock.js +4 -0
- package/lib-es/apps/mock.js.map +1 -1
- package/lib-es/apps/react.test.js +1 -0
- package/lib-es/apps/react.test.js.map +1 -1
- package/lib-es/device/use-cases/listAppsUseCase.d.ts.map +1 -1
- package/lib-es/device/use-cases/listAppsUseCase.js +1 -0
- package/lib-es/device/use-cases/listAppsUseCase.js.map +1 -1
- package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.test.js +4 -4
- package/lib-es/deviceSDK/actions/getLatestAvailableFirmware.test.js.map +1 -1
- package/lib-es/deviceSDK/tasks/core.js +2 -2
- package/lib-es/deviceSDK/tasks/core.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/providers/swap.d.ts.map +1 -1
- package/lib-es/exchange/providers/swap.js +6 -1
- package/lib-es/exchange/providers/swap.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyAll.spec.js +2 -1
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyAll.spec.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js +2 -0
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js +3 -0
- package/lib-es/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyAll.d.ts +2 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyAll.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyAll.js +2 -3
- package/lib-es/exchange/swap/api/v5/fetchCurrencyAll.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.d.ts +2 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.js +2 -3
- package/lib-es/exchange/swap/api/v5/fetchCurrencyFrom.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.d.ts +2 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.js +2 -3
- package/lib-es/exchange/swap/api/v5/fetchCurrencyTo.js.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchRates.d.ts +2 -2
- package/lib-es/exchange/swap/api/v5/fetchRates.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchRates.js +2 -6
- package/lib-es/exchange/swap/api/v5/fetchRates.js.map +1 -1
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +2 -1
- package/lib-es/exchange/swap/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts +4 -3
- package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/useSwapTransaction.js +5 -4
- package/lib-es/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.js +4 -0
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyAll.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyFrom.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyFrom.js +4 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyFrom.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyTo.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyTo.js +4 -2
- package/lib-es/exchange/swap/hooks/v5/useFetchCurrencyTo.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.d.ts +3 -2
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.js +12 -9
- package/lib-es/exchange/swap/hooks/v5/useFetchRates.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.d.ts +6 -0
- package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.d.ts.map +1 -0
- package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.js +47 -0
- package/lib-es/exchange/swap/hooks/v5/useFilteredProviders.js.map +1 -0
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.d.ts +2 -1
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.js +6 -13
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.js.map +1 -1
- package/lib-es/exchange/swap/initSwap.d.ts.map +1 -1
- package/lib-es/exchange/swap/initSwap.js +2 -1
- package/lib-es/exchange/swap/initSwap.js.map +1 -1
- package/lib-es/families/cosmos/bridge/mock.js +1 -1
- package/lib-es/families/evm/config.d.ts.map +1 -1
- package/lib-es/families/evm/config.js +32 -0
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/families/stacks/__tests__/sync.integration.test.js +1 -1
- package/lib-es/families/stacks/__tests__/sync.integration.test.js.map +1 -1
- package/lib-es/families/stacks/bridge/utils/api.d.ts.map +1 -1
- package/lib-es/families/stacks/bridge/utils/api.js +9 -3
- package/lib-es/families/stacks/bridge/utils/api.js.map +1 -1
- package/lib-es/families/stacks/bridge/utils/api.types.d.ts +80 -10
- package/lib-es/families/stacks/bridge/utils/api.types.d.ts.map +1 -1
- package/lib-es/families/stacks/bridge/utils/misc.d.ts +1 -1
- package/lib-es/families/stacks/bridge/utils/misc.d.ts.map +1 -1
- package/lib-es/families/stacks/bridge/utils/misc.js +30 -22
- package/lib-es/families/stacks/bridge/utils/misc.js.map +1 -1
- package/lib-es/families/stacks/bridge/utils/misc.unit.test.js +83 -66
- package/lib-es/families/stacks/bridge/utils/misc.unit.test.js.map +1 -1
- package/lib-es/families/stacks/synchronization.js +1 -1
- package/lib-es/families/stacks/synchronization.js.map +1 -1
- package/lib-es/families/tron/api/index.js +2 -2
- package/lib-es/families/tron/api/index.js.map +1 -1
- package/lib-es/families/tron/signOperation.d.ts.map +1 -1
- package/lib-es/families/tron/signOperation.js +1 -12
- package/lib-es/families/tron/signOperation.js.map +1 -1
- package/lib-es/families/tron/synchronization.d.ts.map +1 -1
- package/lib-es/families/tron/synchronization.js +35 -3
- package/lib-es/families/tron/synchronization.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +5 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +11 -5
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/firebaseFeatureFlags.d.ts +9 -3
- package/lib-es/featureFlags/firebaseFeatureFlags.d.ts.map +1 -1
- package/lib-es/featureFlags/groupedFeatures.d.ts +2 -1
- package/lib-es/featureFlags/groupedFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/groupedFeatures.js +0 -3
- package/lib-es/featureFlags/groupedFeatures.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/generated/deviceTransactionConfig.d.ts +1 -1
- package/lib-es/generated/transaction.d.ts +2 -2
- package/lib-es/helpers.d.ts +1 -0
- package/lib-es/helpers.d.ts.map +1 -1
- package/lib-es/helpers.js +3 -0
- package/lib-es/helpers.js.map +1 -1
- package/lib-es/hw/getOnboardingStatePolling.js +2 -2
- package/lib-es/hw/getOnboardingStatePolling.js.map +1 -1
- package/lib-es/market/api/index.d.ts +8 -0
- package/lib-es/market/api/index.d.ts.map +1 -0
- package/lib-es/market/api/index.js +100 -0
- package/lib-es/market/api/index.js.map +1 -0
- package/lib-es/market/hooks/useMarketDataProvider.d.ts +13 -0
- package/lib-es/market/hooks/useMarketDataProvider.d.ts.map +1 -0
- package/lib-es/market/{v2 → hooks}/useMarketDataProvider.js +34 -37
- package/lib-es/market/hooks/useMarketDataProvider.js.map +1 -0
- package/lib-es/market/{v2 → hooks}/useMarketPerformers.d.ts +1 -1
- package/lib-es/market/hooks/useMarketPerformers.d.ts.map +1 -0
- package/lib-es/market/{v2 → hooks}/useMarketPerformers.js +3 -3
- package/lib-es/market/hooks/useMarketPerformers.js.map +1 -0
- package/lib-es/market/utils/currencyFormatter.d.ts +3 -26
- package/lib-es/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib-es/market/utils/currencyFormatter.js +35 -31
- package/lib-es/market/utils/currencyFormatter.js.map +1 -1
- package/lib-es/market/utils/index.d.ts +5 -0
- package/lib-es/market/utils/index.d.ts.map +1 -0
- package/lib-es/market/utils/index.js +32 -0
- package/lib-es/market/utils/index.js.map +1 -0
- package/lib-es/market/utils/queryKeys.d.ts.map +1 -0
- package/lib-es/market/utils/queryKeys.js.map +1 -0
- package/lib-es/market/utils/timers.d.ts.map +1 -0
- package/lib-es/market/utils/timers.js.map +1 -0
- package/lib-es/market/{types.d.ts → utils/types.d.ts} +35 -53
- package/lib-es/market/utils/types.d.ts.map +1 -0
- package/lib-es/market/utils/types.js +16 -0
- package/lib-es/market/utils/types.js.map +1 -0
- package/lib-es/platform/converters.d.ts.map +1 -1
- package/lib-es/platform/converters.js +5 -6
- package/lib-es/platform/converters.js.map +1 -1
- package/lib-es/platform/types.d.ts +6 -1
- package/lib-es/platform/types.d.ts.map +1 -1
- package/lib-es/platform/types.js +10 -1
- package/lib-es/platform/types.js.map +1 -1
- package/lib-es/wallet-api/constants.d.ts +6 -1
- package/lib-es/wallet-api/constants.d.ts.map +1 -1
- package/lib-es/wallet-api/constants.js +7 -1
- package/lib-es/wallet-api/constants.js.map +1 -1
- package/lib-es/wallet-api/converters.d.ts +1 -1
- package/lib-es/wallet-api/converters.d.ts.map +1 -1
- package/lib-es/wallet-api/converters.js +6 -5
- package/lib-es/wallet-api/converters.js.map +1 -1
- package/package.json +45 -45
- package/src/__tests__/test-helpers/environment.ts +4 -0
- package/src/apps/listApps/v2.test.ts +151 -0
- package/src/apps/listApps/v2.ts +2 -2
- package/src/apps/mock.ts +30 -1
- package/src/apps/react.test.ts +1 -0
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +358 -1
- package/src/device/use-cases/listAppsUseCase.ts +1 -0
- package/src/deviceSDK/actions/getLatestAvailableFirmware.test.ts +4 -4
- package/src/deviceSDK/tasks/core.ts +2 -2
- package/src/exchange/providers/swap.ts +9 -1
- package/src/exchange/swap/api/v5/__tests__/fetchCurrencyAll.spec.ts +2 -1
- package/src/exchange/swap/api/v5/__tests__/fetchCurrencyFrom.spec.ts +3 -0
- package/src/exchange/swap/api/v5/__tests__/fetchCurrencyTo.spec.ts +3 -1
- package/src/exchange/swap/api/v5/fetchCurrencyAll.ts +3 -3
- package/src/exchange/swap/api/v5/fetchCurrencyFrom.ts +7 -3
- package/src/exchange/swap/api/v5/fetchCurrencyTo.ts +7 -3
- package/src/exchange/swap/api/v5/fetchRates.ts +3 -7
- package/src/exchange/swap/completeExchange.ts +5 -1
- package/src/exchange/swap/hooks/useSwapTransaction.ts +12 -9
- package/src/exchange/swap/hooks/v5/useFetchCurrencyAll.ts +4 -0
- package/src/exchange/swap/hooks/v5/useFetchCurrencyFrom.ts +4 -1
- package/src/exchange/swap/hooks/v5/useFetchCurrencyTo.ts +4 -2
- package/src/exchange/swap/hooks/v5/useFetchRates.ts +15 -9
- package/src/exchange/swap/hooks/v5/useFilteredProviders.ts +42 -0
- package/src/exchange/swap/hooks/v5/useProviderRates.ts +7 -14
- package/src/exchange/swap/initSwap.ts +5 -1
- package/src/families/cosmos/bridge/mock.ts +1 -1
- package/src/families/evm/config.ts +32 -0
- package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +7 -7
- package/src/families/stacks/__tests__/sync.integration.test.ts +1 -1
- package/src/families/stacks/bridge/utils/api.ts +10 -5
- package/src/families/stacks/bridge/utils/api.types.ts +81 -10
- package/src/families/stacks/bridge/utils/misc.ts +43 -38
- package/src/families/stacks/bridge/utils/misc.unit.test.ts +88 -70
- package/src/families/stacks/synchronization.ts +1 -1
- package/src/families/tron/api/index.ts +2 -2
- package/src/families/tron/signOperation.ts +0 -15
- package/src/families/tron/synchronization.ts +45 -3
- package/src/featureFlags/defaultFeatures.ts +14 -3
- package/src/featureFlags/groupedFeatures.ts +3 -4
- package/src/helpers.ts +6 -0
- package/src/hw/getOnboardingStatePolling.ts +2 -2
- package/src/market/api/index.ts +138 -0
- package/src/market/{v2 → hooks}/useMarketDataProvider.ts +34 -33
- package/src/market/{v2 → hooks}/useMarketPerformers.ts +4 -4
- package/src/market/utils/currencyFormatter.ts +32 -28
- package/src/market/utils/index.ts +34 -0
- package/src/market/{types.ts → utils/types.ts} +38 -48
- package/src/platform/converters.ts +4 -5
- package/src/platform/types.ts +12 -1
- package/src/wallet-api/constants.ts +9 -1
- package/src/wallet-api/converters.ts +5 -6
- package/lib/market/MarketDataProvider.d.ts +0 -27
- package/lib/market/MarketDataProvider.d.ts.map +0 -1
- package/lib/market/MarketDataProvider.js +0 -261
- package/lib/market/MarketDataProvider.js.map +0 -1
- package/lib/market/api/api.d.ts +0 -18
- package/lib/market/api/api.d.ts.map +0 -1
- package/lib/market/api/api.js +0 -246
- package/lib/market/api/api.js.map +0 -1
- package/lib/market/api/api.mock.d.ts +0 -15
- package/lib/market/api/api.mock.d.ts.map +0 -1
- package/lib/market/api/api.mock.js +0 -395
- package/lib/market/api/api.mock.js.map +0 -1
- package/lib/market/types.d.ts.map +0 -1
- package/lib/market/types.js +0 -3
- package/lib/market/types.js.map +0 -1
- package/lib/market/utils/rangeFormatter.d.ts +0 -3
- package/lib/market/utils/rangeFormatter.d.ts.map +0 -1
- package/lib/market/utils/rangeFormatter.js +0 -18
- package/lib/market/utils/rangeFormatter.js.map +0 -1
- package/lib/market/v2/queryKeys.d.ts.map +0 -1
- package/lib/market/v2/queryKeys.js.map +0 -1
- package/lib/market/v2/timers.d.ts.map +0 -1
- package/lib/market/v2/timers.js.map +0 -1
- package/lib/market/v2/useMarketDataProvider.d.ts +0 -63
- package/lib/market/v2/useMarketDataProvider.d.ts.map +0 -1
- package/lib/market/v2/useMarketDataProvider.js.map +0 -1
- package/lib/market/v2/useMarketPerformers.d.ts.map +0 -1
- package/lib/market/v2/useMarketPerformers.js.map +0 -1
- package/lib-es/market/MarketDataProvider.d.ts +0 -27
- package/lib-es/market/MarketDataProvider.d.ts.map +0 -1
- package/lib-es/market/MarketDataProvider.js +0 -229
- package/lib-es/market/MarketDataProvider.js.map +0 -1
- package/lib-es/market/api/api.d.ts +0 -18
- package/lib-es/market/api/api.d.ts.map +0 -1
- package/lib-es/market/api/api.js +0 -232
- package/lib-es/market/api/api.js.map +0 -1
- package/lib-es/market/api/api.mock.d.ts +0 -15
- package/lib-es/market/api/api.mock.d.ts.map +0 -1
- package/lib-es/market/api/api.mock.js +0 -393
- package/lib-es/market/api/api.mock.js.map +0 -1
- package/lib-es/market/types.d.ts.map +0 -1
- package/lib-es/market/types.js +0 -2
- package/lib-es/market/types.js.map +0 -1
- package/lib-es/market/utils/rangeFormatter.d.ts +0 -3
- package/lib-es/market/utils/rangeFormatter.d.ts.map +0 -1
- package/lib-es/market/utils/rangeFormatter.js +0 -14
- package/lib-es/market/utils/rangeFormatter.js.map +0 -1
- package/lib-es/market/v2/queryKeys.d.ts.map +0 -1
- package/lib-es/market/v2/queryKeys.js.map +0 -1
- package/lib-es/market/v2/timers.d.ts.map +0 -1
- package/lib-es/market/v2/timers.js.map +0 -1
- package/lib-es/market/v2/useMarketDataProvider.d.ts +0 -63
- package/lib-es/market/v2/useMarketDataProvider.d.ts.map +0 -1
- package/lib-es/market/v2/useMarketDataProvider.js.map +0 -1
- package/lib-es/market/v2/useMarketPerformers.d.ts.map +0 -1
- package/lib-es/market/v2/useMarketPerformers.js.map +0 -1
- package/src/market/MarketDataProvider.tsx +0 -403
- package/src/market/api/api.mock.ts +0 -403
- package/src/market/api/api.ts +0 -310
- package/src/market/utils/rangeFormatter.ts +0 -15
- /package/lib/market/{v2 → utils}/queryKeys.d.ts +0 -0
- /package/lib/market/{v2 → utils}/queryKeys.js +0 -0
- /package/lib/market/{v2 → utils}/timers.d.ts +0 -0
- /package/lib/market/{v2 → utils}/timers.js +0 -0
- /package/lib-es/market/{v2 → utils}/queryKeys.d.ts +0 -0
- /package/lib-es/market/{v2 → utils}/queryKeys.js +0 -0
- /package/lib-es/market/{v2 → utils}/timers.d.ts +0 -0
- /package/lib-es/market/{v2 → utils}/timers.js +0 -0
- /package/src/market/{v2 → utils}/queryKeys.ts +0 -0
- /package/src/market/{v2 → utils}/timers.ts +0 -0
@@ -2,7 +2,6 @@ import { Observable } from "rxjs";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
3
3
|
import { AccountBridge, TokenAccount } from "@ledgerhq/types-live";
|
4
4
|
import { buildOptimisticOperation } from "./buildOptimisticOperation";
|
5
|
-
import { TronSendTrc20ToNewAccountForbidden } from "./errors";
|
6
5
|
import signTransaction from "../../hw/signTransaction";
|
7
6
|
import { Transaction, TronAccount } from "./types";
|
8
7
|
import { withDevice } from "../../hw/deviceAccess";
|
@@ -10,7 +9,6 @@ import { getEstimatedFees } from "./logic";
|
|
10
9
|
import {
|
11
10
|
claimRewardTronTransaction,
|
12
11
|
createTronTransaction,
|
13
|
-
fetchTronAccount,
|
14
12
|
fetchTronContract,
|
15
13
|
freezeTronTransaction,
|
16
14
|
legacyUnfreezeTronTransaction,
|
@@ -43,19 +41,6 @@ export const signOperation: AccountBridge<Transaction, TronAccount>["signOperati
|
|
43
41
|
transaction.amount = balance; // force the amount to be the max
|
44
42
|
}
|
45
43
|
|
46
|
-
// send trc20 to a new account is forbidden by us (because it will not activate the account)
|
47
|
-
if (
|
48
|
-
transaction.recipient &&
|
49
|
-
transaction.mode === "send" &&
|
50
|
-
subAccount &&
|
51
|
-
subAccount.type === "TokenAccount" &&
|
52
|
-
subAccount.token.tokenType === "trc20" &&
|
53
|
-
!isContractAddressRecipient && // send trc20 to a smart contract is allowed
|
54
|
-
(await fetchTronAccount(transaction.recipient)).length === 0
|
55
|
-
) {
|
56
|
-
throw new TronSendTrc20ToNewAccountForbidden();
|
57
|
-
}
|
58
|
-
|
59
44
|
const {
|
60
45
|
raw_data_hex: rawDataHex,
|
61
46
|
raw_data: rawData,
|
@@ -53,7 +53,7 @@ export const getAccountShape: GetAccountShape<TronAccount> = async (
|
|
53
53
|
const spendableBalance = acc.balance ? new BigNumber(acc.balance) : new BigNumber(0);
|
54
54
|
const cacheTransactionInfoById = initialAccount
|
55
55
|
? {
|
56
|
-
...(initialAccount
|
56
|
+
...(initialAccount?.tronResources?.cacheTransactionInfoById || {}),
|
57
57
|
}
|
58
58
|
: {};
|
59
59
|
const operationsPageSize = Math.min(
|
@@ -140,9 +140,10 @@ export const getAccountShape: GetAccountShape<TronAccount> = async (
|
|
140
140
|
return accumulator;
|
141
141
|
}, []);
|
142
142
|
|
143
|
+
const { blacklistedTokenIds = [] } = syncConfig;
|
144
|
+
|
143
145
|
const subAccounts: SubAccount[] = compact(
|
144
146
|
trc10Tokens.concat(trc20Tokens).map(({ key, tokenId, balance }) => {
|
145
|
-
const { blacklistedTokenIds = [] } = syncConfig;
|
146
147
|
const token = findTokenById(tokenId);
|
147
148
|
if (!token || blacklistedTokenIds.includes(tokenId)) return;
|
148
149
|
const id = encodeTokenAccountId(accountId, token);
|
@@ -167,6 +168,16 @@ export const getAccountShape: GetAccountShape<TronAccount> = async (
|
|
167
168
|
return sub;
|
168
169
|
}),
|
169
170
|
);
|
171
|
+
|
172
|
+
// Filter blacklisted tokens from the initial account's subAccounts
|
173
|
+
// Could be use to filter out tokens that got their CAL id changed
|
174
|
+
const filteredInitialSubAccounts = (initialAccount?.subAccounts || []).filter(
|
175
|
+
subAccount => !blacklistedTokenIds.includes(subAccount.token.id),
|
176
|
+
);
|
177
|
+
|
178
|
+
// keep old account with emptyBalance and a history not returned by the BE fixes LIVE-12797
|
179
|
+
const mergedSubAccounts = mergeSubAccounts(subAccounts, filteredInitialSubAccounts);
|
180
|
+
|
170
181
|
// get 'OUT' token operations with fee
|
171
182
|
const subOutOperationsWithFee: TronOperation[] = subAccounts
|
172
183
|
.flatMap(s => s.operations)
|
@@ -199,7 +210,7 @@ export const getAccountShape: GetAccountShape<TronAccount> = async (
|
|
199
210
|
spendableBalance,
|
200
211
|
operationsCount: parentOpsAndSubOutOpsWithFee.length,
|
201
212
|
operations: parentOpsAndSubOutOpsWithFee,
|
202
|
-
subAccounts,
|
213
|
+
subAccounts: mergedSubAccounts,
|
203
214
|
tronResources,
|
204
215
|
blockHeight,
|
205
216
|
};
|
@@ -225,4 +236,35 @@ export const postSync = (initial: TronAccount, parent: TronAccount): TronAccount
|
|
225
236
|
return parent;
|
226
237
|
};
|
227
238
|
|
239
|
+
/**
|
240
|
+
* Merges two arrays of subAccounts according to specific rules:
|
241
|
+
* - The first array (subAccounts1) is up-to-date and should not be modified.
|
242
|
+
* - Old duplicates from the second array (subAccounts2) should be filtered out.
|
243
|
+
* - Only new subAccounts with a unique ID from the second array should be included.
|
244
|
+
* - The balance and spendableBalance fields of the second array's subAccounts should be set to 0.
|
245
|
+
*
|
246
|
+
* @param {Array} subAccounts1 - The first array of subAccounts, which is up-to-date and should not be modified.
|
247
|
+
* @param {Array} subAccounts2 - The second array of subAccounts, from which only new unique subAccounts should be included.
|
248
|
+
* @returns {Array} - The merged array of subAccounts.
|
249
|
+
*/
|
250
|
+
const mergeSubAccounts = (subAccounts1, subAccounts2) => {
|
251
|
+
const existingIds = new Set(subAccounts1.map(subAccount => subAccount.id));
|
252
|
+
const filteredSubAccounts2 = subAccounts2
|
253
|
+
.map(subAccount => {
|
254
|
+
if (existingIds.has(subAccount.id)) {
|
255
|
+
return null;
|
256
|
+
} else {
|
257
|
+
// Set balance and spendableBalance to 0 has if they are not here it means balance is 0
|
258
|
+
return {
|
259
|
+
...subAccount,
|
260
|
+
balance: new BigNumber(0),
|
261
|
+
spendableBalance: new BigNumber(0),
|
262
|
+
};
|
263
|
+
}
|
264
|
+
})
|
265
|
+
.filter(subAccount => subAccount !== null);
|
266
|
+
|
267
|
+
return subAccounts1.concat(filteredSubAccounts2);
|
268
|
+
};
|
269
|
+
|
228
270
|
export const sync = makeSync({ getAccountShape, postSync });
|
@@ -71,7 +71,11 @@ export const CURRENCY_DEFAULT_FEATURES = {
|
|
71
71
|
currencyCasper: DEFAULT_FEATURE,
|
72
72
|
currencyNeonEvm: DEFAULT_FEATURE,
|
73
73
|
currencyLinea: DEFAULT_FEATURE,
|
74
|
-
|
74
|
+
currencyLineaSepolia: DEFAULT_FEATURE,
|
75
|
+
currencyBlast: DEFAULT_FEATURE,
|
76
|
+
currencyBlastSepolia: DEFAULT_FEATURE,
|
77
|
+
currencyScroll: DEFAULT_FEATURE,
|
78
|
+
currencyScrollSepolia: DEFAULT_FEATURE,
|
75
79
|
};
|
76
80
|
|
77
81
|
/**
|
@@ -92,7 +96,6 @@ export const DEFAULT_FEATURES: Features = {
|
|
92
96
|
disableNftLedgerMarket: DEFAULT_FEATURE,
|
93
97
|
disableNftRaribleOpensea: DEFAULT_FEATURE,
|
94
98
|
disableNftSend: DEFAULT_FEATURE,
|
95
|
-
staxWelcomeScreen: DEFAULT_FEATURE,
|
96
99
|
listAppsV2minor1: DEFAULT_FEATURE,
|
97
100
|
flexibleContentCards: DEFAULT_FEATURE,
|
98
101
|
ethStakingProviders: initFeature(),
|
@@ -412,6 +415,8 @@ export const DEFAULT_FEATURES: Features = {
|
|
412
415
|
},
|
413
416
|
|
414
417
|
ptxSwapMoonpayProvider: DEFAULT_FEATURE,
|
418
|
+
ptxSwapExodusProvider: DEFAULT_FEATURE,
|
419
|
+
ptxSwapThorswapProvider: DEFAULT_FEATURE,
|
415
420
|
|
416
421
|
llmAnalyticsOptInPrompt: {
|
417
422
|
enabled: false,
|
@@ -455,7 +460,6 @@ export const DEFAULT_FEATURES: Features = {
|
|
455
460
|
|
456
461
|
lldChatbotSupport: DEFAULT_FEATURE,
|
457
462
|
llmChatbotSupport: DEFAULT_FEATURE,
|
458
|
-
supportDeviceStax: DEFAULT_FEATURE,
|
459
463
|
supportDeviceEuropa: DEFAULT_FEATURE,
|
460
464
|
lldRefreshMarketData: {
|
461
465
|
...DEFAULT_FEATURE,
|
@@ -463,8 +467,15 @@ export const DEFAULT_FEATURES: Features = {
|
|
463
467
|
refreshTime: 3, //nb minutes
|
464
468
|
},
|
465
469
|
},
|
470
|
+
llmRefreshMarketData: {
|
471
|
+
...DEFAULT_FEATURE,
|
472
|
+
params: {
|
473
|
+
refreshTime: 3, //nb minutes
|
474
|
+
},
|
475
|
+
},
|
466
476
|
spamReportNfts: DEFAULT_FEATURE,
|
467
477
|
lldWalletSync: DEFAULT_FEATURE,
|
478
|
+
llmWalletSync: DEFAULT_FEATURE,
|
468
479
|
lldNftsGalleryNewArch: DEFAULT_FEATURE,
|
469
480
|
};
|
470
481
|
|
@@ -1,15 +1,14 @@
|
|
1
1
|
import { FeatureId } from "@ledgerhq/types-live";
|
2
2
|
|
3
|
+
export type GroupedFeature = "europa" | "disableNft";
|
4
|
+
|
3
5
|
/** Helper to group several feature flag ids under a common feature flag */
|
4
6
|
export const groupedFeatures: Record<
|
5
|
-
|
7
|
+
GroupedFeature,
|
6
8
|
{
|
7
9
|
featureIds: FeatureId[];
|
8
10
|
}
|
9
11
|
> = {
|
10
|
-
stax: {
|
11
|
-
featureIds: ["supportDeviceStax", "deviceInitialApps", "staxWelcomeScreen"],
|
12
|
-
},
|
13
12
|
europa: {
|
14
13
|
featureIds: ["supportDeviceEuropa", "deviceInitialApps"],
|
15
14
|
},
|
package/src/helpers.ts
CHANGED
@@ -9,3 +9,9 @@ export function includes<T extends U, U>(array: ReadonlyArray<T>, element: U): e
|
|
9
9
|
export function objectKeysType<Type extends object>(value: Type): Array<keyof Type> {
|
10
10
|
return Object.keys(value) as Array<keyof Type>;
|
11
11
|
}
|
12
|
+
|
13
|
+
export function reverseRecord<T extends PropertyKey, U extends PropertyKey>(
|
14
|
+
input: Record<T, U>,
|
15
|
+
): Record<U, T> {
|
16
|
+
return Object.fromEntries(Object.entries(input).map(([key, value]) => [value, key]));
|
17
|
+
}
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
DeviceExtractOnboardingStateError,
|
9
9
|
DisconnectedDevice,
|
10
10
|
CantOpenDevice,
|
11
|
-
|
11
|
+
TransportRaceCondition,
|
12
12
|
LockedDeviceError,
|
13
13
|
UnexpectedBootloader,
|
14
14
|
TransportExchangeTimeoutError,
|
@@ -139,7 +139,7 @@ export const isAllowedOnboardingStatePollingError = (error: unknown): boolean =>
|
|
139
139
|
error instanceof DisconnectedDevice ||
|
140
140
|
error instanceof DisconnectedDeviceDuringOperation ||
|
141
141
|
error instanceof CantOpenDevice ||
|
142
|
-
error instanceof
|
142
|
+
error instanceof TransportRaceCondition ||
|
143
143
|
error instanceof TransportStatusError ||
|
144
144
|
// A locked device is handled as an allowed error
|
145
145
|
error instanceof LockedDeviceError)
|
@@ -0,0 +1,138 @@
|
|
1
|
+
import network from "@ledgerhq/live-network/network";
|
2
|
+
import { getEnv } from "@ledgerhq/live-env";
|
3
|
+
import {
|
4
|
+
MarketCurrencyChartDataRequestParams,
|
5
|
+
MarketListRequestParams,
|
6
|
+
MarketPerformersParams,
|
7
|
+
MarketItemResponse,
|
8
|
+
SupportedCoins,
|
9
|
+
MarketCurrencyRequestParams,
|
10
|
+
MarketCoinDataChart,
|
11
|
+
Order,
|
12
|
+
} from "../utils/types";
|
13
|
+
import { rangeDataTable } from "../utils/rangeDataTable";
|
14
|
+
import URL from "url";
|
15
|
+
import { getRange, getSortParam } from "../utils";
|
16
|
+
|
17
|
+
const baseURL = () => getEnv("LEDGER_COUNTERVALUES_API");
|
18
|
+
const ROOT_PATH = getEnv("MARKET_API_URL");
|
19
|
+
|
20
|
+
export async function getSupportedCoinsList(): Promise<SupportedCoins> {
|
21
|
+
const url = `${ROOT_PATH}/coins/list`;
|
22
|
+
const { data } = await network({ method: "GET", url });
|
23
|
+
return data;
|
24
|
+
}
|
25
|
+
|
26
|
+
// fetches currencies data for selected currencies ids
|
27
|
+
export async function fetchList({
|
28
|
+
counterCurrency,
|
29
|
+
limit = 50,
|
30
|
+
page = 1,
|
31
|
+
order = Order.MarketCapDesc,
|
32
|
+
search = "",
|
33
|
+
liveCoinsList = [],
|
34
|
+
starred = [],
|
35
|
+
range = "24",
|
36
|
+
}: MarketListRequestParams): Promise<MarketItemResponse[]> {
|
37
|
+
const url = URL.format({
|
38
|
+
pathname: `${baseURL()}/v3/markets`,
|
39
|
+
query: {
|
40
|
+
page: page,
|
41
|
+
pageSize: limit,
|
42
|
+
to: counterCurrency,
|
43
|
+
sort: getSortParam(order, range),
|
44
|
+
...(search.length >= 1 && { filter: search }),
|
45
|
+
...(starred.length > 0 && { ids: starred.join(",") }),
|
46
|
+
...(liveCoinsList.length > 1 && { ids: liveCoinsList.join(",") }),
|
47
|
+
...([Order.topLosers, Order.topGainers].includes(order) && { top: 100 }),
|
48
|
+
},
|
49
|
+
});
|
50
|
+
|
51
|
+
const { data } = await network({
|
52
|
+
method: "GET",
|
53
|
+
url,
|
54
|
+
});
|
55
|
+
|
56
|
+
return data;
|
57
|
+
}
|
58
|
+
|
59
|
+
// Fetches list of supported counterCurrencies
|
60
|
+
export async function supportedCounterCurrencies(): Promise<string[]> {
|
61
|
+
const url = `${ROOT_PATH}/simple/supported_vs_currencies`;
|
62
|
+
|
63
|
+
const { data } = await network({
|
64
|
+
method: "GET",
|
65
|
+
url,
|
66
|
+
});
|
67
|
+
|
68
|
+
return data;
|
69
|
+
}
|
70
|
+
|
71
|
+
export async function fetchCurrencyChartData({
|
72
|
+
id,
|
73
|
+
counterCurrency,
|
74
|
+
range = "24h",
|
75
|
+
}: MarketCurrencyChartDataRequestParams): Promise<MarketCoinDataChart> {
|
76
|
+
const { days, interval } = rangeDataTable[range];
|
77
|
+
|
78
|
+
const url = URL.format({
|
79
|
+
pathname: `${ROOT_PATH}/coins/${id}/market_chart`,
|
80
|
+
query: {
|
81
|
+
vs_currency: counterCurrency,
|
82
|
+
days,
|
83
|
+
interval,
|
84
|
+
},
|
85
|
+
});
|
86
|
+
|
87
|
+
const { data } = await network({
|
88
|
+
method: "GET",
|
89
|
+
url,
|
90
|
+
});
|
91
|
+
|
92
|
+
return { [range]: data.prices };
|
93
|
+
}
|
94
|
+
|
95
|
+
export async function fetchCurrency({
|
96
|
+
counterCurrency,
|
97
|
+
id,
|
98
|
+
}: MarketCurrencyRequestParams): Promise<MarketItemResponse> {
|
99
|
+
const url = URL.format({
|
100
|
+
pathname: `${baseURL()}/v3/markets`,
|
101
|
+
query: {
|
102
|
+
to: counterCurrency,
|
103
|
+
ids: id,
|
104
|
+
pageSize: 1,
|
105
|
+
limit: 1,
|
106
|
+
},
|
107
|
+
});
|
108
|
+
|
109
|
+
const { data } = await network({ method: "GET", url });
|
110
|
+
|
111
|
+
return data[0];
|
112
|
+
}
|
113
|
+
|
114
|
+
export async function fetchMarketPerformers({
|
115
|
+
counterCurrency,
|
116
|
+
range,
|
117
|
+
limit = 5,
|
118
|
+
top = 50,
|
119
|
+
sort,
|
120
|
+
supported,
|
121
|
+
}: MarketPerformersParams): Promise<MarketItemResponse[]> {
|
122
|
+
const sortParam = `${sort === "asc" ? "positive" : "negative"}-price-change-${getRange(range)}`;
|
123
|
+
|
124
|
+
const url = URL.format({
|
125
|
+
pathname: `${baseURL()}/v3/markets`,
|
126
|
+
query: {
|
127
|
+
to: counterCurrency,
|
128
|
+
limit,
|
129
|
+
top,
|
130
|
+
sort: sortParam,
|
131
|
+
supported,
|
132
|
+
},
|
133
|
+
});
|
134
|
+
|
135
|
+
const { data } = await network({ method: "GET", url });
|
136
|
+
|
137
|
+
return data;
|
138
|
+
}
|
@@ -2,26 +2,28 @@ import { UseQueryResult, useQueries, useQuery } from "@tanstack/react-query";
|
|
2
2
|
import {
|
3
3
|
fetchCurrency,
|
4
4
|
fetchCurrencyChartData,
|
5
|
-
fetchCurrencyData,
|
6
5
|
fetchList,
|
7
6
|
getSupportedCoinsList,
|
8
7
|
supportedCounterCurrencies,
|
9
|
-
} from "../api
|
8
|
+
} from "../api";
|
9
|
+
import { listCryptoCurrencies } from "@ledgerhq/cryptoassets/currencies";
|
10
|
+
import { listTokens } from "@ledgerhq/cryptoassets/tokens";
|
11
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
12
|
+
|
13
|
+
import { useMemo } from "react";
|
14
|
+
import { listSupportedCurrencies } from "../../currencies";
|
15
|
+
import { currencyFormatter, format } from "../utils/currencyFormatter";
|
16
|
+
import { QUERY_KEY } from "../utils/queryKeys";
|
17
|
+
import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH, ONE_DAY } from "../utils/timers";
|
10
18
|
import {
|
11
|
-
CurrencyData,
|
12
|
-
HashMapBody,
|
13
19
|
MarketCurrencyRequestParams,
|
14
20
|
MarketListRequestParams,
|
21
|
+
CurrencyData,
|
22
|
+
HashMapBody,
|
23
|
+
MarketItemResponse,
|
15
24
|
MarketListRequestResult,
|
16
|
-
|
17
|
-
} from "../types";
|
18
|
-
import { QUERY_KEY } from "./queryKeys";
|
19
|
-
import { listCryptoCurrencies, listSupportedCurrencies, listTokens } from "../../currencies";
|
20
|
-
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
21
|
-
import { useMemo } from "react";
|
22
|
-
|
23
|
-
import { currencyFormatter, format } from "../utils/currencyFormatter";
|
24
|
-
import { BASIC_REFETCH, ONE_DAY, REFETCH_TIME_ONE_MINUTE } from "./timers";
|
25
|
+
Order,
|
26
|
+
} from "../utils/types";
|
25
27
|
|
26
28
|
const cryptoCurrenciesList = [...listCryptoCurrencies(), ...listTokens()];
|
27
29
|
|
@@ -57,26 +59,15 @@ export const useCurrencyChartData = ({ id, counterCurrency, range }: MarketCurre
|
|
57
59
|
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
58
60
|
});
|
59
61
|
|
60
|
-
export
|
61
|
-
|
62
|
-
queryKey: [QUERY_KEY.
|
63
|
-
queryFn: () =>
|
64
|
-
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
65
|
-
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
66
|
-
select: (data: RawCurrencyData) => format(data, range ?? "24h", cryptoCurrenciesList),
|
67
|
-
});
|
68
|
-
|
69
|
-
const resultCurrency = useQuery({
|
70
|
-
queryKey: [QUERY_KEY.CurrencyDataRaw, id],
|
71
|
-
queryFn: () => fetchCurrency({ id }),
|
62
|
+
export const useCurrencyData = ({ id, counterCurrency }: MarketCurrencyRequestParams) =>
|
63
|
+
useQuery({
|
64
|
+
queryKey: [QUERY_KEY.CurrencyDataRaw, id, counterCurrency],
|
65
|
+
queryFn: () => fetchCurrency({ id, counterCurrency }),
|
72
66
|
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
73
67
|
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
74
|
-
select: data => format(data,
|
68
|
+
select: data => format(data, cryptoCurrenciesList),
|
75
69
|
});
|
76
70
|
|
77
|
-
return { currencyData: resultCurrencyData, currencyInfo: resultCurrency };
|
78
|
-
}
|
79
|
-
|
80
71
|
export const useSupportedCounterCurrencies = () =>
|
81
72
|
useQuery({
|
82
73
|
queryKey: [QUERY_KEY.SupportedCounterCurrencies],
|
@@ -95,14 +86,24 @@ export const useSupportedCurrencies = () =>
|
|
95
86
|
|
96
87
|
export function useMarketData(props: MarketListRequestParams): MarketListRequestResult {
|
97
88
|
return useQueries({
|
98
|
-
queries: Array.from({ length: props.page ?? 1 }, (_, i) => i
|
89
|
+
queries: Array.from({ length: props.page ?? 1 }, (_, i) => i).map(page => ({
|
99
90
|
queryKey: [
|
100
91
|
QUERY_KEY.MarketData,
|
101
|
-
|
92
|
+
page,
|
93
|
+
props.order,
|
94
|
+
{
|
95
|
+
counterCurrency: props.counterCurrency,
|
96
|
+
...(props.search && props.search?.length >= 1 && { search: props.search }),
|
97
|
+
...(props.starred && props.starred?.length >= 1 && { starred: props.starred }),
|
98
|
+
...(props.liveCoinsList &&
|
99
|
+
props.liveCoinsList?.length >= 1 && { liveCoinsList: props.liveCoinsList }),
|
100
|
+
...(props.order &&
|
101
|
+
[Order.topLosers, Order.topGainers].includes(props.order) && { range: props.range }),
|
102
|
+
},
|
102
103
|
],
|
103
104
|
queryFn: () => fetchList({ ...props, page }),
|
104
|
-
select: (data:
|
105
|
-
formattedData: currencyFormatter(data,
|
105
|
+
select: (data: MarketItemResponse[]) => ({
|
106
|
+
formattedData: currencyFormatter(data, cryptoCurrenciesList),
|
106
107
|
page,
|
107
108
|
}),
|
108
109
|
refetchOnMount: false,
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { fetchMarketPerformers } from "../api
|
2
|
-
import { MarketItemPerformer, MarketItemResponse, MarketPerformersParams } from "../types";
|
3
|
-
import { QUERY_KEY } from "
|
1
|
+
import { fetchMarketPerformers } from "../api";
|
2
|
+
import { MarketItemPerformer, MarketItemResponse, MarketPerformersParams } from "../utils/types";
|
3
|
+
import { QUERY_KEY } from "../utils/queryKeys";
|
4
4
|
import { UseQueryResult, useQuery } from "@tanstack/react-query";
|
5
5
|
import { formatPerformer } from "../utils/currencyFormatter";
|
6
|
-
import { REFETCH_TIME_ONE_MINUTE } from "
|
6
|
+
import { REFETCH_TIME_ONE_MINUTE } from "../utils/timers";
|
7
7
|
|
8
8
|
export const useMarketPerformers = ({
|
9
9
|
counterCurrency,
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
2
|
import {
|
3
3
|
CurrencyData,
|
4
|
+
KeysPriceChange,
|
4
5
|
MarketItemPerformer,
|
5
6
|
MarketItemResponse,
|
6
|
-
RawCurrencyData,
|
7
7
|
SparklineSvgData,
|
8
|
-
} from "
|
8
|
+
} from "./types";
|
9
9
|
|
10
10
|
function distributedCopy(items: number[], n: number): number[] {
|
11
11
|
if (!items) return [];
|
@@ -46,42 +46,46 @@ function sparklineAsSvgData(points: number[]): SparklineSvgData {
|
|
46
46
|
}
|
47
47
|
|
48
48
|
export function currencyFormatter(
|
49
|
-
data:
|
50
|
-
range: string,
|
49
|
+
data: MarketItemResponse[],
|
51
50
|
cryptoCurrenciesList: (CryptoCurrency | TokenCurrency)[],
|
52
51
|
): CurrencyData[] {
|
53
|
-
return data.map((currency:
|
52
|
+
return data.map((currency: MarketItemResponse) => format(currency, cryptoCurrenciesList));
|
54
53
|
}
|
55
54
|
|
56
55
|
export const format = (
|
57
|
-
currency:
|
58
|
-
range: string,
|
56
|
+
currency: MarketItemResponse,
|
59
57
|
cryptoCurrenciesList: (CryptoCurrency | TokenCurrency)[],
|
60
|
-
) => ({
|
58
|
+
): CurrencyData => ({
|
61
59
|
id: currency.id,
|
62
60
|
name: currency.name,
|
63
|
-
image:
|
61
|
+
image: currency.image,
|
64
62
|
internalCurrency: cryptoCurrenciesList.find(
|
65
|
-
({ ticker }) => ticker.toLowerCase() === currency.
|
63
|
+
({ ticker }) => ticker.toLowerCase() === currency.ticker,
|
66
64
|
),
|
67
|
-
marketcap: currency.
|
68
|
-
marketcapRank: currency.
|
69
|
-
totalVolume: currency.
|
70
|
-
high24h: currency.
|
71
|
-
low24h: currency.
|
72
|
-
ticker: currency.
|
73
|
-
price: currency.
|
74
|
-
priceChangePercentage:
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
65
|
+
marketcap: currency.marketCap,
|
66
|
+
marketcapRank: currency.marketCapRank,
|
67
|
+
totalVolume: currency.totalVolume,
|
68
|
+
high24h: currency.high24h,
|
69
|
+
low24h: currency.low24h,
|
70
|
+
ticker: currency.ticker,
|
71
|
+
price: currency.price,
|
72
|
+
priceChangePercentage: {
|
73
|
+
[KeysPriceChange.hour]: currency.priceChangePercentage1h,
|
74
|
+
[KeysPriceChange.day]: currency.priceChangePercentage24h,
|
75
|
+
[KeysPriceChange.week]: currency.priceChangePercentage7d,
|
76
|
+
[KeysPriceChange.month]: currency.priceChangePercentage30d,
|
77
|
+
[KeysPriceChange.year]: currency.priceChangePercentage1y,
|
78
|
+
},
|
79
|
+
marketCapChangePercentage24h: currency.marketCapChangePercentage24h,
|
80
|
+
circulatingSupply: currency.circulatingSupply,
|
81
|
+
totalSupply: currency.totalSupply,
|
82
|
+
maxSupply: currency.maxSupply,
|
83
|
+
ath: currency.allTimeHigh,
|
84
|
+
athDate: new Date(currency.allTimeHighDate),
|
85
|
+
atl: currency.allTimeLow,
|
86
|
+
atlDate: new Date(currency.allTimeLowDate),
|
87
|
+
sparklineIn7d: currency.sparkline
|
88
|
+
? sparklineAsSvgData(distributedCopy(currency.sparkline, 6 * 7)) // keep 6 points per day
|
85
89
|
: undefined,
|
86
90
|
chartData: {},
|
87
91
|
});
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { PortfolioRange } from "@ledgerhq/types-live";
|
2
|
+
import { Order } from "./types";
|
3
|
+
|
4
|
+
export function getRange(range: PortfolioRange | string) {
|
5
|
+
switch (range) {
|
6
|
+
case "day":
|
7
|
+
case "24h":
|
8
|
+
return "1d";
|
9
|
+
case "7d":
|
10
|
+
case "week":
|
11
|
+
return "1w";
|
12
|
+
case "30d":
|
13
|
+
case "month":
|
14
|
+
return "1m";
|
15
|
+
case "1y":
|
16
|
+
case "year":
|
17
|
+
case "all":
|
18
|
+
return "1y";
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
export const getSortParam = (order: Order, range: PortfolioRange | string) => {
|
23
|
+
switch (order) {
|
24
|
+
default:
|
25
|
+
case Order.MarketCapDesc:
|
26
|
+
return "market-cap-rank";
|
27
|
+
case Order.MarketCapAsc:
|
28
|
+
return "market-cap-rank-desc";
|
29
|
+
case Order.topLosers:
|
30
|
+
return `negative-price-change-${getRange(range)}`;
|
31
|
+
case Order.topGainers:
|
32
|
+
return `positive-price-change-${getRange(range)}`;
|
33
|
+
}
|
34
|
+
};
|