@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
@@ -1,16 +1,7 @@
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
2
2
|
|
3
|
-
import {
|
4
|
-
|
5
|
-
ElrondTransaction,
|
6
|
-
RippleTransaction,
|
7
|
-
SolanaTransaction,
|
8
|
-
StellarTransaction,
|
9
|
-
TonTransaction,
|
10
|
-
Transaction,
|
11
|
-
TransactionCommon,
|
12
|
-
} from "@ledgerhq/wallet-api-client";
|
13
|
-
|
3
|
+
import { Transaction } from "../../generated/types";
|
4
|
+
import { TransactionCommon } from "@ledgerhq/types-live";
|
14
5
|
export type { SwapLiveError } from "@ledgerhq/wallet-api-exchange-module";
|
15
6
|
|
16
7
|
export function defaultTransaction({
|
@@ -18,35 +9,81 @@ export function defaultTransaction({
|
|
18
9
|
amount,
|
19
10
|
recipient,
|
20
11
|
customFeeConfig,
|
21
|
-
}: TransactionWithCustomFee): Transaction {
|
22
|
-
|
12
|
+
}: TransactionWithCustomFee): Partial<Transaction> {
|
13
|
+
// Type assertion needed because each Transaction family has different required properties
|
14
|
+
// This function provides base properties that are then extended by family-specific functions
|
15
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
16
|
+
return {
|
23
17
|
family,
|
24
18
|
amount,
|
25
19
|
recipient,
|
26
20
|
...customFeeConfig,
|
21
|
+
} as Partial<Transaction>;
|
22
|
+
}
|
23
|
+
|
24
|
+
export function cardanoTransaction({
|
25
|
+
amount,
|
26
|
+
recipient,
|
27
|
+
customFeeConfig,
|
28
|
+
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "cardano" }>> {
|
29
|
+
return {
|
30
|
+
family: "cardano",
|
31
|
+
amount,
|
32
|
+
recipient,
|
33
|
+
mode: "send",
|
34
|
+
...customFeeConfig,
|
27
35
|
};
|
28
36
|
}
|
29
37
|
|
30
|
-
export function
|
31
|
-
family,
|
38
|
+
export function nearTransaction({
|
32
39
|
amount,
|
33
40
|
recipient,
|
34
41
|
customFeeConfig,
|
35
|
-
}: TransactionWithCustomFee): Transaction {
|
42
|
+
}: TransactionWithCustomFee): Extract<Transaction, { family: "near" }> {
|
36
43
|
return {
|
37
|
-
|
44
|
+
family: "near",
|
45
|
+
amount,
|
46
|
+
recipient,
|
38
47
|
mode: "send",
|
48
|
+
...customFeeConfig,
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
export function tezosTransaction({
|
53
|
+
amount,
|
54
|
+
recipient,
|
55
|
+
customFeeConfig,
|
56
|
+
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "tezos" }>> {
|
57
|
+
return {
|
58
|
+
family: "tezos",
|
59
|
+
amount,
|
60
|
+
recipient,
|
61
|
+
mode: "send",
|
62
|
+
...customFeeConfig,
|
63
|
+
};
|
64
|
+
}
|
65
|
+
|
66
|
+
export function tronTransaction({
|
67
|
+
amount,
|
68
|
+
recipient,
|
69
|
+
customFeeConfig,
|
70
|
+
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "tron" }>> {
|
71
|
+
return {
|
72
|
+
family: "tron",
|
73
|
+
amount,
|
74
|
+
recipient,
|
75
|
+
mode: "send",
|
76
|
+
...customFeeConfig,
|
39
77
|
};
|
40
78
|
}
|
41
79
|
|
42
80
|
export function stellarTransaction({
|
43
|
-
family,
|
44
81
|
amount,
|
45
82
|
recipient,
|
46
83
|
customFeeConfig,
|
47
84
|
payinExtraId,
|
48
85
|
customErrorType,
|
49
|
-
}: TransactionWithCustomFee):
|
86
|
+
}: TransactionWithCustomFee): Extract<Transaction, { family: "stellar" }> {
|
50
87
|
if (!payinExtraId)
|
51
88
|
throw {
|
52
89
|
error: new Error("Missing payinExtraId"),
|
@@ -55,8 +92,11 @@ export function stellarTransaction({
|
|
55
92
|
};
|
56
93
|
|
57
94
|
return {
|
58
|
-
...defaultTransaction({ family, amount, recipient, customFeeConfig }),
|
59
95
|
family: "stellar",
|
96
|
+
mode: "send",
|
97
|
+
amount,
|
98
|
+
recipient,
|
99
|
+
...customFeeConfig,
|
60
100
|
memoValue: payinExtraId,
|
61
101
|
memoType: "MEMO_TEXT",
|
62
102
|
};
|
@@ -68,7 +108,7 @@ export function rippleTransaction({
|
|
68
108
|
customFeeConfig,
|
69
109
|
payinExtraId,
|
70
110
|
customErrorType,
|
71
|
-
}: TransactionWithCustomFee):
|
111
|
+
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "xrp" }>> {
|
72
112
|
if (!payinExtraId)
|
73
113
|
throw {
|
74
114
|
error: new Error("Missing payinExtraId"),
|
@@ -76,38 +116,40 @@ export function rippleTransaction({
|
|
76
116
|
customErrorType,
|
77
117
|
};
|
78
118
|
|
79
|
-
|
80
|
-
family: "
|
119
|
+
return {
|
120
|
+
family: "xrp",
|
81
121
|
amount,
|
82
122
|
recipient,
|
83
123
|
...customFeeConfig,
|
84
124
|
tag: new BigNumber(payinExtraId).toNumber(),
|
85
125
|
};
|
86
|
-
return transaction;
|
87
126
|
}
|
88
127
|
|
89
|
-
|
90
|
-
export function withoutGasLimitTransaction({
|
91
|
-
family,
|
128
|
+
export function evmTransaction({
|
92
129
|
amount,
|
93
130
|
recipient,
|
94
131
|
customFeeConfig,
|
95
132
|
extraTransactionParameters,
|
96
|
-
}: TransactionWithCustomFee): Transaction {
|
133
|
+
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "evm" }>> {
|
97
134
|
if (customFeeConfig?.gasLimit) {
|
98
135
|
delete customFeeConfig.gasLimit;
|
99
136
|
}
|
100
137
|
|
101
138
|
if (extraTransactionParameters) {
|
102
|
-
return
|
103
|
-
family,
|
139
|
+
return {
|
140
|
+
family: "evm" as const,
|
104
141
|
amount,
|
105
142
|
recipient,
|
106
143
|
...customFeeConfig,
|
107
144
|
data: Buffer.from(extraTransactionParameters, "hex"),
|
108
145
|
};
|
109
146
|
}
|
110
|
-
return
|
147
|
+
return {
|
148
|
+
family: "evm" as const,
|
149
|
+
amount,
|
150
|
+
recipient,
|
151
|
+
...customFeeConfig,
|
152
|
+
};
|
111
153
|
}
|
112
154
|
|
113
155
|
export function bitcoinTransaction({
|
@@ -115,33 +157,33 @@ export function bitcoinTransaction({
|
|
115
157
|
recipient,
|
116
158
|
customFeeConfig,
|
117
159
|
extraTransactionParameters,
|
118
|
-
}: TransactionWithCustomFee): Transaction {
|
160
|
+
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "bitcoin" }>> {
|
161
|
+
const baseTransaction = {
|
162
|
+
family: "bitcoin" as const,
|
163
|
+
amount,
|
164
|
+
recipient,
|
165
|
+
...customFeeConfig,
|
166
|
+
};
|
167
|
+
|
119
168
|
if (extraTransactionParameters) {
|
120
169
|
return {
|
121
|
-
|
122
|
-
amount,
|
123
|
-
recipient,
|
124
|
-
...customFeeConfig,
|
170
|
+
...baseTransaction,
|
125
171
|
opReturnData: Buffer.from(extraTransactionParameters, "utf-8"),
|
126
172
|
};
|
127
173
|
}
|
128
|
-
|
129
|
-
|
130
|
-
amount,
|
131
|
-
recipient,
|
132
|
-
...customFeeConfig,
|
133
|
-
};
|
174
|
+
|
175
|
+
return baseTransaction;
|
134
176
|
}
|
135
177
|
|
136
178
|
export function solanaTransaction({
|
137
|
-
family,
|
138
179
|
amount,
|
139
180
|
recipient,
|
140
|
-
customFeeConfig,
|
141
|
-
}: TransactionWithCustomFee):
|
181
|
+
customFeeConfig: _customFeeConfig,
|
182
|
+
}: TransactionWithCustomFee): Extract<Transaction, { family: "solana" }> {
|
142
183
|
return {
|
143
|
-
...defaultTransaction({ family, amount, recipient, customFeeConfig }),
|
144
184
|
family: "solana",
|
185
|
+
amount,
|
186
|
+
recipient,
|
145
187
|
model: { kind: "transfer", uiState: {} },
|
146
188
|
};
|
147
189
|
}
|
@@ -150,43 +192,44 @@ export function elrondTransaction({
|
|
150
192
|
amount,
|
151
193
|
recipient,
|
152
194
|
customFeeConfig,
|
153
|
-
}: TransactionWithCustomFee):
|
154
|
-
|
155
|
-
family: "
|
195
|
+
}: TransactionWithCustomFee): Extract<Transaction, { family: "multiversx" }> {
|
196
|
+
return {
|
197
|
+
family: "multiversx",
|
156
198
|
amount,
|
157
199
|
recipient,
|
158
200
|
mode: "send",
|
159
|
-
|
160
|
-
gasLimit:
|
201
|
+
fees: customFeeConfig.fees || null,
|
202
|
+
gasLimit: customFeeConfig.gasLimit ? Number(customFeeConfig.gasLimit) : 0,
|
161
203
|
};
|
162
|
-
return transaction;
|
163
204
|
}
|
164
205
|
|
165
206
|
function tonTransaction({
|
166
|
-
family,
|
167
207
|
amount,
|
168
208
|
recipient,
|
169
|
-
customFeeConfig,
|
170
|
-
}: TransactionWithCustomFee):
|
209
|
+
customFeeConfig: _customFeeConfig,
|
210
|
+
}: TransactionWithCustomFee): Extract<Transaction, { family: "ton" }> {
|
171
211
|
return {
|
172
|
-
...defaultTransaction({ family, amount, recipient, customFeeConfig }),
|
173
212
|
family: "ton",
|
213
|
+
amount,
|
214
|
+
recipient,
|
174
215
|
comment: { isEncrypted: false, text: "" },
|
175
216
|
fees: new BigNumber(0), // Set default value as completeExchange call prepareTransaction, which set again fees.
|
176
217
|
};
|
177
218
|
}
|
178
219
|
|
179
220
|
export function cosmosTransaction({
|
180
|
-
family,
|
181
221
|
amount,
|
182
222
|
recipient,
|
183
223
|
customFeeConfig,
|
184
224
|
payinExtraId,
|
185
|
-
}: TransactionWithCustomFee):
|
186
|
-
return
|
187
|
-
...defaultTransaction({ family, amount, recipient, customFeeConfig }),
|
225
|
+
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "cosmos" }>> {
|
226
|
+
return {
|
188
227
|
family: "cosmos",
|
228
|
+
amount,
|
229
|
+
recipient,
|
189
230
|
mode: "send",
|
231
|
+
networkInfo: null,
|
232
|
+
...customFeeConfig,
|
190
233
|
memo: payinExtraId ?? undefined,
|
191
234
|
};
|
192
235
|
}
|
@@ -198,10 +241,13 @@ export type TransactionWithCustomFee = TransactionCommon & {
|
|
198
241
|
payinExtraId?: string;
|
199
242
|
customErrorType?: "swap";
|
200
243
|
extraTransactionParameters?: string;
|
244
|
+
family: string;
|
201
245
|
};
|
202
246
|
|
203
247
|
// Define a specific type for the strategy functions, assuming they might need parameters
|
204
|
-
export type TransactionStrategyFunction = (
|
248
|
+
export type TransactionStrategyFunction = (
|
249
|
+
params: TransactionWithCustomFee,
|
250
|
+
) => Partial<Transaction>;
|
205
251
|
|
206
252
|
export const transactionStrategy: {
|
207
253
|
[K in Transaction["family"]]: TransactionStrategyFunction;
|
@@ -209,26 +255,28 @@ export const transactionStrategy: {
|
|
209
255
|
algorand: defaultTransaction,
|
210
256
|
aptos: defaultTransaction,
|
211
257
|
bitcoin: bitcoinTransaction,
|
212
|
-
|
258
|
+
canton: defaultTransaction,
|
259
|
+
cardano: cardanoTransaction,
|
260
|
+
casper: defaultTransaction,
|
213
261
|
celo: defaultTransaction,
|
214
262
|
cosmos: cosmosTransaction,
|
215
|
-
|
216
|
-
elrond: elrondTransaction,
|
217
|
-
ethereum: withoutGasLimitTransaction,
|
263
|
+
evm: evmTransaction,
|
218
264
|
filecoin: defaultTransaction,
|
219
265
|
hedera: defaultTransaction,
|
220
|
-
|
221
|
-
|
266
|
+
icon: defaultTransaction,
|
267
|
+
internet_computer: defaultTransaction,
|
268
|
+
mina: defaultTransaction,
|
269
|
+
multiversx: elrondTransaction,
|
270
|
+
near: nearTransaction,
|
222
271
|
polkadot: defaultTransaction,
|
223
|
-
ripple: rippleTransaction,
|
224
272
|
solana: solanaTransaction,
|
225
273
|
stacks: defaultTransaction,
|
226
274
|
stellar: stellarTransaction,
|
227
|
-
|
275
|
+
sui: defaultTransaction,
|
276
|
+
tezos: tezosTransaction,
|
228
277
|
ton: tonTransaction,
|
229
|
-
tron:
|
278
|
+
tron: tronTransaction,
|
230
279
|
vechain: defaultTransaction,
|
231
|
-
|
232
|
-
|
233
|
-
internet_computer: defaultTransaction,
|
280
|
+
kaspa: defaultTransaction,
|
281
|
+
xrp: rippleTransaction,
|
234
282
|
};
|
@@ -0,0 +1,175 @@
|
|
1
|
+
type MockTransactionOperation = {
|
2
|
+
meta: {
|
3
|
+
delivered_amount: string;
|
4
|
+
};
|
5
|
+
tx: {
|
6
|
+
Account: string;
|
7
|
+
Amount: string;
|
8
|
+
Destination: string;
|
9
|
+
Fee: string;
|
10
|
+
Memo: string;
|
11
|
+
Sequence: number;
|
12
|
+
SigningPubKey: string;
|
13
|
+
TransactionType: string;
|
14
|
+
TxnSignature: string;
|
15
|
+
date: number;
|
16
|
+
hash: string;
|
17
|
+
inLedger: number;
|
18
|
+
};
|
19
|
+
validated: boolean;
|
20
|
+
};
|
21
|
+
|
22
|
+
const generateMockTransaction = (
|
23
|
+
account: string,
|
24
|
+
destination: string,
|
25
|
+
amount: string,
|
26
|
+
fee: string,
|
27
|
+
hash: string,
|
28
|
+
sequence: number,
|
29
|
+
timestamp: number,
|
30
|
+
inLedger: number,
|
31
|
+
): MockTransactionOperation => ({
|
32
|
+
meta: {
|
33
|
+
delivered_amount: amount,
|
34
|
+
},
|
35
|
+
tx: {
|
36
|
+
Account: account,
|
37
|
+
Amount: amount,
|
38
|
+
Destination: destination,
|
39
|
+
Fee: fee,
|
40
|
+
Memo: "",
|
41
|
+
Sequence: sequence,
|
42
|
+
SigningPubKey: "ED" + account.slice(0, 32),
|
43
|
+
TransactionType: "Payment",
|
44
|
+
TxnSignature: hash.slice(0, 32),
|
45
|
+
date: timestamp,
|
46
|
+
hash,
|
47
|
+
inLedger,
|
48
|
+
},
|
49
|
+
validated: true,
|
50
|
+
});
|
51
|
+
|
52
|
+
export const getMockedMethods = (): {
|
53
|
+
method: string;
|
54
|
+
params: unknown[];
|
55
|
+
answer: unknown;
|
56
|
+
}[] => [
|
57
|
+
// Account balance lookup
|
58
|
+
{
|
59
|
+
method: "getBalance",
|
60
|
+
params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG"],
|
61
|
+
answer: {
|
62
|
+
account_data: {
|
63
|
+
Account: "rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
|
64
|
+
Balance: "1000000000",
|
65
|
+
},
|
66
|
+
ledger_hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
67
|
+
ledger_index: 32570,
|
68
|
+
validated: true,
|
69
|
+
status: "success",
|
70
|
+
},
|
71
|
+
},
|
72
|
+
|
73
|
+
// Empty account (new account)
|
74
|
+
{
|
75
|
+
method: "getBalance",
|
76
|
+
params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW"],
|
77
|
+
answer: {
|
78
|
+
error: "actNotFound",
|
79
|
+
},
|
80
|
+
},
|
81
|
+
|
82
|
+
// Account transactions
|
83
|
+
{
|
84
|
+
method: "getTransactions",
|
85
|
+
params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG", { from: 0, size: 100 }],
|
86
|
+
answer: [
|
87
|
+
generateMockTransaction(
|
88
|
+
"rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
|
89
|
+
"rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW",
|
90
|
+
"100000000",
|
91
|
+
"10000",
|
92
|
+
"E3FE6EA3C48F0C2B639448020EA4F03D4F4F8BDCFDC8882B7B20DBD3A3A5B3A6",
|
93
|
+
1,
|
94
|
+
Date.now() - 3600000, // 1 hour ago
|
95
|
+
32569,
|
96
|
+
),
|
97
|
+
generateMockTransaction(
|
98
|
+
"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
99
|
+
"rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
|
100
|
+
"200000000",
|
101
|
+
"10000",
|
102
|
+
"B7FDE3B1D3C2F4A9638448020EA4F03D4F4F8BDCFDC8882B7B20DBD3A3A5B3C8",
|
103
|
+
5,
|
104
|
+
Date.now() - 7200000, // 2 hours ago
|
105
|
+
32568,
|
106
|
+
),
|
107
|
+
],
|
108
|
+
},
|
109
|
+
|
110
|
+
// Empty transactions for new account
|
111
|
+
{
|
112
|
+
method: "getTransactions",
|
113
|
+
params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW", { from: 0, size: 100 }],
|
114
|
+
answer: [],
|
115
|
+
},
|
116
|
+
|
117
|
+
// Fee estimation
|
118
|
+
{
|
119
|
+
method: "estimateFees",
|
120
|
+
params: ["12000400020000000000000000"], // sample serialized transaction
|
121
|
+
answer: "12000",
|
122
|
+
},
|
123
|
+
|
124
|
+
// Transaction submission
|
125
|
+
{
|
126
|
+
method: "submitTransaction",
|
127
|
+
params: ["12000400020000000000000000"], // sample signed transaction
|
128
|
+
answer: {
|
129
|
+
accepted: true,
|
130
|
+
tx_hash: "F4AB442A6D4CBB935D66E1DA7309A5FC71C7143ED4049053EC14E3875B0CF9BF",
|
131
|
+
},
|
132
|
+
},
|
133
|
+
|
134
|
+
// Network info
|
135
|
+
{
|
136
|
+
method: "getServerInfo",
|
137
|
+
params: [],
|
138
|
+
answer: {
|
139
|
+
info: {
|
140
|
+
complete_ledgers: "32570-32570",
|
141
|
+
ledger_index: 32570,
|
142
|
+
validated_ledger: {
|
143
|
+
hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
144
|
+
seq: 32570,
|
145
|
+
},
|
146
|
+
},
|
147
|
+
status: "success",
|
148
|
+
},
|
149
|
+
},
|
150
|
+
|
151
|
+
// Account sequence number
|
152
|
+
{
|
153
|
+
method: "getNextValidSequence",
|
154
|
+
params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG"],
|
155
|
+
answer: 2,
|
156
|
+
},
|
157
|
+
|
158
|
+
// New account sequence
|
159
|
+
{
|
160
|
+
method: "getNextValidSequence",
|
161
|
+
params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW"],
|
162
|
+
answer: 1,
|
163
|
+
},
|
164
|
+
|
165
|
+
// Last block
|
166
|
+
{
|
167
|
+
method: "lastBlock",
|
168
|
+
params: [],
|
169
|
+
answer: {
|
170
|
+
height: 32570,
|
171
|
+
hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
172
|
+
time: Date.now(),
|
173
|
+
},
|
174
|
+
},
|
175
|
+
];
|
@@ -0,0 +1,180 @@
|
|
1
|
+
import { makeLRUCache, minutes } from "@ledgerhq/live-network/cache";
|
2
|
+
import { createApi } from "@ledgerhq/coin-canton/api/index";
|
3
|
+
import { Transaction as CantonTransaction } from "@ledgerhq/coin-canton/types";
|
4
|
+
import type { AccountBridge } from "@ledgerhq/types-live";
|
5
|
+
import { BigNumber } from "bignumber.js";
|
6
|
+
|
7
|
+
// The calls data can be copied to mock-data.ts from the file.
|
8
|
+
// This function creates a live API with logging for generating mock data
|
9
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
10
|
+
function createMockDataForAPI() {
|
11
|
+
const signerContext = {};
|
12
|
+
|
13
|
+
const apiGetter = makeLRUCache(
|
14
|
+
config => Promise.resolve(createApi(config)),
|
15
|
+
config => config.nodeUrl || "",
|
16
|
+
minutes(1000),
|
17
|
+
);
|
18
|
+
|
19
|
+
return {
|
20
|
+
getAPI: apiGetter,
|
21
|
+
getQueuedAPI: apiGetter,
|
22
|
+
getQueuedAndCachedAPI: apiGetter,
|
23
|
+
signerContext,
|
24
|
+
};
|
25
|
+
}
|
26
|
+
|
27
|
+
const createTransaction = (): CantonTransaction => {
|
28
|
+
return {
|
29
|
+
family: "canton",
|
30
|
+
amount: new BigNumber(0),
|
31
|
+
recipient: "",
|
32
|
+
fee: null,
|
33
|
+
};
|
34
|
+
};
|
35
|
+
|
36
|
+
const updateTransaction = (
|
37
|
+
t: CantonTransaction,
|
38
|
+
patch: Partial<CantonTransaction>,
|
39
|
+
): CantonTransaction => {
|
40
|
+
return { ...t, ...patch };
|
41
|
+
};
|
42
|
+
|
43
|
+
const getTransactionStatus = async (): Promise<any> => {
|
44
|
+
return {
|
45
|
+
errors: {},
|
46
|
+
warnings: {},
|
47
|
+
estimatedFees: new BigNumber(0),
|
48
|
+
amount: new BigNumber(0),
|
49
|
+
totalSpent: new BigNumber(0),
|
50
|
+
};
|
51
|
+
};
|
52
|
+
|
53
|
+
const estimateMaxSpendable = ({ account }: { account: any }): Promise<BigNumber> => {
|
54
|
+
return Promise.resolve(account.balance || new BigNumber(0));
|
55
|
+
};
|
56
|
+
|
57
|
+
const prepareTransaction = async (
|
58
|
+
_account: any,
|
59
|
+
transaction: CantonTransaction,
|
60
|
+
): Promise<CantonTransaction> => {
|
61
|
+
return {
|
62
|
+
...transaction,
|
63
|
+
fee: transaction.fee || new BigNumber(100),
|
64
|
+
};
|
65
|
+
};
|
66
|
+
|
67
|
+
const sync = (_initialAccount: any): any => {
|
68
|
+
return {
|
69
|
+
subscribe: (observer: any) => {
|
70
|
+
observer.next((acc: any) => acc);
|
71
|
+
observer.complete();
|
72
|
+
return { unsubscribe: () => {} };
|
73
|
+
},
|
74
|
+
};
|
75
|
+
};
|
76
|
+
|
77
|
+
const receive = (_account: any, _opts: { deviceId: string }): any => {
|
78
|
+
return {
|
79
|
+
subscribe: (observer: any) => {
|
80
|
+
observer.next({
|
81
|
+
address: "mock-address",
|
82
|
+
path: "44'/60'/0'/0/0",
|
83
|
+
publicKey: "mock-public-key",
|
84
|
+
});
|
85
|
+
observer.complete();
|
86
|
+
return { unsubscribe: () => {} };
|
87
|
+
},
|
88
|
+
};
|
89
|
+
};
|
90
|
+
|
91
|
+
const signOperation = (): any => {
|
92
|
+
return {
|
93
|
+
subscribe: (observer: any) => {
|
94
|
+
observer.next({
|
95
|
+
operation: {
|
96
|
+
id: "mock-operation-id",
|
97
|
+
hash: "mock-hash",
|
98
|
+
type: "OUT",
|
99
|
+
value: new BigNumber(0),
|
100
|
+
fee: new BigNumber(100),
|
101
|
+
blockHash: "mock-block-hash",
|
102
|
+
blockHeight: 12345,
|
103
|
+
accountId: "mock-account-id",
|
104
|
+
date: new Date(),
|
105
|
+
extra: {},
|
106
|
+
},
|
107
|
+
signature: "mock-signature",
|
108
|
+
});
|
109
|
+
observer.complete();
|
110
|
+
return { unsubscribe: () => {} };
|
111
|
+
},
|
112
|
+
};
|
113
|
+
};
|
114
|
+
|
115
|
+
const broadcast = async (): Promise<any> => {
|
116
|
+
return {
|
117
|
+
id: "mock-operation-id",
|
118
|
+
hash: "mock-hash",
|
119
|
+
type: "OUT",
|
120
|
+
value: new BigNumber(0),
|
121
|
+
fee: new BigNumber(100),
|
122
|
+
blockHash: "mock-block-hash",
|
123
|
+
blockHeight: 12345,
|
124
|
+
accountId: "mock-account-id",
|
125
|
+
date: new Date(),
|
126
|
+
extra: {},
|
127
|
+
};
|
128
|
+
};
|
129
|
+
|
130
|
+
const scanAccounts = (): any => {
|
131
|
+
return {
|
132
|
+
subscribe: (observer: any) => {
|
133
|
+
observer.next({
|
134
|
+
type: "discovered",
|
135
|
+
account: {
|
136
|
+
id: "mock-account-id",
|
137
|
+
name: "Mock Canton Account",
|
138
|
+
address: "mock-address",
|
139
|
+
currency: { id: "canton_network_devnet" },
|
140
|
+
balance: new BigNumber(0),
|
141
|
+
spendableBalance: new BigNumber(0),
|
142
|
+
blockHeight: 0,
|
143
|
+
lastSyncDate: new Date(),
|
144
|
+
operations: [],
|
145
|
+
pendingOperations: [],
|
146
|
+
},
|
147
|
+
});
|
148
|
+
observer.complete();
|
149
|
+
return { unsubscribe: () => {} };
|
150
|
+
},
|
151
|
+
};
|
152
|
+
};
|
153
|
+
|
154
|
+
const getSerializedAddressParameters = (): Buffer => {
|
155
|
+
return Buffer.from("mock-address-params");
|
156
|
+
};
|
157
|
+
|
158
|
+
const accountBridge: AccountBridge<CantonTransaction> = {
|
159
|
+
createTransaction,
|
160
|
+
updateTransaction,
|
161
|
+
getTransactionStatus,
|
162
|
+
estimateMaxSpendable,
|
163
|
+
prepareTransaction,
|
164
|
+
sync,
|
165
|
+
receive,
|
166
|
+
signOperation,
|
167
|
+
broadcast,
|
168
|
+
getSerializedAddressParameters,
|
169
|
+
};
|
170
|
+
|
171
|
+
const currencyBridge = {
|
172
|
+
preload: () => Promise.resolve({}),
|
173
|
+
hydrate: () => {},
|
174
|
+
scanAccounts,
|
175
|
+
};
|
176
|
+
|
177
|
+
export default {
|
178
|
+
accountBridge,
|
179
|
+
currencyBridge,
|
180
|
+
};
|