@ledgerhq/live-common 34.50.0 → 34.51.0-nightly.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/test-helpers/bridge.js +1 -1
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/environment.js +1 -1
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +3 -0
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +4 -4
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.js +7 -9
- package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +11 -0
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +15 -9
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +29 -4
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +37 -0
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -0
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js +8 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +15 -1
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +5 -3
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +60 -0
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js +1 -1
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +1 -2
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +2 -2
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +23 -4
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +1 -0
- package/lib/bridge/impl.js.map +1 -1
- package/lib/dada-client/entities/index.d.ts.map +1 -0
- package/lib/dada-client/entities/index.js.map +1 -0
- package/lib/{modularDrawer/data → dada-client}/entities/interestRateSelectors.d.ts +1 -1
- package/lib/dada-client/entities/interestRateSelectors.d.ts.map +1 -0
- package/lib/dada-client/entities/interestRateSelectors.js.map +1 -0
- package/lib/{modularDrawer/data → dada-client}/entities/marketSelectors.d.ts +1 -1
- package/lib/dada-client/entities/marketSelectors.d.ts.map +1 -0
- package/lib/dada-client/entities/marketSelectors.js.map +1 -0
- package/lib/dada-client/entities/selectorUtils.d.ts.map +1 -0
- package/lib/dada-client/entities/selectorUtils.js.map +1 -0
- package/lib/dada-client/hooks/__tests__/useAssetsData.test.d.ts.map +1 -0
- package/lib/{modularDrawer/hooks/__test__ → dada-client/hooks/__tests__}/useAssetsData.test.js +2 -2
- package/lib/dada-client/hooks/__tests__/useAssetsData.test.js.map +1 -0
- package/lib/dada-client/hooks/useAssetData.d.ts +10 -0
- package/lib/dada-client/hooks/useAssetData.d.ts.map +1 -0
- package/lib/dada-client/hooks/useAssetData.js +23 -0
- package/lib/dada-client/hooks/useAssetData.js.map +1 -0
- package/lib/dada-client/hooks/useAssetsData.d.ts +19 -0
- package/lib/dada-client/hooks/useAssetsData.d.ts.map +1 -0
- package/lib/{modularDrawer → dada-client}/hooks/useAssetsData.js +1 -1
- package/lib/dada-client/hooks/useAssetsData.js.map +1 -0
- package/lib/dada-client/hooks/useInterestRatesByCurrencies.d.ts.map +1 -0
- package/lib/{modularDrawer → dada-client}/hooks/useInterestRatesByCurrencies.js +3 -3
- package/lib/dada-client/hooks/useInterestRatesByCurrencies.js.map +1 -0
- package/lib/dada-client/hooks/useMarketByCurrencies.d.ts.map +1 -0
- package/lib/{modularDrawer → dada-client}/hooks/useMarketByCurrencies.js +5 -6
- package/lib/dada-client/hooks/useMarketByCurrencies.js.map +1 -0
- package/lib/{modularDrawer/data → dada-client}/state-manager/api.d.ts +134 -1
- package/lib/{modularDrawer/data → dada-client}/state-manager/api.d.ts.map +1 -1
- package/lib/{modularDrawer/data → dada-client}/state-manager/api.js +21 -2
- package/lib/dada-client/state-manager/api.js.map +1 -0
- package/lib/dada-client/state-manager/types.d.ts.map +1 -0
- package/lib/dada-client/state-manager/types.js.map +1 -0
- package/lib/dada-client/types/trend.d.ts +2 -0
- package/lib/dada-client/types/trend.d.ts.map +1 -0
- package/lib/dada-client/types/trend.js +3 -0
- package/lib/dada-client/types/trend.js.map +1 -0
- package/lib/deposit/useGroupedCurrenciesByProvider.hook.d.ts.map +1 -1
- package/lib/deposit/useGroupedCurrenciesByProvider.hook.js +6 -1
- package/lib/deposit/useGroupedCurrenciesByProvider.hook.js.map +1 -1
- package/lib/e2e/enum/Account.d.ts +2 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +4 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +2 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +4 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +2 -1
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +1 -0
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/enum/Provider.d.ts +1 -0
- package/lib/e2e/enum/Provider.d.ts.map +1 -1
- package/lib/e2e/enum/Provider.js +1 -0
- package/lib/e2e/enum/Provider.js.map +1 -1
- package/lib/e2e/families/hedera.d.ts +2 -0
- package/lib/e2e/families/hedera.d.ts.map +1 -0
- package/lib/e2e/families/hedera.js +11 -0
- package/lib/e2e/families/hedera.js.map +1 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +12 -0
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/swap.d.ts +1 -1
- package/lib/e2e/swap.d.ts.map +1 -1
- package/lib/e2e/swap.js +6 -5
- package/lib/e2e/swap.js.map +1 -1
- package/lib/exchange/platform/types.d.ts +2 -0
- package/lib/exchange/platform/types.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +22 -1
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.js +8 -0
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib/exchange/swap/postSwapState.js +19 -23
- package/lib/exchange/swap/postSwapState.js.map +1 -1
- package/lib/exchange/swap/setBroadcastTransaction.d.ts +4 -4
- package/lib/exchange/swap/setBroadcastTransaction.js +7 -7
- package/lib/exchange/swap/setBroadcastTransaction.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +3 -3
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/exchange/swap/updateAccountSwapStatus.d.ts.map +1 -1
- package/lib/exchange/swap/updateAccountSwapStatus.js +6 -4
- package/lib/exchange/swap/updateAccountSwapStatus.js.map +1 -1
- package/lib/families/canton/config.js +10 -10
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/evm/shouldUseReceiveOptions.d.ts +3 -0
- package/lib/families/evm/shouldUseReceiveOptions.d.ts.map +1 -0
- package/lib/families/evm/shouldUseReceiveOptions.js +5 -0
- package/lib/families/evm/shouldUseReceiveOptions.js.map +1 -0
- package/lib/families/evm/shouldUseReceiveOptions.test.d.ts +2 -0
- package/lib/families/evm/shouldUseReceiveOptions.test.d.ts.map +1 -0
- package/lib/families/evm/shouldUseReceiveOptions.test.js +26 -0
- package/lib/families/evm/shouldUseReceiveOptions.test.js.map +1 -0
- package/lib/families/hedera/exchange.d.ts +9 -0
- package/lib/families/hedera/exchange.d.ts.map +1 -0
- package/lib/families/hedera/exchange.js +36 -0
- package/lib/families/hedera/exchange.js.map +1 -0
- package/lib/families/tezos/config.js +2 -2
- package/lib/families/tezos/react.d.ts +2 -1
- package/lib/families/tezos/react.d.ts.map +1 -1
- package/lib/families/tezos/react.js +19 -1
- package/lib/families/tezos/react.js.map +1 -1
- package/lib/families/tezos/setup.d.ts +1 -4
- package/lib/families/tezos/setup.d.ts.map +1 -1
- package/lib/families/tezos/setup.js +3 -11
- package/lib/families/tezos/setup.js.map +1 -1
- package/lib/generated/bridge/js.d.ts +0 -1
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +10 -12
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/hw/actions/completeExchange.d.ts +2 -0
- package/lib/hw/actions/completeExchange.d.ts.map +1 -1
- package/lib/hw/actions/completeExchange.js +1 -0
- package/lib/hw/actions/completeExchange.js.map +1 -1
- package/lib/hw/signMessage/index.d.ts.map +1 -1
- package/lib/hw/signMessage/index.js +7 -0
- package/lib/hw/signMessage/index.js.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.js +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.js +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.js.map +1 -1
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js +6 -3
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -1
- package/lib/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useAssetAccountCounts.js +2 -4
- package/lib/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +224 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.js +1 -1
- package/lib/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +8 -10
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +21 -64
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +7 -28
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +12 -56
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.js +2 -2
- package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.js +15 -4
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.js +212 -0
- package/lib/modularDrawer/utils/__tests__/calculateProviderTotal.test.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js +202 -0
- package/lib/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js.map +1 -0
- package/lib/modularDrawer/utils/calculateProviderTotal.d.ts +1 -0
- package/lib/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -1
- package/lib/modularDrawer/utils/calculateProviderTotal.js +10 -2
- package/lib/modularDrawer/utils/calculateProviderTotal.js.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +6 -4
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +9 -22
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib/modularDrawer/utils/getInterestRateForAsset.d.ts +1 -1
- package/lib/modularDrawer/utils/getInterestRateForAsset.d.ts.map +1 -1
- package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts +4 -3
- package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -1
- package/lib/modularDrawer/utils/groupAccountsByAsset.js +27 -11
- package/lib/modularDrawer/utils/groupAccountsByAsset.js.map +1 -1
- package/lib/modularDrawer/utils/index.d.ts +2 -6
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +2 -13
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/index.test.js +0 -26
- package/lib/modularDrawer/utils/index.test.js.map +1 -1
- package/lib/modularDrawer/utils/sortByBalance.d.ts +1 -3
- package/lib/modularDrawer/utils/sortByBalance.d.ts.map +1 -1
- package/lib/modularDrawer/utils/sortByBalance.js +6 -18
- package/lib/modularDrawer/utils/sortByBalance.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +15 -17
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib/wallet-api/CustomDeeplink/server.d.ts +16 -0
- package/lib/wallet-api/CustomDeeplink/server.d.ts.map +1 -0
- package/lib/wallet-api/CustomDeeplink/server.js +10 -0
- package/lib/wallet-api/CustomDeeplink/server.js.map +1 -0
- package/lib/wallet-api/Exchange/server.js +6 -6
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/constants.d.ts +1 -1
- package/lib/wallet-api/constants.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib-es/__tests__/test-helpers/environment.js +1 -1
- package/lib-es/__tests__/test-helpers/environment.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 +3 -0
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +4 -4
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +7 -9
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +11 -0
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +15 -9
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +29 -4
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js +38 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js +6 -0
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +15 -1
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +5 -3
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +60 -0
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js +1 -1
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +1 -2
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +2 -2
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +23 -4
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +1 -0
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/dada-client/entities/index.d.ts.map +1 -0
- package/lib-es/dada-client/entities/index.js.map +1 -0
- package/lib-es/{modularDrawer/data → dada-client}/entities/interestRateSelectors.d.ts +1 -1
- package/lib-es/dada-client/entities/interestRateSelectors.d.ts.map +1 -0
- package/lib-es/dada-client/entities/interestRateSelectors.js.map +1 -0
- package/lib-es/{modularDrawer/data → dada-client}/entities/marketSelectors.d.ts +1 -1
- package/lib-es/dada-client/entities/marketSelectors.d.ts.map +1 -0
- package/lib-es/dada-client/entities/marketSelectors.js.map +1 -0
- package/lib-es/dada-client/entities/selectorUtils.d.ts.map +1 -0
- package/lib-es/dada-client/entities/selectorUtils.js.map +1 -0
- package/lib-es/dada-client/hooks/__tests__/useAssetsData.test.d.ts.map +1 -0
- package/lib-es/{modularDrawer/hooks/__test__ → dada-client/hooks/__tests__}/useAssetsData.test.js +2 -2
- package/lib-es/dada-client/hooks/__tests__/useAssetsData.test.js.map +1 -0
- package/lib-es/dada-client/hooks/useAssetData.d.ts +10 -0
- package/lib-es/dada-client/hooks/useAssetData.d.ts.map +1 -0
- package/lib-es/dada-client/hooks/useAssetData.js +19 -0
- package/lib-es/dada-client/hooks/useAssetData.js.map +1 -0
- package/lib-es/dada-client/hooks/useAssetsData.d.ts +19 -0
- package/lib-es/dada-client/hooks/useAssetsData.d.ts.map +1 -0
- package/lib-es/{modularDrawer → dada-client}/hooks/useAssetsData.js +1 -1
- package/lib-es/dada-client/hooks/useAssetsData.js.map +1 -0
- package/lib-es/dada-client/hooks/useInterestRatesByCurrencies.d.ts.map +1 -0
- package/lib-es/{modularDrawer → dada-client}/hooks/useInterestRatesByCurrencies.js +3 -3
- package/lib-es/dada-client/hooks/useInterestRatesByCurrencies.js.map +1 -0
- package/lib-es/dada-client/hooks/useMarketByCurrencies.d.ts.map +1 -0
- package/lib-es/{modularDrawer → dada-client}/hooks/useMarketByCurrencies.js +5 -6
- package/lib-es/dada-client/hooks/useMarketByCurrencies.js.map +1 -0
- package/lib-es/{modularDrawer/data → dada-client}/state-manager/api.d.ts +134 -1
- package/lib-es/{modularDrawer/data → dada-client}/state-manager/api.d.ts.map +1 -1
- package/lib-es/{modularDrawer/data → dada-client}/state-manager/api.js +20 -1
- package/lib-es/dada-client/state-manager/api.js.map +1 -0
- package/lib-es/dada-client/state-manager/types.d.ts.map +1 -0
- package/lib-es/dada-client/state-manager/types.js.map +1 -0
- package/lib-es/dada-client/types/trend.d.ts +2 -0
- package/lib-es/dada-client/types/trend.d.ts.map +1 -0
- package/lib-es/dada-client/types/trend.js +2 -0
- package/lib-es/dada-client/types/trend.js.map +1 -0
- package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.d.ts.map +1 -1
- package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.js +6 -1
- package/lib-es/deposit/useGroupedCurrenciesByProvider.hook.js.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +2 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +4 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +2 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +4 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +2 -1
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +1 -0
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/enum/Provider.d.ts +1 -0
- package/lib-es/e2e/enum/Provider.d.ts.map +1 -1
- package/lib-es/e2e/enum/Provider.js +1 -0
- package/lib-es/e2e/enum/Provider.js.map +1 -1
- package/lib-es/e2e/families/hedera.d.ts +2 -0
- package/lib-es/e2e/families/hedera.d.ts.map +1 -0
- package/lib-es/e2e/families/hedera.js +7 -0
- package/lib-es/e2e/families/hedera.js.map +1 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +12 -0
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/swap.d.ts +1 -1
- package/lib-es/e2e/swap.d.ts.map +1 -1
- package/lib-es/e2e/swap.js +6 -5
- package/lib-es/e2e/swap.js.map +1 -1
- package/lib-es/exchange/platform/types.d.ts +2 -0
- package/lib-es/exchange/platform/types.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +22 -1
- package/lib-es/exchange/swap/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.d.ts.map +1 -1
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js +8 -0
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib-es/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib-es/exchange/swap/postSwapState.js +19 -23
- package/lib-es/exchange/swap/postSwapState.js.map +1 -1
- package/lib-es/exchange/swap/setBroadcastTransaction.d.ts +4 -4
- package/lib-es/exchange/swap/setBroadcastTransaction.js +7 -7
- package/lib-es/exchange/swap/setBroadcastTransaction.js.map +1 -1
- package/lib-es/exchange/swap/types.d.ts +3 -3
- package/lib-es/exchange/swap/types.d.ts.map +1 -1
- package/lib-es/exchange/swap/updateAccountSwapStatus.d.ts.map +1 -1
- package/lib-es/exchange/swap/updateAccountSwapStatus.js +6 -4
- package/lib-es/exchange/swap/updateAccountSwapStatus.js.map +1 -1
- package/lib-es/families/canton/config.js +10 -10
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/evm/shouldUseReceiveOptions.d.ts +3 -0
- package/lib-es/families/evm/shouldUseReceiveOptions.d.ts.map +1 -0
- package/lib-es/families/evm/shouldUseReceiveOptions.js +3 -0
- package/lib-es/families/evm/shouldUseReceiveOptions.js.map +1 -0
- package/lib-es/families/evm/shouldUseReceiveOptions.test.d.ts +2 -0
- package/lib-es/families/evm/shouldUseReceiveOptions.test.d.ts.map +1 -0
- package/lib-es/families/evm/shouldUseReceiveOptions.test.js +21 -0
- package/lib-es/families/evm/shouldUseReceiveOptions.test.js.map +1 -0
- package/lib-es/families/hedera/exchange.d.ts +9 -0
- package/lib-es/families/hedera/exchange.d.ts.map +1 -0
- package/lib-es/families/hedera/exchange.js +29 -0
- package/lib-es/families/hedera/exchange.js.map +1 -0
- package/lib-es/families/tezos/config.js +2 -2
- package/lib-es/families/tezos/react.d.ts +2 -1
- package/lib-es/families/tezos/react.d.ts.map +1 -1
- package/lib-es/families/tezos/react.js +17 -0
- package/lib-es/families/tezos/react.js.map +1 -1
- package/lib-es/families/tezos/setup.d.ts +1 -4
- package/lib-es/families/tezos/setup.d.ts.map +1 -1
- package/lib-es/families/tezos/setup.js +2 -9
- package/lib-es/families/tezos/setup.js.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +0 -1
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +0 -2
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/hw/actions/completeExchange.d.ts +2 -0
- package/lib-es/hw/actions/completeExchange.d.ts.map +1 -1
- package/lib-es/hw/actions/completeExchange.js +1 -0
- package/lib-es/hw/actions/completeExchange.js.map +1 -1
- package/lib-es/hw/signMessage/index.d.ts.map +1 -1
- package/lib-es/hw/signMessage/index.js +7 -0
- package/lib-es/hw/signMessage/index.js.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.js +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.js +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.js.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js +2 -2
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetAccountCounts.js +2 -4
- package/lib-es/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +7 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +217 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js +1 -1
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +8 -10
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +21 -64
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +7 -28
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +12 -56
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js +2 -2
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +15 -4
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.js +207 -0
- package/lib-es/modularDrawer/utils/__tests__/calculateProviderTotal.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js +1 -1
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -1
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js +197 -0
- package/lib-es/modularDrawer/utils/__tests__/groupAccountsByAsset.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts +1 -0
- package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/calculateProviderTotal.js +10 -2
- package/lib-es/modularDrawer/utils/calculateProviderTotal.js.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +6 -4
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +9 -22
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -1
- package/lib-es/modularDrawer/utils/getInterestRateForAsset.d.ts +1 -1
- package/lib-es/modularDrawer/utils/getInterestRateForAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts +4 -3
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.js +27 -11
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.d.ts +2 -6
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +2 -10
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.test.js +1 -27
- package/lib-es/modularDrawer/utils/index.test.js.map +1 -1
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts +1 -3
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/sortByBalance.js +5 -15
- package/lib-es/modularDrawer/utils/sortByBalance.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +15 -17
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/wallet-api/CustomDeeplink/server.d.ts +16 -0
- package/lib-es/wallet-api/CustomDeeplink/server.d.ts.map +1 -0
- package/lib-es/wallet-api/CustomDeeplink/server.js +6 -0
- package/lib-es/wallet-api/CustomDeeplink/server.js.map +1 -0
- package/lib-es/wallet-api/Exchange/server.js +6 -6
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/constants.d.ts +1 -1
- package/lib-es/wallet-api/constants.d.ts.map +1 -1
- package/package.json +9 -7
- package/src/__tests__/test-helpers/bridge.ts +1 -1
- package/src/__tests__/test-helpers/environment.ts +1 -1
- package/src/bridge/generic-alpaca/alpaca/index.ts +4 -0
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +28 -28
- package/src/bridge/generic-alpaca/createTransaction.ts +11 -0
- package/src/bridge/generic-alpaca/getAccountShape.ts +22 -15
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +1 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +47 -5
- package/src/bridge/generic-alpaca/signer/index.ts +44 -1
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +10 -0
- package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +15 -1
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +5 -3
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +78 -0
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +1 -1
- package/src/bridge/generic-alpaca/types.ts +10 -2
- package/src/bridge/generic-alpaca/utils.ts +25 -6
- package/src/bridge/impl.ts +1 -0
- package/src/dada-client/README.md +93 -0
- package/src/{modularDrawer/data → dada-client}/entities/interestRateSelectors.ts +1 -1
- package/src/{modularDrawer/data → dada-client}/entities/marketSelectors.ts +1 -1
- package/src/{modularDrawer/hooks/__test__ → dada-client/hooks/__tests__}/useAssetsData.test.ts +2 -2
- package/src/dada-client/hooks/useAssetData.ts +22 -0
- package/src/{modularDrawer → dada-client}/hooks/useAssetsData.ts +2 -2
- package/src/{modularDrawer → dada-client}/hooks/useInterestRatesByCurrencies.ts +4 -4
- package/src/{modularDrawer → dada-client}/hooks/useMarketByCurrencies.ts +5 -6
- package/src/{modularDrawer/data → dada-client}/state-manager/api.ts +22 -1
- package/src/dada-client/types/trend.ts +1 -0
- package/src/deposit/useGroupedCurrenciesByProvider.hook.ts +8 -2
- package/src/e2e/enum/Account.ts +10 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +11 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/enum/Provider.ts +1 -0
- package/src/e2e/families/hedera.ts +7 -0
- package/src/e2e/speculos.ts +12 -0
- package/src/e2e/swap.ts +6 -6
- package/src/exchange/platform/types.ts +2 -0
- package/src/exchange/swap/completeExchange.ts +32 -2
- package/src/exchange/swap/getIncompatibleCurrencyKeys.ts +8 -0
- package/src/exchange/swap/postSwapState.ts +28 -32
- package/src/exchange/swap/setBroadcastTransaction.ts +12 -12
- package/src/exchange/swap/types.ts +3 -3
- package/src/exchange/swap/updateAccountSwapStatus.ts +8 -6
- package/src/families/canton/config.ts +10 -10
- package/src/families/evm/shouldUseReceiveOptions.test.ts +25 -0
- package/src/families/evm/shouldUseReceiveOptions.ts +4 -0
- package/src/families/hedera/exchange.ts +48 -0
- package/src/families/tezos/config.ts +2 -2
- package/src/families/tezos/react.ts +20 -1
- package/src/families/tezos/setup.ts +3 -22
- package/src/generated/bridge/js.ts +0 -2
- package/src/hw/actions/completeExchange.ts +3 -0
- package/src/hw/signMessage/index.ts +10 -0
- package/src/modularDrawer/hooks/modules/useLeftApyModule.tsx +2 -2
- package/src/modularDrawer/hooks/modules/useLeftMarketTrendModule.tsx +1 -1
- package/src/modularDrawer/hooks/modules/useRightMarketTrendModule.tsx +2 -2
- package/src/modularDrawer/hooks/useAssetAccountCounts.tsx +8 -10
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +231 -0
- package/src/modularDrawer/hooks/useLeftAccountsApy.tsx +1 -1
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +26 -102
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +19 -100
- package/src/modularDrawer/modules/createAssetConfiguration.ts +3 -11
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +26 -10
- package/src/modularDrawer/utils/__tests__/calculateProviderTotal.test.ts +237 -0
- package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +1 -1
- package/src/modularDrawer/utils/__tests__/getInterestRateForAsset.test.ts +1 -1
- package/src/modularDrawer/utils/__tests__/groupAccountsByAsset.test.ts +228 -0
- package/src/modularDrawer/utils/calculateProviderTotal.ts +13 -2
- package/src/modularDrawer/utils/currencyUtils.ts +0 -1
- package/src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts +13 -37
- package/src/modularDrawer/utils/getInterestRateForAsset.ts +1 -1
- package/src/modularDrawer/utils/groupAccountsByAsset.ts +38 -19
- package/src/modularDrawer/utils/index.test.ts +1 -32
- package/src/modularDrawer/utils/index.ts +2 -23
- package/src/modularDrawer/utils/sortByBalance.tsx +5 -18
- package/src/modularDrawer/utils/type.ts +18 -14
- package/src/wallet-api/CustomDeeplink/server.ts +23 -0
- package/src/wallet-api/Exchange/server.ts +6 -6
- package/lib/modularDrawer/data/entities/index.d.ts.map +0 -1
- package/lib/modularDrawer/data/entities/index.js.map +0 -1
- package/lib/modularDrawer/data/entities/interestRateSelectors.d.ts.map +0 -1
- package/lib/modularDrawer/data/entities/interestRateSelectors.js.map +0 -1
- package/lib/modularDrawer/data/entities/marketSelectors.d.ts.map +0 -1
- package/lib/modularDrawer/data/entities/marketSelectors.js.map +0 -1
- package/lib/modularDrawer/data/entities/selectorUtils.d.ts.map +0 -1
- package/lib/modularDrawer/data/entities/selectorUtils.js.map +0 -1
- package/lib/modularDrawer/data/state-manager/api.js.map +0 -1
- package/lib/modularDrawer/data/state-manager/types.d.ts.map +0 -1
- package/lib/modularDrawer/data/state-manager/types.js.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.js.map +0 -1
- package/lib/modularDrawer/hooks/useAssetsData.d.ts +0 -19
- package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/useAssetsData.js.map +0 -1
- package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/useInterestRatesByCurrencies.js.map +0 -1
- package/lib/modularDrawer/hooks/useMarketByCurrencies.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/useMarketByCurrencies.js.map +0 -1
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -496
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +0 -2
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +0 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +0 -28
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +0 -1
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +0 -9
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +0 -1
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js +0 -17
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js.map +0 -1
- package/lib/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
- package/lib/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
- package/lib/modularDrawer/utils/counterValueFormatter.js +0 -107
- package/lib/modularDrawer/utils/counterValueFormatter.js.map +0 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.js +0 -39
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
- package/lib/modularDrawer/utils/getProviderCurrency.js +0 -14
- package/lib/modularDrawer/utils/getProviderCurrency.js.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts +0 -11
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
- package/lib/modularDrawer/utils/haveOneCommonProvider.js +0 -29
- package/lib/modularDrawer/utils/haveOneCommonProvider.js.map +0 -1
- package/lib/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
- package/lib/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
- package/lib/modularDrawer/utils/parseToBigNumber.js +0 -24
- package/lib/modularDrawer/utils/parseToBigNumber.js.map +0 -1
- package/lib-es/modularDrawer/data/entities/index.d.ts.map +0 -1
- package/lib-es/modularDrawer/data/entities/index.js.map +0 -1
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.d.ts.map +0 -1
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.js.map +0 -1
- package/lib-es/modularDrawer/data/entities/marketSelectors.d.ts.map +0 -1
- package/lib-es/modularDrawer/data/entities/marketSelectors.js.map +0 -1
- package/lib-es/modularDrawer/data/entities/selectorUtils.d.ts.map +0 -1
- package/lib-es/modularDrawer/data/entities/selectorUtils.js.map +0 -1
- package/lib-es/modularDrawer/data/state-manager/api.js.map +0 -1
- package/lib-es/modularDrawer/data/state-manager/types.d.ts.map +0 -1
- package/lib-es/modularDrawer/data/state-manager/types.js.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.js.map +0 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +0 -19
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.js.map +0 -1
- package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/useInterestRatesByCurrencies.js.map +0 -1
- package/lib-es/modularDrawer/hooks/useMarketByCurrencies.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/useMarketByCurrencies.js.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +0 -2
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js +0 -494
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +0 -2
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +0 -26
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +0 -1
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +0 -9
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js +0 -13
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js.map +0 -1
- package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts +0 -14
- package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/counterValueFormatter.js +0 -103
- package/lib-es/modularDrawer/utils/counterValueFormatter.js.map +0 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js +0 -32
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts +0 -3
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/getProviderCurrency.js +0 -10
- package/lib-es/modularDrawer/utils/getProviderCurrency.js.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts +0 -11
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.js +0 -25
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.js.map +0 -1
- package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts +0 -9
- package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/parseToBigNumber.js +0 -17
- package/lib-es/modularDrawer/utils/parseToBigNumber.js.map +0 -1
- package/src/modularDrawer/utils/__tests__/counterValueFormatter.test.ts +0 -549
- package/src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts +0 -34
- package/src/modularDrawer/utils/buildProviderCurrenciesMap.tsx +0 -25
- package/src/modularDrawer/utils/counterValueFormatter.ts +0 -165
- package/src/modularDrawer/utils/getBalanceAndFiatValue.ts +0 -53
- package/src/modularDrawer/utils/getProviderCurrency.ts +0 -13
- package/src/modularDrawer/utils/haveOneCommonProvider.ts +0 -31
- package/src/modularDrawer/utils/parseToBigNumber.ts +0 -17
- /package/lib/{modularDrawer/data → dada-client}/entities/index.d.ts +0 -0
- /package/lib/{modularDrawer/data → dada-client}/entities/index.js +0 -0
- /package/lib/{modularDrawer/data → dada-client}/entities/interestRateSelectors.js +0 -0
- /package/lib/{modularDrawer/data → dada-client}/entities/marketSelectors.js +0 -0
- /package/lib/{modularDrawer/data → dada-client}/entities/selectorUtils.d.ts +0 -0
- /package/lib/{modularDrawer/data → dada-client}/entities/selectorUtils.js +0 -0
- /package/lib/{modularDrawer/hooks/__test__ → dada-client/hooks/__tests__}/useAssetsData.test.d.ts +0 -0
- /package/lib/{modularDrawer → dada-client}/hooks/useInterestRatesByCurrencies.d.ts +0 -0
- /package/lib/{modularDrawer → dada-client}/hooks/useMarketByCurrencies.d.ts +0 -0
- /package/lib/{modularDrawer/data → dada-client}/state-manager/types.d.ts +0 -0
- /package/lib/{modularDrawer/data → dada-client}/state-manager/types.js +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/entities/index.d.ts +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/entities/index.js +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/entities/interestRateSelectors.js +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/entities/marketSelectors.js +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/entities/selectorUtils.d.ts +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/entities/selectorUtils.js +0 -0
- /package/lib-es/{modularDrawer/hooks/__test__ → dada-client/hooks/__tests__}/useAssetsData.test.d.ts +0 -0
- /package/lib-es/{modularDrawer → dada-client}/hooks/useInterestRatesByCurrencies.d.ts +0 -0
- /package/lib-es/{modularDrawer → dada-client}/hooks/useMarketByCurrencies.d.ts +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/state-manager/types.d.ts +0 -0
- /package/lib-es/{modularDrawer/data → dada-client}/state-manager/types.js +0 -0
- /package/src/{modularDrawer/data → dada-client}/entities/index.ts +0 -0
- /package/src/{modularDrawer/data → dada-client}/entities/selectorUtils.ts +0 -0
- /package/src/{modularDrawer/data → dada-client}/state-manager/types.ts +0 -0
@@ -0,0 +1,207 @@
|
|
1
|
+
import { calculateProviderTotals } from "../calculateProviderTotal";
|
2
|
+
import { createFixtureCryptoCurrency } from "../../../mock/fixtures/cryptoCurrencies";
|
3
|
+
import { genAccount } from "../../../mock/account";
|
4
|
+
import BigNumber from "bignumber.js";
|
5
|
+
describe("calculateProviderTotals", () => {
|
6
|
+
const mockBTCCurrency = createFixtureCryptoCurrency("bitcoin");
|
7
|
+
const mockETHCurrency = createFixtureCryptoCurrency("ethereum");
|
8
|
+
const mockBTCAccount = genAccount("btc-account", { currency: mockBTCCurrency });
|
9
|
+
const mockUSDCAccount = genAccount("usdc-account", { currency: mockETHCurrency });
|
10
|
+
const mockBscUSDCAccount = genAccount("bsc-usdc-account", { currency: mockETHCurrency });
|
11
|
+
const mockUSDCToken = {
|
12
|
+
type: "TokenCurrency",
|
13
|
+
id: "ethereum/erc20/usdc",
|
14
|
+
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
15
|
+
parentCurrency: mockETHCurrency,
|
16
|
+
tokenType: "erc20",
|
17
|
+
name: "USD Coin",
|
18
|
+
ticker: "USDC",
|
19
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }],
|
20
|
+
};
|
21
|
+
const mockBscUSDCToken = {
|
22
|
+
type: "TokenCurrency",
|
23
|
+
id: "bsc/bep20/usdc",
|
24
|
+
contractAddress: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
|
25
|
+
parentCurrency: mockETHCurrency,
|
26
|
+
tokenType: "bep20",
|
27
|
+
name: "USD Coin (BSC)",
|
28
|
+
ticker: "USDC",
|
29
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 18 }],
|
30
|
+
};
|
31
|
+
it("should return totals with hasAccounts false when no accounts exist", () => {
|
32
|
+
const currencies = [mockBTCCurrency, mockUSDCToken];
|
33
|
+
const groupedAccounts = {};
|
34
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
35
|
+
expect(result).toEqual({
|
36
|
+
totalBalance: new BigNumber(0),
|
37
|
+
totalFiatValue: new BigNumber(0),
|
38
|
+
hasAccounts: false,
|
39
|
+
referenceCurrency: null,
|
40
|
+
});
|
41
|
+
});
|
42
|
+
it("should sum totals across multiple currencies", () => {
|
43
|
+
const currencies = [mockBTCCurrency, mockUSDCToken];
|
44
|
+
const groupedAccounts = {
|
45
|
+
[mockBTCCurrency.id]: {
|
46
|
+
totalBalance: new BigNumber(100000000),
|
47
|
+
totalFiatValue: new BigNumber(50000),
|
48
|
+
accounts: [mockBTCAccount],
|
49
|
+
referenceCurrency: mockBTCCurrency,
|
50
|
+
},
|
51
|
+
[mockUSDCToken.id]: {
|
52
|
+
totalBalance: new BigNumber(1000000),
|
53
|
+
totalFiatValue: new BigNumber(1),
|
54
|
+
accounts: [mockUSDCAccount],
|
55
|
+
referenceCurrency: mockUSDCToken,
|
56
|
+
},
|
57
|
+
};
|
58
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
59
|
+
// BTC (magnitude 8) sets reference, USDC (magnitude 6) gets normalized
|
60
|
+
// USDC: 1000000 * 10^(8-6) = 1000000 * 100 = 100000000
|
61
|
+
// Total: 100000000 (BTC) + 100000000 (normalized USDC) = 200000000
|
62
|
+
expect(result).toEqual({
|
63
|
+
totalBalance: new BigNumber(200000000),
|
64
|
+
totalFiatValue: new BigNumber(50001),
|
65
|
+
hasAccounts: true,
|
66
|
+
referenceCurrency: mockBTCCurrency, // First currency with accounts
|
67
|
+
});
|
68
|
+
});
|
69
|
+
it("should return referenceCurrency from first asset group with accounts", () => {
|
70
|
+
const currencies = [mockUSDCToken, mockBscUSDCToken];
|
71
|
+
const groupedAccounts = {
|
72
|
+
[mockUSDCToken.id]: {
|
73
|
+
totalBalance: new BigNumber(1000000),
|
74
|
+
totalFiatValue: new BigNumber(1),
|
75
|
+
accounts: [mockUSDCAccount],
|
76
|
+
referenceCurrency: mockUSDCToken, // ETH USDC with 6 decimals
|
77
|
+
},
|
78
|
+
[mockBscUSDCToken.id]: {
|
79
|
+
totalBalance: new BigNumber("1000000000000000000"),
|
80
|
+
totalFiatValue: new BigNumber(1),
|
81
|
+
accounts: [mockBscUSDCAccount],
|
82
|
+
referenceCurrency: mockBscUSDCToken, // BSC USDC with 18 decimals
|
83
|
+
},
|
84
|
+
};
|
85
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
86
|
+
expect(result.referenceCurrency).toEqual(mockUSDCToken); // First currency
|
87
|
+
expect(result.hasAccounts).toBe(true);
|
88
|
+
});
|
89
|
+
it("should skip currencies with no accounts", () => {
|
90
|
+
const currencies = [mockBTCCurrency, mockUSDCToken];
|
91
|
+
const groupedAccounts = {
|
92
|
+
[mockUSDCToken.id]: {
|
93
|
+
totalBalance: new BigNumber(1000000),
|
94
|
+
totalFiatValue: new BigNumber(1),
|
95
|
+
accounts: [mockUSDCAccount],
|
96
|
+
referenceCurrency: mockUSDCToken,
|
97
|
+
},
|
98
|
+
// BTC has no entry in groupedAccounts
|
99
|
+
};
|
100
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
101
|
+
expect(result).toEqual({
|
102
|
+
totalBalance: new BigNumber(1000000),
|
103
|
+
totalFiatValue: new BigNumber(1),
|
104
|
+
hasAccounts: true,
|
105
|
+
referenceCurrency: mockUSDCToken,
|
106
|
+
});
|
107
|
+
});
|
108
|
+
it("should skip currencies with empty accounts array", () => {
|
109
|
+
const currencies = [mockBTCCurrency, mockUSDCToken];
|
110
|
+
const groupedAccounts = {
|
111
|
+
[mockBTCCurrency.id]: {
|
112
|
+
totalBalance: new BigNumber(100000000),
|
113
|
+
totalFiatValue: new BigNumber(50000),
|
114
|
+
accounts: [],
|
115
|
+
referenceCurrency: mockBTCCurrency,
|
116
|
+
},
|
117
|
+
[mockUSDCToken.id]: {
|
118
|
+
totalBalance: new BigNumber(1000000),
|
119
|
+
totalFiatValue: new BigNumber(1),
|
120
|
+
accounts: [mockUSDCAccount],
|
121
|
+
referenceCurrency: mockUSDCToken,
|
122
|
+
},
|
123
|
+
};
|
124
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
125
|
+
expect(result).toEqual({
|
126
|
+
totalBalance: new BigNumber(1000000),
|
127
|
+
totalFiatValue: new BigNumber(1),
|
128
|
+
hasAccounts: true,
|
129
|
+
referenceCurrency: mockUSDCToken,
|
130
|
+
});
|
131
|
+
});
|
132
|
+
it("should normalize balances based on magnitude differences", () => {
|
133
|
+
// Test the specific code: magnitude normalization between currencies
|
134
|
+
const currencies = [mockUSDCToken, mockBscUSDCToken];
|
135
|
+
const groupedAccounts = {
|
136
|
+
[mockUSDCToken.id]: {
|
137
|
+
totalBalance: new BigNumber(1000000),
|
138
|
+
totalFiatValue: new BigNumber(1),
|
139
|
+
accounts: [mockUSDCAccount],
|
140
|
+
referenceCurrency: mockUSDCToken, // 6 decimals
|
141
|
+
},
|
142
|
+
[mockBscUSDCToken.id]: {
|
143
|
+
totalBalance: new BigNumber("1000000000000000000"),
|
144
|
+
totalFiatValue: new BigNumber(1),
|
145
|
+
accounts: [mockBscUSDCAccount],
|
146
|
+
referenceCurrency: mockBscUSDCToken, // 18 decimals
|
147
|
+
},
|
148
|
+
};
|
149
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
150
|
+
// First currency (USDC) sets reference magnitude of 6
|
151
|
+
// Second currency (BSC USDC) has magnitude 18, so diff = 6 - 18 = -12
|
152
|
+
// BSC balance of 1000000000000000000 shifted by -12 = 1000000
|
153
|
+
// Total should be 1000000 + 1000000 = 2000000
|
154
|
+
expect(result.totalBalance).toEqual(new BigNumber(2000000));
|
155
|
+
expect(result.totalFiatValue).toEqual(new BigNumber(2));
|
156
|
+
expect(result.hasAccounts).toBe(true);
|
157
|
+
expect(result.referenceCurrency).toEqual(mockUSDCToken);
|
158
|
+
});
|
159
|
+
it("should handle magnitude normalization when referenceCurrency is set", () => {
|
160
|
+
const currencies = [mockBscUSDCToken];
|
161
|
+
const groupedAccounts = {
|
162
|
+
[mockBscUSDCToken.id]: {
|
163
|
+
totalBalance: new BigNumber("2000000000000000000"),
|
164
|
+
totalFiatValue: new BigNumber(2),
|
165
|
+
accounts: [mockBscUSDCAccount],
|
166
|
+
referenceCurrency: mockBscUSDCToken,
|
167
|
+
},
|
168
|
+
};
|
169
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
170
|
+
expect(result.totalBalance).toEqual(new BigNumber("2000000000000000000"));
|
171
|
+
expect(result.referenceCurrency).toEqual(mockBscUSDCToken);
|
172
|
+
});
|
173
|
+
it("should handle zero magnitude difference correctly", () => {
|
174
|
+
const sameMagnitudeCurrency = {
|
175
|
+
type: "TokenCurrency",
|
176
|
+
id: "ethereum/erc20/usdc2",
|
177
|
+
contractAddress: "0x1234567890123456789012345678901234567890",
|
178
|
+
parentCurrency: mockETHCurrency,
|
179
|
+
tokenType: "erc20",
|
180
|
+
name: "USD Coin 2",
|
181
|
+
ticker: "USDC2",
|
182
|
+
units: [{ name: "USD Coin 2", code: "USDC2", magnitude: 6 }],
|
183
|
+
};
|
184
|
+
const mockSameMagnitudeAccount = genAccount("usdc2-account", { currency: mockETHCurrency });
|
185
|
+
const currencies = [mockUSDCToken, sameMagnitudeCurrency];
|
186
|
+
const groupedAccounts = {
|
187
|
+
[mockUSDCToken.id]: {
|
188
|
+
totalBalance: new BigNumber(1000000),
|
189
|
+
totalFiatValue: new BigNumber(1),
|
190
|
+
accounts: [mockUSDCAccount],
|
191
|
+
referenceCurrency: mockUSDCToken, // 6 decimals
|
192
|
+
},
|
193
|
+
[sameMagnitudeCurrency.id]: {
|
194
|
+
totalBalance: new BigNumber(2000000),
|
195
|
+
totalFiatValue: new BigNumber(2),
|
196
|
+
accounts: [mockSameMagnitudeAccount],
|
197
|
+
referenceCurrency: sameMagnitudeCurrency, // 6 decimals
|
198
|
+
},
|
199
|
+
};
|
200
|
+
const result = calculateProviderTotals(currencies, groupedAccounts);
|
201
|
+
// Both have magnitude 6, so diff = 6 - 6 = 0
|
202
|
+
// No shifting needed, simple addition: 1000000 + 2000000 = 3000000
|
203
|
+
expect(result.totalBalance).toEqual(new BigNumber(3000000));
|
204
|
+
expect(result.totalFiatValue).toEqual(new BigNumber(3));
|
205
|
+
});
|
206
|
+
});
|
207
|
+
//# sourceMappingURL=calculateProviderTotal.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"calculateProviderTotal.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/calculateProviderTotal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,MAAM,eAAe,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;IAC/D,MAAM,eAAe,GAAG,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAEhE,MAAM,cAAc,GAAG,UAAU,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;IAChF,MAAM,eAAe,GAAG,UAAU,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;IAClF,MAAM,kBAAkB,GAAG,UAAU,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;IAEzF,MAAM,aAAa,GAA0B;QAC3C,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,qBAAqB;QACzB,eAAe,EAAE,4CAA4C;QAC7D,cAAc,EAAE,eAAe;QAC/B,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;KAC1D,CAAC;IAEF,MAAM,gBAAgB,GAA0B;QAC9C,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,gBAAgB;QACpB,eAAe,EAAE,4CAA4C;QAC7D,cAAc,EAAE,eAAe;QAC/B,SAAS,EAAE,OAAO;QA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AE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;QAE5F,MAAM,UAAU,GAAG,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;QAC1D,MAAM,eAAe,GAAG;YACtB,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE;gBAClB,YAAY,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC;gBACpC,cAAc,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;gBAChC,QAAQ,EAAE,CAAC,eAAe,CAAC;gBAC3B,iBAAiB,EAAE,aAAa,EAAE,aAAa;aAChD;YACD,CAAC,qBAAqB,CAAC,EAAE,CAAC,EAAE;gBAC1B,YAAY,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC;gBACpC,cAAc,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;gBAChC,QAAQ,EAAE,CAAC,wBAAwB,CAAC;gBACpC,iBAAiB,EAAE,qBAAqB,EAAE,aAAa;aACxD;SACF,CAAC;QAEF,MAAM,MAAM,GAAG,uBAAuB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QAEpE,6CAA6C;QAC7C,mEAAmE;QACnE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
|
2
2
|
import { buildProviderCoverageMap, extractProviderCurrencies, filterProvidersByIds, getProviderCurrency, isProviderToken, safeCurrencyLookup, } from "../currencyUtils";
|
3
|
-
import {
|
3
|
+
import { mockBaseCryptoCurrency, mockBtcCryptoCurrency, mockEthCryptoCurrency, usdcToken, } from "../../__mocks__/currencies.mock";
|
4
4
|
describe("safeCurrencyLookup", () => {
|
5
5
|
it("should return the currency if it is found", () => {
|
6
6
|
const currency = safeCurrencyLookup("ethereum");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"currencyUtils.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/currencyUtils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AAGrG,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,
|
1
|
+
{"version":3,"file":"currencyUtils.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/currencyUtils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AAGrG,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,SAAS,GACV,MAAM,iCAAiC,CAAC;AAEzC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC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sByAsset.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,197 @@
|
|
1
|
+
import { groupAccountsByAsset } from "../groupAccountsByAsset";
|
2
|
+
import { createFixtureCryptoCurrency } from "../../../mock/fixtures/cryptoCurrencies";
|
3
|
+
import BigNumber from "bignumber.js";
|
4
|
+
// Mock calculate function
|
5
|
+
jest.mock("@ledgerhq/live-countervalues/logic", () => ({
|
6
|
+
calculate: jest.fn((state, { value }) => {
|
7
|
+
// Mock: return the balance directly as fiat value for simple testing
|
8
|
+
return value;
|
9
|
+
}),
|
10
|
+
}));
|
11
|
+
describe("groupAccountsByAsset", () => {
|
12
|
+
const mockCurrency = createFixtureCryptoCurrency("bitcoin");
|
13
|
+
const mockEthCurrency = createFixtureCryptoCurrency("ethereum");
|
14
|
+
const mockCounterValuesState = {};
|
15
|
+
const mockTargetCurrency = createFixtureCryptoCurrency("usd");
|
16
|
+
const mockUSDCToken = {
|
17
|
+
type: "TokenCurrency",
|
18
|
+
id: "ethereum/erc20/usdc",
|
19
|
+
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
20
|
+
parentCurrency: mockEthCurrency,
|
21
|
+
tokenType: "erc20",
|
22
|
+
name: "USD Coin",
|
23
|
+
ticker: "USDC",
|
24
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }],
|
25
|
+
};
|
26
|
+
const mockBTCAccount = {
|
27
|
+
type: "Account",
|
28
|
+
id: "btc-account-1",
|
29
|
+
seedIdentifier: "seed-id",
|
30
|
+
derivationMode: "",
|
31
|
+
currency: mockCurrency,
|
32
|
+
balance: new BigNumber(100000000),
|
33
|
+
spendableBalance: new BigNumber(100000000),
|
34
|
+
blockHeight: 0,
|
35
|
+
operations: [],
|
36
|
+
operationsCount: 0,
|
37
|
+
pendingOperations: [],
|
38
|
+
index: 0,
|
39
|
+
freshAddress: "btc-address",
|
40
|
+
freshAddressPath: "44'/0'/0'/0/0",
|
41
|
+
used: true,
|
42
|
+
swapHistory: [],
|
43
|
+
nfts: [],
|
44
|
+
lastSyncDate: new Date(),
|
45
|
+
creationDate: new Date(),
|
46
|
+
balanceHistoryCache: {
|
47
|
+
HOUR: { balances: [], latestDate: null },
|
48
|
+
DAY: { balances: [], latestDate: null },
|
49
|
+
WEEK: { balances: [], latestDate: null },
|
50
|
+
},
|
51
|
+
};
|
52
|
+
const mockUSDCAccount = {
|
53
|
+
type: "TokenAccount",
|
54
|
+
id: "usdc-account-1",
|
55
|
+
token: mockUSDCToken,
|
56
|
+
parentId: "eth-account-1",
|
57
|
+
balance: new BigNumber(1000000),
|
58
|
+
spendableBalance: new BigNumber(1000000),
|
59
|
+
operations: [],
|
60
|
+
operationsCount: 0,
|
61
|
+
pendingOperations: [],
|
62
|
+
swapHistory: [],
|
63
|
+
creationDate: new Date(),
|
64
|
+
balanceHistoryCache: {
|
65
|
+
HOUR: { balances: [], latestDate: null },
|
66
|
+
DAY: { balances: [], latestDate: null },
|
67
|
+
WEEK: { balances: [], latestDate: null },
|
68
|
+
},
|
69
|
+
};
|
70
|
+
it("should group accounts by asset ID and aggregate balances", () => {
|
71
|
+
const accounts = [mockBTCAccount, mockUSDCAccount];
|
72
|
+
const result = groupAccountsByAsset(accounts, mockCounterValuesState, mockTargetCurrency);
|
73
|
+
expect(result).toEqual({
|
74
|
+
[mockCurrency.id]: {
|
75
|
+
totalBalance: new BigNumber(100000000),
|
76
|
+
totalFiatValue: new BigNumber(100000000),
|
77
|
+
accounts: [mockBTCAccount],
|
78
|
+
referenceCurrency: mockCurrency,
|
79
|
+
},
|
80
|
+
[mockUSDCToken.id]: {
|
81
|
+
totalBalance: new BigNumber(1000000),
|
82
|
+
totalFiatValue: new BigNumber(1000000),
|
83
|
+
accounts: [mockUSDCAccount],
|
84
|
+
referenceCurrency: mockUSDCToken,
|
85
|
+
},
|
86
|
+
});
|
87
|
+
});
|
88
|
+
it("should aggregate multiple accounts with the same asset", () => {
|
89
|
+
const secondBTCAccount = {
|
90
|
+
...mockBTCAccount,
|
91
|
+
id: "btc-account-2",
|
92
|
+
balance: new BigNumber(50000000), // 0.5 BTC
|
93
|
+
};
|
94
|
+
const accounts = [mockBTCAccount, secondBTCAccount];
|
95
|
+
const result = groupAccountsByAsset(accounts, mockCounterValuesState, mockTargetCurrency);
|
96
|
+
expect(result[mockCurrency.id]).toEqual({
|
97
|
+
totalBalance: new BigNumber(150000000),
|
98
|
+
totalFiatValue: new BigNumber(150000000),
|
99
|
+
accounts: [mockBTCAccount, secondBTCAccount],
|
100
|
+
referenceCurrency: mockCurrency,
|
101
|
+
});
|
102
|
+
});
|
103
|
+
it("should handle empty accounts array", () => {
|
104
|
+
const result = groupAccountsByAsset([], mockCounterValuesState, mockTargetCurrency);
|
105
|
+
expect(result).toEqual({});
|
106
|
+
});
|
107
|
+
it("should handle accounts with zero balance", () => {
|
108
|
+
const zeroBalanceAccount = {
|
109
|
+
...mockBTCAccount,
|
110
|
+
balance: new BigNumber(0),
|
111
|
+
};
|
112
|
+
const accounts = [zeroBalanceAccount];
|
113
|
+
const result = groupAccountsByAsset(accounts, mockCounterValuesState, mockTargetCurrency);
|
114
|
+
expect(result[mockCurrency.id]).toEqual({
|
115
|
+
totalBalance: new BigNumber(0),
|
116
|
+
totalFiatValue: new BigNumber(0),
|
117
|
+
accounts: [zeroBalanceAccount],
|
118
|
+
referenceCurrency: mockCurrency,
|
119
|
+
});
|
120
|
+
});
|
121
|
+
it("should set referenceCurrency to the first currency encountered for each asset group", () => {
|
122
|
+
const accounts = [mockBTCAccount, mockUSDCAccount];
|
123
|
+
const result = groupAccountsByAsset(accounts, mockCounterValuesState, mockTargetCurrency);
|
124
|
+
expect(result[mockCurrency.id].referenceCurrency).toEqual(mockCurrency);
|
125
|
+
expect(result[mockUSDCToken.id].referenceCurrency).toEqual(mockUSDCToken);
|
126
|
+
});
|
127
|
+
it("should normalize balances when tokens have different magnitudes", () => {
|
128
|
+
// Create BSC USDC with different magnitude (18 decimals instead of 6)
|
129
|
+
const mockBscUSDCToken = {
|
130
|
+
...mockUSDCToken,
|
131
|
+
id: "bsc/bep20/usdc",
|
132
|
+
name: "USD Coin (BSC)",
|
133
|
+
ticker: "USDC",
|
134
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 18 }], // 18 decimals
|
135
|
+
};
|
136
|
+
const mockEthUSDCAccount = {
|
137
|
+
...mockUSDCAccount,
|
138
|
+
id: "eth-usdc-account",
|
139
|
+
token: mockUSDCToken,
|
140
|
+
balance: new BigNumber(1000000), // 1 USDC with 6 decimals
|
141
|
+
};
|
142
|
+
const mockBscUSDCAccount = {
|
143
|
+
...mockUSDCAccount,
|
144
|
+
id: "bsc-usdc-account",
|
145
|
+
token: mockBscUSDCToken,
|
146
|
+
balance: new BigNumber("1000000000000000000"), // 1 USDC with 18 decimals
|
147
|
+
};
|
148
|
+
// Both should be grouped under the same token ID for this test
|
149
|
+
// First account (ETH USDC) becomes reference currency with 6 decimals
|
150
|
+
const accounts = [mockEthUSDCAccount, mockBscUSDCAccount];
|
151
|
+
const result = groupAccountsByAsset(accounts, mockCounterValuesState, mockTargetCurrency);
|
152
|
+
const ethGroup = result[mockUSDCToken.id];
|
153
|
+
expect(ethGroup.referenceCurrency).toEqual(mockUSDCToken); // First currency is reference
|
154
|
+
expect(ethGroup.accounts).toHaveLength(1);
|
155
|
+
expect(ethGroup.totalBalance).toEqual(new BigNumber(1000000)); // 1 USDC normalized to 6 decimals
|
156
|
+
const bscGroup = result[mockBscUSDCToken.id];
|
157
|
+
expect(bscGroup.referenceCurrency).toEqual(mockBscUSDCToken);
|
158
|
+
expect(bscGroup.accounts).toHaveLength(1);
|
159
|
+
expect(bscGroup.totalBalance).toEqual(new BigNumber("1000000000000000000")); // 1 USDC with 18 decimals
|
160
|
+
});
|
161
|
+
it("should normalize balances correctly when adding accounts with different magnitudes to same asset group", () => {
|
162
|
+
// Create two USDC tokens with same ID but different magnitudes
|
163
|
+
const ethUSDCToken = {
|
164
|
+
...mockUSDCToken,
|
165
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }], // 6 decimals
|
166
|
+
};
|
167
|
+
const bscUSDCToken = {
|
168
|
+
...mockUSDCToken,
|
169
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 18 }], // 18 decimals
|
170
|
+
};
|
171
|
+
const ethAccount = {
|
172
|
+
...mockUSDCAccount,
|
173
|
+
id: "eth-usdc",
|
174
|
+
token: ethUSDCToken,
|
175
|
+
balance: new BigNumber(1000000), // 1 USDC with 6 decimals
|
176
|
+
};
|
177
|
+
const bscAccount = {
|
178
|
+
...mockUSDCAccount,
|
179
|
+
id: "bsc-usdc",
|
180
|
+
token: bscUSDCToken,
|
181
|
+
balance: new BigNumber("1000000000000000000"), // 1 USDC with 18 decimals
|
182
|
+
};
|
183
|
+
// Process ETH account first to make it the reference currency
|
184
|
+
const accounts = [ethAccount, bscAccount];
|
185
|
+
const result = groupAccountsByAsset(accounts, mockCounterValuesState, mockTargetCurrency);
|
186
|
+
const group = result[mockUSDCToken.id];
|
187
|
+
expect(group.referenceCurrency).toEqual(ethUSDCToken); // First currency is reference (6 decimals)
|
188
|
+
expect(group.accounts).toHaveLength(2);
|
189
|
+
// BSC balance should be normalized from 18 decimals to 6 decimals
|
190
|
+
// 1000000000000000000 (18 decimals) -> 1000000 (6 decimals)
|
191
|
+
// magnitudeDiff = 6 - 18 = -12
|
192
|
+
// normalized = 1000000000000000000 * 10^(-12) = 1000000
|
193
|
+
const expectedTotal = new BigNumber(1000000).plus(new BigNumber(1000000)); // 2 USDC total
|
194
|
+
expect(group.totalBalance).toEqual(expectedTotal);
|
195
|
+
});
|
196
|
+
});
|
197
|
+
//# sourceMappingURL=groupAccountsByAsset.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"groupAccountsByAsset.test.js","sourceRoot":"","sources":["../../../../src/modularDrawer/utils/__tests__/groupAccountsByAsset.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB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,oBAAoB,CAAC,QAAQ,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;QAE1F,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,2CAA2C;QAClG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAEvC,kEAAkE;QAClE,4DAA4D;QAC5D,+BAA+B;QAC/B,wDAAwD;QACxD,MAAM,aAAa,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe;QAC1F,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -5,5 +5,6 @@ export declare const calculateProviderTotals: (currencies: CryptoOrTokenCurrency
|
|
5
5
|
totalBalance: BigNumber;
|
6
6
|
totalFiatValue: BigNumber;
|
7
7
|
hasAccounts: boolean;
|
8
|
+
referenceCurrency: CryptoOrTokenCurrency | null;
|
8
9
|
};
|
9
10
|
//# sourceMappingURL=calculateProviderTotal.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"calculateProviderTotal.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/calculateProviderTotal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,eAAO,MAAM,uBAAuB,eACtB,qBAAqB,EAAE,0BACX,OAAO,MAAM,EAAE,cAAc,CAAC
|
1
|
+
{"version":3,"file":"calculateProviderTotal.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/calculateProviderTotal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,eAAO,MAAM,uBAAuB,eACtB,qBAAqB,EAAE,0BACX,OAAO,MAAM,EAAE,cAAc,CAAC;;;;;CA2BvD,CAAC"}
|
@@ -3,14 +3,22 @@ export const calculateProviderTotals = (currencies, groupedAccountsByAsset) => {
|
|
3
3
|
let totalBalance = new BigNumber(0);
|
4
4
|
let totalFiatValue = new BigNumber(0);
|
5
5
|
let hasAccounts = false;
|
6
|
+
let referenceCurrency = null;
|
6
7
|
for (const currency of currencies) {
|
7
8
|
const assetGroup = groupedAccountsByAsset[currency.id];
|
8
9
|
if (assetGroup?.accounts.length > 0) {
|
9
|
-
|
10
|
+
const refCurrency = referenceCurrency ?? assetGroup.referenceCurrency;
|
11
|
+
const magnitudeDiff = refCurrency.units[0].magnitude - assetGroup.referenceCurrency.units[0].magnitude;
|
12
|
+
const normalizedBalance = assetGroup.totalBalance.shiftedBy(magnitudeDiff);
|
13
|
+
totalBalance = totalBalance.plus(normalizedBalance);
|
10
14
|
totalFiatValue = totalFiatValue.plus(assetGroup.totalFiatValue);
|
11
15
|
hasAccounts = true;
|
16
|
+
// Use the referenceCurrency from the first asset group with accounts
|
17
|
+
if (!referenceCurrency) {
|
18
|
+
referenceCurrency = assetGroup.referenceCurrency;
|
19
|
+
}
|
12
20
|
}
|
13
21
|
}
|
14
|
-
return { totalBalance, totalFiatValue, hasAccounts };
|
22
|
+
return { totalBalance, totalFiatValue, hasAccounts, referenceCurrency };
|
15
23
|
};
|
16
24
|
//# sourceMappingURL=calculateProviderTotal.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"calculateProviderTotal.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/calculateProviderTotal.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,UAAmC,EACnC,sBAAsD,EACtD,EAAE;IACF,IAAI,YAAY,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,cAAc,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,WAAW,GAAG,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"calculateProviderTotal.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/calculateProviderTotal.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,UAAmC,EACnC,sBAAsD,EACtD,EAAE;IACF,IAAI,YAAY,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,cAAc,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,iBAAiB,GAAiC,IAAI,CAAC;IAE3D,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;QACjC,MAAM,UAAU,GAAG,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACvD,IAAI,UAAU,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACnC,MAAM,WAAW,GAAG,iBAAiB,IAAI,UAAU,CAAC,iBAAiB,CAAC;YACtE,MAAM,aAAa,GACjB,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACnF,MAAM,iBAAiB,GAAG,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAE3E,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YACpD,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YAChE,WAAW,GAAG,IAAI,CAAC;YAEnB,qEAAqE;YACrE,IAAI,CAAC,iBAAiB,EAAE;gBACtB,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC;aAClD;SACF;KACF;IAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC1E,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"currencyUtils.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"currencyUtils.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC3D,eAAO,MAAM,kBAAkB,OAAQ,MAAM,KAAG,qBAAqB,GAAG,IAMvE,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,qBAAqB,cAAc,MAAM,KAAG,OAErF,CAAC;AAEF,eAAO,MAAM,mBAAmB,aACpB,sBAAsB,KAC/B,qBAAqB,GAAG,IAU1B,CAAC;AAEF,eAAO,MAAM,wBAAwB,cACxB,sBAAsB,EAAE,wBAcpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,cACpB,sBAAsB,EAAE,kBACnB,IAAI,MAAM,CAAC,+CAE1B,sBAAsB,EAgCxB,CAAC;AAEF,eAAO,MAAM,yBAAyB,cACzB,sBAAsB,EAAE,KAClC,qBAAqB,EAIvB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"currencyUtils.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"currencyUtils.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAgC,EAAE;IAC7E,IAAI;QACF,OAAO,4BAA4B,CAAC,EAAE,CAAC,CAAC;KACzC;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA+B,EAAE,UAAkB,EAAW,EAAE;IAC9F,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAAgC,EACF,EAAE;IAChC,MAAM,aAAa,GAAG,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QACjE,OAAO,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC,CAAC,CAA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QAEF,IAAI,CAAC,sBAAsB,EAAE;YAC3B,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACvE,MAAM,4BAA4B,GAAG,iBAAiB,IAAI,iBAAiB,CAAC,IAAI,GAAG,CAAC,CAAC;YAErF,IAAI,4BAA4B;gBAAE,SAAS;SAC5C;QAED,IAAI,kBAAkB,CAAC,MAAM,KAAK,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE;YACrE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACzB;aAAM;YACL,QAAQ,CAAC,IAAI,CAAC;gBACZ,GAAG,QAAQ;gBACX,mBAAmB,EAAE,kBAAkB;aACxC,CAAC,CAAC;SACJ;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,SAAmC,EACV,EAAE;IAC3B,OAAO,SAAS;SACb,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;SAC9C,MAAM,CAAC,CAAC,QAAQ,EAAqC,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;AAChF,CAAC,CAAC"}
|
@@ -1,11 +1,13 @@
|
|
1
|
-
import type { CounterValuesState } from "@ledgerhq/live-countervalues/types";
|
2
1
|
import type { CryptoOrTokenCurrency, Currency } from "@ledgerhq/types-cryptoassets";
|
3
2
|
import { AssetType } from "./type";
|
4
3
|
import { AccountLike } from "@ledgerhq/types-live";
|
4
|
+
import BigNumber from "bignumber.js";
|
5
|
+
import type { CounterValuesState } from "@ledgerhq/live-countervalues/types";
|
5
6
|
interface ExtendedAssetType extends AssetType {
|
6
|
-
|
7
|
-
|
7
|
+
currency?: CryptoOrTokenCurrency;
|
8
|
+
balance?: BigNumber;
|
9
|
+
fiatValue?: number;
|
8
10
|
}
|
9
|
-
export declare const getBalanceAndFiatValueByAssets: (accounts: AccountLike[], assets: CryptoOrTokenCurrency[], counterValuesState: CounterValuesState, targetCurrency: Currency
|
11
|
+
export declare const getBalanceAndFiatValueByAssets: (accounts: AccountLike[], assets: CryptoOrTokenCurrency[], counterValuesState: CounterValuesState, targetCurrency: Currency) => ExtendedAssetType[];
|
10
12
|
export {};
|
11
13
|
//# sourceMappingURL=getBalanceAndFiatValueByAssets.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getBalanceAndFiatValueByAssets.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"getBalanceAndFiatValueByAssets.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,UAAU,iBAAkB,SAAQ,SAAS;IAC3C,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,8BAA8B,aAC/B,WAAW,EAAE,UACf,qBAAqB,EAAE,sBACX,kBAAkB,kBACtB,QAAQ,KACvB,iBAAiB,EAgBnB,CAAC"}
|
@@ -1,12 +1,10 @@
|
|
1
|
-
import { formatCurrencyUnit } from "@ledgerhq/coin-framework/lib-es/currencies/formatCurrencyUnit";
|
2
1
|
import { groupAccountsByAsset } from "./groupAccountsByAsset";
|
3
|
-
|
4
|
-
|
5
|
-
const groupedAccountsByAsset = groupAccountsByAsset(accounts, counterValuesState, targetCurrency, isDiscreetMode);
|
2
|
+
export const getBalanceAndFiatValueByAssets = (accounts, assets, counterValuesState, targetCurrency) => {
|
3
|
+
const groupedAccountsByAsset = groupAccountsByAsset(accounts, counterValuesState, targetCurrency);
|
6
4
|
return assets.map(asset => {
|
7
5
|
const assetGroup = groupedAccountsByAsset[asset.id];
|
8
6
|
if (assetGroup) {
|
9
|
-
return
|
7
|
+
return yieldAssetDetails(assetGroup, asset);
|
10
8
|
}
|
11
9
|
return {
|
12
10
|
id: asset.id,
|
@@ -15,27 +13,16 @@ export const getBalanceAndFiatValueByAssets = (accounts, assets, counterValuesSt
|
|
15
13
|
};
|
16
14
|
});
|
17
15
|
};
|
18
|
-
const
|
19
|
-
|
20
|
-
|
21
|
-
: assetGroup.accounts[0].token;
|
22
|
-
const formattedBalance = formatCurrencyUnit(assetDetails.units[0], assetGroup.totalBalance, {
|
23
|
-
showCode: true,
|
24
|
-
discreet: isDiscreetMode,
|
25
|
-
});
|
26
|
-
const formattedFiatValue = counterValueFormatter({
|
27
|
-
currency: targetCurrency.ticker,
|
28
|
-
value: assetGroup.totalFiatValue.toNumber(),
|
29
|
-
locale: userLocale,
|
30
|
-
allowZeroValue: true,
|
31
|
-
discreetMode: isDiscreetMode,
|
32
|
-
});
|
16
|
+
const yieldAssetDetails = (assetGroup, asset) => {
|
17
|
+
// Use the reference currency for consistent magnitude
|
18
|
+
const assetDetails = assetGroup.referenceCurrency;
|
33
19
|
return {
|
34
20
|
id: asset.id,
|
35
21
|
name: asset.name,
|
36
22
|
ticker: asset.ticker,
|
37
|
-
|
38
|
-
|
23
|
+
currency: assetDetails,
|
24
|
+
balance: assetGroup.totalBalance,
|
25
|
+
fiatValue: assetGroup.totalFiatValue.toNumber(),
|
39
26
|
};
|
40
27
|
};
|
41
28
|
//# sourceMappingURL=getBalanceAndFiatValueByAssets.js.map
|