@ledgerhq/live-common 34.48.0-nightly.8 → 34.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/test-helpers/environment.js +0 -1
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/apps/inlineAppInstall.d.ts +3 -1
- 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 +2 -1
- 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 +4 -2
- package/lib/apps/runner.d.ts.map +1 -1
- package/lib/apps/runner.js +4 -3
- package/lib/apps/runner.js.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts +1 -2
- 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 +6 -10
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.unit.test.js +9 -37
- 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 +0 -8
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts +1 -2
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.js +2 -3
- 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/index.d.ts +10 -2
- 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 +3 -2
- 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 +0 -11
- package/lib/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +0 -2
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +1 -15
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.js +0 -21
- 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 +28 -30
- package/lib/config/sharedConfig.js.map +1 -1
- package/lib/e2e/enum/Account.d.ts +0 -2
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +0 -2
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +0 -1
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +0 -1
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +0 -1
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +0 -1
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Network.d.ts +1 -2
- package/lib/e2e/enum/Network.d.ts.map +1 -1
- package/lib/e2e/enum/Network.js +0 -1
- package/lib/e2e/enum/Network.js.map +1 -1
- package/lib/e2e/index.d.ts +4 -1
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +0 -12
- 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 +11 -38
- package/lib/exchange/swap/transactionStrategies.d.ts.map +1 -1
- package/lib/exchange/swap/transactionStrategies.js +47 -93
- package/lib/exchange/swap/transactionStrategies.js.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +5 -3
- 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 +5 -5
- 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/xrp/setup.d.ts +2 -2
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +2 -4
- 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 +0 -1
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +22 -24
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/bridge/mock.d.ts +1 -1
- package/lib/generated/cli-transaction.d.ts +2 -13
- package/lib/generated/cli-transaction.d.ts.map +1 -1
- package/lib/generated/cli-transaction.js +26 -28
- package/lib/generated/cli-transaction.js.map +1 -1
- package/lib/generated/deviceTransactionConfig.d.ts +0 -2
- package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/generated/deviceTransactionConfig.js +22 -24
- package/lib/generated/deviceTransactionConfig.js.map +1 -1
- package/lib/generated/hw-getAddress.d.ts +0 -1
- package/lib/generated/hw-getAddress.d.ts.map +1 -1
- package/lib/generated/hw-getAddress.js +26 -28
- 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 +3 -11
- package/lib/generated/transaction.d.ts.map +1 -1
- package/lib/generated/transaction.js +26 -28
- package/lib/generated/transaction.js.map +1 -1
- package/lib/generated/types.d.ts +4 -5
- 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 +0 -2
- package/lib/hw/getDeviceNameMaxLength.js.map +1 -1
- package/lib/hw/getDeviceNameMaxLength.test.js +0 -12
- 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 +2 -3
- package/lib/modularDrawer/data/state-manager/api.js.map +1 -1
- package/lib/modularDrawer/data/state-manager/types.d.ts +0 -1
- package/lib/modularDrawer/data/state-manager/types.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useAssetsData.d.ts +1 -3
- package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useAssetsData.js +3 -6
- package/lib/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib/wallet-api/ACRE/server.d.ts +6 -13
- package/lib/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib/wallet-api/ACRE/server.js +1 -142
- 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 +13 -16
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/__tests__/test-helpers/environment.js +0 -1
- package/lib-es/__tests__/test-helpers/environment.js.map +1 -1
- package/lib-es/apps/inlineAppInstall.d.ts +3 -1
- 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 +2 -1
- 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 +4 -2
- package/lib-es/apps/runner.d.ts.map +1 -1
- package/lib-es/apps/runner.js +4 -3
- package/lib-es/apps/runner.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts +1 -2
- 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 +6 -10
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.unit.test.js +9 -37
- 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 +0 -8
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts +1 -2
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.js +2 -3
- 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/index.d.ts +10 -2
- 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 +3 -2
- 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 +0 -11
- package/lib-es/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +0 -2
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +0 -13
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js +1 -22
- 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 +0 -2
- package/lib-es/config/sharedConfig.js.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +0 -2
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +0 -2
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +0 -1
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +0 -1
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +0 -1
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +0 -1
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Network.d.ts +1 -2
- package/lib-es/e2e/enum/Network.d.ts.map +1 -1
- package/lib-es/e2e/enum/Network.js +0 -1
- package/lib-es/e2e/enum/Network.js.map +1 -1
- package/lib-es/e2e/index.d.ts +4 -1
- 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 +0 -12
- 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 +11 -38
- package/lib-es/exchange/swap/transactionStrategies.d.ts.map +1 -1
- package/lib-es/exchange/swap/transactionStrategies.js +44 -87
- package/lib-es/exchange/swap/transactionStrategies.js.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +5 -3
- 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 +5 -5
- 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/xrp/setup.d.ts +2 -2
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +2 -4
- 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 +0 -1
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +0 -2
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/generated/bridge/mock.d.ts +1 -1
- package/lib-es/generated/cli-transaction.d.ts +2 -13
- package/lib-es/generated/cli-transaction.d.ts.map +1 -1
- package/lib-es/generated/cli-transaction.js +0 -2
- package/lib-es/generated/cli-transaction.js.map +1 -1
- package/lib-es/generated/deviceTransactionConfig.d.ts +0 -2
- package/lib-es/generated/deviceTransactionConfig.d.ts.map +1 -1
- package/lib-es/generated/deviceTransactionConfig.js +0 -2
- package/lib-es/generated/deviceTransactionConfig.js.map +1 -1
- package/lib-es/generated/hw-getAddress.d.ts +0 -1
- package/lib-es/generated/hw-getAddress.d.ts.map +1 -1
- package/lib-es/generated/hw-getAddress.js +0 -2
- 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 +3 -11
- package/lib-es/generated/transaction.d.ts.map +1 -1
- package/lib-es/generated/transaction.js +0 -2
- package/lib-es/generated/transaction.js.map +1 -1
- package/lib-es/generated/types.d.ts +4 -5
- 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 +0 -2
- package/lib-es/hw/getDeviceNameMaxLength.js.map +1 -1
- package/lib-es/hw/getDeviceNameMaxLength.test.js +0 -12
- 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 +2 -3
- package/lib-es/modularDrawer/data/state-manager/api.js.map +1 -1
- package/lib-es/modularDrawer/data/state-manager/types.d.ts +0 -1
- package/lib-es/modularDrawer/data/state-manager/types.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +1 -3
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.js +3 -6
- package/lib-es/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib-es/wallet-api/ACRE/server.d.ts +6 -13
- package/lib-es/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib-es/wallet-api/ACRE/server.js +2 -140
- 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 +13 -16
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/package.json +53 -56
- package/src/__tests__/test-helpers/environment.ts +0 -1
- package/src/apps/inlineAppInstall.ts +4 -1
- package/src/apps/react.ts +3 -1
- package/src/apps/runner.ts +8 -1
- package/src/bridge/generic-alpaca/accountBridge.ts +3 -8
- package/src/bridge/generic-alpaca/alpaca/index.ts +18 -13
- package/src/bridge/generic-alpaca/alpaca/index.unit.test.ts +10 -38
- package/src/bridge/generic-alpaca/createTransaction.ts +1 -9
- package/src/bridge/generic-alpaca/currencyBridge.ts +2 -8
- package/src/bridge/generic-alpaca/getAccountShape.ts +5 -4
- package/src/bridge/generic-alpaca/signer/index.ts +15 -5
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +3 -4
- package/src/bridge/generic-alpaca/signer/types.ts +0 -14
- package/src/bridge/generic-alpaca/utils.test.ts +1 -29
- package/src/bridge/generic-alpaca/utils.ts +0 -15
- package/src/config/sharedConfig.ts +0 -2
- package/src/e2e/enum/Account.ts +0 -14
- package/src/e2e/enum/AppInfos.ts +0 -2
- package/src/e2e/enum/Currency.ts +0 -2
- package/src/e2e/enum/Network.ts +0 -1
- package/src/e2e/speculos.ts +0 -12
- package/src/exchange/swap/transactionStrategies.ts +73 -121
- package/src/families/canton/config.ts +6 -3
- package/src/families/canton/setup.ts +5 -6
- package/src/families/evm/config.ts +2 -2
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +2 -2
- package/src/featureFlags/defaultFeatures.ts +2 -4
- package/src/generated/bridge/js.ts +0 -2
- package/src/generated/cli-transaction.ts +0 -2
- package/src/generated/deviceTransactionConfig.ts +0 -2
- package/src/generated/hw-getAddress.ts +0 -2
- package/src/generated/transaction.ts +0 -2
- package/src/generated/types.ts +0 -10
- package/src/hw/actions/app.ts +1 -0
- package/src/hw/getDeviceNameMaxLength.test.ts +0 -16
- package/src/hw/getDeviceNameMaxLength.ts +0 -2
- package/src/modularDrawer/data/state-manager/api.ts +2 -4
- package/src/modularDrawer/data/state-manager/types.ts +0 -1
- package/src/modularDrawer/hooks/useAssetsData.ts +9 -24
- package/src/wallet-api/ACRE/server.ts +14 -202
- package/src/wallet-api/Exchange/server.ts +14 -17
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts +0 -8
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts.map +0 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js +0 -51
- package/lib/bridge/generic-alpaca/signer/Eth.js.map +0 -1
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.d.ts +0 -2
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.d.ts.map +0 -1
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js +0 -144
- package/lib/bridge/generic-alpaca/tests/getAccountShape.test.js.map +0 -1
- package/lib/e2e/families/kaspa.d.ts +0 -4
- package/lib/e2e/families/kaspa.d.ts.map +0 -1
- package/lib/e2e/families/kaspa.js +0 -23
- package/lib/e2e/families/kaspa.js.map +0 -1
- package/lib/families/kaspa/bridge.integration.test.d.ts +0 -2
- package/lib/families/kaspa/bridge.integration.test.d.ts.map +0 -1
- package/lib/families/kaspa/bridge.integration.test.js +0 -7
- package/lib/families/kaspa/bridge.integration.test.js.map +0 -1
- package/lib/families/kaspa/config.d.ts +0 -3
- package/lib/families/kaspa/config.d.ts.map +0 -1
- package/lib/families/kaspa/config.js +0 -14
- package/lib/families/kaspa/config.js.map +0 -1
- package/lib/families/kaspa/react.d.ts +0 -4
- package/lib/families/kaspa/react.d.ts.map +0 -1
- package/lib/families/kaspa/react.js +0 -18
- package/lib/families/kaspa/react.js.map +0 -1
- package/lib/families/kaspa/setup.d.ts +0 -18
- package/lib/families/kaspa/setup.d.ts.map +0 -1
- package/lib/families/kaspa/setup.js +0 -24
- package/lib/families/kaspa/setup.js.map +0 -1
- package/lib/families/kaspa/types.d.ts +0 -2
- package/lib/families/kaspa/types.d.ts.map +0 -1
- package/lib/families/kaspa/types.js +0 -18
- package/lib/families/kaspa/types.js.map +0 -1
- package/lib/modularDrawer/hooks/useSearch.d.ts +0 -16
- package/lib/modularDrawer/hooks/useSearch.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/useSearch.js +0 -24
- package/lib/modularDrawer/hooks/useSearch.js.map +0 -1
- package/lib/wallet-api/ACRE/server.test.d.ts +0 -2
- package/lib/wallet-api/ACRE/server.test.d.ts.map +0 -1
- package/lib/wallet-api/ACRE/server.test.js +0 -393
- package/lib/wallet-api/ACRE/server.test.js.map +0 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts +0 -8
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts.map +0 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.js +0 -47
- package/lib-es/bridge/generic-alpaca/signer/Eth.js.map +0 -1
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.d.ts +0 -2
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.d.ts.map +0 -1
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js +0 -139
- package/lib-es/bridge/generic-alpaca/tests/getAccountShape.test.js.map +0 -1
- package/lib-es/e2e/families/kaspa.d.ts +0 -4
- package/lib-es/e2e/families/kaspa.d.ts.map +0 -1
- package/lib-es/e2e/families/kaspa.js +0 -15
- package/lib-es/e2e/families/kaspa.js.map +0 -1
- package/lib-es/families/kaspa/bridge.integration.test.d.ts +0 -2
- package/lib-es/families/kaspa/bridge.integration.test.d.ts.map +0 -1
- package/lib-es/families/kaspa/bridge.integration.test.js +0 -5
- package/lib-es/families/kaspa/bridge.integration.test.js.map +0 -1
- package/lib-es/families/kaspa/config.d.ts +0 -3
- package/lib-es/families/kaspa/config.d.ts.map +0 -1
- package/lib-es/families/kaspa/config.js +0 -11
- package/lib-es/families/kaspa/config.js.map +0 -1
- package/lib-es/families/kaspa/react.d.ts +0 -4
- package/lib-es/families/kaspa/react.d.ts.map +0 -1
- package/lib-es/families/kaspa/react.js +0 -14
- package/lib-es/families/kaspa/react.js.map +0 -1
- package/lib-es/families/kaspa/setup.d.ts +0 -18
- package/lib-es/families/kaspa/setup.d.ts.map +0 -1
- package/lib-es/families/kaspa/setup.js +0 -16
- package/lib-es/families/kaspa/setup.js.map +0 -1
- package/lib-es/families/kaspa/types.d.ts +0 -2
- package/lib-es/families/kaspa/types.d.ts.map +0 -1
- package/lib-es/families/kaspa/types.js +0 -2
- package/lib-es/families/kaspa/types.js.map +0 -1
- package/lib-es/modularDrawer/hooks/useSearch.d.ts +0 -16
- package/lib-es/modularDrawer/hooks/useSearch.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/useSearch.js +0 -20
- package/lib-es/modularDrawer/hooks/useSearch.js.map +0 -1
- package/lib-es/wallet-api/ACRE/server.test.d.ts +0 -2
- package/lib-es/wallet-api/ACRE/server.test.d.ts.map +0 -1
- package/lib-es/wallet-api/ACRE/server.test.js +0 -388
- package/lib-es/wallet-api/ACRE/server.test.js.map +0 -1
- package/src/bridge/generic-alpaca/signer/Eth.ts +0 -70
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +0 -173
- package/src/e2e/families/kaspa.ts +0 -17
- package/src/families/kaspa/__snapshots__/bridge.integration.test.ts.snap +0 -66
- package/src/families/kaspa/bridge.integration.test.ts +0 -5
- package/src/families/kaspa/config.ts +0 -12
- package/src/families/kaspa/react.ts +0 -19
- package/src/families/kaspa/setup.ts +0 -27
- package/src/families/kaspa/types.ts +0 -1
- package/src/modularDrawer/hooks/useSearch.ts +0 -52
- package/src/wallet-api/ACRE/server.test.ts +0 -470
@@ -1,470 +0,0 @@
|
|
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
|
-
});
|