@ledgerhq/live-common 34.50.0-nightly.5 → 34.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/test-helpers/bridge.js +1 -1
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +0 -3
- 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 +9 -7
- 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 +0 -11
- 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 +9 -15
- 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 +2 -30
- 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 +0 -37
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +0 -2
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js +1 -8
- package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +1 -15
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +3 -5
- package/lib/bridge/generic-alpaca/tests/getAccountShape.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 -1
- 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 +4 -23
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +0 -1
- package/lib/bridge/impl.js.map +1 -1
- package/lib/e2e/enum/Account.d.ts +0 -6
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +0 -8
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +0 -2
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +0 -2
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +0 -4
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +0 -6
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +1 -3
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +0 -2
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/enum/TokenType.d.ts +1 -2
- package/lib/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib/e2e/enum/TokenType.js +0 -1
- package/lib/e2e/enum/TokenType.js.map +1 -1
- package/lib/e2e/enum/TransactionStatus.d.ts +1 -4
- package/lib/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib/e2e/enum/TransactionStatus.js +0 -3
- package/lib/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib/e2e/speculos.d.ts +0 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +1 -35
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/platform/types.d.ts +0 -2
- 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 +1 -22
- 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 +0 -8
- package/lib/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib/families/tezos/react.d.ts +1 -2
- package/lib/families/tezos/react.d.ts.map +1 -1
- package/lib/families/tezos/react.js +1 -19
- package/lib/families/tezos/react.js.map +1 -1
- package/lib/families/tezos/setup.d.ts +4 -1
- package/lib/families/tezos/setup.d.ts.map +1 -1
- package/lib/families/tezos/setup.js +11 -3
- package/lib/families/tezos/setup.js.map +1 -1
- package/lib/generated/bridge/js.d.ts +1 -0
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +12 -10
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/hw/actions/completeExchange.d.ts +0 -2
- package/lib/hw/actions/completeExchange.d.ts.map +1 -1
- package/lib/hw/actions/completeExchange.js +0 -1
- 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 +0 -7
- package/lib/hw/signMessage/index.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +3 -4
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +47 -13
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +5 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +55 -15
- 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 +3 -1
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +28 -0
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js +17 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
- package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts +3 -0
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts.map +1 -0
- package/lib/modularDrawer/utils/getProviderCurrency.js +14 -0
- package/lib/modularDrawer/utils/getProviderCurrency.js.map +1 -0
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts +11 -0
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -0
- package/lib/modularDrawer/utils/haveOneCommonProvider.js +29 -0
- package/lib/modularDrawer/utils/haveOneCommonProvider.js.map +1 -0
- package/lib/modularDrawer/utils/index.d.ts +6 -3
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +12 -3
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/modularDrawer/utils/index.test.js +26 -0
- package/lib/modularDrawer/utils/index.test.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +6 -0
- package/lib/modularDrawer/utils/type.d.ts.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/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js +0 -3
- 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 +9 -7
- 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 +0 -11
- 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 +9 -15
- 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 +2 -30
- 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 +1 -38
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +0 -2
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js +0 -6
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +1 -15
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +3 -5
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.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 -1
- 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 +4 -23
- 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 +0 -1
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +0 -6
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +0 -8
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +0 -2
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +0 -2
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +0 -4
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +0 -6
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +1 -3
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +0 -2
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/enum/TokenType.d.ts +1 -2
- package/lib-es/e2e/enum/TokenType.d.ts.map +1 -1
- package/lib-es/e2e/enum/TokenType.js +0 -1
- package/lib-es/e2e/enum/TokenType.js.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.d.ts +1 -4
- package/lib-es/e2e/enum/TransactionStatus.d.ts.map +1 -1
- package/lib-es/e2e/enum/TransactionStatus.js +0 -3
- package/lib-es/e2e/enum/TransactionStatus.js.map +1 -1
- package/lib-es/e2e/speculos.d.ts +0 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +0 -33
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/platform/types.d.ts +0 -2
- 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 +1 -22
- 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 +0 -8
- package/lib-es/exchange/swap/getIncompatibleCurrencyKeys.js.map +1 -1
- package/lib-es/families/tezos/react.d.ts +1 -2
- package/lib-es/families/tezos/react.d.ts.map +1 -1
- package/lib-es/families/tezos/react.js +0 -17
- package/lib-es/families/tezos/react.js.map +1 -1
- package/lib-es/families/tezos/setup.d.ts +4 -1
- package/lib-es/families/tezos/setup.d.ts.map +1 -1
- package/lib-es/families/tezos/setup.js +9 -2
- package/lib-es/families/tezos/setup.js.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +1 -0
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +2 -0
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/hw/actions/completeExchange.d.ts +0 -2
- package/lib-es/hw/actions/completeExchange.d.ts.map +1 -1
- package/lib-es/hw/actions/completeExchange.js +0 -1
- 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 +0 -7
- package/lib-es/hw/signMessage/index.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +3 -4
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +47 -13
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +5 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +55 -15
- 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 +3 -1
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -1
- 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__/haveOneCommonProvider.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +26 -0
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js +13 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts +3 -0
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/getProviderCurrency.js +10 -0
- package/lib-es/modularDrawer/utils/getProviderCurrency.js.map +1 -0
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts +11 -0
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.js +25 -0
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.js.map +1 -0
- package/lib-es/modularDrawer/utils/index.d.ts +6 -3
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +10 -3
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.test.js +27 -1
- package/lib-es/modularDrawer/utils/index.test.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +6 -0
- package/lib-es/modularDrawer/utils/type.d.ts.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 +73 -75
- package/src/__tests__/test-helpers/bridge.ts +1 -1
- package/src/bridge/generic-alpaca/alpaca/index.ts +0 -4
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +28 -28
- package/src/bridge/generic-alpaca/createTransaction.ts +0 -11
- package/src/bridge/generic-alpaca/getAccountShape.ts +15 -22
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +1 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +2 -48
- package/src/bridge/generic-alpaca/signer/index.ts +1 -44
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +0 -10
- package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +1 -15
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +3 -5
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +1 -1
- package/src/bridge/generic-alpaca/types.ts +1 -9
- package/src/bridge/generic-alpaca/utils.ts +6 -25
- package/src/bridge/impl.ts +0 -1
- package/src/e2e/enum/Account.ts +0 -41
- package/src/e2e/enum/AppInfos.ts +0 -4
- package/src/e2e/enum/Currency.ts +0 -21
- package/src/e2e/enum/Network.ts +0 -2
- package/src/e2e/enum/TokenType.ts +0 -1
- package/src/e2e/enum/TransactionStatus.ts +0 -3
- package/src/e2e/speculos.ts +0 -34
- package/src/exchange/platform/types.ts +0 -2
- package/src/exchange/swap/completeExchange.ts +2 -32
- package/src/exchange/swap/getIncompatibleCurrencyKeys.ts +0 -8
- package/src/families/tezos/react.ts +1 -20
- package/src/families/tezos/setup.ts +22 -3
- package/src/generated/bridge/js.ts +2 -0
- package/src/hw/actions/completeExchange.ts +0 -3
- package/src/hw/signMessage/index.ts +0 -10
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +76 -16
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +95 -25
- package/src/modularDrawer/modules/createAssetConfiguration.ts +11 -3
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +8 -1
- package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +1 -1
- package/src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts +34 -0
- package/src/modularDrawer/utils/buildProviderCurrenciesMap.tsx +25 -0
- package/src/modularDrawer/utils/currencyUtils.ts +1 -0
- package/src/modularDrawer/utils/getProviderCurrency.ts +13 -0
- package/src/modularDrawer/utils/haveOneCommonProvider.ts +31 -0
- package/src/modularDrawer/utils/index.test.ts +32 -1
- package/src/modularDrawer/utils/index.ts +23 -4
- package/src/modularDrawer/utils/type.ts +6 -0
- package/lib/e2e/families/hedera.d.ts +0 -2
- package/lib/e2e/families/hedera.d.ts.map +0 -1
- package/lib/e2e/families/hedera.js +0 -11
- package/lib/e2e/families/hedera.js.map +0 -1
- package/lib/e2e/families/sui.d.ts +0 -2
- package/lib/e2e/families/sui.d.ts.map +0 -1
- package/lib/e2e/families/sui.js +0 -11
- package/lib/e2e/families/sui.js.map +0 -1
- package/lib/families/evm/shouldUseReceiveOptions.d.ts +0 -3
- package/lib/families/evm/shouldUseReceiveOptions.d.ts.map +0 -1
- package/lib/families/evm/shouldUseReceiveOptions.js +0 -5
- package/lib/families/evm/shouldUseReceiveOptions.js.map +0 -1
- package/lib/families/evm/shouldUseReceiveOptions.test.d.ts +0 -2
- package/lib/families/evm/shouldUseReceiveOptions.test.d.ts.map +0 -1
- package/lib/families/evm/shouldUseReceiveOptions.test.js +0 -26
- package/lib/families/evm/shouldUseReceiveOptions.test.js.map +0 -1
- package/lib/families/hedera/exchange.d.ts +0 -9
- package/lib/families/hedera/exchange.d.ts.map +0 -1
- package/lib/families/hedera/exchange.js +0 -36
- package/lib/families/hedera/exchange.js.map +0 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +0 -7
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +0 -224
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +0 -1
- package/lib-es/e2e/families/hedera.d.ts +0 -2
- package/lib-es/e2e/families/hedera.d.ts.map +0 -1
- package/lib-es/e2e/families/hedera.js +0 -7
- package/lib-es/e2e/families/hedera.js.map +0 -1
- package/lib-es/e2e/families/sui.d.ts +0 -2
- package/lib-es/e2e/families/sui.d.ts.map +0 -1
- package/lib-es/e2e/families/sui.js +0 -7
- package/lib-es/e2e/families/sui.js.map +0 -1
- package/lib-es/families/evm/shouldUseReceiveOptions.d.ts +0 -3
- package/lib-es/families/evm/shouldUseReceiveOptions.d.ts.map +0 -1
- package/lib-es/families/evm/shouldUseReceiveOptions.js +0 -3
- package/lib-es/families/evm/shouldUseReceiveOptions.js.map +0 -1
- package/lib-es/families/evm/shouldUseReceiveOptions.test.d.ts +0 -2
- package/lib-es/families/evm/shouldUseReceiveOptions.test.d.ts.map +0 -1
- package/lib-es/families/evm/shouldUseReceiveOptions.test.js +0 -21
- package/lib-es/families/evm/shouldUseReceiveOptions.test.js.map +0 -1
- package/lib-es/families/hedera/exchange.d.ts +0 -9
- package/lib-es/families/hedera/exchange.d.ts.map +0 -1
- package/lib-es/families/hedera/exchange.js +0 -29
- package/lib-es/families/hedera/exchange.js.map +0 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +0 -7
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +0 -217
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +0 -1
- package/src/e2e/families/hedera.ts +0 -7
- package/src/e2e/families/sui.ts +0 -7
- package/src/families/evm/shouldUseReceiveOptions.test.ts +0 -25
- package/src/families/evm/shouldUseReceiveOptions.ts +0 -4
- package/src/families/hedera/exchange.ts +0 -48
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +0 -231
@@ -17,6 +17,7 @@ import { bridge as near } from "../../families/near/setup";
|
|
17
17
|
import { bridge as polkadot } from "../../families/polkadot/setup";
|
18
18
|
import { bridge as solana } from "../../families/solana/setup";
|
19
19
|
import { bridge as stacks } from "../../families/stacks/setup";
|
20
|
+
import { bridge as tezos } from "../../families/tezos/setup";
|
20
21
|
import { bridge as ton } from "../../families/ton/setup";
|
21
22
|
import { bridge as tron } from "../../families/tron/setup";
|
22
23
|
import { bridge as vechain } from "../../families/vechain/setup";
|
@@ -43,6 +44,7 @@ export default {
|
|
43
44
|
polkadot,
|
44
45
|
solana,
|
45
46
|
stacks,
|
47
|
+
tezos,
|
46
48
|
ton,
|
47
49
|
tron,
|
48
50
|
vechain,
|
@@ -3,7 +3,6 @@ import { scan, tap } from "rxjs/operators";
|
|
3
3
|
import { useEffect, useState } from "react";
|
4
4
|
import type { Action, Device } from "./types";
|
5
5
|
import type { AppState } from "./app";
|
6
|
-
import type { DeviceModelId } from "@ledgerhq/devices";
|
7
6
|
import { log } from "@ledgerhq/logs";
|
8
7
|
import { Exchange } from "../../exchange/types";
|
9
8
|
import { Transaction } from "../../generated/types";
|
@@ -19,7 +18,6 @@ type State = {
|
|
19
18
|
|
20
19
|
type CompleteExchangeState = AppState & State;
|
21
20
|
type CompleteExchangeRequest = {
|
22
|
-
deviceModelId?: DeviceModelId;
|
23
21
|
deviceId?: string;
|
24
22
|
provider: string;
|
25
23
|
transaction: Transaction;
|
@@ -132,7 +130,6 @@ export const createAction = (
|
|
132
130
|
}),
|
133
131
|
completeExchangeExec({
|
134
132
|
deviceId: reduxDeviceFrozen?.deviceId,
|
135
|
-
deviceModelId: reduxDeviceFrozen?.modelId,
|
136
133
|
provider,
|
137
134
|
transaction,
|
138
135
|
binaryPayload,
|
@@ -13,7 +13,6 @@ import type { ConnectAppEvent, Input as ConnectAppInput } from "../connectApp";
|
|
13
13
|
import { withDevice } from "../deviceAccess";
|
14
14
|
import type { SignMessage, Result } from "./types";
|
15
15
|
import { messageSigner as ACREMessageSigner } from "../../families/bitcoin/ACRESetup";
|
16
|
-
import { decodeAccountId } from "../../account";
|
17
16
|
|
18
17
|
export const prepareMessageToSign = (account: Account, message: string): AnyMessage => {
|
19
18
|
const utf8Message = Buffer.from(message, "hex").toString();
|
@@ -92,15 +91,6 @@ export const signMessageExec = ({ request, deviceId }: Input): Observable<Result
|
|
92
91
|
throw new Error("account is required");
|
93
92
|
}
|
94
93
|
|
95
|
-
const { type } = decodeAccountId(request.account.id);
|
96
|
-
if (type === "mock") {
|
97
|
-
return from(
|
98
|
-
Promise.resolve({
|
99
|
-
signature: "mockedSignature",
|
100
|
-
}),
|
101
|
-
);
|
102
|
-
}
|
103
|
-
|
104
94
|
const result: Observable<Result> = withDevice(deviceId)(transport =>
|
105
95
|
from(signMessage(transport, request.account!, request.message)),
|
106
96
|
);
|
@@ -1,11 +1,15 @@
|
|
1
|
-
import { useMemo
|
1
|
+
import { useMemo } from "react";
|
2
|
+
import type { ReactNode } from "react";
|
2
3
|
import type { CryptoOrTokenCurrency, Currency } from "@ledgerhq/types-cryptoassets";
|
3
4
|
import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/formatCurrencyUnit";
|
4
5
|
import BigNumber from "bignumber.js";
|
5
6
|
import { counterValueFormatter } from "../utils/counterValueFormatter";
|
6
7
|
import { compareByBalanceThenFiat } from "../utils/sortByBalance";
|
7
8
|
import { UseBalanceDeps } from "../utils/type";
|
9
|
+
import { buildProviderCurrenciesMap } from "../utils/buildProviderCurrenciesMap";
|
10
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
8
11
|
import { calculateProviderTotals } from "../utils/calculateProviderTotal";
|
12
|
+
import { getProviderCurrency } from "../utils/getProviderCurrency";
|
9
13
|
import { groupAccountsByAsset } from "../utils/groupAccountsByAsset";
|
10
14
|
|
11
15
|
export type AssetDeps = {
|
@@ -39,7 +43,10 @@ export function createUseRightBalanceAsset({ useBalanceDeps, balanceItem, assets
|
|
39
43
|
return { balance, fiatValue };
|
40
44
|
};
|
41
45
|
|
42
|
-
return function useRightBalanceAsset(
|
46
|
+
return function useRightBalanceAsset(
|
47
|
+
assets: CryptoOrTokenCurrency[],
|
48
|
+
currenciesByProvider: CurrenciesByProviderId[],
|
49
|
+
) {
|
43
50
|
const { flattenedAccounts, discreet, state, counterValueCurrency, locale } = useBalanceDeps();
|
44
51
|
|
45
52
|
const grouped = useMemo(
|
@@ -47,39 +54,92 @@ export function createUseRightBalanceAsset({ useBalanceDeps, balanceItem, assets
|
|
47
54
|
[flattenedAccounts, state, counterValueCurrency, discreet],
|
48
55
|
);
|
49
56
|
|
57
|
+
const providerMap = useMemo(
|
58
|
+
() => buildProviderCurrenciesMap(currenciesByProvider),
|
59
|
+
[currenciesByProvider],
|
60
|
+
);
|
61
|
+
|
50
62
|
return useMemo(() => {
|
51
|
-
|
63
|
+
if (!providerMap) {
|
64
|
+
const balanceMap = new Map();
|
65
|
+
|
66
|
+
for (const [, { currencies, mainCurrency }] of assetsMap) {
|
67
|
+
const { totalBalance, totalFiatValue } = calculateProviderTotals(currencies, grouped);
|
52
68
|
|
53
|
-
|
54
|
-
|
69
|
+
const { balance, fiatValue } = formatProviderResult(
|
70
|
+
mainCurrency,
|
71
|
+
totalBalance,
|
72
|
+
totalFiatValue,
|
73
|
+
counterValueCurrency,
|
74
|
+
locale,
|
75
|
+
discreet,
|
76
|
+
);
|
77
|
+
|
78
|
+
balanceMap.set(mainCurrency.id, {
|
79
|
+
balance: balance,
|
80
|
+
fiatValue: fiatValue,
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
const assetsWithBalanceData = assets.map(asset => {
|
85
|
+
const balanceData = balanceMap.get(asset.id) || {};
|
86
|
+
return {
|
87
|
+
asset,
|
88
|
+
balanceData,
|
89
|
+
};
|
90
|
+
});
|
91
|
+
|
92
|
+
assetsWithBalanceData.sort((a, b) =>
|
93
|
+
compareByBalanceThenFiat(a.balanceData, b.balanceData, discreet),
|
94
|
+
);
|
95
|
+
|
96
|
+
return assetsWithBalanceData.map(({ asset, balanceData }) => ({
|
97
|
+
...asset,
|
98
|
+
rightElement: balanceItem(balanceData),
|
99
|
+
}));
|
100
|
+
}
|
101
|
+
|
102
|
+
const assetsSet = new Set(assets.map(a => a.id));
|
103
|
+
const providerResultsMap = new Map<string, { balance?: string; fiatValue?: string }>();
|
104
|
+
|
105
|
+
for (const [, { currencies, mainCurrency }] of providerMap) {
|
106
|
+
if (!assetsSet.has(mainCurrency.id)) continue;
|
107
|
+
const providerCurrency = getProviderCurrency(mainCurrency, currencies);
|
108
|
+
if (!providerCurrency) continue;
|
109
|
+
|
110
|
+
const { totalBalance, totalFiatValue, hasAccounts } = calculateProviderTotals(
|
111
|
+
currencies,
|
112
|
+
grouped,
|
113
|
+
);
|
114
|
+
if (!hasAccounts) continue;
|
55
115
|
|
56
116
|
const { balance, fiatValue } = formatProviderResult(
|
57
|
-
|
117
|
+
providerCurrency,
|
58
118
|
totalBalance,
|
59
119
|
totalFiatValue,
|
60
120
|
counterValueCurrency,
|
61
121
|
locale,
|
62
122
|
discreet,
|
63
123
|
);
|
64
|
-
|
65
|
-
balanceMap.set(mainCurrency.id, {
|
66
|
-
balance: balance,
|
67
|
-
fiatValue: fiatValue,
|
68
|
-
});
|
124
|
+
providerResultsMap.set(mainCurrency.id, { balance, fiatValue });
|
69
125
|
}
|
70
126
|
|
71
127
|
const assetsWithBalanceData = assets.map(asset => {
|
72
|
-
const balanceData =
|
128
|
+
const balanceData = providerResultsMap.get(asset.id) || {};
|
73
129
|
return {
|
74
|
-
|
130
|
+
asset,
|
75
131
|
balanceData,
|
76
|
-
rightElement: balanceItem(balanceData),
|
77
132
|
};
|
78
133
|
});
|
79
134
|
|
80
|
-
|
135
|
+
assetsWithBalanceData.sort((a, b) =>
|
81
136
|
compareByBalanceThenFiat(a.balanceData, b.balanceData, discreet),
|
82
137
|
);
|
83
|
-
|
138
|
+
|
139
|
+
return assetsWithBalanceData.map(({ asset, balanceData }) => ({
|
140
|
+
...asset,
|
141
|
+
rightElement: balanceItem(balanceData),
|
142
|
+
}));
|
143
|
+
}, [providerMap, assets, grouped, counterValueCurrency, locale, discreet]);
|
84
144
|
};
|
85
145
|
}
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { type ReactNode } from "react";
|
1
|
+
import { useMemo, type ReactNode } from "react";
|
2
2
|
import type { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
3
3
|
import { compareByBalanceThenFiat } from "../utils/sortByBalance";
|
4
|
-
import { UseBalanceDeps } from "../utils/type";
|
4
|
+
import { BalanceUI, UseBalanceDeps } from "../utils/type";
|
5
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
5
6
|
import { getBalanceAndFiatValueByAssets } from "../utils/getBalanceAndFiatValueByAssets";
|
6
7
|
|
7
8
|
export type NetworkDeps = {
|
@@ -10,39 +11,108 @@ export type NetworkDeps = {
|
|
10
11
|
};
|
11
12
|
|
12
13
|
type Params = {
|
14
|
+
assets: CryptoOrTokenCurrency[];
|
13
15
|
networks: CryptoOrTokenCurrency[];
|
16
|
+
selectedAssetId: string;
|
17
|
+
currenciesByProvider: CurrenciesByProviderId[];
|
14
18
|
};
|
15
19
|
|
16
20
|
export function createUseRightBalanceNetwork({ useBalanceDeps, balanceItem }: NetworkDeps) {
|
17
|
-
return function useRightBalanceNetwork({
|
21
|
+
return function useRightBalanceNetwork({
|
22
|
+
assets: networks,
|
23
|
+
selectedAssetId,
|
24
|
+
currenciesByProvider,
|
25
|
+
networks: actualNetworks,
|
26
|
+
}: Params) {
|
18
27
|
const { flattenedAccounts, discreet, state, counterValueCurrency, locale } = useBalanceDeps();
|
19
28
|
|
20
|
-
|
21
|
-
|
29
|
+
return useMemo(() => {
|
30
|
+
if (currenciesByProvider && currenciesByProvider.length > 0) {
|
31
|
+
const providerOfSelectedAsset = currenciesByProvider.find(provider =>
|
32
|
+
provider.currenciesByNetwork.some(currency => currency.id === selectedAssetId),
|
33
|
+
);
|
34
|
+
|
35
|
+
if (providerOfSelectedAsset) {
|
36
|
+
const pairs = networks.map(network => ({
|
37
|
+
network,
|
38
|
+
asset: providerOfSelectedAsset.currenciesByNetwork.find(currency =>
|
39
|
+
currency.type === "TokenCurrency"
|
40
|
+
? currency.parentCurrency.id === network.id
|
41
|
+
: currency.id === network.id,
|
42
|
+
),
|
43
|
+
}));
|
44
|
+
|
45
|
+
const validAssets = pairs.filter(p => p.asset).map(p => p.asset!);
|
46
|
+
|
47
|
+
const allBalanceData =
|
48
|
+
validAssets.length > 0
|
49
|
+
? getBalanceAndFiatValueByAssets(
|
50
|
+
flattenedAccounts,
|
51
|
+
validAssets,
|
52
|
+
state,
|
53
|
+
counterValueCurrency,
|
54
|
+
discreet,
|
55
|
+
locale,
|
56
|
+
)
|
57
|
+
: [];
|
58
|
+
|
59
|
+
const balanceMap = new Map(allBalanceData.map(b => [b.id, b]));
|
60
|
+
|
61
|
+
const networkWithBalanceData = pairs.map(({ network, asset }) => {
|
62
|
+
const balanceData: BalanceUI = asset ? balanceMap.get(asset.id) || {} : {};
|
63
|
+
return {
|
64
|
+
network,
|
65
|
+
balanceData,
|
66
|
+
};
|
67
|
+
});
|
68
|
+
|
69
|
+
networkWithBalanceData.sort((a, b) =>
|
70
|
+
compareByBalanceThenFiat(a.balanceData, b.balanceData, discreet),
|
71
|
+
);
|
72
|
+
|
73
|
+
return networkWithBalanceData.map(({ network, balanceData }) => ({
|
74
|
+
...network,
|
75
|
+
rightElement: balanceItem(balanceData),
|
76
|
+
}));
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
const networkBalanceData = getBalanceAndFiatValueByAssets(
|
81
|
+
flattenedAccounts,
|
82
|
+
actualNetworks,
|
83
|
+
state,
|
84
|
+
counterValueCurrency,
|
85
|
+
discreet,
|
86
|
+
locale,
|
87
|
+
);
|
88
|
+
|
89
|
+
const balanceMap = new Map(networkBalanceData.map(b => [b.id, b]));
|
90
|
+
|
91
|
+
const networksWithBalance = actualNetworks.map(network => {
|
92
|
+
const balanceData = balanceMap.get(network.id) || {};
|
93
|
+
return {
|
94
|
+
network,
|
95
|
+
balanceData,
|
96
|
+
};
|
97
|
+
});
|
98
|
+
|
99
|
+
networksWithBalance.sort((a, b) =>
|
100
|
+
compareByBalanceThenFiat(a.balanceData, b.balanceData, discreet),
|
101
|
+
);
|
102
|
+
|
103
|
+
return networksWithBalance.map(({ network, balanceData }) => ({
|
104
|
+
...network,
|
105
|
+
rightElement: balanceItem(balanceData),
|
106
|
+
}));
|
107
|
+
}, [
|
22
108
|
networks,
|
109
|
+
selectedAssetId,
|
110
|
+
currenciesByProvider,
|
111
|
+
flattenedAccounts,
|
23
112
|
state,
|
24
113
|
counterValueCurrency,
|
25
114
|
discreet,
|
26
115
|
locale,
|
27
|
-
);
|
28
|
-
|
29
|
-
const balanceMap = new Map(networkBalanceData.map(b => [b.id, b]));
|
30
|
-
|
31
|
-
const networksWithBalance = networks.map(network => {
|
32
|
-
const balanceData = balanceMap.get(network.id) || {};
|
33
|
-
return {
|
34
|
-
network,
|
35
|
-
balanceData,
|
36
|
-
};
|
37
|
-
});
|
38
|
-
|
39
|
-
networksWithBalance.sort((a, b) =>
|
40
|
-
compareByBalanceThenFiat(a.balanceData, b.balanceData, discreet),
|
41
|
-
);
|
42
|
-
|
43
|
-
return networksWithBalance.map(({ network, balanceData }) => ({
|
44
|
-
...network,
|
45
|
-
rightElement: balanceItem(balanceData),
|
46
|
-
}));
|
116
|
+
]);
|
47
117
|
};
|
48
118
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
2
|
import { AssetType, CreateAssetConfigurationHook, AssetConfigurationDeps } from "../utils/type";
|
3
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
3
4
|
import { composeHooks } from "../../utils/composeHooks";
|
4
5
|
import { useLeftApyModule } from "../hooks/modules/useLeftApyModule";
|
5
6
|
import { createUseRightBalanceAsset } from "../hooks/useRightBalanceAsset";
|
@@ -45,7 +46,7 @@ const getLeftElement =
|
|
45
46
|
|
46
47
|
const createAssetConfigurationHook: CreateAssetConfigurationHook =
|
47
48
|
deps =>
|
48
|
-
({ assetsConfiguration }) => {
|
49
|
+
({ assetsConfiguration, currenciesByProvider }) => {
|
49
50
|
const { rightElement, leftElement } = assetsConfiguration ?? {};
|
50
51
|
|
51
52
|
const rightHook = getRightElement(deps)(rightElement);
|
@@ -53,11 +54,18 @@ const createAssetConfigurationHook: CreateAssetConfigurationHook =
|
|
53
54
|
|
54
55
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
55
56
|
const hooks = [rightHook, leftHook].filter(Boolean) as Array<
|
56
|
-
(
|
57
|
+
(
|
58
|
+
assets: CryptoOrTokenCurrency[],
|
59
|
+
currenciesByProvider?: CurrenciesByProviderId[],
|
60
|
+
) => AssetType[]
|
57
61
|
>;
|
58
62
|
|
59
63
|
return (assets: CryptoOrTokenCurrency[]) => {
|
60
|
-
const composedHook = composeHooks<CryptoOrTokenCurrency, AssetType>(
|
64
|
+
const composedHook = composeHooks<CryptoOrTokenCurrency, AssetType>(
|
65
|
+
...hooks.map(
|
66
|
+
hook => (assets: CryptoOrTokenCurrency[]) => hook(assets, currenciesByProvider),
|
67
|
+
),
|
68
|
+
);
|
61
69
|
return composedHook(assets);
|
62
70
|
};
|
63
71
|
};
|
@@ -53,7 +53,12 @@ export const getRightElement =
|
|
53
53
|
|
54
54
|
export const createNetworkConfigurationHook =
|
55
55
|
(NetworkConfigurationDeps: NetworkConfigurationDeps) =>
|
56
|
-
({
|
56
|
+
({
|
57
|
+
networksConfig,
|
58
|
+
selectedAssetId,
|
59
|
+
currenciesByProvider,
|
60
|
+
accounts$,
|
61
|
+
}: CreateNetworkConfigurationHookProps) => {
|
57
62
|
const { leftElement, rightElement } = networksConfig ?? {};
|
58
63
|
const leftHook = getLeftElement(NetworkConfigurationDeps)(leftElement);
|
59
64
|
const rightHook = getRightElement(NetworkConfigurationDeps)(rightElement);
|
@@ -70,6 +75,8 @@ export const createNetworkConfigurationHook =
|
|
70
75
|
hook => () =>
|
71
76
|
hook({
|
72
77
|
assets,
|
78
|
+
selectedAssetId,
|
79
|
+
currenciesByProvider: currenciesByProvider || [],
|
73
80
|
accounts$,
|
74
81
|
networks,
|
75
82
|
}),
|
@@ -10,10 +10,10 @@ import {
|
|
10
10
|
safeCurrencyLookup,
|
11
11
|
} from "../currencyUtils";
|
12
12
|
import {
|
13
|
+
usdcToken,
|
13
14
|
mockBaseCryptoCurrency,
|
14
15
|
mockBtcCryptoCurrency,
|
15
16
|
mockEthCryptoCurrency,
|
16
|
-
usdcToken,
|
17
17
|
} from "../../__mocks__/currencies.mock";
|
18
18
|
|
19
19
|
describe("safeCurrencyLookup", () => {
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { haveOneCommonProvider } from "../haveOneCommonProvider";
|
2
|
+
import { useGroupedCurrenciesByProvider } from "../../__mocks__/useGroupedCurrenciesByProvider.mock";
|
3
|
+
import { LoadingBasedGroupedCurrencies } from "../../../deposit/type";
|
4
|
+
|
5
|
+
jest.mock("../../../deposit/useGroupedCurrenciesByProvider.hook", () => ({
|
6
|
+
useGroupedCurrenciesByProvider: () => useGroupedCurrenciesByProvider(),
|
7
|
+
}));
|
8
|
+
|
9
|
+
describe("haveOneCommonProvider", () => {
|
10
|
+
it("should return false for an empty array", () => {
|
11
|
+
expect(haveOneCommonProvider([], [])).toBe(false);
|
12
|
+
});
|
13
|
+
|
14
|
+
it("should return true for a single currency with one provider", () => {
|
15
|
+
const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
|
16
|
+
const { currenciesByProvider } = result;
|
17
|
+
|
18
|
+
expect(haveOneCommonProvider(["bitcoin"], currenciesByProvider)).toBe(true);
|
19
|
+
});
|
20
|
+
|
21
|
+
it("should return false for multiple currencies with different providers", () => {
|
22
|
+
const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
|
23
|
+
const { currenciesByProvider } = result;
|
24
|
+
|
25
|
+
expect(haveOneCommonProvider(["bitcoin", "ethereum"], currenciesByProvider)).toBe(false);
|
26
|
+
});
|
27
|
+
|
28
|
+
it("should return true for multiple currencies with the same provider", () => {
|
29
|
+
const { result } = useGroupedCurrenciesByProvider(true) as LoadingBasedGroupedCurrencies;
|
30
|
+
const { currenciesByProvider } = result;
|
31
|
+
|
32
|
+
expect(haveOneCommonProvider(["ethereum", "arbitrum"], currenciesByProvider)).toBe(true);
|
33
|
+
});
|
34
|
+
});
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
+
|
3
|
+
export const buildProviderCurrenciesMap = (
|
4
|
+
currenciesByProvider?: Array<{
|
5
|
+
providerId: string;
|
6
|
+
currenciesByNetwork?: CryptoOrTokenCurrency[];
|
7
|
+
}>,
|
8
|
+
) => {
|
9
|
+
if (!currenciesByProvider?.length) return null;
|
10
|
+
|
11
|
+
const map = new Map<
|
12
|
+
string,
|
13
|
+
{ mainCurrency: CryptoOrTokenCurrency; currencies: CryptoOrTokenCurrency[] }
|
14
|
+
>();
|
15
|
+
|
16
|
+
currenciesByProvider.forEach(({ providerId, currenciesByNetwork = [] }) => {
|
17
|
+
if (currenciesByNetwork.length > 0) {
|
18
|
+
const mainCurrency =
|
19
|
+
currenciesByNetwork.find(c => c.id === providerId) ?? currenciesByNetwork[0];
|
20
|
+
map.set(providerId, { mainCurrency, currencies: currenciesByNetwork });
|
21
|
+
}
|
22
|
+
});
|
23
|
+
|
24
|
+
return map;
|
25
|
+
};
|
@@ -4,6 +4,7 @@ import { isTokenCurrency } from "../../currencies";
|
|
4
4
|
import { CurrenciesByProviderId } from "../../deposit/type";
|
5
5
|
|
6
6
|
export type ProviderCoverageMap = Map<string, Set<string>>;
|
7
|
+
|
7
8
|
export const safeCurrencyLookup = (id: string): CryptoOrTokenCurrency | null => {
|
8
9
|
try {
|
9
10
|
return getTokenOrCryptoCurrencyById(id);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
+
import { getTokenOrCryptoCurrencyById } from "../../deposit/helper";
|
3
|
+
|
4
|
+
export const getProviderCurrency = (
|
5
|
+
mainCurrency: CryptoOrTokenCurrency,
|
6
|
+
currencies: CryptoOrTokenCurrency[],
|
7
|
+
) => {
|
8
|
+
try {
|
9
|
+
return getTokenOrCryptoCurrencyById(mainCurrency.id);
|
10
|
+
} catch {
|
11
|
+
return getTokenOrCryptoCurrencyById(currencies[0].id);
|
12
|
+
}
|
13
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* This function checks if all currencies in the provided array
|
5
|
+
* it stopped at the first currency that does not match to prevent unnecessary iterations.
|
6
|
+
*
|
7
|
+
* @param currenciesIdsArray array of currency IDs to check
|
8
|
+
* @param currenciesByProvider array of currencies grouped by provider
|
9
|
+
* @returns boolean indicating whether all currencies in the array have one common provider
|
10
|
+
*/
|
11
|
+
export const haveOneCommonProvider = (
|
12
|
+
currenciesIdsArray: string[],
|
13
|
+
currenciesByProvider: CurrenciesByProviderId[],
|
14
|
+
): boolean => {
|
15
|
+
if (currenciesIdsArray.length === 0) return false;
|
16
|
+
|
17
|
+
const providerIds = new Set<string>();
|
18
|
+
|
19
|
+
for (const currencyId of currenciesIdsArray) {
|
20
|
+
for (const provider of currenciesByProvider) {
|
21
|
+
if (provider.currenciesByNetwork.some(currency => currency.id === currencyId)) {
|
22
|
+
providerIds.add(provider.providerId);
|
23
|
+
if (providerIds.size > 1) {
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
return true;
|
31
|
+
};
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import { isCorrespondingCurrency } from "./index";
|
1
|
+
import { isCorrespondingCurrency, getEffectiveCurrency } from "./index";
|
2
2
|
|
3
3
|
import { createFixtureCryptoCurrency } from "../../mock/fixtures/cryptoCurrencies";
|
4
4
|
import { cryptocurrenciesById } from "@ledgerhq/cryptoassets";
|
5
5
|
import type { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
6
|
+
import type { CurrenciesByProviderId } from "../../deposit/type";
|
6
7
|
|
7
8
|
describe("isCorrespondingCurrency", () => {
|
8
9
|
const evmCurrency = createFixtureCryptoCurrency("evm");
|
@@ -41,3 +42,33 @@ describe("isCorrespondingCurrency", () => {
|
|
41
42
|
expect(isCorrespondingCurrency(bitcoinCurrency, evmCurrency)).toBe(false);
|
42
43
|
});
|
43
44
|
});
|
45
|
+
|
46
|
+
describe("getEffectiveCurrency", () => {
|
47
|
+
const parent = createFixtureCryptoCurrency("evm");
|
48
|
+
const token: CryptoOrTokenCurrency = {
|
49
|
+
type: "TokenCurrency",
|
50
|
+
id: "ethereum/erc20/usdc",
|
51
|
+
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
52
|
+
parentCurrency: parent,
|
53
|
+
tokenType: "erc20",
|
54
|
+
name: "USD Coin",
|
55
|
+
ticker: "USDC",
|
56
|
+
units: [{ name: "USD Coin", code: "USDC", magnitude: 6 }],
|
57
|
+
};
|
58
|
+
const provider: CurrenciesByProviderId = {
|
59
|
+
providerId: "provider1",
|
60
|
+
currenciesByNetwork: [parent, token],
|
61
|
+
};
|
62
|
+
|
63
|
+
it("returns currency if id is in currencyIds", () => {
|
64
|
+
expect(getEffectiveCurrency(token, provider, [token.id])).toBe(token);
|
65
|
+
});
|
66
|
+
|
67
|
+
it("returns first matching currency from provider if id not in currencyIds", () => {
|
68
|
+
expect(getEffectiveCurrency(token, provider, [parent.id])).toBe(parent);
|
69
|
+
});
|
70
|
+
|
71
|
+
it("returns currency if no match in provider", () => {
|
72
|
+
expect(getEffectiveCurrency(token, provider, ["notfound"])).toBe(token);
|
73
|
+
});
|
74
|
+
});
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
3
|
+
import { haveOneCommonProvider } from "./haveOneCommonProvider";
|
4
|
+
import { getBalanceAndFiatValue } from "./getBalanceAndFiatValue";
|
5
|
+
import { groupCurrenciesByProvider } from "./groupCurrenciesByProvider";
|
5
6
|
|
6
7
|
function isCorrespondingCurrency(
|
7
8
|
elem: CryptoOrTokenCurrency,
|
@@ -16,4 +17,22 @@ function isCorrespondingCurrency(
|
|
16
17
|
return false;
|
17
18
|
}
|
18
19
|
|
19
|
-
|
20
|
+
const getEffectiveCurrency = (
|
21
|
+
currency: CryptoOrTokenCurrency,
|
22
|
+
provider: CurrenciesByProviderId,
|
23
|
+
currencyIds: string[],
|
24
|
+
) => {
|
25
|
+
const isCurrencyFiltered = currencyIds.includes(currency.id);
|
26
|
+
|
27
|
+
if (isCurrencyFiltered) return currency;
|
28
|
+
|
29
|
+
return provider.currenciesByNetwork.find(elem => currencyIds.includes(elem.id)) ?? currency;
|
30
|
+
};
|
31
|
+
|
32
|
+
export {
|
33
|
+
isCorrespondingCurrency,
|
34
|
+
getEffectiveCurrency,
|
35
|
+
haveOneCommonProvider,
|
36
|
+
getBalanceAndFiatValue,
|
37
|
+
groupCurrenciesByProvider,
|
38
|
+
};
|
@@ -4,6 +4,7 @@ import { AccountLike } from "@ledgerhq/types-live";
|
|
4
4
|
import { ReactNode } from "react";
|
5
5
|
import { Observable } from "rxjs";
|
6
6
|
import { WalletAPIAccount } from "../../wallet-api/types";
|
7
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
7
8
|
import { EnhancedModularDrawerConfiguration } from "../../wallet-api/ModularDrawer/types";
|
8
9
|
import { InterestRate } from "../data/entities";
|
9
10
|
import { MarketItemResponse } from "../../market/utils/types";
|
@@ -73,6 +74,8 @@ export type UseAccountData = (params: AccountModuleParams) => AccountDataItem[];
|
|
73
74
|
export type NetworkHookParams = {
|
74
75
|
assets: CryptoOrTokenCurrency[];
|
75
76
|
networks: CryptoOrTokenCurrency[];
|
77
|
+
selectedAssetId: string;
|
78
|
+
currenciesByProvider: CurrenciesByProviderId[];
|
76
79
|
accounts$?: Observable<WalletAPIAccount[]>;
|
77
80
|
};
|
78
81
|
export type NetworkHook = (params: NetworkHookParams) => Array<CryptoOrTokenCurrency & Network>;
|
@@ -98,11 +101,14 @@ export type Network = {
|
|
98
101
|
|
99
102
|
export type CreateNetworkConfigurationHookProps = {
|
100
103
|
networksConfig: EnhancedModularDrawerConfiguration["networks"];
|
104
|
+
currenciesByProvider?: CurrenciesByProviderId[];
|
105
|
+
selectedAssetId: string;
|
101
106
|
accounts$?: Observable<WalletAPIAccount[]>;
|
102
107
|
};
|
103
108
|
|
104
109
|
type Props = {
|
105
110
|
assetsConfiguration: EnhancedModularDrawerConfiguration["assets"];
|
111
|
+
currenciesByProvider?: CurrenciesByProviderId[];
|
106
112
|
};
|
107
113
|
|
108
114
|
export type AssetConfigurationDeps = {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"hedera.d.ts","sourceRoot":"","sources":["../../../src/e2e/families/hedera.ts"],"names":[],"mappings":"AAGA,wBAAsB,UAAU,kBAG/B"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.sendHedera = void 0;
|
4
|
-
const speculos_1 = require("../speculos");
|
5
|
-
const DeviceLabels_1 = require("../enum/DeviceLabels");
|
6
|
-
async function sendHedera() {
|
7
|
-
await (0, speculos_1.pressUntilTextFound)(DeviceLabels_1.DeviceLabels.APPROVE);
|
8
|
-
await (0, speculos_1.pressBoth)();
|
9
|
-
}
|
10
|
-
exports.sendHedera = sendHedera;
|
11
|
-
//# sourceMappingURL=hedera.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"hedera.js","sourceRoot":"","sources":["../../../src/e2e/families/hedera.ts"],"names":[],"mappings":";;;AAAA,0CAA6D;AAC7D,uDAAoD;AAE7C,KAAK,UAAU,UAAU;IAC9B,MAAM,IAAA,8BAAmB,EAAC,2BAAY,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,IAAA,oBAAS,GAAE,CAAC;AACpB,CAAC;AAHD,gCAGC"}
|