@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,202 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const groupAccountsByAsset_1 = require("../groupAccountsByAsset");
|
7
|
+
const cryptoCurrencies_1 = require("../../../mock/fixtures/cryptoCurrencies");
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
9
|
+
// Mock calculate function
|
10
|
+
jest.mock("@ledgerhq/live-countervalues/logic", () => ({
|
11
|
+
calculate: jest.fn((state, { value }) => {
|
12
|
+
// Mock: return the balance directly as fiat value for simple testing
|
13
|
+
return value;
|
14
|
+
}),
|
15
|
+
}));
|
16
|
+
describe("groupAccountsByAsset", () => {
|
17
|
+
const mockCurrency = (0, cryptoCurrencies_1.createFixtureCryptoCurrency)("bitcoin");
|
18
|
+
const mockEthCurrency = (0, cryptoCurrencies_1.createFixtureCryptoCurrency)("ethereum");
|
19
|
+
const mockCounterValuesState = {};
|
20
|
+
const mockTargetCurrency = (0, cryptoCurrencies_1.createFixtureCryptoCurrency)("usd");
|
21
|
+
const mockUSDCToken = {
|
22
|
+
type: "TokenCurrency",
|
23
|
+
id: "ethereum/erc20/usdc",
|
24
|
+
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
25
|
+
parentCurrency: mockEthCurrency,
|
26
|
+
tokenType: "erc20",
|
27
|
+
name: "USD Coin",
|
28
|
+
ticker: "USDC",
|
29
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }],
|
30
|
+
};
|
31
|
+
const mockBTCAccount = {
|
32
|
+
type: "Account",
|
33
|
+
id: "btc-account-1",
|
34
|
+
seedIdentifier: "seed-id",
|
35
|
+
derivationMode: "",
|
36
|
+
currency: mockCurrency,
|
37
|
+
balance: new bignumber_js_1.default(100000000),
|
38
|
+
spendableBalance: new bignumber_js_1.default(100000000),
|
39
|
+
blockHeight: 0,
|
40
|
+
operations: [],
|
41
|
+
operationsCount: 0,
|
42
|
+
pendingOperations: [],
|
43
|
+
index: 0,
|
44
|
+
freshAddress: "btc-address",
|
45
|
+
freshAddressPath: "44'/0'/0'/0/0",
|
46
|
+
used: true,
|
47
|
+
swapHistory: [],
|
48
|
+
nfts: [],
|
49
|
+
lastSyncDate: new Date(),
|
50
|
+
creationDate: new Date(),
|
51
|
+
balanceHistoryCache: {
|
52
|
+
HOUR: { balances: [], latestDate: null },
|
53
|
+
DAY: { balances: [], latestDate: null },
|
54
|
+
WEEK: { balances: [], latestDate: null },
|
55
|
+
},
|
56
|
+
};
|
57
|
+
const mockUSDCAccount = {
|
58
|
+
type: "TokenAccount",
|
59
|
+
id: "usdc-account-1",
|
60
|
+
token: mockUSDCToken,
|
61
|
+
parentId: "eth-account-1",
|
62
|
+
balance: new bignumber_js_1.default(1000000),
|
63
|
+
spendableBalance: new bignumber_js_1.default(1000000),
|
64
|
+
operations: [],
|
65
|
+
operationsCount: 0,
|
66
|
+
pendingOperations: [],
|
67
|
+
swapHistory: [],
|
68
|
+
creationDate: new Date(),
|
69
|
+
balanceHistoryCache: {
|
70
|
+
HOUR: { balances: [], latestDate: null },
|
71
|
+
DAY: { balances: [], latestDate: null },
|
72
|
+
WEEK: { balances: [], latestDate: null },
|
73
|
+
},
|
74
|
+
};
|
75
|
+
it("should group accounts by asset ID and aggregate balances", () => {
|
76
|
+
const accounts = [mockBTCAccount, mockUSDCAccount];
|
77
|
+
const result = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, mockCounterValuesState, mockTargetCurrency);
|
78
|
+
expect(result).toEqual({
|
79
|
+
[mockCurrency.id]: {
|
80
|
+
totalBalance: new bignumber_js_1.default(100000000),
|
81
|
+
totalFiatValue: new bignumber_js_1.default(100000000),
|
82
|
+
accounts: [mockBTCAccount],
|
83
|
+
referenceCurrency: mockCurrency,
|
84
|
+
},
|
85
|
+
[mockUSDCToken.id]: {
|
86
|
+
totalBalance: new bignumber_js_1.default(1000000),
|
87
|
+
totalFiatValue: new bignumber_js_1.default(1000000),
|
88
|
+
accounts: [mockUSDCAccount],
|
89
|
+
referenceCurrency: mockUSDCToken,
|
90
|
+
},
|
91
|
+
});
|
92
|
+
});
|
93
|
+
it("should aggregate multiple accounts with the same asset", () => {
|
94
|
+
const secondBTCAccount = {
|
95
|
+
...mockBTCAccount,
|
96
|
+
id: "btc-account-2",
|
97
|
+
balance: new bignumber_js_1.default(50000000), // 0.5 BTC
|
98
|
+
};
|
99
|
+
const accounts = [mockBTCAccount, secondBTCAccount];
|
100
|
+
const result = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, mockCounterValuesState, mockTargetCurrency);
|
101
|
+
expect(result[mockCurrency.id]).toEqual({
|
102
|
+
totalBalance: new bignumber_js_1.default(150000000),
|
103
|
+
totalFiatValue: new bignumber_js_1.default(150000000),
|
104
|
+
accounts: [mockBTCAccount, secondBTCAccount],
|
105
|
+
referenceCurrency: mockCurrency,
|
106
|
+
});
|
107
|
+
});
|
108
|
+
it("should handle empty accounts array", () => {
|
109
|
+
const result = (0, groupAccountsByAsset_1.groupAccountsByAsset)([], mockCounterValuesState, mockTargetCurrency);
|
110
|
+
expect(result).toEqual({});
|
111
|
+
});
|
112
|
+
it("should handle accounts with zero balance", () => {
|
113
|
+
const zeroBalanceAccount = {
|
114
|
+
...mockBTCAccount,
|
115
|
+
balance: new bignumber_js_1.default(0),
|
116
|
+
};
|
117
|
+
const accounts = [zeroBalanceAccount];
|
118
|
+
const result = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, mockCounterValuesState, mockTargetCurrency);
|
119
|
+
expect(result[mockCurrency.id]).toEqual({
|
120
|
+
totalBalance: new bignumber_js_1.default(0),
|
121
|
+
totalFiatValue: new bignumber_js_1.default(0),
|
122
|
+
accounts: [zeroBalanceAccount],
|
123
|
+
referenceCurrency: mockCurrency,
|
124
|
+
});
|
125
|
+
});
|
126
|
+
it("should set referenceCurrency to the first currency encountered for each asset group", () => {
|
127
|
+
const accounts = [mockBTCAccount, mockUSDCAccount];
|
128
|
+
const result = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, mockCounterValuesState, mockTargetCurrency);
|
129
|
+
expect(result[mockCurrency.id].referenceCurrency).toEqual(mockCurrency);
|
130
|
+
expect(result[mockUSDCToken.id].referenceCurrency).toEqual(mockUSDCToken);
|
131
|
+
});
|
132
|
+
it("should normalize balances when tokens have different magnitudes", () => {
|
133
|
+
// Create BSC USDC with different magnitude (18 decimals instead of 6)
|
134
|
+
const mockBscUSDCToken = {
|
135
|
+
...mockUSDCToken,
|
136
|
+
id: "bsc/bep20/usdc",
|
137
|
+
name: "USD Coin (BSC)",
|
138
|
+
ticker: "USDC",
|
139
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 18 }], // 18 decimals
|
140
|
+
};
|
141
|
+
const mockEthUSDCAccount = {
|
142
|
+
...mockUSDCAccount,
|
143
|
+
id: "eth-usdc-account",
|
144
|
+
token: mockUSDCToken,
|
145
|
+
balance: new bignumber_js_1.default(1000000), // 1 USDC with 6 decimals
|
146
|
+
};
|
147
|
+
const mockBscUSDCAccount = {
|
148
|
+
...mockUSDCAccount,
|
149
|
+
id: "bsc-usdc-account",
|
150
|
+
token: mockBscUSDCToken,
|
151
|
+
balance: new bignumber_js_1.default("1000000000000000000"), // 1 USDC with 18 decimals
|
152
|
+
};
|
153
|
+
// Both should be grouped under the same token ID for this test
|
154
|
+
// First account (ETH USDC) becomes reference currency with 6 decimals
|
155
|
+
const accounts = [mockEthUSDCAccount, mockBscUSDCAccount];
|
156
|
+
const result = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, mockCounterValuesState, mockTargetCurrency);
|
157
|
+
const ethGroup = result[mockUSDCToken.id];
|
158
|
+
expect(ethGroup.referenceCurrency).toEqual(mockUSDCToken); // First currency is reference
|
159
|
+
expect(ethGroup.accounts).toHaveLength(1);
|
160
|
+
expect(ethGroup.totalBalance).toEqual(new bignumber_js_1.default(1000000)); // 1 USDC normalized to 6 decimals
|
161
|
+
const bscGroup = result[mockBscUSDCToken.id];
|
162
|
+
expect(bscGroup.referenceCurrency).toEqual(mockBscUSDCToken);
|
163
|
+
expect(bscGroup.accounts).toHaveLength(1);
|
164
|
+
expect(bscGroup.totalBalance).toEqual(new bignumber_js_1.default("1000000000000000000")); // 1 USDC with 18 decimals
|
165
|
+
});
|
166
|
+
it("should normalize balances correctly when adding accounts with different magnitudes to same asset group", () => {
|
167
|
+
// Create two USDC tokens with same ID but different magnitudes
|
168
|
+
const ethUSDCToken = {
|
169
|
+
...mockUSDCToken,
|
170
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }], // 6 decimals
|
171
|
+
};
|
172
|
+
const bscUSDCToken = {
|
173
|
+
...mockUSDCToken,
|
174
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 18 }], // 18 decimals
|
175
|
+
};
|
176
|
+
const ethAccount = {
|
177
|
+
...mockUSDCAccount,
|
178
|
+
id: "eth-usdc",
|
179
|
+
token: ethUSDCToken,
|
180
|
+
balance: new bignumber_js_1.default(1000000), // 1 USDC with 6 decimals
|
181
|
+
};
|
182
|
+
const bscAccount = {
|
183
|
+
...mockUSDCAccount,
|
184
|
+
id: "bsc-usdc",
|
185
|
+
token: bscUSDCToken,
|
186
|
+
balance: new bignumber_js_1.default("1000000000000000000"), // 1 USDC with 18 decimals
|
187
|
+
};
|
188
|
+
// Process ETH account first to make it the reference currency
|
189
|
+
const accounts = [ethAccount, bscAccount];
|
190
|
+
const result = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, mockCounterValuesState, mockTargetCurrency);
|
191
|
+
const group = result[mockUSDCToken.id];
|
192
|
+
expect(group.referenceCurrency).toEqual(ethUSDCToken); // First currency is reference (6 decimals)
|
193
|
+
expect(group.accounts).toHaveLength(2);
|
194
|
+
// BSC balance should be normalized from 18 decimals to 6 decimals
|
195
|
+
// 1000000000000000000 (18 decimals) -> 1000000 (6 decimals)
|
196
|
+
// magnitudeDiff = 6 - 18 = -12
|
197
|
+
// normalized = 1000000000000000000 * 10^(-12) = 1000000
|
198
|
+
const expectedTotal = new bignumber_js_1.default(1000000).plus(new bignumber_js_1.default(1000000)); // 2 USDC total
|
199
|
+
expect(group.totalBalance).toEqual(expectedTotal);
|
200
|
+
});
|
201
|
+
});
|
202
|
+
//# 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,kEAA+D;AAC/D,8EAAsF;AACtF,gEAAqC;AAIrC,0BAA0B;AAC1B,IAAI,CAAC,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,CAAC;IACrD,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QACtC,qEAAqE;QACrE,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,MAAM,YAAY,GAAG,IAAA,8CAA2B,EAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,eAAe,GAAG,IAAA,8CAA2B,EAAC,UAAU,CAAC,CAAC;IAEhE,MAAM,sBAAsB,GAAG,EAAwB,CAAC;IACxD,MAAM,kBAAkB,GAAG,IAAA,8CAA2B,EAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,aAAa,GAAG;QACpB,IAAI,EAAE,eAAwB;QAC9B,EAAE,EAAE,qBAAqB;QACzB,eAAe,EAAE,4CAA4C;QAC7D,cAAc,EAAE,eAAe;QAC/B,SAAS,EAAE,OAAgB;QAC3B,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,cAAc,GAAY;QAC9B,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,eAAe;QACnB,cAAc,EAAE,SAAS;QAC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,GAAiB;YAC/B,GAAG,eAAe;YAClB,EAAE,EAAE,UAAU;YACd,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,IAAI,sBAAS,CAAC,qBAAqB,CAAC,EAAE,0BAA0B;SAC1E,CAAC;QAEF,8DAA8D;QAC9D,MAAM,QAAQ,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,IAAA,2CAAoB,EAAC,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,sBAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,sBAAS,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"}
|
@@ -9,15 +9,23 @@ const calculateProviderTotals = (currencies, groupedAccountsByAsset) => {
|
|
9
9
|
let totalBalance = new bignumber_js_1.default(0);
|
10
10
|
let totalFiatValue = new bignumber_js_1.default(0);
|
11
11
|
let hasAccounts = false;
|
12
|
+
let referenceCurrency = null;
|
12
13
|
for (const currency of currencies) {
|
13
14
|
const assetGroup = groupedAccountsByAsset[currency.id];
|
14
15
|
if (assetGroup?.accounts.length > 0) {
|
15
|
-
|
16
|
+
const refCurrency = referenceCurrency ?? assetGroup.referenceCurrency;
|
17
|
+
const magnitudeDiff = refCurrency.units[0].magnitude - assetGroup.referenceCurrency.units[0].magnitude;
|
18
|
+
const normalizedBalance = assetGroup.totalBalance.shiftedBy(magnitudeDiff);
|
19
|
+
totalBalance = totalBalance.plus(normalizedBalance);
|
16
20
|
totalFiatValue = totalFiatValue.plus(assetGroup.totalFiatValue);
|
17
21
|
hasAccounts = true;
|
22
|
+
// Use the referenceCurrency from the first asset group with accounts
|
23
|
+
if (!referenceCurrency) {
|
24
|
+
referenceCurrency = assetGroup.referenceCurrency;
|
25
|
+
}
|
18
26
|
}
|
19
27
|
}
|
20
|
-
return { totalBalance, totalFiatValue, hasAccounts };
|
28
|
+
return { totalBalance, totalFiatValue, hasAccounts, referenceCurrency };
|
21
29
|
};
|
22
30
|
exports.calculateProviderTotals = calculateProviderTotals;
|
23
31
|
//# sourceMappingURL=calculateProviderTotal.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"calculateProviderTotal.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/calculateProviderTotal.ts"],"names":[],"mappings":";;;;;;AACA,gEAAqC;AAG9B,MAAM,uBAAuB,GAAG,CACrC,UAAmC,EACnC,sBAAsD,EACtD,EAAE;IACF,IAAI,YAAY,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,cAAc,GAAG,IAAI,sBAAS,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,gEAAqC;AAG9B,MAAM,uBAAuB,GAAG,CACrC,UAAmC,EACnC,sBAAsD,EACtD,EAAE;IACF,IAAI,YAAY,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,cAAc,GAAG,IAAI,sBAAS,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;AA7BW,QAAA,uBAAuB,2BA6BlC"}
|
@@ -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,iDAAoE;AACpE,iDAAmD;
|
1
|
+
{"version":3,"file":"currencyUtils.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/currencyUtils.ts"],"names":[],"mappings":";;;AACA,iDAAoE;AACpE,iDAAmD;AAI5C,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAgC,EAAE;IAC7E,IAAI;QACF,OAAO,IAAA,qCAA4B,EAAC,EAAE,CAAC,CAAC;KACzC;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B;AAEK,MAAM,eAAe,GAAG,CAAC,QAA+B,EAAE,UAAkB,EAAW,EAAE;IAC9F,OAAO,IAAA,4BAAe,EAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AACnG,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEK,MAAM,mBAAmB,GAAG,CACjC,QAAgC,EAC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E,CAAC,CAChC,CAAC;QAEF,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAE9C,MAAM,sBAAsB,GAAG,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAC9D,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,UAAU,CAChD,CAAC;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;AApCW,QAAA,oBAAoB,wBAoC/B;AAEK,MAAM,yBAAyB,GAAG,CACvC,SAAmC,EACV,EAAE;IAC3B,OAAO,SAAS;SACb,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAA,2BAAmB,EAAC,QAAQ,CAAC,CAAC;SAC9C,MAAM,CAAC,CAAC,QAAQ,EAAqC,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;AAChF,CAAC,CAAC;AANW,QAAA,yBAAyB,6BAMpC"}
|
@@ -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,15 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getBalanceAndFiatValueByAssets = void 0;
|
4
|
-
const formatCurrencyUnit_1 = require("@ledgerhq/coin-framework/lib-es/currencies/formatCurrencyUnit");
|
5
4
|
const groupAccountsByAsset_1 = require("./groupAccountsByAsset");
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const groupedAccountsByAsset = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, counterValuesState, targetCurrency, isDiscreetMode);
|
5
|
+
const getBalanceAndFiatValueByAssets = (accounts, assets, counterValuesState, targetCurrency) => {
|
6
|
+
const groupedAccountsByAsset = (0, groupAccountsByAsset_1.groupAccountsByAsset)(accounts, counterValuesState, targetCurrency);
|
9
7
|
return assets.map(asset => {
|
10
8
|
const assetGroup = groupedAccountsByAsset[asset.id];
|
11
9
|
if (assetGroup) {
|
12
|
-
return
|
10
|
+
return yieldAssetDetails(assetGroup, asset);
|
13
11
|
}
|
14
12
|
return {
|
15
13
|
id: asset.id,
|
@@ -19,27 +17,16 @@ const getBalanceAndFiatValueByAssets = (accounts, assets, counterValuesState, ta
|
|
19
17
|
});
|
20
18
|
};
|
21
19
|
exports.getBalanceAndFiatValueByAssets = getBalanceAndFiatValueByAssets;
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
: assetGroup.accounts[0].token;
|
26
|
-
const formattedBalance = (0, formatCurrencyUnit_1.formatCurrencyUnit)(assetDetails.units[0], assetGroup.totalBalance, {
|
27
|
-
showCode: true,
|
28
|
-
discreet: isDiscreetMode,
|
29
|
-
});
|
30
|
-
const formattedFiatValue = (0, counterValueFormatter_1.counterValueFormatter)({
|
31
|
-
currency: targetCurrency.ticker,
|
32
|
-
value: assetGroup.totalFiatValue.toNumber(),
|
33
|
-
locale: userLocale,
|
34
|
-
allowZeroValue: true,
|
35
|
-
discreetMode: isDiscreetMode,
|
36
|
-
});
|
20
|
+
const yieldAssetDetails = (assetGroup, asset) => {
|
21
|
+
// Use the reference currency for consistent magnitude
|
22
|
+
const assetDetails = assetGroup.referenceCurrency;
|
37
23
|
return {
|
38
24
|
id: asset.id,
|
39
25
|
name: asset.name,
|
40
26
|
ticker: asset.ticker,
|
41
|
-
|
42
|
-
|
27
|
+
currency: assetDetails,
|
28
|
+
balance: assetGroup.totalBalance,
|
29
|
+
fiatValue: assetGroup.totalFiatValue.toNumber(),
|
43
30
|
};
|
44
31
|
};
|
45
32
|
//# sourceMappingURL=getBalanceAndFiatValueByAssets.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getBalanceAndFiatValueByAssets.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"getBalanceAndFiatValueByAssets.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts"],"names":[],"mappings":";;;AACA,iEAAmF;AAY5E,MAAM,8BAA8B,GAAG,CAC5C,QAAuB,EACvB,MAA+B,EAC/B,kBAAsC,EACtC,cAAwB,EACH,EAAE;IACvB,MAAM,sBAAsB,GAAG,IAAA,2CAAoB,EAAC,QAAQ,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAC;IAElG,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACxB,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAEpD,IAAI,UAAU,EAAE;YACd,OAAO,iBAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SAC7C;QAED,OAAO;YACL,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AArBW,QAAA,8BAA8B,kCAqBzC;AAEF,MAAM,iBAAiB,GAAG,CACxB,UAA0B,EAC1B,KAA4B,EACT,EAAE;IACrB,sDAAsD;IACtD,MAAM,YAAY,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAElD,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,UAAU,CAAC,YAAY;QAChC,SAAS,EAAE,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE;KAChD,CAAC;AACJ,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getInterestRateForAsset.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getInterestRateForAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"getInterestRateForAsset.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/getInterestRateForAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,KAAK,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AACrD,KAAK,kBAAkB,GAAG;IACxB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;IACvC,6BAA6B,EAAE,MAAM,CAAC;CACvC,CAAC;AAOF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,qBAAqB,EAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC,EACvD,QAAQ,GAAE,qBAAqB,EAAO,GACrC,kBAAkB,CAapB"}
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import type { CounterValuesState } from "@ledgerhq/live-countervalues/types";
|
2
|
-
import { Currency } from "@ledgerhq/types-cryptoassets";
|
3
1
|
import { AccountLike } from "@ledgerhq/types-live";
|
4
2
|
import BigNumber from "bignumber.js";
|
3
|
+
import type { CounterValuesState } from "@ledgerhq/live-countervalues/types";
|
4
|
+
import { CryptoOrTokenCurrency, Currency } from "@ledgerhq/types-cryptoassets";
|
5
5
|
export type GroupedAccount = {
|
6
6
|
totalBalance: BigNumber;
|
7
7
|
totalFiatValue: BigNumber;
|
8
8
|
accounts: AccountLike[];
|
9
|
+
referenceCurrency: CryptoOrTokenCurrency;
|
9
10
|
};
|
10
|
-
export declare const groupAccountsByAsset: (accounts: AccountLike[], counterValuesState: CounterValuesState, targetCurrency: Currency
|
11
|
+
export declare const groupAccountsByAsset: (accounts: AccountLike[], counterValuesState: CounterValuesState, targetCurrency: Currency) => Record<string, GroupedAccount>;
|
11
12
|
//# sourceMappingURL=groupAccountsByAsset.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"groupAccountsByAsset.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/groupAccountsByAsset.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"groupAccountsByAsset.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/groupAccountsByAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAG/E,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,SAAS,CAAC;IACxB,cAAc,EAAE,SAAS,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,iBAAiB,EAAE,qBAAqB,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,oBAAoB,aACrB,WAAW,EAAE,sBACH,kBAAkB,kBACtB,QAAQ,KACvB,OAAO,MAAM,EAAE,cAAc,CAkC/B,CAAC"}
|
@@ -4,29 +4,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.groupAccountsByAsset = void 0;
|
7
|
-
const getBalanceAndFiatValue_1 = require("./getBalanceAndFiatValue");
|
8
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
9
|
-
const
|
10
|
-
const groupAccountsByAsset = (accounts, counterValuesState, targetCurrency
|
8
|
+
const logic_1 = require("@ledgerhq/live-countervalues/logic");
|
9
|
+
const groupAccountsByAsset = (accounts, counterValuesState, targetCurrency) => {
|
11
10
|
const initialGroupedAccounts = {};
|
12
11
|
return accounts.reduce((groupedAccounts, account) => {
|
13
12
|
const assetId = account.type === "Account" ? account.currency.id : account.token.id;
|
14
|
-
|
15
|
-
|
13
|
+
let assetGroup = groupedAccounts[assetId];
|
14
|
+
if (!assetGroup) {
|
15
|
+
const currency = account.type === "Account" ? account.currency : account.token;
|
16
|
+
assetGroup = groupedAccounts[assetId] = {
|
16
17
|
totalBalance: new bignumber_js_1.default(0),
|
17
18
|
totalFiatValue: new bignumber_js_1.default(0),
|
18
19
|
accounts: [],
|
20
|
+
referenceCurrency: currency, // First currency becomes the reference
|
19
21
|
};
|
20
22
|
}
|
21
|
-
const
|
23
|
+
const currency = account.type === "Account" ? account.currency : account.token;
|
22
24
|
const balance = account.balance;
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
// Convert balance to reference currency magnitude before summing
|
26
|
+
const referenceMagnitude = assetGroup.referenceCurrency.units[0].magnitude || 0;
|
27
|
+
const currentMagnitude = currency.units[0].magnitude || 0;
|
28
|
+
const magnitudeDiff = referenceMagnitude - currentMagnitude;
|
29
|
+
const normalizedBalance = balance.shiftedBy(magnitudeDiff);
|
30
|
+
const fiatValue = calculateFiatValue(account, counterValuesState, targetCurrency);
|
31
|
+
assetGroup.totalBalance = assetGroup.totalBalance.plus(normalizedBalance);
|
32
|
+
assetGroup.totalFiatValue = assetGroup.totalFiatValue.plus(fiatValue || 0);
|
33
|
+
assetGroup.accounts.push(account);
|
28
34
|
return groupedAccounts;
|
29
35
|
}, initialGroupedAccounts);
|
30
36
|
};
|
31
37
|
exports.groupAccountsByAsset = groupAccountsByAsset;
|
38
|
+
function calculateFiatValue(account, state, toCurrency) {
|
39
|
+
const currency = account.type === "Account" ? account.currency : account.token;
|
40
|
+
const balanceNumber = account.balance.toNumber();
|
41
|
+
const fiatValue = (0, logic_1.calculate)(state, {
|
42
|
+
from: currency,
|
43
|
+
to: toCurrency,
|
44
|
+
value: balanceNumber,
|
45
|
+
});
|
46
|
+
return fiatValue || 0;
|
47
|
+
}
|
32
48
|
//# sourceMappingURL=groupAccountsByAsset.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"groupAccountsByAsset.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/groupAccountsByAsset.ts"],"names":[],"mappings":";;;;;;
|
1
|
+
{"version":3,"file":"groupAccountsByAsset.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/groupAccountsByAsset.ts"],"names":[],"mappings":";;;;;;AACA,gEAAqC;AAGrC,8DAA+D;AASxD,MAAM,oBAAoB,GAAG,CAClC,QAAuB,EACvB,kBAAsC,EACtC,cAAwB,EACQ,EAAE;IAClC,MAAM,sBAAsB,GAAmC,EAAE,CAAC;IAElE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,OAAO,EAAE,EAAE;QAClD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CA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AC,CAAC;QAC1E,UAAU,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC;QAC3E,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAElC,OAAO,eAAe,CAAC;IACzB,CAAC,EAAE,sBAAsB,CAAC,CAAC;AAC7B,CAAC,CAAC;AAtCW,QAAA,oBAAoB,wBAsC/B;AAEF,SAAS,kBAAkB,CACzB,OAAoB,EACpB,KAAyB,EACzB,UAAoB;IAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAE/E,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEjD,MAAM,SAAS,GAAG,IAAA,iBAAS,EAAC,KAAK,EAAE;QACjC,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC;IAEH,OAAO,SAAS,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
@@ -1,9 +1,5 @@
|
|
1
1
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
|
3
|
-
import { haveOneCommonProvider } from "./haveOneCommonProvider";
|
4
|
-
import { getBalanceAndFiatValue } from "./getBalanceAndFiatValue";
|
5
|
-
import { groupCurrenciesByProvider } from "./groupCurrenciesByProvider";
|
2
|
+
export { groupCurrenciesByProvider } from "./groupCurrenciesByProvider";
|
6
3
|
declare function isCorrespondingCurrency(elem: CryptoOrTokenCurrency, network: CryptoOrTokenCurrency): boolean;
|
7
|
-
|
8
|
-
export { isCorrespondingCurrency, getEffectiveCurrency, haveOneCommonProvider, getBalanceAndFiatValue, groupCurrenciesByProvider, };
|
4
|
+
export { isCorrespondingCurrency };
|
9
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,iBAAS,uBAAuB,CAC9B,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAQT;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
@@ -1,11 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "haveOneCommonProvider", { enumerable: true, get: function () { return haveOneCommonProvider_1.haveOneCommonProvider; } });
|
6
|
-
const getBalanceAndFiatValue_1 = require("./getBalanceAndFiatValue");
|
7
|
-
Object.defineProperty(exports, "getBalanceAndFiatValue", { enumerable: true, get: function () { return getBalanceAndFiatValue_1.getBalanceAndFiatValue; } });
|
8
|
-
const groupCurrenciesByProvider_1 = require("./groupCurrenciesByProvider");
|
3
|
+
exports.isCorrespondingCurrency = exports.groupCurrenciesByProvider = void 0;
|
4
|
+
var groupCurrenciesByProvider_1 = require("./groupCurrenciesByProvider");
|
9
5
|
Object.defineProperty(exports, "groupCurrenciesByProvider", { enumerable: true, get: function () { return groupCurrenciesByProvider_1.groupCurrenciesByProvider; } });
|
10
6
|
function isCorrespondingCurrency(elem, network) {
|
11
7
|
if (elem.type === "TokenCurrency") {
|
@@ -17,11 +13,4 @@ function isCorrespondingCurrency(elem, network) {
|
|
17
13
|
return false;
|
18
14
|
}
|
19
15
|
exports.isCorrespondingCurrency = isCorrespondingCurrency;
|
20
|
-
const getEffectiveCurrency = (currency, provider, currencyIds) => {
|
21
|
-
const isCurrencyFiltered = currencyIds.includes(currency.id);
|
22
|
-
if (isCurrencyFiltered)
|
23
|
-
return currency;
|
24
|
-
return provider.currenciesByNetwork.find(elem => currencyIds.includes(elem.id)) ?? currency;
|
25
|
-
};
|
26
|
-
exports.getEffectiveCurrency = getEffectiveCurrency;
|
27
16
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.ts"],"names":[],"mappings":";;;AACA,yEAAwE;AAA/D,sIAAA,yBAAyB,OAAA;AAElC,SAAS,uBAAuB,CAC9B,IAA2B,EAC3B,OAA8B;IAE9B,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,EAAE;QACjC,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,KAAK,OAAO,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;KACzE;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE;QAClC,OAAO,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;KAC/B;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAEQ,0DAAuB"}
|
@@ -35,30 +35,4 @@ describe("isCorrespondingCurrency", () => {
|
|
35
35
|
expect((0, index_1.isCorrespondingCurrency)(bitcoinCurrency, evmCurrency)).toBe(false);
|
36
36
|
});
|
37
37
|
});
|
38
|
-
describe("getEffectiveCurrency", () => {
|
39
|
-
const parent = (0, cryptoCurrencies_1.createFixtureCryptoCurrency)("evm");
|
40
|
-
const token = {
|
41
|
-
type: "TokenCurrency",
|
42
|
-
id: "ethereum/erc20/usdc",
|
43
|
-
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
44
|
-
parentCurrency: parent,
|
45
|
-
tokenType: "erc20",
|
46
|
-
name: "USD Coin",
|
47
|
-
ticker: "USDC",
|
48
|
-
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }],
|
49
|
-
};
|
50
|
-
const provider = {
|
51
|
-
providerId: "provider1",
|
52
|
-
currenciesByNetwork: [parent, token],
|
53
|
-
};
|
54
|
-
it("returns currency if id is in currencyIds", () => {
|
55
|
-
expect((0, index_1.getEffectiveCurrency)(token, provider, [token.id])).toBe(token);
|
56
|
-
});
|
57
|
-
it("returns first matching currency from provider if id not in currencyIds", () => {
|
58
|
-
expect((0, index_1.getEffectiveCurrency)(token, provider, [parent.id])).toBe(parent);
|
59
|
-
});
|
60
|
-
it("returns currency if no match in provider", () => {
|
61
|
-
expect((0, index_1.getEffectiveCurrency)(token, provider, ["notfound"])).toBe(token);
|
62
|
-
});
|
63
|
-
});
|
64
38
|
//# sourceMappingURL=index.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.test.ts"],"names":[],"mappings":";;AAAA,
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/modularDrawer/utils/index.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAElD,2EAAmF;AACnF,yDAA8D;AAG9D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,MAAM,WAAW,GAAG,IAAA,8CAA2B,EAAC,KAAK,CAAC,CAAC;IACvD,MAAM,SAAS,GAA0B;QACvC,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,qBAAqB;QACzB,eAAe,EAAE,4CAA4C;QAC7D,cAAc,EAAE,WAAW;QAC3B,SAAS,EAAE,OAAO;QAClB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAA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 -1,6 +1,4 @@
|
|
1
1
|
import { BalanceUI } from "./type";
|
2
|
-
export declare const parseFiatValue: (value?: string, discreet?: boolean) => number;
|
3
|
-
export declare function toFiatString(x?: BalanceUI): string | undefined;
|
4
2
|
export declare function hasBalance(balanceData?: BalanceUI): boolean;
|
5
|
-
export declare function compareByBalanceThenFiat(a: BalanceUI | undefined, b: BalanceUI | undefined
|
3
|
+
export declare function compareByBalanceThenFiat(a: BalanceUI | undefined, b: BalanceUI | undefined): number;
|
6
4
|
//# sourceMappingURL=sortByBalance.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sortByBalance.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/sortByBalance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,
|
1
|
+
{"version":3,"file":"sortByBalance.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/utils/sortByBalance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,wBAAgB,UAAU,CAAC,WAAW,CAAC,EAAE,SAAS,GAAG,OAAO,CAE3D;AAED,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,SAAS,GAAG,SAAS,EACxB,CAAC,EAAE,SAAS,GAAG,SAAS,GACvB,MAAM,CASR"}
|