@ledgerhq/live-common 34.52.0-nightly.9 → 34.53.0-nightly.20251107095716
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/DataModel.d.ts +2 -2
- package/lib/DataModel.d.ts.map +1 -1
- package/lib/DataModel.js +2 -2
- package/lib/DataModel.js.map +1 -1
- package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/bridge.js +103 -47
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/__tests__/test-helpers/setup.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/setup.js +6 -5
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/account/serialization.d.ts +1 -1
- package/lib/account/serialization.d.ts.map +1 -1
- package/lib/account/serialization.js +2 -2
- package/lib/account/serialization.js.map +1 -1
- package/lib/api/ofacGeoBlockApi.d.ts +4 -0
- package/lib/api/ofacGeoBlockApi.d.ts.map +1 -0
- package/lib/api/ofacGeoBlockApi.js +21 -0
- package/lib/api/ofacGeoBlockApi.js.map +1 -0
- package/lib/apps/config.d.ts.map +1 -1
- package/lib/apps/config.js +1 -0
- package/lib/apps/config.js.map +1 -1
- package/lib/bot/engine.d.ts +5 -5
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js.map +1 -1
- package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +2 -2
- package/lib/bridge/crypto-assets/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +6 -1
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +1 -0
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +2 -2
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +30 -26
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +6 -4
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts +2 -1
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js +2 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +61 -2
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +121 -7
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/index.d.ts +1 -1
- package/lib/bridge/index.d.ts.map +1 -1
- package/lib/bridge/index.js +2 -2
- package/lib/bridge/index.js.map +1 -1
- package/lib/currencies/index.d.ts +1 -1
- package/lib/currencies/index.d.ts.map +1 -1
- package/lib/currencies/index.js +1 -4
- package/lib/currencies/index.js.map +1 -1
- package/lib/dada-client/__mocks__/assets.mock.d.ts +383 -0
- package/lib/dada-client/__mocks__/assets.mock.d.ts.map +1 -0
- package/lib/dada-client/__mocks__/assets.mock.js +260 -0
- package/lib/dada-client/__mocks__/assets.mock.js.map +1 -0
- package/lib/dada-client/hooks/useAssetsData.d.ts +2 -1
- package/lib/dada-client/hooks/useAssetsData.d.ts.map +1 -1
- package/lib/dada-client/hooks/useAssetsData.js +2 -2
- package/lib/dada-client/hooks/useAssetsData.js.map +1 -1
- package/lib/dada-client/hooks/useLazyLedgerCurrency.d.ts +13 -0
- package/lib/dada-client/hooks/useLazyLedgerCurrency.d.ts.map +1 -0
- package/lib/dada-client/hooks/useLazyLedgerCurrency.js +34 -0
- package/lib/dada-client/hooks/useLazyLedgerCurrency.js.map +1 -0
- package/lib/dada-client/index.d.ts +2 -0
- package/lib/dada-client/index.d.ts.map +1 -0
- package/lib/dada-client/index.js +18 -0
- package/lib/dada-client/index.js.map +1 -0
- package/lib/dada-client/state-manager/api.js +1 -1
- package/lib/dada-client/state-manager/api.js.map +1 -1
- package/lib/dada-client/utils/currencySelection.d.ts +10 -0
- package/lib/dada-client/utils/currencySelection.d.ts.map +1 -0
- package/lib/dada-client/utils/currencySelection.js +34 -0
- package/lib/dada-client/utils/currencySelection.js.map +1 -0
- package/lib/deposit/helper.d.ts +1 -1
- package/lib/deposit/helper.d.ts.map +1 -1
- package/lib/deposit/helper.js +3 -2
- package/lib/deposit/helper.js.map +1 -1
- package/lib/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib/e2e/data/deviceLabelsData.js +2 -1
- package/lib/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +5 -1
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +4 -0
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/index.d.ts +4 -8
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +24 -5
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/speculosAppVersion.d.ts.map +1 -1
- package/lib/e2e/speculosAppVersion.js +1 -0
- package/lib/e2e/speculosAppVersion.js.map +1 -1
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +1 -17
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +3 -0
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/cosmos/datasets/coreum.d.ts.map +1 -1
- package/lib/families/cosmos/datasets/coreum.js +2 -1
- package/lib/families/cosmos/datasets/coreum.js.map +1 -1
- package/lib/families/near/config.d.ts.map +1 -1
- package/lib/families/near/config.js +1 -0
- package/lib/families/near/config.js.map +1 -1
- package/lib/families/solana/setup.d.ts +1 -1
- package/lib/families/tron/data.mock.d.ts +4 -4
- package/lib/families/tron/data.mock.d.ts.map +1 -1
- package/lib/families/tron/data.mock.js +27 -13
- package/lib/families/tron/data.mock.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +3 -4
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/stakePrograms/index.d.ts +1 -0
- package/lib/featureFlags/stakePrograms/index.d.ts.map +1 -1
- package/lib/featureFlags/stakePrograms/index.js +13 -1
- package/lib/featureFlags/stakePrograms/index.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/cli-transaction.d.ts +1 -1
- package/lib/generated/transaction.d.ts +1 -1
- package/lib/hw/actions/implementations.d.ts.map +1 -1
- package/lib/hw/actions/implementations.js +13 -7
- package/lib/hw/actions/implementations.js.map +1 -1
- package/lib/hw/connectAppEventMapper.d.ts.map +1 -1
- package/lib/hw/connectAppEventMapper.js +2 -2
- package/lib/hw/connectAppEventMapper.js.map +1 -1
- package/lib/market/hooks/useLargeMoverCurrencies.d.ts +1 -1
- package/lib/market/hooks/useMarketDataProvider.d.ts +2 -2
- package/lib/market/hooks/useMarketDataProvider.d.ts.map +1 -1
- package/lib/market/hooks/useMarketDataProvider.js +4 -7
- package/lib/market/hooks/useMarketDataProvider.js.map +1 -1
- package/lib/market/utils/currencyFormatter.d.ts +3 -4
- package/lib/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib/market/utils/currencyFormatter.js +3 -6
- package/lib/market/utils/currencyFormatter.js.map +1 -1
- package/lib/market/utils/queryKeys.d.ts +0 -1
- package/lib/market/utils/queryKeys.d.ts.map +1 -1
- package/lib/market/utils/queryKeys.js +0 -1
- package/lib/market/utils/queryKeys.js.map +1 -1
- package/lib/market/utils/types.d.ts +6 -8
- package/lib/market/utils/types.d.ts.map +1 -1
- package/lib/market/utils/types.js.map +1 -1
- package/lib/mock/fixtures/cryptoCurrencies.d.ts.map +1 -1
- package/lib/mock/fixtures/cryptoCurrencies.js +10 -1
- package/lib/mock/fixtures/cryptoCurrencies.js.map +1 -1
- package/lib/modularDrawer/__mocks__/currencies.mock.d.ts +1 -1
- package/lib/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
- package/lib/modularDrawer/__mocks__/currencies.mock.js +1 -1
- package/lib/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.d.ts +3 -3
- package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib/modularDrawer/utils/currencyUtils.js +8 -8
- package/lib/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -1
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js +13 -4
- package/lib/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -1
- package/lib/postOnboarding/mock.d.ts +1 -0
- package/lib/postOnboarding/mock.d.ts.map +1 -1
- package/lib/postOnboarding/mock.js +3 -1
- package/lib/postOnboarding/mock.js.map +1 -1
- package/lib/postOnboarding/reducer.d.ts +16 -14
- package/lib/postOnboarding/reducer.d.ts.map +1 -1
- package/lib/transaction/index.d.ts +1 -1
- package/lib/transaction/index.d.ts.map +1 -1
- package/lib/transaction/index.js +2 -2
- package/lib/transaction/index.js.map +1 -1
- package/lib/utils/addressUtils.d.ts +15 -0
- package/lib/utils/addressUtils.d.ts.map +1 -0
- package/lib/utils/addressUtils.js +39 -0
- package/lib/utils/addressUtils.js.map +1 -0
- package/lib/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib/wallet-api/ACRE/server.js +19 -15
- package/lib/wallet-api/ACRE/server.js.map +1 -1
- package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +8 -5
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/logic.d.ts.map +1 -1
- package/lib/wallet-api/logic.js +29 -29
- package/lib/wallet-api/logic.js.map +1 -1
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +37 -29
- package/lib/wallet-api/react.js.map +1 -1
- package/lib/wallet-api/useDappLogic.d.ts.map +1 -1
- package/lib/wallet-api/useDappLogic.js +76 -60
- package/lib/wallet-api/useDappLogic.js.map +1 -1
- package/lib-es/DataModel.d.ts +2 -2
- package/lib-es/DataModel.d.ts.map +1 -1
- package/lib-es/DataModel.js +2 -2
- package/lib-es/DataModel.js.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js +103 -47
- package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib-es/__tests__/test-helpers/setup.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/setup.js +6 -5
- package/lib-es/__tests__/test-helpers/setup.js.map +1 -1
- package/lib-es/account/serialization.d.ts +1 -1
- package/lib-es/account/serialization.d.ts.map +1 -1
- package/lib-es/account/serialization.js +2 -2
- package/lib-es/account/serialization.js.map +1 -1
- package/lib-es/api/ofacGeoBlockApi.d.ts +4 -0
- package/lib-es/api/ofacGeoBlockApi.d.ts.map +1 -0
- package/lib-es/api/ofacGeoBlockApi.js +18 -0
- package/lib-es/api/ofacGeoBlockApi.js.map +1 -0
- package/lib-es/apps/config.d.ts.map +1 -1
- package/lib-es/apps/config.js +1 -0
- package/lib-es/apps/config.js.map +1 -1
- package/lib-es/bot/engine.d.ts +5 -5
- package/lib-es/bot/engine.d.ts.map +1 -1
- package/lib-es/bot/engine.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +1 -1
- package/lib-es/bridge/crypto-assets/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +6 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +1 -0
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +2 -2
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +30 -26
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +6 -4
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts +2 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.js +2 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +61 -2
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +121 -7
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/index.d.ts +1 -1
- package/lib-es/bridge/index.d.ts.map +1 -1
- package/lib-es/bridge/index.js +2 -2
- package/lib-es/bridge/index.js.map +1 -1
- package/lib-es/currencies/index.d.ts +1 -1
- package/lib-es/currencies/index.d.ts.map +1 -1
- package/lib-es/currencies/index.js +1 -1
- package/lib-es/currencies/index.js.map +1 -1
- package/lib-es/dada-client/__mocks__/assets.mock.d.ts +383 -0
- package/lib-es/dada-client/__mocks__/assets.mock.d.ts.map +1 -0
- package/lib-es/dada-client/__mocks__/assets.mock.js +257 -0
- package/lib-es/dada-client/__mocks__/assets.mock.js.map +1 -0
- package/lib-es/dada-client/hooks/useAssetsData.d.ts +2 -1
- package/lib-es/dada-client/hooks/useAssetsData.d.ts.map +1 -1
- package/lib-es/dada-client/hooks/useAssetsData.js +2 -2
- package/lib-es/dada-client/hooks/useAssetsData.js.map +1 -1
- package/lib-es/dada-client/hooks/useLazyLedgerCurrency.d.ts +13 -0
- package/lib-es/dada-client/hooks/useLazyLedgerCurrency.d.ts.map +1 -0
- package/lib-es/dada-client/hooks/useLazyLedgerCurrency.js +27 -0
- package/lib-es/dada-client/hooks/useLazyLedgerCurrency.js.map +1 -0
- package/lib-es/dada-client/index.d.ts +2 -0
- package/lib-es/dada-client/index.d.ts.map +1 -0
- package/lib-es/dada-client/index.js +2 -0
- package/lib-es/dada-client/index.js.map +1 -0
- package/lib-es/dada-client/state-manager/api.js +1 -1
- package/lib-es/dada-client/state-manager/api.js.map +1 -1
- package/lib-es/dada-client/utils/currencySelection.d.ts +10 -0
- package/lib-es/dada-client/utils/currencySelection.d.ts.map +1 -0
- package/lib-es/dada-client/utils/currencySelection.js +30 -0
- package/lib-es/dada-client/utils/currencySelection.js.map +1 -0
- package/lib-es/deposit/helper.d.ts +1 -1
- package/lib-es/deposit/helper.d.ts.map +1 -1
- package/lib-es/deposit/helper.js +4 -3
- package/lib-es/deposit/helper.js.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.js +2 -1
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +5 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +4 -0
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/index.d.ts +4 -8
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +24 -5
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/speculosAppVersion.d.ts.map +1 -1
- package/lib-es/e2e/speculosAppVersion.js +1 -0
- package/lib-es/e2e/speculosAppVersion.js.map +1 -1
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +1 -17
- package/lib-es/exchange/swap/completeExchange.js.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +3 -0
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/cosmos/datasets/coreum.d.ts.map +1 -1
- package/lib-es/families/cosmos/datasets/coreum.js +2 -1
- package/lib-es/families/cosmos/datasets/coreum.js.map +1 -1
- package/lib-es/families/near/config.d.ts.map +1 -1
- package/lib-es/families/near/config.js +1 -0
- package/lib-es/families/near/config.js.map +1 -1
- package/lib-es/families/solana/setup.d.ts +1 -1
- package/lib-es/families/tron/data.mock.d.ts +4 -4
- package/lib-es/families/tron/data.mock.d.ts.map +1 -1
- package/lib-es/families/tron/data.mock.js +22 -12
- package/lib-es/families/tron/data.mock.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +3 -4
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/stakePrograms/index.d.ts +1 -0
- package/lib-es/featureFlags/stakePrograms/index.d.ts.map +1 -1
- package/lib-es/featureFlags/stakePrograms/index.js +11 -0
- package/lib-es/featureFlags/stakePrograms/index.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/cli-transaction.d.ts +1 -1
- package/lib-es/generated/transaction.d.ts +1 -1
- package/lib-es/hw/actions/implementations.d.ts.map +1 -1
- package/lib-es/hw/actions/implementations.js +15 -9
- package/lib-es/hw/actions/implementations.js.map +1 -1
- package/lib-es/hw/connectAppEventMapper.d.ts.map +1 -1
- package/lib-es/hw/connectAppEventMapper.js +3 -3
- package/lib-es/hw/connectAppEventMapper.js.map +1 -1
- package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts +1 -1
- package/lib-es/market/hooks/useMarketDataProvider.d.ts +2 -2
- package/lib-es/market/hooks/useMarketDataProvider.d.ts.map +1 -1
- package/lib-es/market/hooks/useMarketDataProvider.js +2 -5
- package/lib-es/market/hooks/useMarketDataProvider.js.map +1 -1
- package/lib-es/market/utils/currencyFormatter.d.ts +3 -4
- package/lib-es/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib-es/market/utils/currencyFormatter.js +3 -6
- package/lib-es/market/utils/currencyFormatter.js.map +1 -1
- package/lib-es/market/utils/queryKeys.d.ts +0 -1
- package/lib-es/market/utils/queryKeys.d.ts.map +1 -1
- package/lib-es/market/utils/queryKeys.js +0 -1
- package/lib-es/market/utils/queryKeys.js.map +1 -1
- package/lib-es/market/utils/types.d.ts +6 -8
- package/lib-es/market/utils/types.d.ts.map +1 -1
- package/lib-es/market/utils/types.js.map +1 -1
- package/lib-es/mock/fixtures/cryptoCurrencies.d.ts.map +1 -1
- package/lib-es/mock/fixtures/cryptoCurrencies.js +11 -2
- package/lib-es/mock/fixtures/cryptoCurrencies.js.map +1 -1
- package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts +1 -1
- package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
- package/lib-es/modularDrawer/__mocks__/currencies.mock.js +1 -1
- package/lib-es/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts +3 -3
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/currencyUtils.js +8 -8
- package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -1
- package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.d.ts.map +1 -1
- package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.js +13 -4
- package/lib-es/postOnboarding/hooks/usePostOnboardingHubState.js.map +1 -1
- package/lib-es/postOnboarding/mock.d.ts +1 -0
- package/lib-es/postOnboarding/mock.d.ts.map +1 -1
- package/lib-es/postOnboarding/mock.js +2 -0
- package/lib-es/postOnboarding/mock.js.map +1 -1
- package/lib-es/postOnboarding/reducer.d.ts +16 -14
- package/lib-es/postOnboarding/reducer.d.ts.map +1 -1
- package/lib-es/transaction/index.d.ts +1 -1
- package/lib-es/transaction/index.d.ts.map +1 -1
- package/lib-es/transaction/index.js +2 -2
- package/lib-es/transaction/index.js.map +1 -1
- package/lib-es/utils/addressUtils.d.ts +15 -0
- package/lib-es/utils/addressUtils.d.ts.map +1 -0
- package/lib-es/utils/addressUtils.js +35 -0
- package/lib-es/utils/addressUtils.js.map +1 -0
- package/lib-es/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib-es/wallet-api/ACRE/server.js +19 -15
- package/lib-es/wallet-api/ACRE/server.js.map +1 -1
- package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +9 -6
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/logic.d.ts.map +1 -1
- package/lib-es/wallet-api/logic.js +26 -26
- package/lib-es/wallet-api/logic.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +38 -30
- package/lib-es/wallet-api/react.js.map +1 -1
- package/lib-es/wallet-api/useDappLogic.d.ts.map +1 -1
- package/lib-es/wallet-api/useDappLogic.js +74 -58
- package/lib-es/wallet-api/useDappLogic.js.map +1 -1
- package/package.json +79 -75
- package/src/DataModel.test.ts +74 -24
- package/src/DataModel.ts +4 -4
- package/src/__tests__/accounts/groupPerDay.ts +182 -177
- package/src/__tests__/csvExport.ts +3 -0
- package/src/__tests__/migration/account-migration.ts +2 -2
- package/src/__tests__/test-helpers/bridge.ts +426 -358
- package/src/__tests__/test-helpers/setup.ts +7 -6
- package/src/account/serialization.test.ts +6 -6
- package/src/account/serialization.ts +2 -2
- package/src/api/ofacGeoBlockApi.ts +19 -0
- package/src/apps/config.ts +1 -0
- package/src/bot/engine.ts +5 -5
- package/src/bridge/cache.test.ts +2 -0
- package/src/bridge/crypto-assets/index.test.ts +3 -9
- package/src/bridge/crypto-assets/index.ts +1 -1
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +3 -3
- package/src/bridge/generic-alpaca/createTransaction.ts +6 -1
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +1 -0
- package/src/bridge/generic-alpaca/prepareTransaction.ts +36 -41
- package/src/bridge/generic-alpaca/signOperation.ts +10 -4
- package/src/bridge/generic-alpaca/signer/Eth.ts +4 -2
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +29 -76
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +10 -2
- package/src/bridge/generic-alpaca/types.ts +80 -2
- package/src/bridge/generic-alpaca/utils.test.ts +58 -2
- package/src/bridge/generic-alpaca/utils.ts +151 -10
- package/src/bridge/index.ts +2 -2
- package/src/bridge/useBridgeTransaction.test.ts +9 -6
- package/src/currencies/cryptoIcons.test.ts +10 -5
- package/src/currencies/index.ts +0 -3
- package/src/currencies/sortByMarketcap.test.ts +4 -1
- package/src/dada-client/README.md +38 -0
- package/src/dada-client/__mocks__/assets.mock.ts +264 -0
- package/src/dada-client/hooks/__tests__/useLazyLedgerCurrency.test.ts +155 -0
- package/src/dada-client/hooks/useAssetsData.ts +14 -9
- package/src/dada-client/hooks/useLazyLedgerCurrency.ts +46 -0
- package/src/dada-client/index.ts +1 -0
- package/src/dada-client/state-manager/api.ts +1 -1
- package/src/dada-client/utils/__test__/currencySelection.test.ts +16 -0
- package/src/dada-client/utils/currencySelection.ts +33 -0
- package/src/deposit/deposit.integration.test.ts +15 -0
- package/src/deposit/deposit.test.ts +60 -40
- package/src/deposit/helper.ts +4 -8
- package/src/domain/getTokensWithFunds.test.ts +4 -0
- package/src/e2e/data/deviceLabelsData.ts +2 -1
- package/src/e2e/enum/DeviceLabels.ts +4 -0
- package/src/e2e/speculos.ts +26 -6
- package/src/e2e/speculosAppVersion.ts +1 -0
- package/src/exchange/swap/completeExchange.ts +1 -22
- package/src/families/aptos/__snapshots__/bridge.integration.test.ts.snap +12 -12
- package/src/families/bitcoin/__snapshots__/bridge.integration.test.ts.snap +1482 -843
- package/src/families/bitcoin/satstack.test.ts +33 -20
- package/src/families/canton/config.ts +3 -0
- package/src/families/cosmos/datasets/__snapshots__/babylon.integration.test.ts.snap +1 -1
- package/src/families/cosmos/datasets/__snapshots__/coreum.integration.test.ts.snap +4 -4
- package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +251 -209
- package/src/families/cosmos/datasets/coreum.ts +2 -1
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +675 -37
- package/src/families/multiversx/__snapshots__/bridge.integration.test.ts.snap +3 -3
- package/src/families/near/config.ts +1 -0
- package/src/families/polkadot/__snapshots__/bridge.integration.test.ts.snap +34 -34
- package/src/families/solana/__snapshots__/bridge.integration.test.ts.snap +3 -3
- package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +10 -10
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +1183 -625
- package/src/families/sui/__snapshots__/bridge.integration.test.ts.snap +428 -0
- package/src/families/tron/data.mock.ts +32 -16
- package/src/families/tron/react.test.ts +16 -4
- package/src/featureFlags/defaultFeatures.ts +3 -4
- package/src/featureFlags/stakePrograms/index.ts +14 -0
- package/src/hw/actions/implementations.ts +22 -11
- package/src/hw/connectAppEventMapper.ts +2 -4
- package/src/market/hooks/useMarketDataProvider.ts +4 -8
- package/src/market/utils/currencyFormatter.ts +4 -18
- package/src/market/utils/queryKeys.ts +0 -1
- package/src/market/utils/types.ts +6 -8
- package/src/mock/fixtures/cryptoCurrencies.ts +11 -2
- package/src/modularDrawer/__mocks__/currencies.mock.ts +1 -1
- package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +10 -10
- package/src/modularDrawer/utils/currencyUtils.ts +11 -10
- package/src/platform/serializers.test.ts +2 -2
- package/src/postOnboarding/hooks/usePostOnboardingHubState.test.ts +30 -3
- package/src/postOnboarding/hooks/usePostOnboardingHubState.ts +20 -6
- package/src/postOnboarding/mock.ts +2 -0
- package/src/transaction/index.ts +2 -2
- package/src/utils/__tests__/addressUtils.test.ts +229 -0
- package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +15 -4
- package/src/utils/addressUtils.ts +40 -0
- package/src/wallet-api/ACRE/server.test.ts +11 -8
- package/src/wallet-api/ACRE/server.ts +25 -22
- package/src/wallet-api/Exchange/server.ts +11 -8
- package/src/wallet-api/logic.test.ts +4 -0
- package/src/wallet-api/logic.ts +28 -32
- package/src/wallet-api/react.ts +37 -34
- package/src/wallet-api/useDappLogic.ts +103 -82
- package/lib/hooks/useOFACGeoBlockCheck.d.ts +0 -8
- package/lib/hooks/useOFACGeoBlockCheck.d.ts.map +0 -1
- package/lib/hooks/useOFACGeoBlockCheck.js +0 -32
- package/lib/hooks/useOFACGeoBlockCheck.js.map +0 -1
- package/lib-es/hooks/useOFACGeoBlockCheck.d.ts +0 -8
- package/lib-es/hooks/useOFACGeoBlockCheck.d.ts.map +0 -1
- package/lib-es/hooks/useOFACGeoBlockCheck.js +0 -28
- package/lib-es/hooks/useOFACGeoBlockCheck.js.map +0 -1
- package/src/hooks/useOFACGeoBlockCheck.ts +0 -37
|
@@ -10,10 +10,14 @@ import {
|
|
|
10
10
|
of,
|
|
11
11
|
timer,
|
|
12
12
|
} from "rxjs";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
DisconnectedDevice,
|
|
15
|
+
DisconnectedDeviceDuringOperation,
|
|
16
|
+
LockedDeviceError,
|
|
17
|
+
} from "@ledgerhq/errors";
|
|
14
18
|
import { catchError, debounce, delayWhen, filter, switchMap, tap, timeout } from "rxjs/operators";
|
|
15
19
|
import { Device } from "./types";
|
|
16
|
-
import { getDeviceModel } from "@ledgerhq/devices";
|
|
20
|
+
import { DeviceModelId, getDeviceModel } from "@ledgerhq/devices";
|
|
17
21
|
import { ConnectManagerTimeout } from "../../errors";
|
|
18
22
|
import { LocalTracer } from "@ledgerhq/logs";
|
|
19
23
|
import { LOG_TYPE } from "..";
|
|
@@ -73,6 +77,21 @@ export type EmittedEvent<T> = {
|
|
|
73
77
|
type: string;
|
|
74
78
|
} & T;
|
|
75
79
|
|
|
80
|
+
const remapError = (error: Error, deviceModelID: DeviceModelId): Error => {
|
|
81
|
+
if (!(error instanceof TimeoutError)) {
|
|
82
|
+
return error;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (deviceModelID === DeviceModelId.nanoS) {
|
|
86
|
+
return new LockedDeviceError();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return new ConnectManagerTimeout(undefined, {
|
|
90
|
+
// TODO make this configurable
|
|
91
|
+
productName: getDeviceModel(deviceModelID).productName,
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
76
95
|
/**
|
|
77
96
|
* Returns a polling implementation function that repeatedly performs a given task
|
|
78
97
|
* with a given request, with a specified polling frequency and wait times until a
|
|
@@ -112,8 +131,6 @@ const pollingImplementation: Implementation = <SpecificType, GenericRequestType>
|
|
|
112
131
|
// Runs every time we get a new device.
|
|
113
132
|
function actionLoop() {
|
|
114
133
|
if (currentDevice) {
|
|
115
|
-
const productName = getDeviceModel(currentDevice.modelId).productName;
|
|
116
|
-
|
|
117
134
|
connectSub = concat(
|
|
118
135
|
of({
|
|
119
136
|
type: "deviceChange",
|
|
@@ -144,13 +161,7 @@ const pollingImplementation: Implementation = <SpecificType, GenericRequestType>
|
|
|
144
161
|
}),
|
|
145
162
|
|
|
146
163
|
catchError((error: Error) => {
|
|
147
|
-
const maybeRemappedError =
|
|
148
|
-
error instanceof TimeoutError
|
|
149
|
-
? (new ConnectManagerTimeout(undefined, {
|
|
150
|
-
// TODO make this configurable
|
|
151
|
-
productName,
|
|
152
|
-
}) as Error)
|
|
153
|
-
: error;
|
|
164
|
+
const maybeRemappedError = remapError(error, currentDevice.modelId);
|
|
154
165
|
|
|
155
166
|
tracer.trace(`Error when running task in polling implementation: ${error}`, {
|
|
156
167
|
error,
|
|
@@ -12,11 +12,9 @@ import type {
|
|
|
12
12
|
import {
|
|
13
13
|
DeviceActionStatus,
|
|
14
14
|
DeviceDisconnectedWhileSendingError,
|
|
15
|
-
DeviceLockedError,
|
|
16
15
|
DeviceSessionStateType,
|
|
17
16
|
UserInteractionRequired,
|
|
18
17
|
OutOfMemoryDAError,
|
|
19
|
-
SecureChannelError,
|
|
20
18
|
UnsupportedFirmwareDAError,
|
|
21
19
|
} from "@ledgerhq/device-management-kit";
|
|
22
20
|
import type {
|
|
@@ -254,10 +252,10 @@ export class ConnectAppEventMapper {
|
|
|
254
252
|
deviceState.firmwareUpdateContext!.currentFirmware.version,
|
|
255
253
|
}),
|
|
256
254
|
);
|
|
257
|
-
} else if (error
|
|
255
|
+
} else if ("_tag" in error && error._tag === "DeviceLockedError") {
|
|
258
256
|
this.eventSubject.next({ type: "lockedDevice" });
|
|
259
257
|
this.eventSubject.complete();
|
|
260
|
-
} else if (error
|
|
258
|
+
} else if ("_tag" in error && error._tag === "RefusedByUserDAError") {
|
|
261
259
|
this.eventSubject.error(new UserRefusedAllowManager());
|
|
262
260
|
} else if (error instanceof DeviceDisconnectedWhileSendingError) {
|
|
263
261
|
this.eventSubject.next({ type: "disconnected", expected: false });
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
getSupportedCoinsList,
|
|
7
7
|
supportedCounterCurrencies,
|
|
8
8
|
} from "../api";
|
|
9
|
-
import { listCryptoCurrencies } from "@ledgerhq/cryptoassets/currencies";
|
|
10
|
-
import { listTokens } from "@ledgerhq/cryptoassets/tokens";
|
|
11
9
|
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
12
10
|
|
|
13
11
|
import { useMemo } from "react";
|
|
@@ -18,15 +16,13 @@ import { REFETCH_TIME_ONE_MINUTE, BASIC_REFETCH, ONE_DAY } from "../utils/timers
|
|
|
18
16
|
import {
|
|
19
17
|
MarketCurrencyRequestParams,
|
|
20
18
|
MarketListRequestParams,
|
|
21
|
-
|
|
19
|
+
MarketCurrencyData,
|
|
22
20
|
HashMapBody,
|
|
23
21
|
MarketItemResponse,
|
|
24
22
|
MarketListRequestResult,
|
|
25
23
|
Order,
|
|
26
24
|
} from "../utils/types";
|
|
27
25
|
|
|
28
|
-
const cryptoCurrenciesList = [...listCryptoCurrencies(), ...listTokens()];
|
|
29
|
-
|
|
30
26
|
export function useMarketDataProvider() {
|
|
31
27
|
const supportedCurrenciesInLIve = listSupportedCurrencies();
|
|
32
28
|
|
|
@@ -65,7 +61,7 @@ export const useCurrencyData = ({ id, counterCurrency }: MarketCurrencyRequestPa
|
|
|
65
61
|
queryFn: () => fetchCurrency({ id, counterCurrency }),
|
|
66
62
|
refetchInterval: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
|
67
63
|
staleTime: REFETCH_TIME_ONE_MINUTE * BASIC_REFETCH,
|
|
68
|
-
select: data => format(data
|
|
64
|
+
select: data => format(data),
|
|
69
65
|
});
|
|
70
66
|
|
|
71
67
|
export const useSupportedCounterCurrencies = () =>
|
|
@@ -104,7 +100,7 @@ export function useMarketData(props: MarketListRequestParams): MarketListRequest
|
|
|
104
100
|
],
|
|
105
101
|
queryFn: () => fetchList({ ...props, page, search }),
|
|
106
102
|
select: (data: MarketItemResponse[]) => ({
|
|
107
|
-
formattedData: currencyFormatter(data
|
|
103
|
+
formattedData: currencyFormatter(data),
|
|
108
104
|
page,
|
|
109
105
|
}),
|
|
110
106
|
refetchOnMount: false,
|
|
@@ -118,7 +114,7 @@ export function useMarketData(props: MarketListRequestParams): MarketListRequest
|
|
|
118
114
|
function combineMarketData(
|
|
119
115
|
results: UseQueryResult<
|
|
120
116
|
{
|
|
121
|
-
formattedData:
|
|
117
|
+
formattedData: MarketCurrencyData[];
|
|
122
118
|
page: number;
|
|
123
119
|
},
|
|
124
120
|
Error
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
1
|
import {
|
|
3
|
-
|
|
2
|
+
MarketCurrencyData,
|
|
4
3
|
KeysPriceChange,
|
|
5
4
|
MarketItemPerformer,
|
|
6
5
|
MarketItemResponse,
|
|
@@ -45,29 +44,16 @@ function sparklineAsSvgData(points: number[]): SparklineSvgData {
|
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
export function currencyFormatter(
|
|
49
|
-
data: MarketItemResponse
|
|
50
|
-
cryptoCurrenciesList: (CryptoCurrency | TokenCurrency)[],
|
|
51
|
-
): CurrencyData[] {
|
|
52
|
-
return data.map((currency: MarketItemResponse) => format(currency, cryptoCurrenciesList));
|
|
47
|
+
export function currencyFormatter(data: MarketItemResponse[]): MarketCurrencyData[] {
|
|
48
|
+
return data.map((currency: MarketItemResponse) => format(currency));
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
export const format = (
|
|
56
|
-
currency: MarketItemResponse,
|
|
57
|
-
cryptoCurrenciesList?: (CryptoCurrency | TokenCurrency)[],
|
|
58
|
-
): CurrencyData => {
|
|
59
|
-
const ledgerIdsSet = new Set(currency.ledgerIds.map(id => id.toLowerCase()));
|
|
60
|
-
|
|
61
|
-
const internalCurrency = cryptoCurrenciesList?.find(({ id }) =>
|
|
62
|
-
ledgerIdsSet.has(id.toLowerCase()),
|
|
63
|
-
);
|
|
64
|
-
|
|
51
|
+
export const format = (currency: MarketItemResponse): MarketCurrencyData => {
|
|
65
52
|
return {
|
|
66
53
|
id: currency.id,
|
|
67
54
|
ledgerIds: currency.ledgerIds,
|
|
68
55
|
name: currency.name,
|
|
69
56
|
image: currency.image,
|
|
70
|
-
internalCurrency,
|
|
71
57
|
marketcap: currency.marketCap,
|
|
72
58
|
marketcapRank: currency.marketCapRank,
|
|
73
59
|
totalVolume: currency.totalVolume,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
1
|
import { RefetchOptions, QueryObserverResult } from "@tanstack/react-query";
|
|
3
2
|
import { PortfolioRange } from "@ledgerhq/types-live";
|
|
4
3
|
|
|
@@ -33,7 +32,7 @@ export type MarketListRequestParams = {
|
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
export type MarketListRequestResult = {
|
|
36
|
-
data:
|
|
35
|
+
data: MarketCurrencyData[];
|
|
37
36
|
isPending: boolean;
|
|
38
37
|
isLoading: boolean;
|
|
39
38
|
isError: boolean;
|
|
@@ -45,7 +44,7 @@ export type HashMapBody = {
|
|
|
45
44
|
refetch: (options?: RefetchOptions | undefined) => Promise<
|
|
46
45
|
QueryObserverResult<
|
|
47
46
|
{
|
|
48
|
-
formattedData:
|
|
47
|
+
formattedData: MarketCurrencyData[];
|
|
49
48
|
page: number;
|
|
50
49
|
},
|
|
51
50
|
Error
|
|
@@ -80,12 +79,11 @@ export enum KeysPriceChange {
|
|
|
80
79
|
year = "1y",
|
|
81
80
|
}
|
|
82
81
|
|
|
83
|
-
export type
|
|
82
|
+
export type MarketCurrencyData = {
|
|
84
83
|
id: string;
|
|
85
84
|
ledgerIds: string[];
|
|
86
85
|
name: string;
|
|
87
86
|
image?: string;
|
|
88
|
-
internalCurrency?: CryptoOrTokenCurrency;
|
|
89
87
|
marketcap?: number;
|
|
90
88
|
marketcapRank: number;
|
|
91
89
|
totalVolume: number;
|
|
@@ -113,13 +111,13 @@ export type SingleCoinState = {
|
|
|
113
111
|
loadingChart: boolean;
|
|
114
112
|
error?: Error;
|
|
115
113
|
supportedCounterCurrencies: string[];
|
|
116
|
-
selectedCoinData?:
|
|
114
|
+
selectedCoinData?: MarketCurrencyData;
|
|
117
115
|
counterCurrency?: string;
|
|
118
116
|
};
|
|
119
117
|
|
|
120
118
|
export type State = SingleCoinState & {
|
|
121
119
|
ready: boolean;
|
|
122
|
-
marketData?:
|
|
120
|
+
marketData?: MarketCurrencyData[];
|
|
123
121
|
requestParams: MarketListRequestParams;
|
|
124
122
|
page: number;
|
|
125
123
|
endOfList: boolean;
|
|
@@ -187,7 +185,7 @@ export type MarketItemPerformer = {
|
|
|
187
185
|
|
|
188
186
|
export type MarketDataApi = {
|
|
189
187
|
setSupportedCoinsList: () => Promise<SupportedCoins>;
|
|
190
|
-
listPaginated: (params: MarketListRequestParams) => Promise<
|
|
188
|
+
listPaginated: (params: MarketListRequestParams) => Promise<MarketCurrencyData[]>;
|
|
191
189
|
supportedCounterCurrencies: () => Promise<string[]>;
|
|
192
190
|
currencyChartData: (
|
|
193
191
|
params: MarketCurrencyChartDataRequestParams,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import type { CoinType, CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
3
3
|
import type { TokenAccount, Account } from "@ledgerhq/types-live";
|
|
4
|
-
import { cryptocurrenciesById
|
|
4
|
+
import { cryptocurrenciesById } from "@ledgerhq/cryptoassets";
|
|
5
5
|
import { CryptoCurrencyId } from "@ledgerhq/types-cryptoassets";
|
|
6
6
|
|
|
7
7
|
export function createFixtureCryptoCurrency(family: string): CryptoCurrency {
|
|
@@ -38,7 +38,16 @@ export function createFixtureCryptoCurrency(family: string): CryptoCurrency {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const defaultEthCryptoFamily = cryptocurrenciesById["ethereum"];
|
|
41
|
-
const defaultERC20USDTToken =
|
|
41
|
+
const defaultERC20USDTToken: TokenCurrency = {
|
|
42
|
+
type: "TokenCurrency",
|
|
43
|
+
id: "ethereum/erc20/usd_tether__erc20_",
|
|
44
|
+
name: "Tether USD (ERC-20)",
|
|
45
|
+
ticker: "USDT",
|
|
46
|
+
units: [{ name: "Tether USD", code: "USDT", magnitude: 6 }],
|
|
47
|
+
contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
48
|
+
parentCurrency: defaultEthCryptoFamily,
|
|
49
|
+
tokenType: "erc20",
|
|
50
|
+
};
|
|
42
51
|
|
|
43
52
|
export function createFixtureTokenAccount(
|
|
44
53
|
id = "00",
|
|
@@ -83,7 +83,7 @@ export const maticBsc: TokenCurrency = {
|
|
|
83
83
|
};
|
|
84
84
|
export const findCryptoCurrencyById = (id: string) =>
|
|
85
85
|
[mockBtcCryptoCurrency, mockEthCryptoCurrency, mockArbitrumCryptoCurrency].find(a => a.id === id);
|
|
86
|
-
export const getTokenOrCryptoCurrencyById = (id: string) =>
|
|
86
|
+
export const getTokenOrCryptoCurrencyById = async (id: string) =>
|
|
87
87
|
[
|
|
88
88
|
mockBtcCryptoCurrency,
|
|
89
89
|
mockEthCryptoCurrency,
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
} from "../../__mocks__/currencies.mock";
|
|
18
18
|
|
|
19
19
|
describe("safeCurrencyLookup", () => {
|
|
20
|
-
it("should return the currency if it is found", () => {
|
|
21
|
-
const currency = safeCurrencyLookup("ethereum");
|
|
20
|
+
it("should return the currency if it is found", async () => {
|
|
21
|
+
const currency = await safeCurrencyLookup("ethereum");
|
|
22
22
|
expect(currency).toBeDefined();
|
|
23
23
|
});
|
|
24
|
-
it("should return null if the currency is not found", () => {
|
|
25
|
-
const currency = safeCurrencyLookup("not-a-currency");
|
|
24
|
+
it("should return null if the currency is not found", async () => {
|
|
25
|
+
const currency = await safeCurrencyLookup("not-a-currency");
|
|
26
26
|
expect(currency).toBeNull();
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -55,14 +55,14 @@ describe("isProviderToken", () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
describe("getProviderCurrency", () => {
|
|
58
|
-
it("should return the currency if it is a provider currency", () => {
|
|
58
|
+
it("should return the currency if it is a provider currency", async () => {
|
|
59
59
|
const { result } = useGroupedCurrenciesByProvider();
|
|
60
|
-
const currency = getProviderCurrency(result.currenciesByProvider[0]);
|
|
60
|
+
const currency = await getProviderCurrency(result.currenciesByProvider[0]);
|
|
61
61
|
expect(currency).toEqual(mockBtcCryptoCurrency);
|
|
62
62
|
});
|
|
63
|
-
it("should return the currency if it is a provider token", () => {
|
|
63
|
+
it("should return the currency if it is a provider token", async () => {
|
|
64
64
|
const { result } = useGroupedCurrenciesByProvider();
|
|
65
|
-
const currency = getProviderCurrency(result.currenciesByProvider[3]);
|
|
65
|
+
const currency = await getProviderCurrency(result.currenciesByProvider[3]);
|
|
66
66
|
expect(currency).toEqual(usdcToken);
|
|
67
67
|
});
|
|
68
68
|
});
|
|
@@ -115,9 +115,9 @@ describe("filterProvidersByIds", () => {
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
describe("extractProviderCurrencies", () => {
|
|
118
|
-
it("should extract provider currencies correctly", () => {
|
|
118
|
+
it("should extract provider currencies correctly", async () => {
|
|
119
119
|
const { result } = useGroupedCurrenciesByProvider();
|
|
120
|
-
const providerCurrencies = extractProviderCurrencies(result.currenciesByProvider);
|
|
120
|
+
const providerCurrencies = await extractProviderCurrencies(result.currenciesByProvider);
|
|
121
121
|
expect(providerCurrencies).toHaveLength(5);
|
|
122
122
|
expect(providerCurrencies[0]).toEqual(mockBtcCryptoCurrency);
|
|
123
123
|
expect(providerCurrencies[1].id).toBe("ethereum");
|
|
@@ -4,9 +4,10 @@ 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 = async (id: string): Promise<CryptoOrTokenCurrency | null> => {
|
|
8
9
|
try {
|
|
9
|
-
return getTokenOrCryptoCurrencyById(id);
|
|
10
|
+
return await getTokenOrCryptoCurrencyById(id);
|
|
10
11
|
} catch {
|
|
11
12
|
return null;
|
|
12
13
|
}
|
|
@@ -16,9 +17,9 @@ export const isProviderToken = (currency: CryptoOrTokenCurrency, providerId: str
|
|
|
16
17
|
return isTokenCurrency(currency) && currency.id.toLowerCase().includes(providerId.toLowerCase());
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
export const getProviderCurrency = (
|
|
20
|
+
export const getProviderCurrency = async (
|
|
20
21
|
provider: CurrenciesByProviderId,
|
|
21
|
-
): CryptoOrTokenCurrency | null => {
|
|
22
|
+
): Promise<CryptoOrTokenCurrency | null> => {
|
|
22
23
|
const providerToken = provider.currenciesByNetwork.find(currency => {
|
|
23
24
|
return isProviderToken(currency, provider.providerId);
|
|
24
25
|
});
|
|
@@ -27,7 +28,8 @@ export const getProviderCurrency = (
|
|
|
27
28
|
return providerToken;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
const lookupResult = await safeCurrencyLookup(provider.providerId);
|
|
32
|
+
return lookupResult ?? provider.currenciesByNetwork[0];
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export const buildProviderCoverageMap = (
|
|
@@ -85,10 +87,9 @@ export const filterProvidersByIds = (
|
|
|
85
87
|
return filtered;
|
|
86
88
|
};
|
|
87
89
|
|
|
88
|
-
export const extractProviderCurrencies = (
|
|
90
|
+
export const extractProviderCurrencies = async (
|
|
89
91
|
providers: CurrenciesByProviderId[],
|
|
90
|
-
): CryptoOrTokenCurrency[] => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
.filter((currency): currency is CryptoOrTokenCurrency => currency !== null);
|
|
92
|
+
): Promise<CryptoOrTokenCurrency[]> => {
|
|
93
|
+
const currencies = await Promise.all(providers.map(provider => getProviderCurrency(provider)));
|
|
94
|
+
return currencies.filter((currency): currency is CryptoOrTokenCurrency => currency !== null);
|
|
94
95
|
};
|
|
@@ -22,7 +22,7 @@ const SIGNED_TRANSACTION: SignedOperation = {
|
|
|
22
22
|
date: new Date("2021-08-24T12:33:40.584Z"),
|
|
23
23
|
value: new BigNumber("1"),
|
|
24
24
|
fee: new BigNumber("2091600000000000"),
|
|
25
|
-
transactionSequenceNumber: 15,
|
|
25
|
+
transactionSequenceNumber: BigNumber(15),
|
|
26
26
|
},
|
|
27
27
|
signature:
|
|
28
28
|
"0xf8640f850f75bf9800827b0c943f87926741ecaXXXXXXXXXXXXXXXXXXXXXXXXXXX018025a058693cad6ee2299f034ffa04287faba5e777b30659e5bb29bcefdb8284285c97a022169e3ec2a894a35c6edf4223ca6cb3c24453cea78d474d29d1252a236e132b",
|
|
@@ -42,7 +42,7 @@ const RAW_SIGNED_TRANSACTION: SignedOperationRaw = {
|
|
|
42
42
|
date: "2021-08-24T12:33:40.584Z",
|
|
43
43
|
value: "1",
|
|
44
44
|
fee: "2091600000000000",
|
|
45
|
-
transactionSequenceNumber: 15,
|
|
45
|
+
transactionSequenceNumber: "15",
|
|
46
46
|
},
|
|
47
47
|
signature:
|
|
48
48
|
"0xf8640f850f75bf9800827b0c943f87926741ecaXXXXXXXXXXXXXXXXXXXXXXXXXXX018025a058693cad6ee2299f034ffa04287faba5e777b30659e5bb29bcefdb8284285c97a022169e3ec2a894a35c6edf4223ca6cb3c24453cea78d474d29d1252a236e132b",
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
import { useFeatureFlags } from "../../featureFlags";
|
|
5
5
|
import { hubStateSelector } from "../reducer";
|
|
6
6
|
import { usePostOnboardingContext } from "./usePostOnboardingContext";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getPostOnboardingAction,
|
|
9
|
+
mockedFeatureIdToTest,
|
|
10
|
+
mockedFeatureParamIdToTest,
|
|
11
|
+
} from "../mock";
|
|
8
12
|
import { renderHook } from "@testing-library/react";
|
|
9
13
|
import { DeviceModelId } from "@ledgerhq/types-devices";
|
|
10
14
|
import { PostOnboardingActionId } from "@ledgerhq/types-live";
|
|
@@ -19,10 +23,16 @@ jest.mock("../reducer");
|
|
|
19
23
|
|
|
20
24
|
const mockedUseFeatureFlags = jest.mocked(useFeatureFlags);
|
|
21
25
|
|
|
22
|
-
const mockedGetFeatureWithMockFeatureEnabled = enabled => ({
|
|
26
|
+
const mockedGetFeatureWithMockFeatureEnabled = (enabled, paramEnabled = true) => ({
|
|
23
27
|
isFeature: () => true,
|
|
24
28
|
getFeature: id => {
|
|
25
|
-
if (id === mockedFeatureIdToTest)
|
|
29
|
+
if (id === mockedFeatureIdToTest)
|
|
30
|
+
return {
|
|
31
|
+
enabled,
|
|
32
|
+
params: {
|
|
33
|
+
[mockedFeatureParamIdToTest]: paramEnabled,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
26
36
|
return { enabled: true };
|
|
27
37
|
},
|
|
28
38
|
overrideFeature: () => {},
|
|
@@ -134,6 +144,23 @@ describe("usePostOnboardingHubState", () => {
|
|
|
134
144
|
expect(lastActionCompleted).toBe(null);
|
|
135
145
|
});
|
|
136
146
|
|
|
147
|
+
it("should not return actions that have a disabled feature param flag ", () => {
|
|
148
|
+
const state = stateAllCompleted;
|
|
149
|
+
mockedHubStateSelector.mockReturnValue(state);
|
|
150
|
+
mockedUseFeatureFlags.mockReturnValue(mockedGetFeatureWithMockFeatureEnabled(true, false));
|
|
151
|
+
|
|
152
|
+
const {
|
|
153
|
+
result: {
|
|
154
|
+
current: { actionsState, lastActionCompleted },
|
|
155
|
+
},
|
|
156
|
+
} = renderHook(() => usePostOnboardingHubState());
|
|
157
|
+
|
|
158
|
+
expect(actionsState.find(action => action.featureFlagId === mockedFeatureIdToTest)).toBe(
|
|
159
|
+
undefined,
|
|
160
|
+
);
|
|
161
|
+
expect(lastActionCompleted).toBe(null);
|
|
162
|
+
});
|
|
163
|
+
|
|
137
164
|
it("should return actions that have a feature flag enabled", () => {
|
|
138
165
|
const state = stateAllCompleted;
|
|
139
166
|
mockedHubStateSelector.mockReturnValue(state);
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { useSelector } from "react-redux";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import { PostOnboardingHubState } from "@ledgerhq/types-live";
|
|
4
|
-
import { useFeatureFlags } from "../../featureFlags";
|
|
3
|
+
import { PostOnboardingAction, PostOnboardingHubState } from "@ledgerhq/types-live";
|
|
4
|
+
import { FeatureFlagsContextValue, useFeatureFlags } from "../../featureFlags";
|
|
5
5
|
import { hubStateSelector } from "../reducer";
|
|
6
6
|
import { usePostOnboardingContext } from "./usePostOnboardingContext";
|
|
7
7
|
|
|
8
|
+
const getIsFeatureEnabled = (
|
|
9
|
+
action: PostOnboardingAction | undefined,
|
|
10
|
+
getFeature: FeatureFlagsContextValue["getFeature"],
|
|
11
|
+
) => {
|
|
12
|
+
if (!action) return false;
|
|
13
|
+
if (!action.featureFlagId) return true;
|
|
14
|
+
|
|
15
|
+
const flag = getFeature(action.featureFlagId);
|
|
16
|
+
if (!flag?.enabled) return false;
|
|
17
|
+
|
|
18
|
+
return !action.featureFlagParamId || !!flag.params?.[action.featureFlagParamId];
|
|
19
|
+
};
|
|
20
|
+
|
|
8
21
|
/**
|
|
9
22
|
* @returns an object representing the state that should be rendered on the post
|
|
10
23
|
* onboarding hub screen.
|
|
@@ -26,9 +39,12 @@ export function usePostOnboardingHubState(): PostOnboardingHubState {
|
|
|
26
39
|
actionsState: [],
|
|
27
40
|
postOnboardingInProgress: hubState.postOnboardingInProgress,
|
|
28
41
|
};
|
|
42
|
+
|
|
29
43
|
const actionsState = hubState.actionsToComplete.flatMap(actionId => {
|
|
30
44
|
const action = getPostOnboardingAction(actionId);
|
|
31
|
-
|
|
45
|
+
const isFeatureEnabled = getIsFeatureEnabled(action, getFeature);
|
|
46
|
+
|
|
47
|
+
if (!action || !isFeatureEnabled) {
|
|
32
48
|
return [];
|
|
33
49
|
}
|
|
34
50
|
return [{ ...action, completed: !!hubState.actionsCompleted[actionId] }];
|
|
@@ -38,9 +54,7 @@ export function usePostOnboardingHubState(): PostOnboardingHubState {
|
|
|
38
54
|
: null;
|
|
39
55
|
|
|
40
56
|
const isLastActionCompletedEnabled =
|
|
41
|
-
lastActionCompleted &&
|
|
42
|
-
(!lastActionCompleted.featureFlagId ||
|
|
43
|
-
getFeature(lastActionCompleted.featureFlagId)?.enabled);
|
|
57
|
+
lastActionCompleted && getIsFeatureEnabled(lastActionCompleted, getFeature);
|
|
44
58
|
|
|
45
59
|
return {
|
|
46
60
|
deviceModelId: hubState.deviceModelId,
|
|
@@ -5,6 +5,7 @@ import { FeatureId, PostOnboardingAction, PostOnboardingActionId } from "@ledger
|
|
|
5
5
|
const MockIcon = () => null;
|
|
6
6
|
|
|
7
7
|
export const mockedFeatureIdToTest: FeatureId = "mockFeature";
|
|
8
|
+
export const mockedFeatureParamIdToTest: string = "mockFeatureParam";
|
|
8
9
|
|
|
9
10
|
export const claimTestMock: PostOnboardingAction = {
|
|
10
11
|
id: PostOnboardingActionId.claimMock,
|
|
@@ -21,6 +22,7 @@ export const personalizeTestMock: PostOnboardingAction = {
|
|
|
21
22
|
id: PostOnboardingActionId.personalizeMock,
|
|
22
23
|
Icon: MockIcon,
|
|
23
24
|
featureFlagId: mockedFeatureIdToTest,
|
|
25
|
+
featureFlagParamId: mockedFeatureParamIdToTest,
|
|
24
26
|
title: `Personalize my device`,
|
|
25
27
|
titleCompleted: `Personalize my device`,
|
|
26
28
|
description: "By customizing the screen.",
|
package/src/transaction/index.ts
CHANGED
|
@@ -36,10 +36,10 @@ export const toTransactionStatusRaw = (
|
|
|
36
36
|
return TM.toTransactionStatusRaw(t as any);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export const formatTransaction = (t: Transaction, a: Account): string => {
|
|
39
|
+
export const formatTransaction = async (t: Transaction, a: Account): Promise<string> => {
|
|
40
40
|
const TM = transactionModulePerFamily[t.family];
|
|
41
41
|
// FIXME: something is wrong with TM.formatTransaction expecting a (arg: never) => for some reasons
|
|
42
|
-
return TM.formatTransaction ? TM.formatTransaction(t as any, a as any) : "";
|
|
42
|
+
return TM.formatTransaction ? await TM.formatTransaction(t as any, a as any) : "";
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export const formatTransactionStatus = (
|