@ledgerhq/live-common 34.48.0-nightly.1 → 34.48.0-nightly.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/test-helpers/environment.js +1 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/apps/inlineAppInstall.d.ts +1 -3
- package/lib/apps/inlineAppInstall.d.ts.map +1 -1
- package/lib/apps/inlineAppInstall.js +2 -2
- package/lib/apps/inlineAppInstall.js.map +1 -1
- package/lib/apps/react.d.ts +1 -2
- package/lib/apps/react.d.ts.map +1 -1
- package/lib/apps/react.js +2 -2
- package/lib/apps/react.js.map +1 -1
- package/lib/apps/runner.d.ts +2 -4
- package/lib/apps/runner.d.ts.map +1 -1
- package/lib/apps/runner.js +3 -4
- package/lib/apps/runner.js.map +1 -1
- package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +0 -4
- package/lib/bridge/crypto-assets/index.js.map +1 -1
- package/lib/bridge/crypto-assets/index.test.js +0 -36
- package/lib/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts +2 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.js +2 -2
- package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +10 -6
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.unit.test.js +37 -9
- package/lib/bridge/generic-alpaca/alpaca/index.unit.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.d.ts +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +8 -0
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts +2 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.js +3 -2
- package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +4 -4
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts +8 -0
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/signer/Eth.js +51 -0
- package/lib/bridge/generic-alpaca/signer/Eth.js.map +1 -0
- package/lib/bridge/generic-alpaca/signer/index.d.ts +2 -10
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +2 -2
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -3
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/types.d.ts +11 -0
- package/lib/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.d.ts +2 -0
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +144 -0
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -0
- package/lib/bridge/generic-alpaca/utils.d.ts +2 -0
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +15 -1
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.js +21 -0
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib/config/sharedConfig.d.ts.map +1 -1
- package/lib/config/sharedConfig.js +30 -26
- package/lib/config/sharedConfig.js.map +1 -1
- package/lib/e2e/enum/Account.d.ts +2 -0
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +2 -0
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +1 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +1 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +2 -1
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +1 -0
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +2 -1
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +1 -0
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/families/kaspa.d.ts +4 -0
- package/lib/e2e/families/kaspa.d.ts.map +1 -0
- package/lib/e2e/families/kaspa.js +23 -0
- package/lib/e2e/families/kaspa.js.map +1 -0
- package/lib/e2e/index.d.ts +3 -8
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +13 -0
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/exchange/swap/transactionStrategies.d.ts +38 -11
- package/lib/exchange/swap/transactionStrategies.d.ts.map +1 -1
- package/lib/exchange/swap/transactionStrategies.js +93 -47
- package/lib/exchange/swap/transactionStrategies.js.map +1 -1
- package/lib/families/canton/bridge/mock-data.d.ts +6 -0
- package/lib/families/canton/bridge/mock-data.d.ts.map +1 -0
- package/lib/families/canton/bridge/mock-data.js +120 -0
- package/lib/families/canton/bridge/mock-data.js.map +1 -0
- package/lib/families/canton/bridge/mock.d.ts +12 -0
- package/lib/families/canton/bridge/mock.d.ts.map +1 -0
- package/lib/families/canton/bridge/mock.js +154 -0
- package/lib/families/canton/bridge/mock.js.map +1 -0
- package/lib/families/canton/config.js +7 -6
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/canton/setup.d.ts.map +1 -1
- package/lib/families/canton/setup.js +10 -4
- package/lib/families/canton/setup.js.map +1 -1
- package/lib/families/evm/config.js +2 -2
- package/lib/families/evm/config.js.map +1 -1
- package/lib/families/kaspa/bridge.integration.test.d.ts +2 -0
- package/lib/families/kaspa/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/kaspa/bridge.integration.test.js +7 -0
- package/lib/families/kaspa/bridge.integration.test.js.map +1 -0
- package/lib/families/kaspa/config.d.ts +3 -0
- package/lib/families/kaspa/config.d.ts.map +1 -0
- package/lib/families/kaspa/config.js +14 -0
- package/lib/families/kaspa/config.js.map +1 -0
- package/lib/families/kaspa/react.d.ts +4 -0
- package/lib/families/kaspa/react.d.ts.map +1 -0
- package/lib/families/kaspa/react.js +18 -0
- package/lib/families/kaspa/react.js.map +1 -0
- package/lib/families/kaspa/setup.d.ts +18 -0
- package/lib/families/kaspa/setup.d.ts.map +1 -0
- package/lib/families/kaspa/setup.js +24 -0
- package/lib/families/kaspa/setup.js.map +1 -0
- package/lib/families/kaspa/types.d.ts +2 -0
- package/lib/families/kaspa/types.d.ts.map +1 -0
- package/lib/families/kaspa/types.js +18 -0
- package/lib/families/kaspa/types.js.map +1 -0
- package/lib/families/xrp/setup.d.ts +2 -2
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +4 -3
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/bridge/js.d.ts +1 -0
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +24 -22
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/bridge/mock.d.ts +9 -1
- package/lib/generated/bridge/mock.d.ts.map +1 -1
- package/lib/generated/bridge/mock.js +26 -24
- package/lib/generated/bridge/mock.js.map +1 -1
- package/lib/generated/cli-transaction.d.ts +13 -2
- package/lib/generated/cli-transaction.d.ts.map +1 -1
- package/lib/generated/cli-transaction.js +28 -26
- package/lib/generated/cli-transaction.js.map +1 -1
- package/lib/generated/deviceTransactionConfig.d.ts +2 -0
- package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/generated/deviceTransactionConfig.js +24 -22
- package/lib/generated/deviceTransactionConfig.js.map +1 -1
- package/lib/generated/hw-getAddress.d.ts +1 -0
- package/lib/generated/hw-getAddress.d.ts.map +1 -1
- package/lib/generated/hw-getAddress.js +28 -26
- package/lib/generated/hw-getAddress.js.map +1 -1
- package/lib/generated/platformAdapter.d.ts +1 -1
- package/lib/generated/specs.d.ts +1 -1
- package/lib/generated/transaction.d.ts +11 -3
- package/lib/generated/transaction.d.ts.map +1 -1
- package/lib/generated/transaction.js +28 -26
- package/lib/generated/transaction.js.map +1 -1
- package/lib/generated/types.d.ts +5 -4
- package/lib/generated/types.d.ts.map +1 -1
- package/lib/generated/walletApiAdapter.d.ts +1 -1
- package/lib/hw/actions/app.d.ts.map +1 -1
- package/lib/hw/actions/app.js.map +1 -1
- package/lib/hw/getDeviceNameMaxLength.d.ts.map +1 -1
- package/lib/hw/getDeviceNameMaxLength.js +2 -0
- package/lib/hw/getDeviceNameMaxLength.js.map +1 -1
- package/lib/hw/getDeviceNameMaxLength.test.js +12 -0
- package/lib/hw/getDeviceNameMaxLength.test.js.map +1 -1
- package/lib/modularDrawer/data/state-manager/api.d.ts.map +1 -1
- package/lib/modularDrawer/data/state-manager/api.js +3 -2
- package/lib/modularDrawer/data/state-manager/api.js.map +1 -1
- package/lib/modularDrawer/data/state-manager/types.d.ts +1 -0
- package/lib/modularDrawer/data/state-manager/types.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useAssetsData.d.ts +3 -1
- package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useAssetsData.js +6 -3
- package/lib/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib/modularDrawer/hooks/useSearch.d.ts +16 -0
- package/lib/modularDrawer/hooks/useSearch.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useSearch.js +24 -0
- package/lib/modularDrawer/hooks/useSearch.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/index.d.ts +16 -1
- package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.js +31 -7
- package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/index.test.js +88 -0
- package/lib/notifications/ServiceStatusProvider/index.test.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.js +16 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
- package/lib/wallet-api/ACRE/server.d.ts +13 -6
- package/lib/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib/wallet-api/ACRE/server.js +142 -1
- package/lib/wallet-api/ACRE/server.js.map +1 -1
- package/lib/wallet-api/ACRE/server.test.d.ts +2 -0
- package/lib/wallet-api/ACRE/server.test.d.ts.map +1 -0
- package/lib/wallet-api/ACRE/server.test.js +393 -0
- package/lib/wallet-api/ACRE/server.test.js.map +1 -0
- package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +16 -13
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/__tests__/test-helpers/environment.js +1 -0
- package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
- package/lib-es/apps/inlineAppInstall.d.ts +1 -3
- package/lib-es/apps/inlineAppInstall.d.ts.map +1 -1
- package/lib-es/apps/inlineAppInstall.js +2 -2
- package/lib-es/apps/inlineAppInstall.js.map +1 -1
- package/lib-es/apps/react.d.ts +1 -2
- package/lib-es/apps/react.d.ts.map +1 -1
- package/lib-es/apps/react.js +2 -2
- package/lib-es/apps/react.js.map +1 -1
- package/lib-es/apps/runner.d.ts +2 -4
- package/lib-es/apps/runner.d.ts.map +1 -1
- package/lib-es/apps/runner.js +3 -4
- package/lib-es/apps/runner.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +0 -4
- package/lib-es/bridge/crypto-assets/index.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.test.js +0 -36
- package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts +2 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.js +2 -2
- package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js +10 -6
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.js +37 -9
- package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +8 -0
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts +2 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.js +3 -2
- package/lib-es/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +4 -4
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts +8 -0
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/signer/Eth.js +47 -0
- package/lib-es/bridge/generic-alpaca/signer/Eth.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts +2 -10
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js +2 -2
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +2 -3
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/types.d.ts +11 -0
- package/lib-es/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +139 -0
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/utils.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +13 -0
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js +22 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib-es/config/sharedConfig.d.ts.map +1 -1
- package/lib-es/config/sharedConfig.js +4 -0
- package/lib-es/config/sharedConfig.js.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +2 -0
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +2 -0
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +1 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +1 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +2 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +1 -0
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +2 -1
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +1 -0
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/families/kaspa.d.ts +4 -0
- package/lib-es/e2e/families/kaspa.d.ts.map +1 -0
- package/lib-es/e2e/families/kaspa.js +15 -0
- package/lib-es/e2e/families/kaspa.js.map +1 -0
- package/lib-es/e2e/index.d.ts +3 -8
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +13 -0
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/exchange/swap/transactionStrategies.d.ts +38 -11
- package/lib-es/exchange/swap/transactionStrategies.d.ts.map +1 -1
- package/lib-es/exchange/swap/transactionStrategies.js +87 -44
- package/lib-es/exchange/swap/transactionStrategies.js.map +1 -1
- package/lib-es/families/canton/bridge/mock-data.d.ts +6 -0
- package/lib-es/families/canton/bridge/mock-data.d.ts.map +1 -0
- package/lib-es/families/canton/bridge/mock-data.js +116 -0
- package/lib-es/families/canton/bridge/mock-data.js.map +1 -0
- package/lib-es/families/canton/bridge/mock.d.ts +12 -0
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -0
- package/lib-es/families/canton/bridge/mock.js +152 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -0
- package/lib-es/families/canton/config.js +7 -6
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/canton/setup.d.ts.map +1 -1
- package/lib-es/families/canton/setup.js +10 -4
- package/lib-es/families/canton/setup.js.map +1 -1
- package/lib-es/families/evm/config.js +2 -2
- package/lib-es/families/evm/config.js.map +1 -1
- package/lib-es/families/kaspa/bridge.integration.test.d.ts +2 -0
- package/lib-es/families/kaspa/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/families/kaspa/bridge.integration.test.js +5 -0
- package/lib-es/families/kaspa/bridge.integration.test.js.map +1 -0
- package/lib-es/families/kaspa/config.d.ts +3 -0
- package/lib-es/families/kaspa/config.d.ts.map +1 -0
- package/lib-es/families/kaspa/config.js +11 -0
- package/lib-es/families/kaspa/config.js.map +1 -0
- package/lib-es/families/kaspa/react.d.ts +4 -0
- package/lib-es/families/kaspa/react.d.ts.map +1 -0
- package/lib-es/families/kaspa/react.js +14 -0
- package/lib-es/families/kaspa/react.js.map +1 -0
- package/lib-es/families/kaspa/setup.d.ts +18 -0
- package/lib-es/families/kaspa/setup.d.ts.map +1 -0
- package/lib-es/families/kaspa/setup.js +16 -0
- package/lib-es/families/kaspa/setup.js.map +1 -0
- package/lib-es/families/kaspa/types.d.ts +2 -0
- package/lib-es/families/kaspa/types.d.ts.map +1 -0
- package/lib-es/families/kaspa/types.js +2 -0
- package/lib-es/families/kaspa/types.js.map +1 -0
- package/lib-es/families/xrp/setup.d.ts +2 -2
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +4 -3
- package/lib-es/featureFlags/defaultFeatures.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/bridge/js.d.ts +1 -0
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +2 -0
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/generated/bridge/mock.d.ts +9 -1
- package/lib-es/generated/bridge/mock.d.ts.map +1 -1
- package/lib-es/generated/bridge/mock.js +2 -0
- package/lib-es/generated/bridge/mock.js.map +1 -1
- package/lib-es/generated/cli-transaction.d.ts +13 -2
- package/lib-es/generated/cli-transaction.d.ts.map +1 -1
- package/lib-es/generated/cli-transaction.js +2 -0
- package/lib-es/generated/cli-transaction.js.map +1 -1
- package/lib-es/generated/deviceTransactionConfig.d.ts +2 -0
- package/lib-es/generated/deviceTransactionConfig.d.ts.map +1 -1
- package/lib-es/generated/deviceTransactionConfig.js +2 -0
- package/lib-es/generated/deviceTransactionConfig.js.map +1 -1
- package/lib-es/generated/hw-getAddress.d.ts +1 -0
- package/lib-es/generated/hw-getAddress.d.ts.map +1 -1
- package/lib-es/generated/hw-getAddress.js +2 -0
- package/lib-es/generated/hw-getAddress.js.map +1 -1
- package/lib-es/generated/platformAdapter.d.ts +1 -1
- package/lib-es/generated/specs.d.ts +1 -1
- package/lib-es/generated/transaction.d.ts +11 -3
- package/lib-es/generated/transaction.d.ts.map +1 -1
- package/lib-es/generated/transaction.js +2 -0
- package/lib-es/generated/transaction.js.map +1 -1
- package/lib-es/generated/types.d.ts +5 -4
- package/lib-es/generated/types.d.ts.map +1 -1
- package/lib-es/generated/walletApiAdapter.d.ts +1 -1
- package/lib-es/hw/actions/app.d.ts.map +1 -1
- package/lib-es/hw/actions/app.js.map +1 -1
- package/lib-es/hw/getDeviceNameMaxLength.d.ts.map +1 -1
- package/lib-es/hw/getDeviceNameMaxLength.js +2 -0
- package/lib-es/hw/getDeviceNameMaxLength.js.map +1 -1
- package/lib-es/hw/getDeviceNameMaxLength.test.js +12 -0
- package/lib-es/hw/getDeviceNameMaxLength.test.js.map +1 -1
- package/lib-es/modularDrawer/data/state-manager/api.d.ts.map +1 -1
- package/lib-es/modularDrawer/data/state-manager/api.js +3 -2
- package/lib-es/modularDrawer/data/state-manager/api.js.map +1 -1
- package/lib-es/modularDrawer/data/state-manager/types.d.ts +1 -0
- package/lib-es/modularDrawer/data/state-manager/types.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +3 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.js +6 -3
- package/lib-es/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useSearch.d.ts +16 -0
- package/lib-es/modularDrawer/hooks/useSearch.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useSearch.js +20 -0
- package/lib-es/modularDrawer/hooks/useSearch.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts +16 -1
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.js +31 -7
- package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.js +86 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js +13 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
- package/lib-es/wallet-api/ACRE/server.d.ts +13 -6
- package/lib-es/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib-es/wallet-api/ACRE/server.js +140 -2
- package/lib-es/wallet-api/ACRE/server.js.map +1 -1
- package/lib-es/wallet-api/ACRE/server.test.d.ts +2 -0
- package/lib-es/wallet-api/ACRE/server.test.d.ts.map +1 -0
- package/lib-es/wallet-api/ACRE/server.test.js +388 -0
- package/lib-es/wallet-api/ACRE/server.test.js.map +1 -0
- package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +16 -13
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/package.json +55 -52
- package/src/__tests__/test-helpers/environment.ts +1 -0
- package/src/apps/inlineAppInstall.ts +1 -4
- package/src/apps/react.ts +1 -3
- package/src/apps/runner.ts +1 -8
- package/src/bridge/crypto-assets/index.test.ts +0 -47
- package/src/bridge/crypto-assets/index.ts +0 -5
- package/src/bridge/generic-alpaca/accountBridge.ts +8 -3
- package/src/bridge/generic-alpaca/alpaca/index.ts +13 -18
- package/src/bridge/generic-alpaca/alpaca/index.unit.test.ts +38 -10
- package/src/bridge/generic-alpaca/createTransaction.ts +9 -1
- package/src/bridge/generic-alpaca/currencyBridge.ts +8 -2
- package/src/bridge/generic-alpaca/getAccountShape.ts +4 -5
- package/src/bridge/generic-alpaca/signer/Eth.ts +70 -0
- package/src/bridge/generic-alpaca/signer/index.ts +5 -15
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +4 -3
- package/src/bridge/generic-alpaca/signer/types.ts +14 -0
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +173 -0
- package/src/bridge/generic-alpaca/utils.test.ts +29 -1
- package/src/bridge/generic-alpaca/utils.ts +15 -0
- package/src/config/sharedConfig.ts +4 -0
- package/src/e2e/enum/Account.ts +14 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +2 -0
- package/src/e2e/enum/DeviceLabels.ts +1 -0
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/families/kaspa.ts +17 -0
- package/src/e2e/speculos.ts +13 -0
- package/src/exchange/swap/transactionStrategies.ts +121 -73
- package/src/families/canton/bridge/mock-data.ts +175 -0
- package/src/families/canton/bridge/mock.ts +180 -0
- package/src/families/canton/config.ts +7 -7
- package/src/families/canton/setup.ts +11 -7
- package/src/families/evm/config.ts +2 -2
- package/src/families/kaspa/__snapshots__/bridge.integration.test.ts.snap +66 -0
- package/src/families/kaspa/bridge.integration.test.ts +5 -0
- package/src/families/kaspa/config.ts +12 -0
- package/src/families/kaspa/react.ts +19 -0
- package/src/families/kaspa/setup.ts +27 -0
- package/src/families/kaspa/types.ts +1 -0
- package/src/featureFlags/defaultFeatures.ts +4 -3
- package/src/generated/bridge/js.ts +2 -0
- package/src/generated/bridge/mock.ts +2 -0
- package/src/generated/cli-transaction.ts +2 -0
- package/src/generated/deviceTransactionConfig.ts +2 -0
- package/src/generated/hw-getAddress.ts +2 -0
- package/src/generated/transaction.ts +2 -0
- package/src/generated/types.ts +10 -0
- package/src/hw/actions/app.ts +0 -1
- package/src/hw/getDeviceNameMaxLength.test.ts +16 -0
- package/src/hw/getDeviceNameMaxLength.ts +2 -0
- package/src/modularDrawer/data/state-manager/api.ts +4 -2
- package/src/modularDrawer/data/state-manager/types.ts +1 -0
- package/src/modularDrawer/hooks/useAssetsData.ts +24 -9
- package/src/modularDrawer/hooks/useSearch.ts +52 -0
- package/src/notifications/ServiceStatusProvider/index.test.ts +102 -0
- package/src/notifications/ServiceStatusProvider/index.tsx +37 -12
- package/src/notifications/ServiceStatusProvider/ledger-components.ts +12 -0
- package/src/wallet-api/ACRE/server.test.ts +470 -0
- package/src/wallet-api/ACRE/server.ts +202 -14
- package/src/wallet-api/Exchange/server.ts +17 -14
- package/lib/bridge/crypto-assets/cal-integration.d.ts +0 -4
- package/lib/bridge/crypto-assets/cal-integration.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-integration.js +0 -26
- package/lib/bridge/crypto-assets/cal-integration.js.map +0 -1
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts +0 -2
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-integration.test.js +0 -45
- package/lib/bridge/crypto-assets/cal-integration.test.js.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.d.ts +0 -14
- package/lib/bridge/crypto-assets/cal-store.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.js +0 -58
- package/lib/bridge/crypto-assets/cal-store.js.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.test.d.ts +0 -2
- package/lib/bridge/crypto-assets/cal-store.test.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.test.js +0 -70
- package/lib/bridge/crypto-assets/cal-store.test.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts +0 -4
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.js +0 -21
- package/lib-es/bridge/crypto-assets/cal-integration.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts +0 -2
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.test.js +0 -43
- package/lib-es/bridge/crypto-assets/cal-integration.test.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.d.ts +0 -14
- package/lib-es/bridge/crypto-assets/cal-store.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.js +0 -54
- package/lib-es/bridge/crypto-assets/cal-store.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts +0 -2
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.test.js +0 -68
- package/lib-es/bridge/crypto-assets/cal-store.test.js.map +0 -1
- package/src/bridge/crypto-assets/cal-integration.test.ts +0 -53
- package/src/bridge/crypto-assets/cal-integration.ts +0 -23
- package/src/bridge/crypto-assets/cal-store.test.ts +0 -93
- package/src/bridge/crypto-assets/cal-store.ts +0 -63
@@ -0,0 +1,102 @@
|
|
1
|
+
import { filterServiceStatusIncidents } from "./index";
|
2
|
+
import { LEDGER_COMPONENTS } from "./ledger-components";
|
3
|
+
import type { Incident } from "./types";
|
4
|
+
|
5
|
+
const makeIncident = (overrides: Partial<Incident> = {}): Incident => ({
|
6
|
+
created_at: "2025-01-01T00:00:00Z",
|
7
|
+
id: Math.random().toString(16).slice(2),
|
8
|
+
impact: "minor",
|
9
|
+
incident_updates: [],
|
10
|
+
monitoring_at: null,
|
11
|
+
name: "Test incident",
|
12
|
+
page_id: null,
|
13
|
+
resolved_at: null,
|
14
|
+
shortlink: null,
|
15
|
+
status: "investigating",
|
16
|
+
updated_at: null,
|
17
|
+
...overrides,
|
18
|
+
});
|
19
|
+
|
20
|
+
describe("filterServiceStatusIncidents", () => {
|
21
|
+
it("returns empty when no tickers or no incidents", () => {
|
22
|
+
expect(filterServiceStatusIncidents([], ["BTC"]).length).toBe(0);
|
23
|
+
expect(filterServiceStatusIncidents([makeIncident()], []).length).toBe(0);
|
24
|
+
});
|
25
|
+
|
26
|
+
it("matches incidents with known Ledger components (case-insensitive)", () => {
|
27
|
+
const incidents: Incident[] = [
|
28
|
+
makeIncident({ components: [{ id: "1", name: "Ledger Application Store" }] }),
|
29
|
+
makeIncident({ components: [{ id: "2", name: "ledger appliCAtion store" }] }),
|
30
|
+
makeIncident({ components: [{ id: "3", name: "Unknown Component" }] }),
|
31
|
+
];
|
32
|
+
|
33
|
+
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
34
|
+
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
35
|
+
});
|
36
|
+
|
37
|
+
it("matches incidents if a component contains a tracked ticker as a whole word (case-insensitive)", () => {
|
38
|
+
const incidents: Incident[] = [
|
39
|
+
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
40
|
+
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
41
|
+
makeIncident({ components: [{ id: "3", name: "TETHER Service" }] }),
|
42
|
+
makeIncident({ components: [{ id: "4", name: "NOTBTCService" }] }),
|
43
|
+
];
|
44
|
+
|
45
|
+
const result = filterServiceStatusIncidents(incidents, ["BTC", "ETH"]);
|
46
|
+
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
47
|
+
});
|
48
|
+
|
49
|
+
it("includes incidents with no components array or empty array", () => {
|
50
|
+
const incidents: Incident[] = [
|
51
|
+
makeIncident({ components: undefined }),
|
52
|
+
makeIncident({ components: [] }),
|
53
|
+
];
|
54
|
+
|
55
|
+
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
56
|
+
expect(result.length).toBe(2);
|
57
|
+
});
|
58
|
+
|
59
|
+
it("escapes tickers so special regex characters do not break matching", () => {
|
60
|
+
const incidents: Incident[] = [
|
61
|
+
makeIncident({ components: [{ id: "1", name: "USDT Node" }] }),
|
62
|
+
makeIncident({ components: [{ id: "2", name: "US.DT Node" }] }),
|
63
|
+
makeIncident({ components: [{ id: "3", name: "(USDT) Node" }] }),
|
64
|
+
makeIncident({ components: [{ id: "4", name: "Ethereum Node" }] }),
|
65
|
+
makeIncident({ components: [{ id: "5", name: "Ethereum (ETH) swap issue" }] }),
|
66
|
+
];
|
67
|
+
|
68
|
+
const result = filterServiceStatusIncidents(incidents, ["USDT", "ETH"]);
|
69
|
+
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "3", "5"]);
|
70
|
+
expect(result.length).toBe(3);
|
71
|
+
});
|
72
|
+
|
73
|
+
it("matches incidents for all known Ledger components", () => {
|
74
|
+
const incidents: Incident[] = LEDGER_COMPONENTS.map((name, index) =>
|
75
|
+
makeIncident({ components: [{ id: `${index + 1}`, name }] }),
|
76
|
+
);
|
77
|
+
|
78
|
+
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
79
|
+
expect(result.length).toBe(LEDGER_COMPONENTS.length);
|
80
|
+
});
|
81
|
+
|
82
|
+
it("filters correctly with common tickers", () => {
|
83
|
+
const tickers = ["XRP", "SOL", "ETH", "BTC", "ADA", "USDC", "USDT"];
|
84
|
+
const incidents: Incident[] = [
|
85
|
+
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
86
|
+
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
87
|
+
makeIncident({ components: [{ id: "3", name: "ADA-Service" }] }),
|
88
|
+
makeIncident({ components: [{ id: "4", name: "usdc gateway" }] }),
|
89
|
+
makeIncident({ components: [{ id: "5", name: "NOTUSDTService" }] }),
|
90
|
+
makeIncident({ components: [{ id: "6", name: "USDT" }] }),
|
91
|
+
makeIncident({ components: [{ id: "7", name: "xrp relayer" }] }),
|
92
|
+
makeIncident({ components: [{ id: "8", name: "SOL Node" }] }),
|
93
|
+
makeIncident({ components: [{ id: "9", name: "SOLANA Node" }] }),
|
94
|
+
makeIncident({ components: [{ id: "10", name: "Random Service" }] }),
|
95
|
+
makeIncident({ components: [] }),
|
96
|
+
];
|
97
|
+
|
98
|
+
const result = filterServiceStatusIncidents(incidents, tickers);
|
99
|
+
expect(result.map(i => i.components?.[0]?.id)).toEqual(["1", "2", "3", "4", "6", "7", "8"]);
|
100
|
+
expect(result.length).toBe(8);
|
101
|
+
});
|
102
|
+
});
|
@@ -4,6 +4,7 @@ import defaultNetworkApi from "./api";
|
|
4
4
|
import { fromPromise } from "xstate";
|
5
5
|
import { useMachine } from "@xstate/react";
|
6
6
|
import { serviceStatusMachine } from "./machine";
|
7
|
+
import { LEDGER_COMPONENTS } from "./ledger-components";
|
7
8
|
type Props = {
|
8
9
|
children: React.ReactNode;
|
9
10
|
autoUpdateDelay: number;
|
@@ -33,27 +34,51 @@ function escapeRegExp(string) {
|
|
33
34
|
return string.replace(/[.*+?^${}()[\]\\]/g, "\\$&"); // $& means the whole matched string
|
34
35
|
}
|
35
36
|
|
37
|
+
function sanitizeName(name: string): string {
|
38
|
+
return name.toLowerCase().trim().replace(/\s+/g, " "); // collapse multiple spaces
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Filters service status incidents based on related tickers or Ledger components.
|
43
|
+
*
|
44
|
+
* ## Behavior:
|
45
|
+
* - If there are no `tickers` or no `incidents`, returns an empty list.
|
46
|
+
* - For each incident:
|
47
|
+
* 1. ✅ If the incident has no components → keep it (always relevant).
|
48
|
+
* 2. ✅ If at least one component name matches a known **Ledger component** → keep it.
|
49
|
+
* 3. ✅ If at least one component name contains a **currency ticker** → keep it.
|
50
|
+
* 4. ❌ Otherwise, the incident is discarded.
|
51
|
+
*
|
52
|
+
* @param {Incident[]} [incidents=[]] - List of incidents to filter.
|
53
|
+
* @param {string[]} [tickers=[]] - List of currency tickers to match against incident components.
|
54
|
+
* @returns {Incident[]} The list of incidents relevant to the provided tickers or Ledger components.
|
55
|
+
*/
|
56
|
+
|
36
57
|
export function filterServiceStatusIncidents(
|
37
|
-
incidents: Incident[],
|
58
|
+
incidents: Incident[] = [],
|
38
59
|
tickers: string[] = [],
|
39
60
|
): Incident[] {
|
40
|
-
if (!tickers
|
41
|
-
|
42
|
-
}
|
43
|
-
|
44
|
-
const
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
61
|
+
if (!tickers.length || !incidents.length) return [];
|
62
|
+
|
63
|
+
const tickerRegex = new RegExp(`\\b(${tickers.map(escapeRegExp).join("|")})\\b`, "i");
|
64
|
+
|
65
|
+
const ledgerComponentsSet = new Set(LEDGER_COMPONENTS.map(component => sanitizeName(component)));
|
66
|
+
|
67
|
+
return incidents.filter(({ components }) => {
|
68
|
+
if (!components?.length) return true;
|
69
|
+
|
70
|
+
return components.some(({ name }) => {
|
71
|
+
const sanitizedName = sanitizeName(name);
|
72
|
+
return ledgerComponentsSet.has(sanitizedName) || tickerRegex.test(sanitizedName);
|
73
|
+
});
|
74
|
+
});
|
51
75
|
}
|
52
76
|
|
53
77
|
// filter out service status incidents by given currencies or fallback on context currencies
|
54
78
|
export function useFilteredServiceStatus(filters?: ServiceStatusUserSettings): StatusContextType {
|
55
79
|
const stateData = useContext(ServiceStatusContext);
|
56
80
|
const { incidents, context } = stateData;
|
81
|
+
|
57
82
|
const filteredIncidents = useMemo(() => {
|
58
83
|
return filterServiceStatusIncidents(incidents, filters?.tickers || context?.tickers);
|
59
84
|
}, [incidents, context, filters?.tickers]);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export const LEDGER_COMPONENTS = [
|
2
|
+
"Ledger Application Store",
|
3
|
+
"Ledger Live Security Services",
|
4
|
+
"Swap API",
|
5
|
+
"Buy",
|
6
|
+
"Earn Dashboard",
|
7
|
+
"Crypto Assets Service",
|
8
|
+
"Cloud Sync",
|
9
|
+
"Trustchain",
|
10
|
+
"Loyalty Program",
|
11
|
+
"Card Program",
|
12
|
+
] as const;
|
@@ -0,0 +1,470 @@
|
|
1
|
+
import { handlers } from "./server";
|
2
|
+
import { Account } from "@ledgerhq/types-live";
|
3
|
+
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
4
|
+
import BigNumber from "bignumber.js";
|
5
|
+
import { AppPlatform, AppBranch, Visibility } from "../types";
|
6
|
+
|
7
|
+
// Mock dependencies
|
8
|
+
jest.mock("@ledgerhq/wallet-api-server", () => ({
|
9
|
+
RPCHandler: jest.fn(),
|
10
|
+
customWrapper: jest.fn(handler => handler),
|
11
|
+
}));
|
12
|
+
|
13
|
+
jest.mock("@ledgerhq/cryptoassets", () => ({
|
14
|
+
findTokenById: jest.fn(),
|
15
|
+
findTokenByAddressInCurrency: jest.fn(),
|
16
|
+
getCryptoCurrencyById: jest.fn(),
|
17
|
+
}));
|
18
|
+
|
19
|
+
jest.mock("../converters", () => ({
|
20
|
+
getAccountIdFromWalletAccountId: jest.fn(),
|
21
|
+
getWalletAPITransactionSignFlowInfos: jest.fn(),
|
22
|
+
}));
|
23
|
+
|
24
|
+
jest.mock("../../bridge", () => ({
|
25
|
+
getAccountBridge: jest.fn(),
|
26
|
+
}));
|
27
|
+
|
28
|
+
jest.mock("@ledgerhq/live-env", () => ({
|
29
|
+
getEnv: jest.fn(),
|
30
|
+
}));
|
31
|
+
|
32
|
+
// Mock types
|
33
|
+
const mockTracking = {
|
34
|
+
signMessageRequested: jest.fn(),
|
35
|
+
signMessageSuccess: jest.fn(),
|
36
|
+
signMessageFail: jest.fn(),
|
37
|
+
signMessageNoParams: jest.fn(),
|
38
|
+
signMessageUserRefused: jest.fn(),
|
39
|
+
signTransactionRequested: jest.fn(),
|
40
|
+
signTransactionSuccess: jest.fn(),
|
41
|
+
signTransactionFail: jest.fn(),
|
42
|
+
signTransactionNoParams: jest.fn(),
|
43
|
+
signTransactionAndBroadcastNoParams: jest.fn(),
|
44
|
+
broadcastSuccess: jest.fn(),
|
45
|
+
broadcastFail: jest.fn(),
|
46
|
+
broadcastOperationDetailsClick: jest.fn(),
|
47
|
+
};
|
48
|
+
|
49
|
+
const mockManifest = {
|
50
|
+
id: "test-manifest",
|
51
|
+
name: "Test App",
|
52
|
+
url: "https://test.app",
|
53
|
+
homepageUrl: "https://test.app",
|
54
|
+
icon: "data:image/png;base64,test",
|
55
|
+
apiVersion: "1.0.0",
|
56
|
+
permissions: [],
|
57
|
+
domains: [],
|
58
|
+
categories: [],
|
59
|
+
platforms: ["desktop", "ios"] as AppPlatform[],
|
60
|
+
manifestVersion: "1.0.0",
|
61
|
+
branch: "stable" as AppBranch,
|
62
|
+
currencies: [],
|
63
|
+
visibility: "complete" as Visibility,
|
64
|
+
content: {
|
65
|
+
shortDescription: { en: "Test app" },
|
66
|
+
description: { en: "Test app description" },
|
67
|
+
},
|
68
|
+
};
|
69
|
+
|
70
|
+
const mockEthereumCurrency: CryptoCurrency = {
|
71
|
+
type: "CryptoCurrency",
|
72
|
+
id: "ethereum",
|
73
|
+
coinType: 60,
|
74
|
+
name: "Ethereum",
|
75
|
+
managerAppName: "Ethereum",
|
76
|
+
ticker: "ETH",
|
77
|
+
scheme: "ethereum",
|
78
|
+
color: "#0ebdcd",
|
79
|
+
symbol: "Ξ",
|
80
|
+
family: "evm",
|
81
|
+
blockAvgTime: 15,
|
82
|
+
units: [
|
83
|
+
{
|
84
|
+
name: "ether",
|
85
|
+
code: "ETH",
|
86
|
+
magnitude: 18,
|
87
|
+
},
|
88
|
+
],
|
89
|
+
keywords: ["eth", "ethereum"],
|
90
|
+
explorerViews: [],
|
91
|
+
explorerId: "eth",
|
92
|
+
};
|
93
|
+
|
94
|
+
const mockTokenCurrency: TokenCurrency = {
|
95
|
+
type: "TokenCurrency",
|
96
|
+
id: "ethereum/erc20/acre_btc",
|
97
|
+
contractAddress: "0x1234567890123456789012345678901234567890",
|
98
|
+
parentCurrency: mockEthereumCurrency,
|
99
|
+
tokenType: "erc20",
|
100
|
+
name: "ACRE Bitcoin",
|
101
|
+
ticker: "acreBTC",
|
102
|
+
units: [
|
103
|
+
{
|
104
|
+
name: "ACRE Bitcoin",
|
105
|
+
code: "acreBTC",
|
106
|
+
magnitude: 8,
|
107
|
+
},
|
108
|
+
],
|
109
|
+
};
|
110
|
+
|
111
|
+
const mockAccount: Account = {
|
112
|
+
type: "Account",
|
113
|
+
id: "js:2:ethereum:0x1234567890123456789012345678901234567890:ethereum",
|
114
|
+
seedIdentifier: "0x1234567890123456789012345678901234567890",
|
115
|
+
derivationMode: "",
|
116
|
+
index: 0,
|
117
|
+
freshAddress: "0x1234567890123456789012345678901234567890",
|
118
|
+
freshAddressPath: "44'/60'/0'/0/0",
|
119
|
+
used: false,
|
120
|
+
blockHeight: 0,
|
121
|
+
creationDate: new Date(),
|
122
|
+
balance: new BigNumber(0),
|
123
|
+
spendableBalance: new BigNumber(0),
|
124
|
+
operationsCount: 0,
|
125
|
+
operations: [],
|
126
|
+
pendingOperations: [],
|
127
|
+
currency: mockEthereumCurrency,
|
128
|
+
lastSyncDate: new Date(),
|
129
|
+
swapHistory: [],
|
130
|
+
balanceHistoryCache: {
|
131
|
+
HOUR: { latestDate: null, balances: [] },
|
132
|
+
DAY: { latestDate: null, balances: [] },
|
133
|
+
WEEK: { latestDate: null, balances: [] },
|
134
|
+
},
|
135
|
+
syncHash: "0x00000000",
|
136
|
+
subAccounts: [],
|
137
|
+
nfts: [],
|
138
|
+
};
|
139
|
+
|
140
|
+
jest.mock("@ledgerhq/coin-framework/account/index", () => ({
|
141
|
+
getParentAccount: jest.fn(),
|
142
|
+
getMainAccount: jest.fn(),
|
143
|
+
makeEmptyTokenAccount: jest.fn(),
|
144
|
+
isTokenAccount: jest.fn(),
|
145
|
+
}));
|
146
|
+
|
147
|
+
describe("ACRE Server Handlers", () => {
|
148
|
+
let mockUiHooks: any;
|
149
|
+
let serverHandlers: any;
|
150
|
+
|
151
|
+
beforeEach(() => {
|
152
|
+
jest.clearAllMocks();
|
153
|
+
mockUiHooks = {
|
154
|
+
"custom.acre.messageSign": jest.fn().mockImplementation(({ onSuccess }) => {
|
155
|
+
onSuccess("0x1234567890abcdef");
|
156
|
+
}),
|
157
|
+
"custom.acre.transactionSign": jest.fn().mockImplementation(({ onSuccess }) => {
|
158
|
+
onSuccess({
|
159
|
+
operation: { hash: "0x1234567890abcdef" },
|
160
|
+
signature: "0xabcdef1234567890",
|
161
|
+
});
|
162
|
+
}),
|
163
|
+
"custom.acre.transactionBroadcast": jest.fn(),
|
164
|
+
"custom.acre.registerAccount": jest.fn().mockImplementation(({ onSuccess }) => {
|
165
|
+
onSuccess();
|
166
|
+
}),
|
167
|
+
};
|
168
|
+
|
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
|
+
// Mock the account functions
|
176
|
+
const { makeEmptyTokenAccount, getMainAccount, getParentAccount } = jest.requireMock(
|
177
|
+
"@ledgerhq/coin-framework/account/index",
|
178
|
+
);
|
179
|
+
makeEmptyTokenAccount.mockReturnValue({
|
180
|
+
type: "TokenAccount",
|
181
|
+
id: "mock-token-account-id",
|
182
|
+
parentId: "mock-parent-id",
|
183
|
+
token: mockTokenCurrency,
|
184
|
+
balance: new BigNumber(0),
|
185
|
+
spendableBalance: new BigNumber(0),
|
186
|
+
creationDate: new Date(),
|
187
|
+
operationsCount: 0,
|
188
|
+
operations: [],
|
189
|
+
pendingOperations: [],
|
190
|
+
balanceHistoryCache: {
|
191
|
+
HOUR: { latestDate: null, balances: [] },
|
192
|
+
DAY: { latestDate: null, balances: [] },
|
193
|
+
WEEK: { latestDate: null, balances: [] },
|
194
|
+
},
|
195
|
+
swapHistory: [],
|
196
|
+
});
|
197
|
+
getMainAccount.mockReturnValue(mockAccount);
|
198
|
+
getParentAccount.mockReturnValue(undefined);
|
199
|
+
|
200
|
+
// Mock the converter functions
|
201
|
+
const { getAccountIdFromWalletAccountId, getWalletAPITransactionSignFlowInfos } =
|
202
|
+
jest.requireMock("../converters");
|
203
|
+
getAccountIdFromWalletAccountId.mockReturnValue(
|
204
|
+
"js:2:ethereum:0x1234567890123456789012345678901234567890:ethereum",
|
205
|
+
);
|
206
|
+
getWalletAPITransactionSignFlowInfos.mockReturnValue({
|
207
|
+
canEditFees: true,
|
208
|
+
liveTx: { family: "evm" },
|
209
|
+
hasFeesProvided: true,
|
210
|
+
});
|
211
|
+
|
212
|
+
// Mock the bridge
|
213
|
+
const { getAccountBridge } = jest.requireMock("../../bridge");
|
214
|
+
getAccountBridge.mockReturnValue({
|
215
|
+
broadcast: jest.fn().mockResolvedValue({ hash: "0x1234567890abcdef" }),
|
216
|
+
});
|
217
|
+
|
218
|
+
serverHandlers = handlers({
|
219
|
+
accounts: [mockAccount],
|
220
|
+
tracking: mockTracking,
|
221
|
+
manifest: mockManifest,
|
222
|
+
uiHooks: mockUiHooks,
|
223
|
+
});
|
224
|
+
});
|
225
|
+
|
226
|
+
describe("custom.acre.messageSign", () => {
|
227
|
+
it("should handle message signing request successfully", async () => {
|
228
|
+
const mockParams = {
|
229
|
+
accountId: "test-account-id",
|
230
|
+
message: { type: "SignIn", message: "test" },
|
231
|
+
derivationPath: "0/0",
|
232
|
+
options: { hwAppId: "test-app" },
|
233
|
+
meta: { test: "data" },
|
234
|
+
};
|
235
|
+
|
236
|
+
const mockSignature = "0x1234567890abcdef";
|
237
|
+
mockUiHooks["custom.acre.messageSign"].mockImplementation(({ onSuccess }) => {
|
238
|
+
onSuccess(mockSignature);
|
239
|
+
});
|
240
|
+
|
241
|
+
const result = await serverHandlers["custom.acre.messageSign"](mockParams);
|
242
|
+
|
243
|
+
expect(result).toEqual({
|
244
|
+
hexSignedMessage: "1234567890abcdef",
|
245
|
+
});
|
246
|
+
expect(mockTracking.signMessageRequested).toHaveBeenCalledWith(mockManifest);
|
247
|
+
expect(mockTracking.signMessageSuccess).toHaveBeenCalledWith(mockManifest);
|
248
|
+
});
|
249
|
+
|
250
|
+
it("should handle missing parameters", async () => {
|
251
|
+
const result = await serverHandlers["custom.acre.messageSign"](null);
|
252
|
+
|
253
|
+
expect(result).toEqual({
|
254
|
+
hexSignedMessage: "",
|
255
|
+
});
|
256
|
+
expect(mockTracking.signMessageNoParams).toHaveBeenCalledWith(mockManifest);
|
257
|
+
});
|
258
|
+
|
259
|
+
it("should handle account not found", async () => {
|
260
|
+
const mockParams = {
|
261
|
+
accountId: "non-existent-account",
|
262
|
+
message: { type: "SignIn", message: "test" },
|
263
|
+
derivationPath: "0/0",
|
264
|
+
options: {},
|
265
|
+
meta: {},
|
266
|
+
};
|
267
|
+
|
268
|
+
// Mock getAccountIdFromWalletAccountId to return null for non-existent account
|
269
|
+
const { getAccountIdFromWalletAccountId } = jest.requireMock("../converters");
|
270
|
+
getAccountIdFromWalletAccountId.mockReturnValueOnce(null);
|
271
|
+
|
272
|
+
await expect(serverHandlers["custom.acre.messageSign"](mockParams)).rejects.toThrow(
|
273
|
+
"accountId non-existent-account unknown",
|
274
|
+
);
|
275
|
+
});
|
276
|
+
});
|
277
|
+
|
278
|
+
describe("custom.acre.transactionSign", () => {
|
279
|
+
it("should handle transaction signing request successfully", async () => {
|
280
|
+
const mockParams = {
|
281
|
+
accountId: "test-account-id",
|
282
|
+
rawTransaction: "0x1234567890abcdef",
|
283
|
+
options: { hwAppId: "test-app" },
|
284
|
+
meta: { test: "data" },
|
285
|
+
tokenCurrency: "ethereum/erc20/test",
|
286
|
+
};
|
287
|
+
|
288
|
+
const mockSignedOperation = {
|
289
|
+
operation: { hash: "0x1234567890abcdef" },
|
290
|
+
signature: "0xabcdef1234567890",
|
291
|
+
};
|
292
|
+
|
293
|
+
mockUiHooks["custom.acre.transactionSign"].mockImplementation(({ onSuccess }) => {
|
294
|
+
onSuccess(mockSignedOperation);
|
295
|
+
});
|
296
|
+
|
297
|
+
const result = await serverHandlers["custom.acre.transactionSign"](mockParams);
|
298
|
+
|
299
|
+
expect(result).toEqual({
|
300
|
+
signedTransactionHex: "307861626364656631323334353637383930",
|
301
|
+
});
|
302
|
+
expect(mockTracking.signTransactionRequested).toHaveBeenCalledWith(mockManifest);
|
303
|
+
expect(mockTracking.signTransactionSuccess).toHaveBeenCalledWith(mockManifest);
|
304
|
+
});
|
305
|
+
|
306
|
+
it("should handle missing parameters", async () => {
|
307
|
+
const result = await serverHandlers["custom.acre.transactionSign"](null);
|
308
|
+
|
309
|
+
expect(result).toEqual({
|
310
|
+
signedTransactionHex: "",
|
311
|
+
});
|
312
|
+
expect(mockTracking.signTransactionNoParams).toHaveBeenCalledWith(mockManifest);
|
313
|
+
});
|
314
|
+
});
|
315
|
+
|
316
|
+
describe("custom.acre.transactionSignAndBroadcast", () => {
|
317
|
+
it("should handle transaction sign and broadcast successfully", async () => {
|
318
|
+
const mockParams = {
|
319
|
+
accountId: "test-account-id",
|
320
|
+
rawTransaction: "0x1234567890abcdef",
|
321
|
+
options: { hwAppId: "test-app" },
|
322
|
+
meta: { test: "data" },
|
323
|
+
tokenCurrency: "ethereum/erc20/test",
|
324
|
+
};
|
325
|
+
|
326
|
+
const mockSignedOperation = {
|
327
|
+
operation: { hash: "0x1234567890abcdef" },
|
328
|
+
signature: "0xabcdef1234567890",
|
329
|
+
};
|
330
|
+
|
331
|
+
mockUiHooks["custom.acre.transactionSign"].mockImplementation(({ onSuccess }) => {
|
332
|
+
onSuccess(mockSignedOperation);
|
333
|
+
});
|
334
|
+
|
335
|
+
const result = await serverHandlers["custom.acre.transactionSignAndBroadcast"](mockParams);
|
336
|
+
|
337
|
+
expect(result).toEqual({
|
338
|
+
transactionHash: "0x1234567890abcdef",
|
339
|
+
});
|
340
|
+
});
|
341
|
+
|
342
|
+
it("should handle missing parameters", async () => {
|
343
|
+
const result = await serverHandlers["custom.acre.transactionSignAndBroadcast"](null);
|
344
|
+
|
345
|
+
expect(result).toEqual({
|
346
|
+
transactionHash: "",
|
347
|
+
});
|
348
|
+
expect(mockTracking.signTransactionAndBroadcastNoParams).toHaveBeenCalledWith(mockManifest);
|
349
|
+
});
|
350
|
+
});
|
351
|
+
|
352
|
+
describe("custom.acre.registerYieldBearingEthereumAddress", () => {
|
353
|
+
const mockParams = {
|
354
|
+
ethereumAddress: "0x9876543210987654321098765432109876543210",
|
355
|
+
tokenContractAddress: "0x1234567890123456789012345678901234567890",
|
356
|
+
meta: { test: "data" },
|
357
|
+
};
|
358
|
+
|
359
|
+
it("should register new yield-bearing Ethereum address successfully on mobile", async () => {
|
360
|
+
const result =
|
361
|
+
await serverHandlers["custom.acre.registerYieldBearingEthereumAddress"](mockParams);
|
362
|
+
|
363
|
+
expect(result.success).toBe(true);
|
364
|
+
expect(result.accountName).toBe("Yield-bearing BTC on ACRE");
|
365
|
+
expect(result.ethereumAddress).toBe(mockParams.ethereumAddress);
|
366
|
+
expect(result.tokenContractAddress).toBe(mockParams.tokenContractAddress);
|
367
|
+
|
368
|
+
// Verify UI hook was called with correct parameters
|
369
|
+
expect(mockUiHooks["custom.acre.registerAccount"]).toHaveBeenCalledWith({
|
370
|
+
parentAccount: expect.objectContaining({
|
371
|
+
type: "Account",
|
372
|
+
id: expect.stringContaining("0x9876543210987654321098765432109876543210"),
|
373
|
+
}),
|
374
|
+
accountName: "Yield-bearing BTC on ACRE",
|
375
|
+
existingAccounts: [mockAccount],
|
376
|
+
onSuccess: expect.any(Function),
|
377
|
+
onError: expect.any(Function),
|
378
|
+
});
|
379
|
+
});
|
380
|
+
|
381
|
+
it("should register new yield-bearing Ethereum address successfully on desktop", async () => {
|
382
|
+
const desktopServerHandlers = handlers({
|
383
|
+
accounts: [mockAccount],
|
384
|
+
tracking: mockTracking,
|
385
|
+
manifest: mockManifest,
|
386
|
+
uiHooks: mockUiHooks,
|
387
|
+
});
|
388
|
+
|
389
|
+
const result = await (
|
390
|
+
desktopServerHandlers["custom.acre.registerYieldBearingEthereumAddress"] as any
|
391
|
+
)(mockParams);
|
392
|
+
|
393
|
+
expect(result.success).toBe(true);
|
394
|
+
|
395
|
+
expect(mockUiHooks["custom.acre.registerAccount"]).toHaveBeenCalledWith({
|
396
|
+
parentAccount: expect.objectContaining({
|
397
|
+
type: "Account",
|
398
|
+
id: expect.stringContaining("0x9876543210987654321098765432109876543210"),
|
399
|
+
}),
|
400
|
+
accountName: "Yield-bearing BTC on ACRE",
|
401
|
+
existingAccounts: [mockAccount],
|
402
|
+
onSuccess: expect.any(Function),
|
403
|
+
onError: expect.any(Function),
|
404
|
+
});
|
405
|
+
});
|
406
|
+
|
407
|
+
it("should handle existing account gracefully", async () => {
|
408
|
+
const existingAccount = {
|
409
|
+
...mockAccount,
|
410
|
+
freshAddress: mockParams.ethereumAddress,
|
411
|
+
};
|
412
|
+
|
413
|
+
const serverHandlersWithExisting = handlers({
|
414
|
+
accounts: [existingAccount],
|
415
|
+
tracking: mockTracking,
|
416
|
+
manifest: mockManifest,
|
417
|
+
uiHooks: mockUiHooks,
|
418
|
+
});
|
419
|
+
|
420
|
+
const result = await (
|
421
|
+
serverHandlersWithExisting["custom.acre.registerYieldBearingEthereumAddress"] as any
|
422
|
+
)(mockParams);
|
423
|
+
|
424
|
+
expect(result.success).toBe(true);
|
425
|
+
expect(result.parentAccountId).toBe(existingAccount.id);
|
426
|
+
expect(result.tokenAccountId).toBe(existingAccount.id);
|
427
|
+
expect(mockUiHooks["custom.acre.registerAccount"]).not.toHaveBeenCalled();
|
428
|
+
});
|
429
|
+
|
430
|
+
it("should handle missing UI hook", async () => {
|
431
|
+
const serverHandlersWithoutHook = handlers({
|
432
|
+
accounts: [mockAccount],
|
433
|
+
tracking: mockTracking,
|
434
|
+
manifest: mockManifest,
|
435
|
+
uiHooks: {
|
436
|
+
...mockUiHooks,
|
437
|
+
"custom.acre.registerAccount": undefined,
|
438
|
+
},
|
439
|
+
});
|
440
|
+
|
441
|
+
await expect(
|
442
|
+
(serverHandlersWithoutHook["custom.acre.registerYieldBearingEthereumAddress"] as any)(
|
443
|
+
mockParams,
|
444
|
+
),
|
445
|
+
).rejects.toThrow("No account registration UI hook available");
|
446
|
+
});
|
447
|
+
|
448
|
+
it("should validate Ethereum address format", async () => {
|
449
|
+
const invalidParams = {
|
450
|
+
...mockParams,
|
451
|
+
ethereumAddress: "invalid-address",
|
452
|
+
};
|
453
|
+
|
454
|
+
await expect(
|
455
|
+
serverHandlers["custom.acre.registerYieldBearingEthereumAddress"](invalidParams),
|
456
|
+
).rejects.toThrow("Invalid Ethereum address format");
|
457
|
+
});
|
458
|
+
|
459
|
+
it("should require either tokenContractAddress or tokenTicker", async () => {
|
460
|
+
const invalidParams = {
|
461
|
+
ethereumAddress: mockParams.ethereumAddress,
|
462
|
+
meta: mockParams.meta,
|
463
|
+
};
|
464
|
+
|
465
|
+
await expect(
|
466
|
+
serverHandlers["custom.acre.registerYieldBearingEthereumAddress"](invalidParams),
|
467
|
+
).rejects.toThrow("Either tokenContractAddress or tokenTicker must be provided");
|
468
|
+
});
|
469
|
+
});
|
470
|
+
});
|