@ledgerhq/live-common 34.52.0 → 34.53.0-nightly.20251108023448
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/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/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 +51 -47
- 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/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/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
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { addressSplit } from "../addressUtils";
|
|
2
|
+
|
|
3
|
+
describe("addressSplit", () => {
|
|
4
|
+
describe("Basic functionality", () => {
|
|
5
|
+
it("should split a simple address correctly", () => {
|
|
6
|
+
const result = addressSplit("HelloWorld", 2);
|
|
7
|
+
expect(result).toEqual({
|
|
8
|
+
start: "He",
|
|
9
|
+
middle: "lloWor",
|
|
10
|
+
end: "ld",
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should split a longer address with size 4", () => {
|
|
15
|
+
const result = addressSplit("0x1234567890abcdef", 4);
|
|
16
|
+
expect(result).toEqual({
|
|
17
|
+
start: "0x12",
|
|
18
|
+
middle: "34567890ab",
|
|
19
|
+
end: "cdef",
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("Boundary conditions", () => {
|
|
25
|
+
it("should handle exact boundary where size * 2 equals address length", () => {
|
|
26
|
+
const result = addressSplit("ABCDEF", 3);
|
|
27
|
+
expect(result).toEqual({
|
|
28
|
+
start: "ABC",
|
|
29
|
+
middle: "",
|
|
30
|
+
end: "DEF",
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should handle size equal to half address length", () => {
|
|
35
|
+
const result = addressSplit("ABCDEFGH", 4);
|
|
36
|
+
expect(result).toEqual({
|
|
37
|
+
start: "ABCD",
|
|
38
|
+
middle: "",
|
|
39
|
+
end: "EFGH",
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("should handle odd-length address with equal split", () => {
|
|
44
|
+
const result = addressSplit("ABCDE", 2);
|
|
45
|
+
expect(result).toEqual({
|
|
46
|
+
start: "AB",
|
|
47
|
+
middle: "C",
|
|
48
|
+
end: "DE",
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("should handle very long address", () => {
|
|
53
|
+
const longAddress = "A".repeat(1000);
|
|
54
|
+
const result = addressSplit(longAddress, 10);
|
|
55
|
+
expect(result).toEqual({
|
|
56
|
+
start: "A".repeat(10),
|
|
57
|
+
middle: "A".repeat(980),
|
|
58
|
+
end: "A".repeat(10),
|
|
59
|
+
});
|
|
60
|
+
expect(result.start.length + result.middle.length + result.end.length).toBe(1000);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe("Edge cases - size variations", () => {
|
|
65
|
+
it("should handle size of 0", () => {
|
|
66
|
+
const result = addressSplit("HelloWorld", 0);
|
|
67
|
+
expect(result).toEqual({
|
|
68
|
+
start: "",
|
|
69
|
+
middle: "HelloWorld",
|
|
70
|
+
end: "",
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("should handle size of 1", () => {
|
|
75
|
+
const result = addressSplit("HelloWorld", 1);
|
|
76
|
+
expect(result).toEqual({
|
|
77
|
+
start: "H",
|
|
78
|
+
middle: "elloWorl",
|
|
79
|
+
end: "d",
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("should handle negative size", () => {
|
|
84
|
+
const result = addressSplit("HelloWorld", -5);
|
|
85
|
+
expect(result).toEqual({
|
|
86
|
+
start: "",
|
|
87
|
+
middle: "HelloWorld",
|
|
88
|
+
end: "",
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("should handle size larger than half the address length", () => {
|
|
93
|
+
const result = addressSplit("Hello", 3);
|
|
94
|
+
expect(result).toEqual({
|
|
95
|
+
start: "He",
|
|
96
|
+
middle: "",
|
|
97
|
+
end: "llo",
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("should handle size equal to address length", () => {
|
|
102
|
+
const result = addressSplit("Hello", 5);
|
|
103
|
+
expect(result).toEqual({
|
|
104
|
+
start: "He",
|
|
105
|
+
middle: "",
|
|
106
|
+
end: "llo",
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("should handle size larger than address length", () => {
|
|
111
|
+
const result = addressSplit("Hello", 10);
|
|
112
|
+
expect(result).toEqual({
|
|
113
|
+
start: "He",
|
|
114
|
+
middle: "",
|
|
115
|
+
end: "llo",
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe("Edge cases - address variations", () => {
|
|
121
|
+
it("should handle empty string", () => {
|
|
122
|
+
const result = addressSplit("", 2);
|
|
123
|
+
expect(result).toEqual({
|
|
124
|
+
start: "",
|
|
125
|
+
middle: "",
|
|
126
|
+
end: "",
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("should handle single character address", () => {
|
|
131
|
+
const result = addressSplit("A", 1);
|
|
132
|
+
expect(result).toEqual({
|
|
133
|
+
start: "",
|
|
134
|
+
middle: "",
|
|
135
|
+
end: "A",
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it("should handle two character address", () => {
|
|
140
|
+
const result = addressSplit("AB", 1);
|
|
141
|
+
expect(result).toEqual({
|
|
142
|
+
start: "A",
|
|
143
|
+
middle: "",
|
|
144
|
+
end: "B",
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("should handle three character address with size 1", () => {
|
|
149
|
+
const result = addressSplit("ABC", 1);
|
|
150
|
+
expect(result).toEqual({
|
|
151
|
+
start: "A",
|
|
152
|
+
middle: "B",
|
|
153
|
+
end: "C",
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe("Real-world cryptocurrency addresses", () => {
|
|
159
|
+
it("should split a Bitcoin address correctly", () => {
|
|
160
|
+
const bitcoinAddress = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa";
|
|
161
|
+
const result = addressSplit(bitcoinAddress, 5);
|
|
162
|
+
expect(result).toEqual({
|
|
163
|
+
start: "1A1zP",
|
|
164
|
+
middle: "1eP5QGefi2DMPTfTL5SLmv7D",
|
|
165
|
+
end: "ivfNa",
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it("should split an Ethereum address correctly", () => {
|
|
170
|
+
const ethAddress = "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb";
|
|
171
|
+
const result = addressSplit(ethAddress, 6);
|
|
172
|
+
expect(result).toEqual({
|
|
173
|
+
start: "0x742d",
|
|
174
|
+
middle: "35Cc6634C0532925a3b844Bc9e759",
|
|
175
|
+
end: "5f0bEb",
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("should handle a Solana address", () => {
|
|
180
|
+
const solanaAddress = "7EqQdEULxWcraVx3mXKFjc84LhCkMGZCkRuDpvcMwJeK";
|
|
181
|
+
const result = addressSplit(solanaAddress, 4);
|
|
182
|
+
expect(result).toEqual({
|
|
183
|
+
start: "7EqQ",
|
|
184
|
+
middle: "dEULxWcraVx3mXKFjc84LhCkMGZCkRuDpvcM",
|
|
185
|
+
end: "wJeK",
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it("should handle a Polkadot address", () => {
|
|
190
|
+
const polkadotAddress = "15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5";
|
|
191
|
+
const result = addressSplit(polkadotAddress, 6);
|
|
192
|
+
expect(result).toEqual({
|
|
193
|
+
start: "15oF4u",
|
|
194
|
+
middle: "VJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMN",
|
|
195
|
+
end: "Hr6Sp5",
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it("should handle a Cardano address", () => {
|
|
200
|
+
const cardanoAddress =
|
|
201
|
+
"addr1qxy3w7depgr3wle7kqwzz8u4h5f6gxqe9q0rk8w3n0d7wqxqk0n7n8s3w3w3w3w3w3w3w3w3w3w3w3w3w3w";
|
|
202
|
+
const result = addressSplit(cardanoAddress, 8);
|
|
203
|
+
expect(result).toEqual({
|
|
204
|
+
start: "addr1qxy",
|
|
205
|
+
middle: "3w7depgr3wle7kqwzz8u4h5f6gxqe9q0rk8w3n0d7wqxqk0n7n8s3w3w3w3w3w3w3w3w3w3w",
|
|
206
|
+
end: "3w3w3w3w",
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("should handle a Near protocol address", () => {
|
|
211
|
+
const nearAddress = "alice.near";
|
|
212
|
+
const result = addressSplit(nearAddress, 3);
|
|
213
|
+
expect(result).toEqual({
|
|
214
|
+
start: "ali",
|
|
215
|
+
middle: "ce.n",
|
|
216
|
+
end: "ear",
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
describe("Data integrity", () => {
|
|
222
|
+
it("should preserve the entire address when concatenated", () => {
|
|
223
|
+
const address = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa";
|
|
224
|
+
const result = addressSplit(address, 5);
|
|
225
|
+
const reconstructed = result.start + result.middle + result.end;
|
|
226
|
+
expect(reconstructed).toBe(address);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { getCryptoCurrencyById
|
|
1
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
|
|
2
2
|
import { genAccount } from "../../mock/account";
|
|
3
3
|
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
4
|
import type { Account, TokenAccount } from "@ledgerhq/types-live";
|
|
5
5
|
import { getAccountTuplesForCurrency } from "../getAccountTuplesForCurrency";
|
|
6
|
+
import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
|
|
7
|
+
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
8
|
+
|
|
9
|
+
initializeLegacyTokens(addTokens);
|
|
6
10
|
|
|
7
11
|
function* accountGenerator(currency: CryptoCurrency): Generator<Account> {
|
|
8
12
|
let id = 0;
|
|
@@ -66,9 +70,16 @@ describe("getAccountTuplesForCurrency", () => {
|
|
|
66
70
|
});
|
|
67
71
|
|
|
68
72
|
describe("TokenCurrency", () => {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
const aaveToken = {
|
|
74
|
+
type: "TokenCurrency" as const,
|
|
75
|
+
id: "ethereum/erc20/aave",
|
|
76
|
+
name: "Aave Token",
|
|
77
|
+
ticker: "AAVE",
|
|
78
|
+
units: [{ name: "Aave Token", code: "AAVE", magnitude: 18 }],
|
|
79
|
+
contractAddress: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
|
|
80
|
+
parentCurrency: getCryptoCurrencyById("ethereum"),
|
|
81
|
+
tokenType: "erc20" as const,
|
|
82
|
+
};
|
|
72
83
|
|
|
73
84
|
test("returns correct parent accounts including a new subAccount when a TokenCurrency is provided", () => {
|
|
74
85
|
const ethAccounts = [
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split an address into start, middle, and end sections
|
|
3
|
+
*
|
|
4
|
+
* @param address - The address string to split
|
|
5
|
+
* @param size - The number of characters to include in the start and end sections
|
|
6
|
+
* @returns An object containing the start, middle, and end portions of the address
|
|
7
|
+
* @example
|
|
8
|
+
* addressSplit("HelloWorld", 2) // => { start: "He", middle: "lloWor", end: "ld" }
|
|
9
|
+
*/
|
|
10
|
+
export function addressSplit(
|
|
11
|
+
address: string,
|
|
12
|
+
size: number,
|
|
13
|
+
): { start: string; middle: string; end: string } {
|
|
14
|
+
if (!address) {
|
|
15
|
+
return { start: "", middle: "", end: "" };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (size < 0) {
|
|
19
|
+
return { start: "", middle: address, end: "" };
|
|
20
|
+
} else if (size === 0) {
|
|
21
|
+
return { start: "", middle: address, end: "" };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Handle edge case of address length smaller than or equal to size * 2
|
|
25
|
+
// In this case, we can't extract both start and end without overlapping
|
|
26
|
+
if (address.length <= size * 2) {
|
|
27
|
+
const halfLength = Math.floor(address.length / 2);
|
|
28
|
+
return {
|
|
29
|
+
start: address.slice(0, halfLength),
|
|
30
|
+
middle: "",
|
|
31
|
+
end: address.slice(halfLength),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const start = address.slice(0, size);
|
|
36
|
+
const end = address.slice(-size);
|
|
37
|
+
const middle = address.slice(size, -size);
|
|
38
|
+
|
|
39
|
+
return { start, middle, end };
|
|
40
|
+
}
|
|
@@ -11,11 +11,13 @@ jest.mock("@ledgerhq/wallet-api-server", () => ({
|
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
13
|
jest.mock("@ledgerhq/cryptoassets", () => ({
|
|
14
|
-
findTokenById: jest.fn(),
|
|
15
|
-
findTokenByAddressInCurrency: jest.fn(),
|
|
16
14
|
getCryptoCurrencyById: jest.fn(),
|
|
17
15
|
}));
|
|
18
16
|
|
|
17
|
+
jest.mock("../../bridge/crypto-assets/index", () => ({
|
|
18
|
+
getCryptoAssetsStore: jest.fn(),
|
|
19
|
+
}));
|
|
20
|
+
|
|
19
21
|
jest.mock("../converters", () => ({
|
|
20
22
|
getAccountIdFromWalletAccountId: jest.fn(),
|
|
21
23
|
getWalletAPITransactionSignFlowInfos: jest.fn(),
|
|
@@ -148,8 +150,15 @@ describe("ACRE Server Handlers", () => {
|
|
|
148
150
|
let mockUiHooks: any;
|
|
149
151
|
let serverHandlers: any;
|
|
150
152
|
|
|
153
|
+
const { getCryptoAssetsStore } = jest.requireMock("../../bridge/crypto-assets/index");
|
|
154
|
+
|
|
151
155
|
beforeEach(() => {
|
|
152
156
|
jest.clearAllMocks();
|
|
157
|
+
|
|
158
|
+
getCryptoAssetsStore.mockReturnValue({
|
|
159
|
+
findTokenByAddressInCurrency: jest.fn().mockResolvedValue(mockTokenCurrency),
|
|
160
|
+
findTokenById: jest.fn().mockResolvedValue(mockTokenCurrency),
|
|
161
|
+
});
|
|
153
162
|
mockUiHooks = {
|
|
154
163
|
"custom.acre.messageSign": jest.fn().mockImplementation(({ onSuccess }) => {
|
|
155
164
|
onSuccess("0x1234567890abcdef");
|
|
@@ -166,12 +175,6 @@ describe("ACRE Server Handlers", () => {
|
|
|
166
175
|
}),
|
|
167
176
|
};
|
|
168
177
|
|
|
169
|
-
// Mock the cryptoassets functions globally
|
|
170
|
-
const { findTokenByAddressInCurrency, getCryptoCurrencyById } =
|
|
171
|
-
jest.requireMock("@ledgerhq/cryptoassets");
|
|
172
|
-
findTokenByAddressInCurrency.mockReturnValue(mockTokenCurrency);
|
|
173
|
-
getCryptoCurrencyById.mockReturnValue(mockEthereumCurrency);
|
|
174
|
-
|
|
175
178
|
// Mock the account functions
|
|
176
179
|
const { makeEmptyTokenAccount, getMainAccount, getParentAccount } = jest.requireMock(
|
|
177
180
|
"@ledgerhq/coin-framework/account/index",
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
isTokenAccount,
|
|
9
9
|
} from "@ledgerhq/coin-framework/account/index";
|
|
10
10
|
import { Account, AccountLike, AnyMessage, Operation, SignedOperation } from "@ledgerhq/types-live";
|
|
11
|
-
import {
|
|
11
|
+
import { getCryptoAssetsStore } from "../../bridge/crypto-assets/index";
|
|
12
12
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
13
13
|
import {
|
|
14
14
|
MessageSignParams,
|
|
@@ -115,16 +115,19 @@ function validateInputs(params: RegisterYieldBearingEthereumAddressParams): {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// Helper function to find acreToken by address or token id
|
|
118
|
-
function findAcreToken(
|
|
118
|
+
async function findAcreToken(
|
|
119
119
|
tokenContractAddress?: string,
|
|
120
120
|
tokenTicker?: string,
|
|
121
|
-
): { token: TokenCurrency; contractAddress: string } {
|
|
121
|
+
): Promise<{ token: TokenCurrency; contractAddress: string }> {
|
|
122
122
|
let foundToken: TokenCurrency | undefined;
|
|
123
123
|
// Try to find token by contract address first (if provided)
|
|
124
124
|
if (tokenContractAddress) {
|
|
125
|
-
foundToken = findTokenByAddressInCurrency(
|
|
125
|
+
foundToken = await getCryptoAssetsStore().findTokenByAddressInCurrency(
|
|
126
|
+
tokenContractAddress,
|
|
127
|
+
"ethereum",
|
|
128
|
+
);
|
|
126
129
|
} else if (tokenTicker) {
|
|
127
|
-
foundToken = findTokenById(tokenTicker.toLowerCase());
|
|
130
|
+
foundToken = await getCryptoAssetsStore().findTokenById(tokenTicker.toLowerCase());
|
|
128
131
|
}
|
|
129
132
|
if (!foundToken) {
|
|
130
133
|
throw new Error(
|
|
@@ -202,7 +205,7 @@ export const handlers = ({
|
|
|
202
205
|
manifest: AppManifest;
|
|
203
206
|
uiHooks: ACREUiHooks;
|
|
204
207
|
}) => {
|
|
205
|
-
function signTransaction({
|
|
208
|
+
async function signTransaction({
|
|
206
209
|
accountId: walletAccountId,
|
|
207
210
|
rawTransaction,
|
|
208
211
|
options,
|
|
@@ -213,17 +216,17 @@ export const handlers = ({
|
|
|
213
216
|
tracking.signTransactionRequested(manifest);
|
|
214
217
|
if (!transaction) {
|
|
215
218
|
tracking.signTransactionFail(manifest);
|
|
216
|
-
|
|
219
|
+
throw new Error("Transaction required");
|
|
217
220
|
}
|
|
218
221
|
const accountId = getAccountIdFromWalletAccountId(walletAccountId);
|
|
219
222
|
if (!accountId) {
|
|
220
223
|
tracking.signTransactionFail(manifest);
|
|
221
|
-
|
|
224
|
+
throw new Error(`accountId ${walletAccountId} unknown`);
|
|
222
225
|
}
|
|
223
226
|
const account = accounts.find(account => account.id === accountId);
|
|
224
227
|
if (!account) {
|
|
225
228
|
tracking.signTransactionFail(manifest);
|
|
226
|
-
|
|
229
|
+
throw new Error("Account required");
|
|
227
230
|
}
|
|
228
231
|
|
|
229
232
|
const parentAccount = getParentAccount(account, accounts);
|
|
@@ -233,7 +236,9 @@ export const handlers = ({
|
|
|
233
236
|
: account.currency.family;
|
|
234
237
|
|
|
235
238
|
const mainAccount = getMainAccount(account, parentAccount);
|
|
236
|
-
const currency = tokenCurrency
|
|
239
|
+
const currency = tokenCurrency
|
|
240
|
+
? await getCryptoAssetsStore().findTokenById(tokenCurrency)
|
|
241
|
+
: null;
|
|
237
242
|
const signerAccount = currency ? makeEmptyTokenAccount(mainAccount, currency) : account;
|
|
238
243
|
const { canEditFees, liveTx, hasFeesProvided } = getWalletAPITransactionSignFlowInfos({
|
|
239
244
|
walletApiTransaction: transaction,
|
|
@@ -241,10 +246,8 @@ export const handlers = ({
|
|
|
241
246
|
});
|
|
242
247
|
|
|
243
248
|
if (accountFamily !== liveTx.family) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
`Account and transaction must be from the same family. Account family: ${accountFamily}, Transaction family: ${liveTx.family}`,
|
|
247
|
-
),
|
|
249
|
+
throw new Error(
|
|
250
|
+
`Account and transaction must be from the same family. Account family: ${accountFamily}, Transaction family: ${liveTx.family}`,
|
|
248
251
|
);
|
|
249
252
|
}
|
|
250
253
|
|
|
@@ -291,13 +294,13 @@ export const handlers = ({
|
|
|
291
294
|
const accountId = getAccountIdFromWalletAccountId(walletAccountId);
|
|
292
295
|
if (!accountId) {
|
|
293
296
|
tracking.signMessageFail(manifest);
|
|
294
|
-
|
|
297
|
+
throw new Error(`accountId ${walletAccountId} unknown`);
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
const account = accounts.find(account => account.id === accountId);
|
|
298
301
|
if (account === undefined) {
|
|
299
302
|
tracking.signMessageFail(manifest);
|
|
300
|
-
|
|
303
|
+
throw new Error("account not found");
|
|
301
304
|
}
|
|
302
305
|
|
|
303
306
|
const path = fromRelativePath(getMainAccount(account).freshAddressPath, derivationPath);
|
|
@@ -328,7 +331,7 @@ export const handlers = ({
|
|
|
328
331
|
if (done) return;
|
|
329
332
|
done = true;
|
|
330
333
|
tracking.signMessageFail(manifest);
|
|
331
|
-
reject(error);
|
|
334
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
332
335
|
},
|
|
333
336
|
});
|
|
334
337
|
});
|
|
@@ -379,7 +382,9 @@ export const handlers = ({
|
|
|
379
382
|
return Promise.reject(new Error("Account required"));
|
|
380
383
|
}
|
|
381
384
|
|
|
382
|
-
const currency = tokenCurrency
|
|
385
|
+
const currency = tokenCurrency
|
|
386
|
+
? await getCryptoAssetsStore().findTokenById(tokenCurrency)
|
|
387
|
+
: null;
|
|
383
388
|
const parentAccount = getParentAccount(account, accounts);
|
|
384
389
|
const mainAccount = getMainAccount(account, parentAccount);
|
|
385
390
|
const signerAccount = currency ? makeEmptyTokenAccount(mainAccount, currency) : account;
|
|
@@ -415,10 +420,8 @@ export const handlers = ({
|
|
|
415
420
|
}
|
|
416
421
|
const validatedInputs = validateInputs(params);
|
|
417
422
|
const ethereumCurrency = getCryptoCurrencyById("ethereum");
|
|
418
|
-
const { token: existingToken, contractAddress: finalTokenContractAddress } =
|
|
419
|
-
validatedInputs.tokenContractAddress,
|
|
420
|
-
validatedInputs.tokenTicker,
|
|
421
|
-
);
|
|
423
|
+
const { token: existingToken, contractAddress: finalTokenContractAddress } =
|
|
424
|
+
await findAcreToken(validatedInputs.tokenContractAddress, validatedInputs.tokenTicker);
|
|
422
425
|
const existingBearingAccount = accounts.find(
|
|
423
426
|
account =>
|
|
424
427
|
"freshAddress" in account &&
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
getParentAccount,
|
|
5
5
|
makeEmptyTokenAccount,
|
|
6
6
|
} from "@ledgerhq/coin-framework/account/index";
|
|
7
|
-
import {
|
|
7
|
+
import { listTokensForCryptoCurrency } from "@ledgerhq/cryptoassets";
|
|
8
|
+
import { getCryptoAssetsStore } from "../../bridge/crypto-assets/index";
|
|
8
9
|
import { decodeSwapPayload } from "@ledgerhq/hw-app-exchange";
|
|
9
10
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
10
11
|
import { Account, AccountLike, getCurrencyForAccount, TokenAccount } from "@ledgerhq/types-live";
|
|
@@ -172,7 +173,7 @@ export const handlers = ({
|
|
|
172
173
|
|
|
173
174
|
// Use `if else` instead of switch to leverage TS type narrowing and avoid `params` force cast.
|
|
174
175
|
if (params.exchangeType == "SWAP") {
|
|
175
|
-
exchangeParams = extractSwapStartParam(params, accounts);
|
|
176
|
+
exchangeParams = await extractSwapStartParam(params, accounts);
|
|
176
177
|
} else if (params.exchangeType == "SELL") {
|
|
177
178
|
exchangeParams = extractSellStartParam(params, accounts);
|
|
178
179
|
} else {
|
|
@@ -237,7 +238,7 @@ export const handlers = ({
|
|
|
237
238
|
let toParentAccount = getParentAccount(toAccount, accounts);
|
|
238
239
|
let newTokenAccount: TokenAccount | undefined;
|
|
239
240
|
if (params.tokenCurrency) {
|
|
240
|
-
const currency = findTokenById(params.tokenCurrency);
|
|
241
|
+
const currency = await getCryptoAssetsStore().findTokenById(params.tokenCurrency);
|
|
241
242
|
if (!currency) {
|
|
242
243
|
throw new ServerError(createCurrencyNotFound(params.tokenCurrency));
|
|
243
244
|
}
|
|
@@ -397,10 +398,10 @@ export const handlers = ({
|
|
|
397
398
|
|
|
398
399
|
tracking.startExchangeRequested(trackingParams);
|
|
399
400
|
|
|
400
|
-
const exchangeStartParams: ExchangeStartParamsUiRequest = extractSwapStartParam(
|
|
401
|
+
const exchangeStartParams: ExchangeStartParamsUiRequest = (await extractSwapStartParam(
|
|
401
402
|
params,
|
|
402
403
|
accounts,
|
|
403
|
-
) as SwapStartParamsUiRequest;
|
|
404
|
+
)) as SwapStartParamsUiRequest;
|
|
404
405
|
|
|
405
406
|
const {
|
|
406
407
|
fromCurrency,
|
|
@@ -621,10 +622,10 @@ export const handlers = ({
|
|
|
621
622
|
}),
|
|
622
623
|
}) as const satisfies Handlers;
|
|
623
624
|
|
|
624
|
-
function extractSwapStartParam(
|
|
625
|
+
async function extractSwapStartParam(
|
|
625
626
|
params: ExchangeStartSwapParams,
|
|
626
627
|
accounts: AccountLike[],
|
|
627
|
-
): ExchangeStartParamsUiRequest {
|
|
628
|
+
): Promise<ExchangeStartParamsUiRequest> {
|
|
628
629
|
if (!("fromAccountId" in params && "toAccountId" in params)) {
|
|
629
630
|
throw new ExchangeError(createWrongSwapParams(params));
|
|
630
631
|
}
|
|
@@ -657,7 +658,9 @@ function extractSwapStartParam(
|
|
|
657
658
|
const fromParentAccount = getParentAccount(fromAccount, accounts);
|
|
658
659
|
const toParentAccount = toAccount ? getParentAccount(toAccount, accounts) : undefined;
|
|
659
660
|
|
|
660
|
-
const currency = params.tokenCurrency
|
|
661
|
+
const currency = params.tokenCurrency
|
|
662
|
+
? await getCryptoAssetsStore().findTokenById(params.tokenCurrency)
|
|
663
|
+
: null;
|
|
661
664
|
const newTokenAccount = currency ? makeEmptyTokenAccount(toAccount, currency) : null;
|
|
662
665
|
|
|
663
666
|
return {
|
|
@@ -26,6 +26,10 @@ import { TrackingAPI } from "./tracking";
|
|
|
26
26
|
import { cryptocurrenciesById } from "@ledgerhq/cryptoassets/currencies";
|
|
27
27
|
import { setSupportedCurrencies } from "../currencies";
|
|
28
28
|
import { initialState as walletState } from "@ledgerhq/live-wallet/store";
|
|
29
|
+
import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
|
|
30
|
+
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
31
|
+
|
|
32
|
+
initializeLegacyTokens(addTokens);
|
|
29
33
|
|
|
30
34
|
describe("receiveOnAccountLogic", () => {
|
|
31
35
|
// Given
|