@ledgerhq/live-common 34.43.0 → 34.44.0-nightly.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/DataModel.test.js +6 -0
- package/lib/DataModel.test.js.map +1 -1
- package/lib/__fixtures__/solana-spl-epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v.json +53 -0
- package/lib/__tests__/accounts/groupPerDay.js +10 -0
- package/lib/__tests__/accounts/groupPerDay.js.map +1 -1
- package/lib/__tests__/test-helpers/environment.js +1 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -1
- package/lib/__tests__/test-helpers/setup.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/setup.js +6 -0
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/account/serialization.test.js +17 -1
- package/lib/account/serialization.test.js.map +1 -1
- package/lib/appSupportsQuitApp.d.ts +1 -0
- package/lib/appSupportsQuitApp.d.ts.map +1 -1
- package/lib/appSupportsQuitApp.js +1 -0
- package/lib/appSupportsQuitApp.js.map +1 -1
- package/lib/appSupportsQuitApp.test.js +28 -3
- package/lib/appSupportsQuitApp.test.js.map +1 -1
- package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +5 -5
- package/lib/bridge/crypto-assets/index.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.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -6
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +5 -6
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +3 -2
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +6 -2
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.d.ts +2 -0
- package/lib/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/utils.test.js +20 -0
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -0
- package/lib/currencies/sortByMarketcap.test.js +5 -0
- package/lib/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib/e2e/enum/Currency.js +1 -1
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/enum/Provider.d.ts +1 -0
- package/lib/e2e/enum/Provider.d.ts.map +1 -1
- package/lib/e2e/enum/Provider.js +1 -0
- package/lib/e2e/enum/Provider.js.map +1 -1
- package/lib/e2e/index.d.ts +3 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +45 -15
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/speculosCI.d.ts.map +1 -1
- package/lib/e2e/speculosCI.js +22 -4
- package/lib/e2e/speculosCI.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/families/bitcoin/satstack.test.js +6 -0
- package/lib/families/bitcoin/satstack.test.js.map +1 -1
- package/lib/families/canton/bridge.integration.test.d.ts +2 -0
- package/lib/families/canton/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/canton/bridge.integration.test.js +7 -0
- package/lib/families/canton/bridge.integration.test.js.map +1 -0
- package/lib/families/canton/config.d.ts +3 -0
- package/lib/families/canton/config.d.ts.map +1 -0
- package/lib/families/canton/config.js +14 -0
- package/lib/families/canton/config.js.map +1 -0
- package/lib/families/canton/logic.d.ts +2 -0
- package/lib/families/canton/logic.d.ts.map +1 -0
- package/lib/families/canton/logic.js +19 -0
- package/lib/families/canton/logic.js.map +1 -0
- package/lib/families/canton/setup.d.ts +27 -0
- package/lib/families/canton/setup.d.ts.map +1 -0
- package/lib/families/canton/setup.js +27 -0
- package/lib/families/canton/setup.js.map +1 -0
- package/lib/families/canton/types.d.ts +2 -0
- package/lib/families/canton/types.d.ts.map +1 -0
- package/lib/families/canton/types.js +19 -0
- package/lib/families/canton/types.js.map +1 -0
- package/lib/families/solana/bridge/mock-data.d.ts.map +1 -1
- package/lib/families/solana/bridge/mock-data.js +46 -316
- package/lib/families/solana/bridge/mock-data.js.map +1 -1
- package/lib/families/solana/bridge/mock.js +2 -2
- package/lib/families/solana/bridge/mock.js.map +1 -1
- package/lib/families/stellar/ui.d.ts +6 -0
- package/lib/families/stellar/ui.d.ts.map +1 -0
- package/lib/families/stellar/ui.js +18 -0
- package/lib/families/stellar/ui.js.map +1 -0
- package/lib/families/tron/data.mock.d.ts.map +1 -1
- package/lib/families/tron/data.mock.js +6 -0
- package/lib/families/tron/data.mock.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +1 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -0
- package/lib/featureFlags/defaultFeatures.js.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 +40 -38
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/cli-transaction.d.ts +20 -0
- package/lib/generated/cli-transaction.d.ts.map +1 -1
- package/lib/generated/cli-transaction.js +42 -40
- 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 +38 -36
- 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 +42 -40
- package/lib/generated/hw-getAddress.js.map +1 -1
- package/lib/generated/specs.d.ts +2 -0
- package/lib/generated/specs.d.ts.map +1 -1
- package/lib/generated/specs.js +40 -38
- package/lib/generated/specs.js.map +1 -1
- package/lib/generated/transaction.d.ts +8 -0
- package/lib/generated/transaction.d.ts.map +1 -1
- package/lib/generated/transaction.js +42 -40
- 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/modularDrawer/__mocks__/accounts.mock.d.ts +18 -0
- package/lib/modularDrawer/__mocks__/accounts.mock.d.ts.map +1 -0
- package/lib/modularDrawer/__mocks__/accounts.mock.js +48 -0
- package/lib/modularDrawer/__mocks__/accounts.mock.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/currencyUtils.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/currencyUtils.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js +100 -0
- package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -0
- package/lib/modularDrawer/utils/currencyUtils.d.ts +10 -0
- package/lib/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
- package/lib/modularDrawer/utils/currencyUtils.js +74 -0
- package/lib/modularDrawer/utils/currencyUtils.js.map +1 -0
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts +1 -1
- package/lib/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -1
- package/lib/utils/__tests__/composeHooks.test.d.ts +2 -0
- package/lib/utils/__tests__/composeHooks.test.d.ts.map +1 -0
- package/lib/utils/__tests__/composeHooks.test.js +35 -0
- package/lib/utils/__tests__/composeHooks.test.js.map +1 -0
- package/lib/utils/__tests__/getAccountTuplesForCurrency.test.d.ts +2 -0
- package/lib/utils/__tests__/getAccountTuplesForCurrency.test.d.ts.map +1 -0
- package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js +104 -0
- package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -0
- package/lib/utils/composeHooks.d.ts +11 -0
- package/lib/utils/composeHooks.d.ts.map +1 -0
- package/lib/utils/composeHooks.js +25 -0
- package/lib/utils/composeHooks.js.map +1 -0
- package/lib/utils/getAccountTuplesForCurrency.d.ts +8 -0
- package/lib/utils/getAccountTuplesForCurrency.d.ts.map +1 -0
- package/lib/utils/getAccountTuplesForCurrency.js +19 -0
- package/lib/utils/getAccountTuplesForCurrency.js.map +1 -0
- package/lib/wallet-api/helpers.d.ts +1 -0
- package/lib/wallet-api/helpers.d.ts.map +1 -1
- package/lib/wallet-api/helpers.js +16 -1
- package/lib/wallet-api/helpers.js.map +1 -1
- package/lib-es/DataModel.test.js +6 -0
- package/lib-es/DataModel.test.js.map +1 -1
- package/lib-es/__fixtures__/solana-spl-epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v.json +53 -0
- package/lib-es/__tests__/accounts/groupPerDay.js +10 -0
- package/lib-es/__tests__/accounts/groupPerDay.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/__tests__/test-helpers/setup.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/setup.js +6 -0
- package/lib-es/__tests__/test-helpers/setup.js.map +1 -1
- package/lib-es/account/serialization.test.js +15 -2
- package/lib-es/account/serialization.test.js.map +1 -1
- package/lib-es/appSupportsQuitApp.d.ts +1 -0
- package/lib-es/appSupportsQuitApp.d.ts.map +1 -1
- package/lib-es/appSupportsQuitApp.js +1 -0
- package/lib-es/appSupportsQuitApp.js.map +1 -1
- package/lib-es/appSupportsQuitApp.test.js +6 -1
- package/lib-es/appSupportsQuitApp.test.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +4 -4
- package/lib-es/bridge/crypto-assets/index.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.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -6
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +6 -7
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +3 -2
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +4 -1
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/utils.test.js +18 -0
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -0
- package/lib-es/currencies/sortByMarketcap.test.js +5 -0
- package/lib-es/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib-es/e2e/enum/Currency.js +1 -1
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/enum/Provider.d.ts +1 -0
- package/lib-es/e2e/enum/Provider.d.ts.map +1 -1
- package/lib-es/e2e/enum/Provider.js +1 -0
- package/lib-es/e2e/enum/Provider.js.map +1 -1
- package/lib-es/e2e/index.d.ts +3 -0
- 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 +45 -15
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/speculosCI.d.ts.map +1 -1
- package/lib-es/e2e/speculosCI.js +22 -4
- package/lib-es/e2e/speculosCI.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/families/bitcoin/satstack.test.js +6 -0
- package/lib-es/families/bitcoin/satstack.test.js.map +1 -1
- package/lib-es/families/canton/bridge.integration.test.d.ts +2 -0
- package/lib-es/families/canton/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/families/canton/bridge.integration.test.js +5 -0
- package/lib-es/families/canton/bridge.integration.test.js.map +1 -0
- package/lib-es/families/canton/config.d.ts +3 -0
- package/lib-es/families/canton/config.d.ts.map +1 -0
- package/lib-es/families/canton/config.js +11 -0
- package/lib-es/families/canton/config.js.map +1 -0
- package/lib-es/families/canton/logic.d.ts +2 -0
- package/lib-es/families/canton/logic.d.ts.map +1 -0
- package/lib-es/families/canton/logic.js +3 -0
- package/lib-es/families/canton/logic.js.map +1 -0
- package/lib-es/families/canton/setup.d.ts +27 -0
- package/lib-es/families/canton/setup.d.ts.map +1 -0
- package/lib-es/families/canton/setup.js +19 -0
- package/lib-es/families/canton/setup.js.map +1 -0
- package/lib-es/families/canton/types.d.ts +2 -0
- package/lib-es/families/canton/types.d.ts.map +1 -0
- package/lib-es/families/canton/types.js +3 -0
- package/lib-es/families/canton/types.js.map +1 -0
- package/lib-es/families/solana/bridge/mock-data.d.ts.map +1 -1
- package/lib-es/families/solana/bridge/mock-data.js +46 -316
- package/lib-es/families/solana/bridge/mock-data.js.map +1 -1
- package/lib-es/families/solana/bridge/mock.js +3 -3
- package/lib-es/families/solana/bridge/mock.js.map +1 -1
- package/lib-es/families/stellar/ui.d.ts +6 -0
- package/lib-es/families/stellar/ui.d.ts.map +1 -0
- package/lib-es/families/stellar/ui.js +14 -0
- package/lib-es/families/stellar/ui.js.map +1 -0
- package/lib-es/families/tron/data.mock.d.ts.map +1 -1
- package/lib-es/families/tron/data.mock.js +6 -0
- package/lib-es/families/tron/data.mock.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +1 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -0
- package/lib-es/featureFlags/defaultFeatures.js.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/cli-transaction.d.ts +20 -0
- 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/specs.d.ts +2 -0
- package/lib-es/generated/specs.d.ts.map +1 -1
- package/lib-es/generated/specs.js +2 -0
- package/lib-es/generated/specs.js.map +1 -1
- package/lib-es/generated/transaction.d.ts +8 -0
- 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/modularDrawer/__mocks__/accounts.mock.d.ts +18 -0
- package/lib-es/modularDrawer/__mocks__/accounts.mock.d.ts.map +1 -0
- package/lib-es/modularDrawer/__mocks__/accounts.mock.js +42 -0
- package/lib-es/modularDrawer/__mocks__/accounts.mock.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js +98 -0
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts +10 -0
- package/lib-es/modularDrawer/utils/currencyUtils.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/currencyUtils.js +65 -0
- package/lib-es/modularDrawer/utils/currencyUtils.js.map +1 -0
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts +1 -1
- package/lib-es/modularDrawer/utils/haveOneCommonProvider.d.ts.map +1 -1
- package/lib-es/utils/__tests__/composeHooks.test.d.ts +2 -0
- package/lib-es/utils/__tests__/composeHooks.test.d.ts.map +1 -0
- package/lib-es/utils/__tests__/composeHooks.test.js +33 -0
- package/lib-es/utils/__tests__/composeHooks.test.js.map +1 -0
- package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.d.ts +2 -0
- package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.d.ts.map +1 -0
- package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js +102 -0
- package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -0
- package/lib-es/utils/composeHooks.d.ts +11 -0
- package/lib-es/utils/composeHooks.d.ts.map +1 -0
- package/lib-es/utils/composeHooks.js +21 -0
- package/lib-es/utils/composeHooks.js.map +1 -0
- package/lib-es/utils/getAccountTuplesForCurrency.d.ts +8 -0
- package/lib-es/utils/getAccountTuplesForCurrency.d.ts.map +1 -0
- package/lib-es/utils/getAccountTuplesForCurrency.js +15 -0
- package/lib-es/utils/getAccountTuplesForCurrency.js.map +1 -0
- package/lib-es/wallet-api/helpers.d.ts +1 -0
- package/lib-es/wallet-api/helpers.d.ts.map +1 -1
- package/lib-es/wallet-api/helpers.js +14 -0
- package/lib-es/wallet-api/helpers.js.map +1 -1
- package/package.json +40 -38
- package/src/DataModel.test.ts +8 -0
- package/src/__fixtures__/solana-spl-epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v.json +53 -0
- package/src/__tests__/accounts/groupPerDay.ts +13 -0
- package/src/__tests__/test-helpers/environment.ts +1 -0
- package/src/__tests__/test-helpers/setup.ts +8 -0
- package/src/account/serialization.test.ts +20 -2
- package/src/appSupportsQuitApp.test.ts +7 -1
- package/src/appSupportsQuitApp.ts +1 -0
- package/src/bridge/crypto-assets/index.ts +6 -6
- package/src/bridge/generic-alpaca/alpaca/index.ts +3 -3
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +3 -8
- package/src/bridge/generic-alpaca/getAccountShape.ts +6 -7
- package/src/bridge/generic-alpaca/signOperation.ts +1 -1
- package/src/bridge/generic-alpaca/utils.test.ts +19 -0
- package/src/bridge/generic-alpaca/utils.ts +7 -6
- package/src/currencies/sortByMarketcap.test.ts +7 -0
- package/src/e2e/enum/Currency.ts +1 -1
- package/src/e2e/enum/Provider.ts +1 -0
- package/src/e2e/speculos.ts +77 -21
- package/src/e2e/speculosCI.ts +32 -10
- package/src/families/bitcoin/satstack.test.ts +7 -0
- package/src/families/canton/bridge.integration.test.ts +6 -0
- package/src/families/canton/config.ts +12 -0
- package/src/families/canton/logic.ts +2 -0
- package/src/families/canton/setup.ts +34 -0
- package/src/families/canton/types.ts +2 -0
- package/src/families/solana/bridge/mock-data.ts +52 -316
- package/src/families/solana/bridge/mock.ts +3 -3
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +1930 -94
- package/src/families/stellar/ui.ts +15 -0
- package/src/families/tron/data.mock.ts +8 -0
- package/src/featureFlags/defaultFeatures.ts +1 -0
- package/src/generated/bridge/js.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/specs.ts +2 -0
- package/src/generated/transaction.ts +2 -0
- package/src/generated/types.ts +10 -0
- package/src/modularDrawer/__mocks__/accounts.mock.ts +43 -0
- package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +126 -0
- package/src/modularDrawer/utils/currencyUtils.ts +95 -0
- package/src/modularDrawer/utils/haveOneCommonProvider.ts +1 -1
- package/src/utils/__tests__/composeHooks.test.ts +46 -0
- package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +138 -0
- package/src/utils/composeHooks.ts +26 -0
- package/src/utils/getAccountTuplesForCurrency.ts +34 -0
- package/src/wallet-api/helpers.ts +16 -0
@@ -2,7 +2,7 @@ import { encodeAccountId } from "@ledgerhq/coin-framework/account/index";
|
|
2
2
|
import { GetAccountShape, mergeOps } from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
3
3
|
import BigNumber from "bignumber.js";
|
4
4
|
import { getAlpacaApi } from "./alpaca";
|
5
|
-
import { adaptCoreOperationToLiveOperation } from "./utils";
|
5
|
+
import { adaptCoreOperationToLiveOperation, extractBalance } from "./utils";
|
6
6
|
|
7
7
|
export function genericGetAccountShape(network: string, kind: "local" | "remote"): GetAccountShape {
|
8
8
|
return async info => {
|
@@ -18,15 +18,14 @@ export function genericGetAccountShape(network: string, kind: "local" | "remote"
|
|
18
18
|
|
19
19
|
const blockInfo = await getAlpacaApi(network, kind).lastBlock();
|
20
20
|
|
21
|
-
const
|
22
|
-
|
23
|
-
|
24
|
-
const balance = BigNumber(balanceRes[0].value.toString());
|
21
|
+
const balances = await getAlpacaApi(network, kind).getBalance(address);
|
22
|
+
const nativeBalance = extractBalance(balances, "native");
|
23
|
+
const balance = BigNumber(nativeBalance.value.toString());
|
25
24
|
|
26
25
|
let spendableBalance: BigNumber;
|
27
|
-
if (
|
26
|
+
if (nativeBalance.locked) {
|
28
27
|
spendableBalance = BigNumber.max(
|
29
|
-
balance.minus(BigNumber(
|
28
|
+
balance.minus(BigNumber(nativeBalance.locked.toString())),
|
30
29
|
BigNumber(0),
|
31
30
|
);
|
32
31
|
} else {
|
@@ -40,7 +40,7 @@ export const genericSignOperation =
|
|
40
40
|
const transactionIntent = transactionToIntent(account, transaction);
|
41
41
|
transactionIntent.senderPublicKey = publicKey;
|
42
42
|
// NOTE: is setting the memo here instead of transactionToIntent sensible?
|
43
|
-
const txWithMemo = transactionIntent as TransactionIntent<
|
43
|
+
const txWithMemo = transactionIntent as TransactionIntent<MapMemo<string, string>>;
|
44
44
|
if (transaction["tag"]) {
|
45
45
|
const txMemo = String(transaction["tag"]);
|
46
46
|
txWithMemo.memo = {
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { extractBalance } from "./utils";
|
2
|
+
|
3
|
+
describe("Alpaca utils", () => {
|
4
|
+
describe("extractBalance", () => {
|
5
|
+
it("extracts an existing balance", () => {
|
6
|
+
expect(extractBalance([{ value: 4n, asset: { type: "type1" } }], "type1")).toEqual({
|
7
|
+
value: 4n,
|
8
|
+
asset: { type: "type1" },
|
9
|
+
});
|
10
|
+
});
|
11
|
+
|
12
|
+
it("generates an empty balance for a missing type", () => {
|
13
|
+
expect(extractBalance([{ value: 4n, asset: { type: "type1" } }], "type2")).toEqual({
|
14
|
+
value: 0n,
|
15
|
+
asset: { type: "type2" },
|
16
|
+
});
|
17
|
+
});
|
18
|
+
});
|
19
|
+
});
|
@@ -1,17 +1,18 @@
|
|
1
1
|
import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
|
2
2
|
import { Account, Operation, OperationType, TransactionCommon } from "@ledgerhq/types-live";
|
3
3
|
import {
|
4
|
+
Balance,
|
4
5
|
Operation as CoreOperation,
|
5
|
-
Asset,
|
6
6
|
TransactionIntent,
|
7
7
|
} from "@ledgerhq/coin-framework/api/types";
|
8
8
|
import BigNumber from "bignumber.js";
|
9
9
|
import { fromBigNumberToBigInt } from "@ledgerhq/coin-framework/utils";
|
10
10
|
|
11
|
-
export function
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
export function extractBalance(balances: Balance[], type: string): Balance {
|
12
|
+
return balances.find(balance => balance.asset.type === type) ?? { asset: { type }, value: 0n };
|
13
|
+
}
|
14
|
+
|
15
|
+
export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOperation): Operation {
|
15
16
|
return {
|
16
17
|
id: encodeOperationId(accountId, op.tx.hash, op.type),
|
17
18
|
hash: op.tx.hash,
|
@@ -38,7 +39,7 @@ export function transactionToIntent(
|
|
38
39
|
sender: account.freshAddress,
|
39
40
|
recipient: transaction.recipient,
|
40
41
|
amount: fromBigNumberToBigInt(transaction.amount, BigInt(0)),
|
41
|
-
asset:
|
42
|
+
asset: { type: "native" },
|
42
43
|
};
|
43
44
|
}
|
44
45
|
|
@@ -2,6 +2,13 @@ import { sortCurrenciesByIds } from "./sortByMarketcap";
|
|
2
2
|
import { findCurrencyByTicker, listCryptoCurrencies, listTokens } from ".";
|
3
3
|
import { getBTCValues } from "@ledgerhq/live-countervalues/mock";
|
4
4
|
import { CURRENCIES_LIST, IDS } from "./mock";
|
5
|
+
import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
|
6
|
+
import { CryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/type";
|
7
|
+
|
8
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
9
|
+
setCryptoAssetsStoreForCoinFramework({
|
10
|
+
findTokenByTicker: (_: string) => undefined,
|
11
|
+
} as CryptoAssetsStore);
|
5
12
|
|
6
13
|
test("sortCurrenciesByIds snapshot", () => {
|
7
14
|
const list = [...listCryptoCurrencies(), ...listTokens()];
|
package/src/e2e/enum/Currency.ts
CHANGED
@@ -87,7 +87,7 @@ export class Currency {
|
|
87
87
|
static readonly ETH_LIDO = new Currency(
|
88
88
|
"LIDO Staked ETH",
|
89
89
|
"STETH",
|
90
|
-
"ethereum",
|
90
|
+
"ethereum/erc20/steth",
|
91
91
|
AppInfos.ETHEREUM,
|
92
92
|
);
|
93
93
|
static readonly XLM_USCD = new Currency("USDC", "usdc", "stellar", AppInfos.STELLAR);
|
package/src/e2e/enum/Provider.ts
CHANGED
@@ -19,6 +19,7 @@ export class Provider {
|
|
19
19
|
static readonly KILN = new Provider("kiln", "Kiln staking Pool", false, true, true);
|
20
20
|
static readonly STADER_LABS = new Provider("stader", "Stader Labs", false, true, true);
|
21
21
|
static readonly LIDO = new Provider("lido", "Lido", false, true, true);
|
22
|
+
static readonly TRANSAK = new Provider("transak", "Transak", false, true, true);
|
22
23
|
|
23
24
|
static getNameByUiName(uiName: string): string {
|
24
25
|
const provider = Object.values(Provider).find(p => p.uiName === uiName);
|
package/src/e2e/speculos.ts
CHANGED
@@ -11,7 +11,7 @@ import { createSpeculosDeviceCI, releaseSpeculosDeviceCI } from "./speculosCI";
|
|
11
11
|
import type { AppCandidate } from "@ledgerhq/coin-framework/bot/types";
|
12
12
|
import { DeviceModelId } from "@ledgerhq/devices";
|
13
13
|
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
14
|
-
import axios from "axios";
|
14
|
+
import axios, { AxiosError, AxiosResponse } from "axios";
|
15
15
|
import { getEnv } from "@ledgerhq/live-env";
|
16
16
|
import { getCryptoCurrencyById } from "../currencies";
|
17
17
|
import { DeviceLabels } from "../e2e/enum/DeviceLabels";
|
@@ -415,13 +415,59 @@ interface ResponseData {
|
|
415
415
|
events: Event[];
|
416
416
|
}
|
417
417
|
|
418
|
+
function getSpeculosAddress(): string {
|
419
|
+
const speculosAddress = process.env.SPECULOS_ADDRESS;
|
420
|
+
return speculosAddress || "http://127.0.0.1";
|
421
|
+
}
|
422
|
+
|
423
|
+
async function retryAxiosRequest<T>(
|
424
|
+
requestFn: () => Promise<AxiosResponse<T>>,
|
425
|
+
maxRetries: number = 5,
|
426
|
+
baseDelay: number = 1000,
|
427
|
+
retryableStatusCodes: number[] = [500, 502, 503, 504],
|
428
|
+
): Promise<AxiosResponse<T>> {
|
429
|
+
let lastError: AxiosError | Error;
|
430
|
+
|
431
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
432
|
+
try {
|
433
|
+
return await requestFn();
|
434
|
+
} catch (error) {
|
435
|
+
lastError = error as AxiosError | Error;
|
436
|
+
|
437
|
+
const isRetryable =
|
438
|
+
axios.isAxiosError(error) &&
|
439
|
+
error.response &&
|
440
|
+
retryableStatusCodes.includes(error.response.status);
|
441
|
+
|
442
|
+
const isNetworkError = axios.isAxiosError(error) && !error.response;
|
443
|
+
|
444
|
+
if ((isRetryable || isNetworkError) && attempt < maxRetries) {
|
445
|
+
const delay = baseDelay * (attempt + 1);
|
446
|
+
console.warn(
|
447
|
+
`Axios request failed (attempt ${attempt + 1}/${maxRetries + 1}), retrying in ${delay}ms...`,
|
448
|
+
{
|
449
|
+
status: axios.isAxiosError(error) ? error.response?.status : "network error",
|
450
|
+
message: error.message,
|
451
|
+
},
|
452
|
+
);
|
453
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
454
|
+
continue;
|
455
|
+
}
|
456
|
+
|
457
|
+
throw lastError;
|
458
|
+
}
|
459
|
+
}
|
460
|
+
|
461
|
+
throw lastError!;
|
462
|
+
}
|
463
|
+
|
418
464
|
export async function waitFor(text: string, maxAttempts = 15): Promise<string[]> {
|
419
465
|
const port = getEnv("SPECULOS_API_PORT");
|
420
|
-
const address =
|
466
|
+
const address = getSpeculosAddress();
|
421
467
|
const url = `${address}:${port}/events?stream=false¤tscreenonly=true`;
|
422
468
|
|
423
469
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
424
|
-
const { data } = await axios.get<ResponseData>(url);
|
470
|
+
const { data } = await retryAxiosRequest(() => axios.get<ResponseData>(url));
|
425
471
|
const texts = data.events.map(event => event.text);
|
426
472
|
|
427
473
|
if (texts?.some(t => t?.toLowerCase().includes(text.toLowerCase()))) {
|
@@ -436,10 +482,12 @@ export async function waitFor(text: string, maxAttempts = 15): Promise<string[]>
|
|
436
482
|
|
437
483
|
export async function pressBoth() {
|
438
484
|
const speculosApiPort = getEnv("SPECULOS_API_PORT");
|
439
|
-
const speculosAddress =
|
440
|
-
await
|
441
|
-
|
442
|
-
|
485
|
+
const speculosAddress = getSpeculosAddress();
|
486
|
+
await retryAxiosRequest(() =>
|
487
|
+
axios.post(`${speculosAddress}:${speculosApiPort}/button/both`, {
|
488
|
+
action: "press-and-release",
|
489
|
+
}),
|
490
|
+
);
|
443
491
|
}
|
444
492
|
|
445
493
|
export async function pressUntilTextFound(
|
@@ -465,27 +513,33 @@ export async function pressUntilTextFound(
|
|
465
513
|
}
|
466
514
|
|
467
515
|
async function fetchCurrentScreenTexts(speculosApiPort: number): Promise<string> {
|
468
|
-
const speculosAddress =
|
469
|
-
const response = await
|
470
|
-
|
516
|
+
const speculosAddress = getSpeculosAddress();
|
517
|
+
const response = await retryAxiosRequest(() =>
|
518
|
+
axios.get<ResponseData>(
|
519
|
+
`${speculosAddress}:${speculosApiPort}/events?stream=false¤tscreenonly=true`,
|
520
|
+
),
|
471
521
|
);
|
472
522
|
return response.data.events.map(event => event.text).join("");
|
473
523
|
}
|
474
524
|
|
475
525
|
async function fetchAllEvents(speculosApiPort: number): Promise<string[]> {
|
476
|
-
const speculosAddress =
|
477
|
-
const response = await
|
478
|
-
|
526
|
+
const speculosAddress = getSpeculosAddress();
|
527
|
+
const response = await retryAxiosRequest(() =>
|
528
|
+
axios.get<ResponseData>(
|
529
|
+
`${speculosAddress}:${speculosApiPort}/events?stream=false¤tscreenonly=false`,
|
530
|
+
),
|
479
531
|
);
|
480
532
|
return response.data.events.map(event => event.text);
|
481
533
|
}
|
482
534
|
|
483
535
|
export async function pressRightButton(): Promise<void> {
|
484
536
|
const speculosApiPort = getEnv("SPECULOS_API_PORT");
|
485
|
-
const speculosAddress =
|
486
|
-
await
|
487
|
-
|
488
|
-
|
537
|
+
const speculosAddress = getSpeculosAddress();
|
538
|
+
await retryAxiosRequest(() =>
|
539
|
+
axios.post(`${speculosAddress}:${speculosApiPort}/button/right`, {
|
540
|
+
action: "press-and-release",
|
541
|
+
}),
|
542
|
+
);
|
489
543
|
}
|
490
544
|
|
491
545
|
export function containsSubstringInEvent(targetString: string, events: string[]): boolean {
|
@@ -503,12 +557,14 @@ export function containsSubstringInEvent(targetString: string, events: string[])
|
|
503
557
|
}
|
504
558
|
|
505
559
|
export async function takeScreenshot(port?: number): Promise<Buffer | undefined> {
|
506
|
-
const speculosAddress =
|
560
|
+
const speculosAddress = getSpeculosAddress();
|
507
561
|
const speculosApiPort = port ?? getEnv("SPECULOS_API_PORT");
|
508
562
|
try {
|
509
|
-
const response = await
|
510
|
-
|
511
|
-
|
563
|
+
const response = await retryAxiosRequest(() =>
|
564
|
+
axios.get(`${speculosAddress}:${speculosApiPort}/screenshot`, {
|
565
|
+
responseType: "arraybuffer",
|
566
|
+
}),
|
567
|
+
);
|
512
568
|
return response.data;
|
513
569
|
} catch (error) {
|
514
570
|
console.error("Error downloading speculos screenshot:", error);
|
package/src/e2e/speculosCI.ts
CHANGED
@@ -61,22 +61,44 @@ async function githubApiRequest<T = unknown>({
|
|
61
61
|
function waitForSpeculosReady(url: string, { interval = 2000, timeout = 300_000 } = {}) {
|
62
62
|
return new Promise((resolve, reject) => {
|
63
63
|
const startTime = Date.now();
|
64
|
+
let currentRequest: ReturnType<typeof https.get> | null = null;
|
65
|
+
|
66
|
+
function cleanup() {
|
67
|
+
if (currentRequest) {
|
68
|
+
currentRequest.destroy();
|
69
|
+
currentRequest = null;
|
70
|
+
}
|
71
|
+
}
|
64
72
|
|
65
73
|
function check() {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
|
74
|
+
cleanup();
|
75
|
+
|
76
|
+
currentRequest = https.get(url, { timeout: 10000 }, res => {
|
77
|
+
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 400) {
|
78
|
+
process.env.SPECULOS_ADDRESS = url;
|
79
|
+
cleanup();
|
80
|
+
console.warn(`Speculos is ready at ${url}`);
|
81
|
+
resolve(true);
|
82
|
+
} else {
|
83
|
+
console.warn(`Speculos not ready yet, status: ${res.statusCode}`);
|
84
|
+
retry();
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
currentRequest.on("error", error => {
|
89
|
+
console.error(`Request error: ${error.message}`);
|
90
|
+
retry();
|
91
|
+
});
|
92
|
+
|
93
|
+
currentRequest.on("timeout", () => {
|
94
|
+
console.error("Request timeout");
|
95
|
+
retry();
|
96
|
+
});
|
76
97
|
}
|
77
98
|
|
78
99
|
function retry() {
|
79
100
|
if (Date.now() - startTime >= timeout) {
|
101
|
+
cleanup();
|
80
102
|
reject(new Error(`Timeout: ${url} did not become available within ${timeout}ms`));
|
81
103
|
} else {
|
82
104
|
setTimeout(check, interval);
|
@@ -18,6 +18,8 @@ import { inferDescriptorFromAccount, AccountDescriptor } from "@ledgerhq/coin-bi
|
|
18
18
|
import { setEnv } from "@ledgerhq/live-env";
|
19
19
|
import { fromAccountRaw } from "../../account";
|
20
20
|
import { setSupportedCurrencies } from "../../currencies";
|
21
|
+
import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
|
22
|
+
import { CryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/type";
|
21
23
|
|
22
24
|
setSupportedCurrencies(["bitcoin"]);
|
23
25
|
jest.setTimeout(10000);
|
@@ -230,6 +232,11 @@ describe("stringifySatStackConfig", () => {
|
|
230
232
|
});
|
231
233
|
});
|
232
234
|
describe("editSatStackConfig", () => {
|
235
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
236
|
+
setCryptoAssetsStoreForCoinFramework({
|
237
|
+
findTokenById: (_: string) => undefined,
|
238
|
+
findTokenByAddressInCurrency: (_: string, __: string) => undefined,
|
239
|
+
} as CryptoAssetsStore);
|
233
240
|
const config = {
|
234
241
|
node: { ...mockConfig, tls: false },
|
235
242
|
extra: {
|
@@ -0,0 +1,34 @@
|
|
1
|
+
// Goal of this file is to inject all necessary device/signer dependency to coin-modules
|
2
|
+
|
3
|
+
import { createBridges } from "@ledgerhq/coin-canton/bridge/index";
|
4
|
+
import Transport from "@ledgerhq/hw-transport";
|
5
|
+
import { CantonSigner } from "@ledgerhq/coin-canton";
|
6
|
+
import cantonResolver from "@ledgerhq/coin-canton/signer";
|
7
|
+
import type { Account, Bridge } from "@ledgerhq/types-live";
|
8
|
+
import makeCliTools from "@ledgerhq/coin-canton/test/cli";
|
9
|
+
import { CantonCoinConfig } from "@ledgerhq/coin-canton/config";
|
10
|
+
import { TransactionStatus, Transaction } from "@ledgerhq/coin-canton/types";
|
11
|
+
import { LegacySignerCanton } from "@ledgerhq/live-signer-canton";
|
12
|
+
import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
|
13
|
+
import { Resolver } from "../../hw/getAddress/types";
|
14
|
+
import { getCurrencyConfiguration } from "../../config";
|
15
|
+
import { getCryptoCurrencyById } from "../../currencies";
|
16
|
+
|
17
|
+
const createSigner: CreateSigner<CantonSigner> = (transport: Transport) => {
|
18
|
+
return new LegacySignerCanton(transport);
|
19
|
+
};
|
20
|
+
|
21
|
+
const getCurrencyConfig = () => {
|
22
|
+
return getCurrencyConfiguration<CantonCoinConfig>(getCryptoCurrencyById("canton_network"));
|
23
|
+
};
|
24
|
+
|
25
|
+
const bridge: Bridge<Transaction, Account, TransactionStatus> = createBridges(
|
26
|
+
executeWithSigner(createSigner),
|
27
|
+
getCurrencyConfig,
|
28
|
+
);
|
29
|
+
|
30
|
+
const resolver: Resolver = createResolver(createSigner, cantonResolver);
|
31
|
+
|
32
|
+
const cliTools = makeCliTools();
|
33
|
+
|
34
|
+
export { bridge, cliTools, resolver };
|