@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
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
|
|
2
|
-
import
|
|
2
|
+
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
|
|
3
|
+
import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
|
|
4
|
+
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
3
5
|
import "./environment";
|
|
4
6
|
import BigNumber from "bignumber.js";
|
|
5
7
|
|
|
8
|
+
initializeLegacyTokens(addTokens);
|
|
9
|
+
|
|
6
10
|
jest.setTimeout(360000);
|
|
7
11
|
|
|
8
12
|
expect.extend({
|
|
@@ -14,8 +18,5 @@ expect.extend({
|
|
|
14
18
|
},
|
|
15
19
|
});
|
|
16
20
|
|
|
17
|
-
//
|
|
18
|
-
setCryptoAssetsStoreForCoinFramework(
|
|
19
|
-
findTokenById: (_: string) => undefined,
|
|
20
|
-
findTokenByAddressInCurrency: (_: string, __: string) => undefined,
|
|
21
|
-
} as CryptoAssetsStore);
|
|
21
|
+
// Use legacyCryptoAssetsStore for integration tests so tokens can be found
|
|
22
|
+
setCryptoAssetsStoreForCoinFramework(legacyCryptoAssetsStore);
|
|
@@ -18,19 +18,19 @@ const USDC = solanaSplTokenData as TokenCurrency;
|
|
|
18
18
|
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
20
20
|
setCryptoAssetsStoreForCoinFramework({
|
|
21
|
-
findTokenById: (id: string) => {
|
|
21
|
+
findTokenById: async (id: string) => {
|
|
22
22
|
if (id === "solana/spl/epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v") {
|
|
23
23
|
return USDC;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
return undefined;
|
|
27
27
|
},
|
|
28
|
-
findTokenByAddressInCurrency: (_: string, __: string) => undefined,
|
|
29
|
-
getTokensSyncHash: (_: string) =>
|
|
30
|
-
} as CryptoAssetsStore);
|
|
28
|
+
findTokenByAddressInCurrency: async (_: string, __: string) => undefined,
|
|
29
|
+
getTokensSyncHash: async (_: string) => "0",
|
|
30
|
+
} as unknown as CryptoAssetsStore);
|
|
31
31
|
|
|
32
32
|
describe("serialization", () => {
|
|
33
|
-
test("TokenAccount extra fields should be serialized/deserialized", () => {
|
|
33
|
+
test("TokenAccount extra fields should be serialized/deserialized", async () => {
|
|
34
34
|
const acc: any = genAccount("mocked-account-1", { currency: Solana });
|
|
35
35
|
const tokenAcc: any = genTokenAccount(1, acc, USDC);
|
|
36
36
|
tokenAcc.state = "initialized";
|
|
@@ -39,7 +39,7 @@ describe("serialization", () => {
|
|
|
39
39
|
const accRaw: any = toAccountRaw(acc);
|
|
40
40
|
expect(accRaw.subAccounts?.[0]?.state).toBe("initialized");
|
|
41
41
|
|
|
42
|
-
const deserializedAcc: any = fromAccountRaw(accRaw);
|
|
42
|
+
const deserializedAcc: any = await fromAccountRaw(accRaw);
|
|
43
43
|
expect(deserializedAcc.subAccounts?.[0]?.state).toBe("initialized");
|
|
44
44
|
});
|
|
45
45
|
});
|
|
@@ -62,11 +62,11 @@ export const fromOperationRaw = (
|
|
|
62
62
|
return commonFromOperationRaw(operationRaw, accountId, subAccounts, fromOperationRaw);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
export function fromAccountRaw(rawAccount: AccountRaw): Account {
|
|
65
|
+
export async function fromAccountRaw(rawAccount: AccountRaw): Promise<Account> {
|
|
66
66
|
const currency = getCryptoCurrencyById(rawAccount.currencyId);
|
|
67
67
|
const bridge = getAccountBridgeByFamily(currency.family, rawAccount.id);
|
|
68
68
|
|
|
69
|
-
return commonFromAccountRaw(rawAccount, {
|
|
69
|
+
return await commonFromAccountRaw(rawAccount, {
|
|
70
70
|
assignFromAccountRaw: bridge.assignFromAccountRaw,
|
|
71
71
|
assignFromTokenAccountRaw: bridge.assignFromTokenAccountRaw,
|
|
72
72
|
fromOperationExtraRaw: bridge.fromOperationExtraRaw,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
|
|
2
|
+
import { getEnv } from "@ledgerhq/live-env";
|
|
3
|
+
|
|
4
|
+
export const ofacGeoBlockApi = createApi({
|
|
5
|
+
reducerPath: "ofacGeoBlockApi",
|
|
6
|
+
baseQuery: fetchBaseQuery({
|
|
7
|
+
baseUrl: getEnv("LEDGER_COUNTERVALUES_API"),
|
|
8
|
+
validateStatus: response => [200, 451].includes(response.status), // Treat both 200 (not blocked) and 451 (blocked) as successful responses
|
|
9
|
+
}),
|
|
10
|
+
|
|
11
|
+
endpoints: build => ({
|
|
12
|
+
check: build.query<boolean, void>({
|
|
13
|
+
query: () => ({
|
|
14
|
+
url: "/v3/markets",
|
|
15
|
+
}),
|
|
16
|
+
transformResponse: (response: unknown, meta) => meta?.response?.status === 451,
|
|
17
|
+
}),
|
|
18
|
+
}),
|
|
19
|
+
});
|
package/src/apps/config.ts
CHANGED
package/src/bot/engine.ts
CHANGED
|
@@ -50,7 +50,7 @@ import type {
|
|
|
50
50
|
SignOperationEvent,
|
|
51
51
|
TransactionCommon,
|
|
52
52
|
} from "@ledgerhq/types-live";
|
|
53
|
-
import type {
|
|
53
|
+
import type { TransactionStatus } from "../generated/types";
|
|
54
54
|
import { botTest } from "@ledgerhq/coin-framework/bot/bot-test-context";
|
|
55
55
|
import { getDefaultAccountNameForCurrencyIndex } from "@ledgerhq/live-wallet/accountName";
|
|
56
56
|
|
|
@@ -70,7 +70,7 @@ const cache = makeBridgeCacheSystem({
|
|
|
70
70
|
const defaultScanAccountsRetries = 2;
|
|
71
71
|
const delayBetweenScanAccountRetries = 5000;
|
|
72
72
|
|
|
73
|
-
export async function runWithAppSpec<T extends
|
|
73
|
+
export async function runWithAppSpec<T extends TransactionCommon>(
|
|
74
74
|
spec: AppSpec<T>,
|
|
75
75
|
reportLog: (arg0: string) => void,
|
|
76
76
|
): Promise<SpecReport<T>> {
|
|
@@ -276,7 +276,7 @@ export async function runWithAppSpec<T extends Transaction>(
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
// eslint-disable-next-line no-console
|
|
279
|
-
console.log(formatReportForConsole(report));
|
|
279
|
+
console.log(formatReportForConsole(report as any));
|
|
280
280
|
mutationReports.push(report);
|
|
281
281
|
appReport.mutations = mutationReports;
|
|
282
282
|
|
|
@@ -343,7 +343,7 @@ export async function runWithAppSpec<T extends Transaction>(
|
|
|
343
343
|
|
|
344
344
|
return appReport;
|
|
345
345
|
}
|
|
346
|
-
export async function runOnAccount<T extends
|
|
346
|
+
export async function runOnAccount<T extends TransactionCommon>({
|
|
347
347
|
appCandidate,
|
|
348
348
|
spec,
|
|
349
349
|
device,
|
|
@@ -761,7 +761,7 @@ async function syncAccount(initialAccount: Account): Promise<Account> {
|
|
|
761
761
|
return deepFreezeAccount(acc);
|
|
762
762
|
}
|
|
763
763
|
|
|
764
|
-
export function autoSignTransaction<T extends
|
|
764
|
+
export function autoSignTransaction<T extends TransactionCommon>({
|
|
765
765
|
transport,
|
|
766
766
|
deviceAction,
|
|
767
767
|
appCandidate,
|
package/src/bridge/cache.test.ts
CHANGED
|
@@ -10,10 +10,12 @@ describe("Bridge Cache", () => {
|
|
|
10
10
|
|
|
11
11
|
beforeAll(() => {
|
|
12
12
|
setEnv("MOCK", "1");
|
|
13
|
+
setEnv("PLAYWRIGHT_RUN", true);
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
afterAll(() => {
|
|
16
17
|
setEnv("MOCK", "");
|
|
18
|
+
setEnv("PLAYWRIGHT_RUN", false);
|
|
17
19
|
});
|
|
18
20
|
|
|
19
21
|
it("does not re-generate the LRU cache by default", async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
2
2
|
import { getCryptoAssetsStore, setCryptoAssetsStore } from ".";
|
|
3
|
-
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/
|
|
3
|
+
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
|
|
4
4
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
|
5
5
|
|
|
6
6
|
describe("Testing CryptoAssetStore", () => {
|
|
@@ -13,10 +13,7 @@ describe("Testing CryptoAssetStore", () => {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
const store = getCryptoAssetsStore();
|
|
16
|
-
expect(store
|
|
17
|
-
expect(store.findTokenByAddressInCurrency).toBe(
|
|
18
|
-
legacyCryptoAssetsStore.findTokenByAddressInCurrency,
|
|
19
|
-
);
|
|
16
|
+
expect(store).toBe(legacyCryptoAssetsStore);
|
|
20
17
|
});
|
|
21
18
|
|
|
22
19
|
it("should return the default methods from cryptoassets libs when feature flag is disabled", () => {
|
|
@@ -28,10 +25,7 @@ describe("Testing CryptoAssetStore", () => {
|
|
|
28
25
|
});
|
|
29
26
|
|
|
30
27
|
const store = getCryptoAssetsStore();
|
|
31
|
-
expect(store
|
|
32
|
-
expect(store.findTokenByAddressInCurrency).toBe(
|
|
33
|
-
legacyCryptoAssetsStore.findTokenByAddressInCurrency,
|
|
34
|
-
);
|
|
28
|
+
expect(store).toBe(legacyCryptoAssetsStore);
|
|
35
29
|
});
|
|
36
30
|
|
|
37
31
|
it("should throw an error when no store is set and feature flag is enabled", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
2
|
-
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/tokens";
|
|
3
2
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
|
3
|
+
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
|
|
4
4
|
|
|
5
5
|
let cryptoAssetsStore: CryptoAssetsStore | undefined = undefined;
|
|
6
6
|
|
|
@@ -124,8 +124,8 @@ const buildGetBalance = (networkFamily: string) =>
|
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
const buildGetSequence = (networkFamily: string) =>
|
|
127
|
-
async function getSequence(address: string): Promise<
|
|
128
|
-
const { data } = await network<
|
|
127
|
+
async function getSequence(address: string): Promise<bigint> {
|
|
128
|
+
const { data } = await network<bigint, unknown>({
|
|
129
129
|
method: "GET",
|
|
130
130
|
url: `${ALPACA_URL}/${networkFamily}/account/${address}/info`,
|
|
131
131
|
});
|
|
@@ -191,7 +191,7 @@ export const getNetworkAlpacaApi = (networkFamily: string) =>
|
|
|
191
191
|
_transaction: string,
|
|
192
192
|
_sender: string,
|
|
193
193
|
_publicKey: string,
|
|
194
|
-
_sequence:
|
|
194
|
+
_sequence: bigint,
|
|
195
195
|
): Promise<CraftedTransaction> => {
|
|
196
196
|
throw new Error("craftRawTransaction is not supported");
|
|
197
197
|
},
|
|
@@ -43,12 +43,17 @@ export function createTransaction(account: Account | TokenAccount): GenericTrans
|
|
|
43
43
|
};
|
|
44
44
|
case "evm": {
|
|
45
45
|
return {
|
|
46
|
-
mode: "send
|
|
46
|
+
mode: "send",
|
|
47
|
+
type: 2,
|
|
47
48
|
family: currency.family,
|
|
48
49
|
amount: new BigNumber(0),
|
|
49
50
|
recipient: "",
|
|
50
51
|
useAllAmount: false,
|
|
51
52
|
feesStrategy: "medium",
|
|
53
|
+
chainId: currency.ethereumLikeInfo?.chainId ?? 0,
|
|
54
|
+
gasLimit: new BigNumber(21000),
|
|
55
|
+
maxFeePerGas: new BigNumber(0),
|
|
56
|
+
maxPriorityFeePerGas: new BigNumber(0),
|
|
52
57
|
};
|
|
53
58
|
}
|
|
54
59
|
default:
|
|
@@ -2,7 +2,7 @@ import { Account, AccountBridge } from "@ledgerhq/types-live";
|
|
|
2
2
|
import { getAlpacaApi } from "./alpaca";
|
|
3
3
|
import { transactionToIntent } from "./utils";
|
|
4
4
|
import BigNumber from "bignumber.js";
|
|
5
|
-
import { AssetInfo } from "@ledgerhq/coin-framework/api/types";
|
|
5
|
+
import { AssetInfo, FeeEstimation } from "@ledgerhq/coin-framework/api/types";
|
|
6
6
|
import { decodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
|
|
7
7
|
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
8
8
|
import { GenericTransaction } from "./types";
|
|
@@ -21,6 +21,23 @@ function assetInfosFallback(transaction: GenericTransaction): {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function propagateField(estimation: FeeEstimation, field: string, dest: GenericTransaction): void {
|
|
25
|
+
const value = estimation?.parameters?.[field];
|
|
26
|
+
|
|
27
|
+
if (typeof value !== "bigint" && typeof value !== "number" && typeof value !== "string") return;
|
|
28
|
+
|
|
29
|
+
switch (field) {
|
|
30
|
+
case "type":
|
|
31
|
+
dest[field] = Number(value.toString());
|
|
32
|
+
return;
|
|
33
|
+
case "storageLimit":
|
|
34
|
+
dest[field] = new BigNumber(value.toString());
|
|
35
|
+
return;
|
|
36
|
+
default:
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
24
41
|
export function genericPrepareTransaction(
|
|
25
42
|
network: string,
|
|
26
43
|
kind,
|
|
@@ -31,13 +48,12 @@ export function genericPrepareTransaction(
|
|
|
31
48
|
kind,
|
|
32
49
|
);
|
|
33
50
|
const { assetReference, assetOwner } = getAssetFromToken
|
|
34
|
-
? getAssetInfos(transaction, account.freshAddress, getAssetFromToken)
|
|
51
|
+
? await getAssetInfos(transaction, account.freshAddress, getAssetFromToken)
|
|
35
52
|
: assetInfosFallback(transaction);
|
|
36
53
|
const customParametersFees = transaction.customFees?.parameters?.fees;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
await estimateFees(
|
|
54
|
+
const estimation: FeeEstimation = customParametersFees
|
|
55
|
+
? { value: BigInt(customParametersFees.toFixed()) }
|
|
56
|
+
: await estimateFees(
|
|
41
57
|
transactionToIntent(
|
|
42
58
|
account,
|
|
43
59
|
{
|
|
@@ -45,14 +61,13 @@ export function genericPrepareTransaction(
|
|
|
45
61
|
},
|
|
46
62
|
computeIntentType,
|
|
47
63
|
),
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
}
|
|
64
|
+
);
|
|
65
|
+
const fees = new BigNumber(estimation.value.toString());
|
|
51
66
|
|
|
52
|
-
if (!bnEq(transaction.fees,
|
|
67
|
+
if (!bnEq(transaction.fees, fees)) {
|
|
53
68
|
const next: GenericTransaction = {
|
|
54
69
|
...transaction,
|
|
55
|
-
fees
|
|
70
|
+
fees,
|
|
56
71
|
assetReference,
|
|
57
72
|
assetOwner,
|
|
58
73
|
customFees: {
|
|
@@ -62,35 +77,15 @@ export function genericPrepareTransaction(
|
|
|
62
77
|
},
|
|
63
78
|
};
|
|
64
79
|
|
|
65
|
-
//
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
...transaction,
|
|
71
|
-
},
|
|
72
|
-
computeIntentType,
|
|
73
|
-
),
|
|
74
|
-
);
|
|
75
|
-
const params = feeEstimation?.parameters;
|
|
76
|
-
if (params) {
|
|
77
|
-
const storageLimit = params["storageLimit"];
|
|
78
|
-
if (
|
|
79
|
-
storageLimit !== undefined &&
|
|
80
|
-
(typeof storageLimit === "bigint" ||
|
|
81
|
-
typeof storageLimit === "number" ||
|
|
82
|
-
typeof storageLimit === "string")
|
|
83
|
-
) {
|
|
84
|
-
next.storageLimit = new BigNumber(storageLimit.toString());
|
|
85
|
-
}
|
|
80
|
+
// Propagate needed fields
|
|
81
|
+
const fieldsToPropagate = ["type", "storageLimit"];
|
|
82
|
+
|
|
83
|
+
for (const field of fieldsToPropagate) {
|
|
84
|
+
propagateField(estimation, field, next);
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
// align with stellar/xrp: when send max (or staking intents), reflect validated amount in UI
|
|
89
|
-
if (
|
|
90
|
-
transaction.useAllAmount ||
|
|
91
|
-
transaction["mode"] === "stake" ||
|
|
92
|
-
transaction["mode"] === "unstake"
|
|
93
|
-
) {
|
|
88
|
+
if (transaction.useAllAmount || ["stake", "unstake"].includes(transaction.mode ?? "")) {
|
|
94
89
|
const { amount } = await validateIntent(
|
|
95
90
|
transactionToIntent(
|
|
96
91
|
account,
|
|
@@ -109,16 +104,16 @@ export function genericPrepareTransaction(
|
|
|
109
104
|
};
|
|
110
105
|
}
|
|
111
106
|
|
|
112
|
-
export function getAssetInfos(
|
|
107
|
+
export async function getAssetInfos(
|
|
113
108
|
tr: GenericTransaction,
|
|
114
109
|
owner: string,
|
|
115
110
|
getAssetFromToken: (token: TokenCurrency, owner: string) => AssetInfo,
|
|
116
|
-
): {
|
|
111
|
+
): Promise<{
|
|
117
112
|
assetReference: string;
|
|
118
113
|
assetOwner: string;
|
|
119
|
-
} {
|
|
114
|
+
}> {
|
|
120
115
|
if (tr.subAccountId) {
|
|
121
|
-
const { token } = decodeTokenAccountId(tr.subAccountId);
|
|
116
|
+
const { token } = await decodeTokenAccountId(tr.subAccountId);
|
|
122
117
|
|
|
123
118
|
if (!token) return assetInfosFallback(tr);
|
|
124
119
|
|
|
@@ -119,9 +119,11 @@ export const genericSignOperation =
|
|
|
119
119
|
// Enrich with memo and asset information
|
|
120
120
|
transactionIntent = enrichTransactionIntent(transactionIntent, transaction, publicKey);
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (typeof transactionIntent.sequence !== "bigint") {
|
|
123
|
+
// TODO: should compute it and pass it down to craftTransaction (duplicate call right now)
|
|
124
|
+
const sequenceNumber = await alpacaApi.getSequence(transactionIntent.sender);
|
|
125
|
+
transactionIntent.sequence = sequenceNumber;
|
|
126
|
+
}
|
|
125
127
|
|
|
126
128
|
/* Craft unsigned blob via Alpaca */
|
|
127
129
|
const { transaction: unsigned } = await alpacaApi.craftTransaction(transactionIntent, {
|
|
@@ -131,7 +133,11 @@ export const genericSignOperation =
|
|
|
131
133
|
/* Notify UI that the device is now showing the tx */
|
|
132
134
|
o.next({ type: "device-signature-requested" });
|
|
133
135
|
/* Sign on Ledger device */
|
|
134
|
-
const txnSig = await signer.signTransaction(
|
|
136
|
+
const txnSig = await signer.signTransaction(
|
|
137
|
+
derivationPath,
|
|
138
|
+
unsigned,
|
|
139
|
+
transaction.recipientDomain,
|
|
140
|
+
);
|
|
135
141
|
return { unsigned, txnSig, publicKey, sequence: transactionIntent.sequence };
|
|
136
142
|
});
|
|
137
143
|
|
|
@@ -7,10 +7,11 @@ import Transport from "@ledgerhq/hw-transport";
|
|
|
7
7
|
import { getEnv } from "@ledgerhq/live-env";
|
|
8
8
|
import { ResolutionConfig, LoadConfig } from "@ledgerhq/hw-app-eth/lib/services/types";
|
|
9
9
|
import { Signature } from "ethers";
|
|
10
|
+
import type { DomainServiceResolution } from "@ledgerhq/types-live";
|
|
10
11
|
|
|
11
12
|
export type Signer = {
|
|
12
13
|
getAddress: (path: string) => Promise<EvmAddress>;
|
|
13
|
-
signTransaction: (path: string, tx: string) => Promise<string>;
|
|
14
|
+
signTransaction: (path: string, tx: string, domain?: DomainServiceResolution) => Promise<string>;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const isDmkTransport = (
|
|
@@ -37,13 +38,14 @@ export const createSigner: CreateSigner<Signer> = (transport: Transport) => {
|
|
|
37
38
|
|
|
38
39
|
return {
|
|
39
40
|
getAddress: signer.getAddress.bind(signer),
|
|
40
|
-
signTransaction: async (path, tx) => {
|
|
41
|
+
signTransaction: async (path, tx, domain) => {
|
|
41
42
|
// Configure type of resolutions necessary for the clear signing
|
|
42
43
|
const resolutionConfig: ResolutionConfig = {
|
|
43
44
|
externalPlugins: true,
|
|
44
45
|
erc20: true,
|
|
45
46
|
nft: false,
|
|
46
47
|
uniswapV3: true,
|
|
48
|
+
domains: domain && [domain],
|
|
47
49
|
};
|
|
48
50
|
const loadConfig: LoadConfig = {
|
|
49
51
|
cryptoassetsBaseURL: getEnv("DYNAMIC_CAL_BASE_URL"),
|
|
@@ -92,81 +92,34 @@ describe("genericPrepareTransaction", () => {
|
|
|
92
92
|
expect(result).toBe(baseTransaction); // still same reference
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
it(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
expect.objectContaining({
|
|
121
|
-
fees: estimatedFee,
|
|
122
|
-
storageLimit: new BigNumber(0),
|
|
123
|
-
customFees: {
|
|
124
|
-
parameters: {
|
|
125
|
-
fees: undefined,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
}),
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
expect((getAlpacaApi as jest.Mock)().estimateFees).toHaveBeenCalledTimes(2);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it("propagates storageLimit showing new account scenario", async () => {
|
|
135
|
-
const estimatedFee = new BigNumber(491);
|
|
136
|
-
|
|
137
|
-
const estimateFeesFirstCall = jest.fn().mockResolvedValue({
|
|
138
|
-
value: estimatedFee,
|
|
139
|
-
parameters: { storageLimit: 300 },
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const estimateFeesSecondCall = jest.fn().mockResolvedValue({
|
|
143
|
-
value: estimatedFee,
|
|
144
|
-
parameters: { storageLimit: 277 },
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
148
|
-
estimateFees: jest
|
|
149
|
-
.fn()
|
|
150
|
-
.mockImplementationOnce(() => estimateFeesFirstCall())
|
|
151
|
-
.mockImplementationOnce(() => estimateFeesSecondCall()),
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
const txWithoutCustomFees = { ...baseTransaction, customFees: undefined };
|
|
155
|
-
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
156
|
-
const result = await prepareTransaction(account, txWithoutCustomFees);
|
|
157
|
-
|
|
158
|
-
expect(result).toEqual(
|
|
159
|
-
expect.objectContaining({
|
|
160
|
-
fees: estimatedFee,
|
|
161
|
-
storageLimit: new BigNumber(277),
|
|
162
|
-
customFees: {
|
|
163
|
-
parameters: {
|
|
164
|
-
fees: undefined,
|
|
95
|
+
it.each([
|
|
96
|
+
["type", 2, 2],
|
|
97
|
+
["storageLimit", 300n, new BigNumber(300)],
|
|
98
|
+
])(
|
|
99
|
+
"propagates %s from estimation parameters",
|
|
100
|
+
async (parameterName, parameterValue, expectedValue) => {
|
|
101
|
+
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
102
|
+
estimateFees: jest.fn().mockResolvedValue({
|
|
103
|
+
value: new BigNumber(491),
|
|
104
|
+
parameters: { [parameterName]: parameterValue },
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const txWithoutCustomFees = { ...baseTransaction, customFees: undefined };
|
|
109
|
+
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
110
|
+
const result = await prepareTransaction(account, txWithoutCustomFees);
|
|
111
|
+
|
|
112
|
+
expect(result).toEqual(
|
|
113
|
+
expect.objectContaining({
|
|
114
|
+
fees: new BigNumber(491),
|
|
115
|
+
[parameterName]: expectedValue,
|
|
116
|
+
customFees: {
|
|
117
|
+
parameters: {
|
|
118
|
+
fees: undefined,
|
|
119
|
+
},
|
|
165
120
|
},
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
expect((getAlpacaApi as jest.Mock)().estimateFees).toHaveBeenCalledTimes(2);
|
|
171
|
-
});
|
|
121
|
+
}),
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
);
|
|
172
125
|
});
|
|
@@ -27,6 +27,10 @@ describe("genericSignOperation", () => {
|
|
|
27
27
|
amount: 100_000n,
|
|
28
28
|
fees: 500n,
|
|
29
29
|
tag: 1234,
|
|
30
|
+
recipientDomain: {
|
|
31
|
+
domain: "recipient.gen",
|
|
32
|
+
address: "recipient-address",
|
|
33
|
+
},
|
|
30
34
|
} as any;
|
|
31
35
|
|
|
32
36
|
const deviceId = "mockDevice";
|
|
@@ -38,7 +42,7 @@ describe("genericSignOperation", () => {
|
|
|
38
42
|
},
|
|
39
43
|
};
|
|
40
44
|
|
|
41
|
-
const unsignedTx = "unsignedTx";
|
|
45
|
+
const unsignedTx = { transaction: "unsignedTx" };
|
|
42
46
|
const signedTx = "signedTx";
|
|
43
47
|
const pubKey = "pubKey";
|
|
44
48
|
|
|
@@ -49,7 +53,7 @@ describe("genericSignOperation", () => {
|
|
|
49
53
|
craftTransaction: jest.fn().mockResolvedValue(unsignedTx),
|
|
50
54
|
getAccountInfo: jest.fn().mockResolvedValue(pubKey),
|
|
51
55
|
combine: jest.fn().mockResolvedValue(signedTx),
|
|
52
|
-
getSequence: jest.fn().mockResolvedValue(
|
|
56
|
+
getSequence: jest.fn().mockResolvedValue(1n),
|
|
53
57
|
});
|
|
54
58
|
|
|
55
59
|
(transactionToIntent as jest.Mock).mockReturnValue(txIntent);
|
|
@@ -84,6 +88,10 @@ describe("genericSignOperation", () => {
|
|
|
84
88
|
});
|
|
85
89
|
|
|
86
90
|
expect(transactionToIntent).toHaveBeenCalledWith(account, transaction, undefined);
|
|
91
|
+
expect(mockSigner.signTransaction).toHaveBeenCalledWith("44'/144'/0'/0/0", "unsignedTx", {
|
|
92
|
+
domain: "recipient.gen",
|
|
93
|
+
address: "recipient-address",
|
|
94
|
+
});
|
|
87
95
|
expect(txIntent.memo.memos.get("destinationTag")).toBe("1234");
|
|
88
96
|
});
|
|
89
97
|
|