@ledgerhq/live-common 34.48.1 → 34.49.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/__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/bot/index.js +1 -1
- package/lib/bot/index.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/broadcast.js +2 -2
- package/lib/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.d.ts +3 -23
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +11 -7
- 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/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +4 -2
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +5 -5
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +2 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +5 -13
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +2 -2
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts +3 -2
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +19 -15
- package/lib/bridge/generic-alpaca/signOperation.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/tests/prepareTransaction.test.js +2 -0
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js +5 -4
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +25 -0
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/types.js +3 -0
- package/lib/bridge/generic-alpaca/types.js.map +1 -0
- package/lib/bridge/generic-alpaca/utils.d.ts +4 -8
- 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 -28
- package/lib/config/sharedConfig.js.map +1 -1
- package/lib/crypto/index.d.ts +1 -1
- package/lib/crypto/index.d.ts.map +1 -1
- package/lib/crypto/index.js +2 -5
- package/lib/crypto/index.js.map +1 -1
- package/lib/e2e/data/deviceLabelsData.d.ts +27 -0
- package/lib/e2e/data/deviceLabelsData.d.ts.map +1 -0
- package/lib/e2e/data/deviceLabelsData.js +78 -0
- package/lib/e2e/data/deviceLabelsData.js.map +1 -0
- 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 +51 -44
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +51 -44
- 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/cardano.d.ts.map +1 -1
- package/lib/e2e/families/cardano.js +1 -0
- package/lib/e2e/families/cardano.js.map +1 -1
- package/lib/e2e/families/celo.d.ts +1 -1
- package/lib/e2e/families/celo.d.ts.map +1 -1
- package/lib/e2e/families/celo.js +3 -5
- package/lib/e2e/families/celo.js.map +1 -1
- package/lib/e2e/families/cosmos.d.ts.map +1 -1
- package/lib/e2e/families/cosmos.js +1 -2
- package/lib/e2e/families/cosmos.js.map +1 -1
- package/lib/e2e/families/evm.d.ts.map +1 -1
- package/lib/e2e/families/evm.js +4 -1
- package/lib/e2e/families/evm.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/families/multiversX.d.ts +2 -1
- package/lib/e2e/families/multiversX.d.ts.map +1 -1
- package/lib/e2e/families/multiversX.js +2 -4
- package/lib/e2e/families/multiversX.js.map +1 -1
- package/lib/e2e/families/near.d.ts.map +1 -1
- package/lib/e2e/families/near.js +1 -2
- package/lib/e2e/families/near.js.map +1 -1
- package/lib/e2e/families/osmosis.d.ts.map +1 -1
- package/lib/e2e/families/osmosis.js +1 -3
- package/lib/e2e/families/osmosis.js.map +1 -1
- package/lib/e2e/families/solana.d.ts +2 -1
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +6 -4
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts +2 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +7 -5
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/index.d.ts +5 -17
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +2 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +48 -28
- 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/providers/swap.d.ts.map +1 -1
- package/lib/exchange/providers/swap.js +15 -0
- package/lib/exchange/providers/swap.js.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/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +3 -5
- 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/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/solana/bridge/mock-data.d.ts.map +1 -1
- package/lib/families/solana/bridge/mock-data.js +7 -0
- package/lib/families/solana/bridge/mock-data.js.map +1 -1
- package/lib/families/xrp/setup.d.ts +2 -2
- package/lib/featureFlags/defaultFeatures.d.ts +1 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +6 -13
- 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 +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/entities/interestRateSelectors.d.ts +1 -13
- package/lib/modularDrawer/data/entities/interestRateSelectors.d.ts.map +1 -1
- package/lib/modularDrawer/data/entities/interestRateSelectors.js +2 -17
- package/lib/modularDrawer/data/entities/interestRateSelectors.js.map +1 -1
- package/lib/modularDrawer/data/entities/marketSelectors.d.ts +4 -0
- package/lib/modularDrawer/data/entities/marketSelectors.d.ts.map +1 -0
- package/lib/modularDrawer/data/entities/marketSelectors.js +6 -0
- package/lib/modularDrawer/data/entities/marketSelectors.js.map +1 -0
- package/lib/modularDrawer/data/entities/selectorUtils.d.ts +18 -0
- package/lib/modularDrawer/data/entities/selectorUtils.d.ts.map +1 -0
- package/lib/modularDrawer/data/entities/selectorUtils.js +29 -0
- package/lib/modularDrawer/data/entities/selectorUtils.js.map +1 -0
- 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/modules/useLeftMarketTrendModule.d.ts +50 -0
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.js +49 -0
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.js.map +1 -0
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +56 -0
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js +59 -0
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -0
- 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/useMarketByCurrencies.d.ts +3 -0
- package/lib/modularDrawer/hooks/useMarketByCurrencies.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useMarketByCurrencies.js +26 -0
- package/lib/modularDrawer/hooks/useMarketByCurrencies.js.map +1 -0
- 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/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib/modularDrawer/modules/createAssetConfiguration.js +8 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib/modularDrawer/utils/type.d.ts +7 -0
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- 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/bot/index.js +1 -1
- package/lib-es/bot/index.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/broadcast.js +2 -2
- package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts +3 -23
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +10 -6
- 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/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +4 -2
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +5 -5
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +2 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +5 -13
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +2 -2
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts +3 -2
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +19 -15
- package/lib-es/bridge/generic-alpaca/signOperation.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/tests/prepareTransaction.test.js +2 -0
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js +5 -4
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +25 -0
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/types.js +2 -0
- package/lib-es/bridge/generic-alpaca/types.js.map +1 -0
- package/lib-es/bridge/generic-alpaca/utils.d.ts +4 -8
- 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 +2 -0
- package/lib-es/config/sharedConfig.js.map +1 -1
- package/lib-es/crypto/index.d.ts +1 -1
- package/lib-es/crypto/index.d.ts.map +1 -1
- package/lib-es/crypto/index.js +2 -2
- package/lib-es/crypto/index.js.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.d.ts +27 -0
- package/lib-es/e2e/data/deviceLabelsData.d.ts.map +1 -0
- package/lib-es/e2e/data/deviceLabelsData.js +75 -0
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -0
- 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 +51 -44
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +51 -44
- 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/cardano.d.ts.map +1 -1
- package/lib-es/e2e/families/cardano.js +1 -0
- package/lib-es/e2e/families/cardano.js.map +1 -1
- package/lib-es/e2e/families/celo.d.ts +1 -1
- package/lib-es/e2e/families/celo.d.ts.map +1 -1
- package/lib-es/e2e/families/celo.js +4 -6
- package/lib-es/e2e/families/celo.js.map +1 -1
- package/lib-es/e2e/families/cosmos.d.ts.map +1 -1
- package/lib-es/e2e/families/cosmos.js +2 -3
- package/lib-es/e2e/families/cosmos.js.map +1 -1
- package/lib-es/e2e/families/evm.d.ts.map +1 -1
- package/lib-es/e2e/families/evm.js +5 -2
- package/lib-es/e2e/families/evm.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/families/multiversX.d.ts +2 -1
- package/lib-es/e2e/families/multiversX.d.ts.map +1 -1
- package/lib-es/e2e/families/multiversX.js +3 -5
- package/lib-es/e2e/families/multiversX.js.map +1 -1
- package/lib-es/e2e/families/near.d.ts.map +1 -1
- package/lib-es/e2e/families/near.js +2 -3
- package/lib-es/e2e/families/near.js.map +1 -1
- package/lib-es/e2e/families/osmosis.d.ts.map +1 -1
- package/lib-es/e2e/families/osmosis.js +2 -4
- package/lib-es/e2e/families/osmosis.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts +2 -1
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +7 -5
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts +2 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +8 -6
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/index.d.ts +5 -17
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +2 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +46 -27
- 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/providers/swap.d.ts.map +1 -1
- package/lib-es/exchange/providers/swap.js +15 -0
- package/lib-es/exchange/providers/swap.js.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/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +3 -5
- 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/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/solana/bridge/mock-data.d.ts.map +1 -1
- package/lib-es/families/solana/bridge/mock-data.js +7 -0
- package/lib-es/families/solana/bridge/mock-data.js.map +1 -1
- package/lib-es/families/xrp/setup.d.ts +2 -2
- 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 +6 -13
- 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 +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/entities/interestRateSelectors.d.ts +1 -13
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.d.ts.map +1 -1
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.js +2 -17
- package/lib-es/modularDrawer/data/entities/interestRateSelectors.js.map +1 -1
- package/lib-es/modularDrawer/data/entities/marketSelectors.d.ts +4 -0
- package/lib-es/modularDrawer/data/entities/marketSelectors.d.ts.map +1 -0
- package/lib-es/modularDrawer/data/entities/marketSelectors.js +3 -0
- package/lib-es/modularDrawer/data/entities/marketSelectors.js.map +1 -0
- package/lib-es/modularDrawer/data/entities/selectorUtils.d.ts +18 -0
- package/lib-es/modularDrawer/data/entities/selectorUtils.d.ts.map +1 -0
- package/lib-es/modularDrawer/data/entities/selectorUtils.js +25 -0
- package/lib-es/modularDrawer/data/entities/selectorUtils.js.map +1 -0
- 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/modules/useLeftMarketTrendModule.d.ts +50 -0
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.js +22 -0
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.js.map +1 -0
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +56 -0
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js +32 -0
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.js.map +1 -0
- 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/useMarketByCurrencies.d.ts +3 -0
- package/lib-es/modularDrawer/hooks/useMarketByCurrencies.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useMarketByCurrencies.js +22 -0
- package/lib-es/modularDrawer/hooks/useMarketByCurrencies.js.map +1 -0
- 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/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -1
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js +8 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -1
- package/lib-es/modularDrawer/utils/type.d.ts +7 -0
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- 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 +72 -69
- 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/bot/index.ts +1 -1
- package/src/bridge/generic-alpaca/accountBridge.ts +8 -3
- package/src/bridge/generic-alpaca/alpaca/index.ts +15 -17
- package/src/bridge/generic-alpaca/alpaca/index.unit.test.ts +38 -10
- package/src/bridge/generic-alpaca/broadcast.ts +2 -2
- package/src/bridge/generic-alpaca/createTransaction.ts +13 -24
- package/src/bridge/generic-alpaca/currencyBridge.ts +8 -2
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +5 -7
- package/src/bridge/generic-alpaca/getAccountShape.ts +7 -7
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +5 -14
- package/src/bridge/generic-alpaca/prepareTransaction.ts +10 -17
- package/src/bridge/generic-alpaca/signOperation.ts +25 -31
- 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/tests/prepareTransaction.test.ts +3 -2
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +6 -5
- package/src/bridge/generic-alpaca/types.ts +23 -0
- package/src/bridge/generic-alpaca/utils.test.ts +29 -1
- package/src/bridge/generic-alpaca/utils.ts +17 -8
- package/src/config/sharedConfig.ts +2 -0
- package/src/crypto/index.ts +2 -2
- package/src/e2e/data/deviceLabelsData.ts +100 -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 +51 -44
- package/src/e2e/enum/Network.ts +1 -0
- package/src/e2e/families/cardano.ts +1 -0
- package/src/e2e/families/celo.ts +4 -6
- package/src/e2e/families/cosmos.ts +7 -3
- package/src/e2e/families/evm.ts +12 -2
- package/src/e2e/families/kaspa.ts +17 -0
- package/src/e2e/families/multiversX.ts +4 -5
- package/src/e2e/families/near.ts +8 -3
- package/src/e2e/families/osmosis.ts +2 -4
- package/src/e2e/families/solana.ts +15 -5
- package/src/e2e/families/tezos.ts +10 -6
- package/src/e2e/speculos.ts +67 -28
- package/src/exchange/providers/swap.ts +21 -0
- package/src/exchange/swap/transactionStrategies.ts +121 -73
- package/src/families/canton/config.ts +3 -6
- package/src/families/canton/setup.ts +6 -5
- 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/families/solana/bridge/mock-data.ts +7 -0
- package/src/featureFlags/defaultFeatures.ts +7 -13
- 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/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/entities/interestRateSelectors.ts +2 -34
- package/src/modularDrawer/data/entities/marketSelectors.ts +8 -0
- package/src/modularDrawer/data/entities/selectorUtils.ts +42 -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/modules/useLeftMarketTrendModule.tsx +36 -0
- package/src/modularDrawer/hooks/modules/useRightMarketTrendModule.tsx +57 -0
- package/src/modularDrawer/hooks/useAssetsData.ts +24 -9
- package/src/modularDrawer/hooks/useMarketByCurrencies.ts +29 -0
- package/src/modularDrawer/hooks/useSearch.ts +52 -0
- package/src/modularDrawer/modules/createAssetConfiguration.ts +10 -0
- package/src/modularDrawer/utils/type.ts +2 -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/exchange/providers/swap.integration.test.d.ts +0 -2
- package/lib/exchange/providers/swap.integration.test.d.ts.map +0 -1
- package/lib/exchange/providers/swap.integration.test.js +0 -201
- package/lib/exchange/providers/swap.integration.test.js.map +0 -1
- package/lib-es/exchange/providers/swap.integration.test.d.ts +0 -2
- package/lib-es/exchange/providers/swap.integration.test.d.ts.map +0 -1
- package/lib-es/exchange/providers/swap.integration.test.js +0 -199
- package/lib-es/exchange/providers/swap.integration.test.js.map +0 -1
- package/src/exchange/providers/swap.integration.test.ts +0 -261
@@ -5,11 +5,12 @@ import { getAlpacaApi } from "./alpaca";
|
|
5
5
|
import { adaptCoreOperationToLiveOperation, extractBalance } from "./utils";
|
6
6
|
import { inferSubOperations } from "@ledgerhq/coin-framework/serialization";
|
7
7
|
import { buildSubAccounts, OperationCommon } from "./buildSubAccounts";
|
8
|
+
import { Pagination } from "@ledgerhq/coin-framework/api/types";
|
8
9
|
|
9
10
|
export function genericGetAccountShape(network: string, kind: string): GetAccountShape {
|
10
11
|
return async (info, syncConfig) => {
|
11
12
|
const { address, initialAccount, currency, derivationMode } = info;
|
12
|
-
const alpacaApi = getAlpacaApi(
|
13
|
+
const alpacaApi = getAlpacaApi(currency.id, kind);
|
13
14
|
|
14
15
|
if (alpacaApi.getChainSpecificRules) {
|
15
16
|
const chainSpecificValidation = alpacaApi.getChainSpecificRules();
|
@@ -41,7 +42,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
41
42
|
const lastPagingToken = oldOps[0]?.extra?.pagingToken || "";
|
42
43
|
|
43
44
|
const blockHeight = oldOps.length ? (oldOps[0].blockHeight ?? 0) + 1 : 0;
|
44
|
-
const paginationParams:
|
45
|
+
const paginationParams: Pagination = { minHeight: blockHeight, order: "asc" };
|
45
46
|
if (lastPagingToken) {
|
46
47
|
paginationParams.lastPagingToken = lastPagingToken;
|
47
48
|
}
|
@@ -73,7 +74,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
73
74
|
getTokenFromAsset: alpacaApi.getTokenFromAsset,
|
74
75
|
}) || [];
|
75
76
|
|
76
|
-
const
|
77
|
+
const operations = mergedOps.map(op => {
|
77
78
|
const subOperations = inferSubOperations(op.hash, subAccounts);
|
78
79
|
|
79
80
|
return {
|
@@ -85,13 +86,12 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
85
86
|
const res = {
|
86
87
|
id: accountId,
|
87
88
|
xpub: address,
|
88
|
-
blockHeight:
|
89
|
-
operationsWithSubs.length === 0 ? 0 : blockInfo.height || initialAccount?.blockHeight,
|
89
|
+
blockHeight: operations.length === 0 ? 0 : blockInfo.height || initialAccount?.blockHeight,
|
90
90
|
balance: new BigNumber(nativeBalance.toString()),
|
91
91
|
spendableBalance: new BigNumber(spendableBalance.toString()),
|
92
|
-
operations
|
92
|
+
operations,
|
93
93
|
subAccounts,
|
94
|
-
operationsCount:
|
94
|
+
operationsCount: operations.length,
|
95
95
|
};
|
96
96
|
return res;
|
97
97
|
};
|
@@ -1,27 +1,17 @@
|
|
1
|
-
import { AccountBridge
|
1
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
2
2
|
import { AccountAwaitingSendPendingOperations } from "@ledgerhq/errors";
|
3
3
|
import BigNumber from "bignumber.js";
|
4
4
|
import { getAlpacaApi } from "./alpaca";
|
5
5
|
import { transactionToIntent } from "./utils";
|
6
|
+
import { GenericTransaction } from "./types";
|
6
7
|
|
7
8
|
// => alpaca validateIntent
|
8
9
|
export function genericGetTransactionStatus(
|
9
10
|
network,
|
10
11
|
kind,
|
11
12
|
): AccountBridge<any>["getTransactionStatus"] {
|
12
|
-
return async (
|
13
|
-
account,
|
14
|
-
transaction: TransactionCommon & {
|
15
|
-
fees: BigNumber | null | undefined;
|
16
|
-
assetReference?: string;
|
17
|
-
assetOwner?: string;
|
18
|
-
mode?: string;
|
19
|
-
subAccountId?: string;
|
20
|
-
memoType?: string;
|
21
|
-
memoValue?: string;
|
22
|
-
},
|
23
|
-
) => {
|
24
|
-
const alpacaApi = getAlpacaApi(network, kind);
|
13
|
+
return async (account, transaction: GenericTransaction) => {
|
14
|
+
const alpacaApi = getAlpacaApi(account.currency.id, kind);
|
25
15
|
const draftTransaction = {
|
26
16
|
mode: transaction?.mode,
|
27
17
|
recipient: transaction.recipient,
|
@@ -32,6 +22,7 @@ export function genericGetTransactionStatus(
|
|
32
22
|
subAccountId: transaction.subAccountId || "",
|
33
23
|
memoType: transaction.memoType || "",
|
34
24
|
memoValue: transaction.memoValue || "",
|
25
|
+
family: transaction.family,
|
35
26
|
};
|
36
27
|
|
37
28
|
if (alpacaApi.getChainSpecificRules) {
|
@@ -1,24 +1,17 @@
|
|
1
|
-
import { Account, AccountBridge
|
1
|
+
import { Account, AccountBridge } from "@ledgerhq/types-live";
|
2
2
|
import { getAlpacaApi } from "./alpaca";
|
3
3
|
import { transactionToIntent } from "./utils";
|
4
4
|
import BigNumber from "bignumber.js";
|
5
|
-
import { AssetInfo
|
5
|
+
import { AssetInfo } from "@ledgerhq/coin-framework/api/types";
|
6
6
|
import { decodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
|
7
7
|
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
8
|
+
import { GenericTransaction } from "./types";
|
8
9
|
|
9
10
|
function bnEq(a: BigNumber | null | undefined, b: BigNumber | null | undefined): boolean {
|
10
11
|
return !a && !b ? true : !a || !b ? false : a.eq(b);
|
11
12
|
}
|
12
13
|
|
13
|
-
|
14
|
-
fees: BigNumber | null | undefined;
|
15
|
-
customFees?: FeeEstimation;
|
16
|
-
assetReference?: string;
|
17
|
-
assetOwner?: string;
|
18
|
-
subAccountId?: string;
|
19
|
-
};
|
20
|
-
|
21
|
-
function assetInfosFallback(transaction: TransactionParam): {
|
14
|
+
function assetInfosFallback(transaction: GenericTransaction): {
|
22
15
|
assetReference: string;
|
23
16
|
assetOwner: string;
|
24
17
|
} {
|
@@ -31,17 +24,17 @@ function assetInfosFallback(transaction: TransactionParam): {
|
|
31
24
|
export function genericPrepareTransaction(
|
32
25
|
network: string,
|
33
26
|
kind,
|
34
|
-
): AccountBridge<
|
35
|
-
return async (account, transaction:
|
36
|
-
const { getAssetFromToken } = getAlpacaApi(
|
27
|
+
): AccountBridge<GenericTransaction, Account>["prepareTransaction"] {
|
28
|
+
return async (account, transaction: GenericTransaction) => {
|
29
|
+
const { getAssetFromToken } = getAlpacaApi(account.currency.id, kind);
|
37
30
|
const { assetReference, assetOwner } = getAssetFromToken
|
38
31
|
? getAssetInfos(transaction, account.freshAddress, getAssetFromToken)
|
39
32
|
: assetInfosFallback(transaction);
|
40
33
|
|
41
|
-
let fees = transaction.customFees?.parameters?.fees || null;
|
34
|
+
let fees: BigNumber | bigint | null = transaction.customFees?.parameters?.fees || null;
|
42
35
|
if (fees === null) {
|
43
36
|
fees = (
|
44
|
-
await getAlpacaApi(
|
37
|
+
await getAlpacaApi(account.currency.id, kind).estimateFees(
|
45
38
|
transactionToIntent(account, {
|
46
39
|
...transaction,
|
47
40
|
}),
|
@@ -68,7 +61,7 @@ export function genericPrepareTransaction(
|
|
68
61
|
}
|
69
62
|
|
70
63
|
export function getAssetInfos(
|
71
|
-
tr:
|
64
|
+
tr: GenericTransaction,
|
72
65
|
owner: string,
|
73
66
|
getAssetFromToken: (token: TokenCurrency, owner: string) => AssetInfo,
|
74
67
|
): {
|
@@ -1,12 +1,6 @@
|
|
1
1
|
import { Observable } from "rxjs";
|
2
2
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
3
|
-
import type {
|
4
|
-
Account,
|
5
|
-
DeviceId,
|
6
|
-
SignOperationEvent,
|
7
|
-
AccountBridge,
|
8
|
-
TransactionCommon,
|
9
|
-
} from "@ledgerhq/types-live";
|
3
|
+
import type { Account, DeviceId, SignOperationEvent, AccountBridge } from "@ledgerhq/types-live";
|
10
4
|
import { getAlpacaApi } from "./alpaca";
|
11
5
|
import { buildOptimisticOperation, transactionToIntent } from "./utils";
|
12
6
|
import { FeeNotLoaded } from "@ledgerhq/errors";
|
@@ -15,6 +9,7 @@ import { MapMemo, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
15
9
|
import { StellarMemo } from "@ledgerhq/coin-stellar/types/bridge";
|
16
10
|
import { log } from "@ledgerhq/logs";
|
17
11
|
import BigNumber from "bignumber.js";
|
12
|
+
import { GenericTransaction } from "./types";
|
18
13
|
|
19
14
|
/**
|
20
15
|
* Applies memo information to transaction intent
|
@@ -22,12 +17,12 @@ import BigNumber from "bignumber.js";
|
|
22
17
|
*/
|
23
18
|
function applyMemoToIntent(
|
24
19
|
transactionIntent: TransactionIntent<any>,
|
25
|
-
transaction:
|
20
|
+
transaction: GenericTransaction,
|
26
21
|
): TransactionIntent<any> {
|
27
22
|
// Handle destination tag memo (for XRP-like chains)
|
28
|
-
if (transaction
|
23
|
+
if (transaction.tag) {
|
29
24
|
const txWithMemoTag = transactionIntent as TransactionIntent<MapMemo<string, string>>;
|
30
|
-
const txMemo = String(transaction
|
25
|
+
const txMemo = String(transaction.tag);
|
31
26
|
|
32
27
|
txWithMemoTag.memo = {
|
33
28
|
type: "map",
|
@@ -39,10 +34,10 @@ function applyMemoToIntent(
|
|
39
34
|
}
|
40
35
|
|
41
36
|
// Handle Stellar-style memo
|
42
|
-
if (transaction
|
37
|
+
if (transaction.memoType && transaction.memoValue) {
|
43
38
|
const txWithMemo = transactionIntent as TransactionIntent<StellarMemo>;
|
44
|
-
const txMemoType = String(transaction
|
45
|
-
const txMemoValue = String(transaction
|
39
|
+
const txMemoType = String(transaction.memoType);
|
40
|
+
const txMemoValue = String(transaction.memoValue);
|
46
41
|
|
47
42
|
txWithMemo.memo = {
|
48
43
|
type: txMemoType as "NO_MEMO" | "MEMO_TEXT" | "MEMO_ID" | "MEMO_HASH" | "MEMO_RETURN",
|
@@ -60,7 +55,7 @@ function applyMemoToIntent(
|
|
60
55
|
*/
|
61
56
|
function enrichTransactionIntent(
|
62
57
|
transactionIntent: TransactionIntent<any>,
|
63
|
-
transaction:
|
58
|
+
transaction: GenericTransaction,
|
64
59
|
publicKey: string,
|
65
60
|
): TransactionIntent<any> {
|
66
61
|
// Set sender public key
|
@@ -76,31 +71,33 @@ function enrichTransactionIntent(
|
|
76
71
|
*/
|
77
72
|
export const genericSignOperation =
|
78
73
|
(network, kind) =>
|
79
|
-
(signerContext: SignerContext<any>): AccountBridge<
|
74
|
+
(signerContext: SignerContext<any>): AccountBridge<GenericTransaction>["signOperation"] =>
|
80
75
|
({
|
81
76
|
account,
|
82
77
|
transaction,
|
83
78
|
deviceId,
|
84
79
|
}: {
|
85
80
|
account: Account;
|
86
|
-
transaction:
|
81
|
+
transaction: GenericTransaction;
|
87
82
|
deviceId: DeviceId;
|
88
83
|
}): Observable<SignOperationEvent> =>
|
89
84
|
new Observable(o => {
|
90
85
|
async function main() {
|
91
|
-
|
92
|
-
if (!transaction
|
93
|
-
const fees = BigInt(transaction
|
94
|
-
if (transaction
|
86
|
+
const alpacaApi = getAlpacaApi(account.currency.id, kind);
|
87
|
+
if (!transaction.fees) throw new FeeNotLoaded();
|
88
|
+
const fees = BigInt(transaction.fees?.toString() || "0");
|
89
|
+
if (transaction.useAllAmount) {
|
95
90
|
const draftTransaction = {
|
91
|
+
mode: transaction.mode,
|
96
92
|
recipient: transaction.recipient,
|
97
93
|
amount: transaction.amount ?? 0,
|
98
94
|
useAllAmount: !!transaction.useAllAmount,
|
99
|
-
assetReference: transaction?.
|
100
|
-
assetOwner: transaction?.
|
95
|
+
assetReference: transaction?.assetReference || "",
|
96
|
+
assetOwner: transaction?.assetOwner || "",
|
101
97
|
subAccountId: transaction.subAccountId || "",
|
98
|
+
family: transaction.family,
|
102
99
|
};
|
103
|
-
const { amount } = await
|
100
|
+
const { amount } = await alpacaApi.validateIntent(
|
104
101
|
transactionToIntent(account, draftTransaction),
|
105
102
|
{ value: fees },
|
106
103
|
);
|
@@ -117,16 +114,13 @@ export const genericSignOperation =
|
|
117
114
|
transactionIntent = enrichTransactionIntent(transactionIntent, transaction, publicKey);
|
118
115
|
|
119
116
|
// TODO: should compute it and pass it down to craftTransaction (duplicate call right now)
|
120
|
-
const sequenceNumber = await
|
121
|
-
transactionIntent.sender,
|
122
|
-
);
|
117
|
+
const sequenceNumber = await alpacaApi.getSequence(transactionIntent.sender);
|
123
118
|
transactionIntent.sequence = sequenceNumber;
|
124
119
|
|
125
120
|
/* Craft unsigned blob via Alpaca */
|
126
|
-
const { transaction: unsigned } = await
|
127
|
-
|
128
|
-
|
129
|
-
);
|
121
|
+
const { transaction: unsigned } = await alpacaApi.craftTransaction(transactionIntent, {
|
122
|
+
value: fees,
|
123
|
+
});
|
130
124
|
|
131
125
|
/* Notify UI that the device is now showing the tx */
|
132
126
|
o.next({ type: "device-signature-requested" });
|
@@ -140,7 +134,7 @@ export const genericSignOperation =
|
|
140
134
|
o.next({ type: "device-signature-granted" });
|
141
135
|
|
142
136
|
/* Combine payload + signature for broadcast */
|
143
|
-
const combined = await
|
137
|
+
const combined = await alpacaApi.combine(
|
144
138
|
signedInfo.unsigned,
|
145
139
|
signedInfo.txnSig,
|
146
140
|
signedInfo.publicKey,
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { filter, firstValueFrom } from "rxjs";
|
2
|
+
import { EvmAddress, EvmSignature, EvmSigner } from "@ledgerhq/coin-evm/types/signer";
|
3
|
+
import { CreateSigner } from "../../setup";
|
4
|
+
import { DeviceManagementKit } from "@ledgerhq/device-management-kit";
|
5
|
+
import { DmkSignerEth, LegacySignerEth } from "@ledgerhq/live-signer-evm";
|
6
|
+
import Transport from "@ledgerhq/hw-transport";
|
7
|
+
import { getEnv } from "@ledgerhq/live-env";
|
8
|
+
import { ResolutionConfig, LoadConfig } from "@ledgerhq/hw-app-eth/lib/services/types";
|
9
|
+
import { Signature } from "ethers";
|
10
|
+
|
11
|
+
export type Signer = {
|
12
|
+
getAddress: (path: string) => Promise<EvmAddress>;
|
13
|
+
signTransaction: (path: string, tx: string) => Promise<string>;
|
14
|
+
};
|
15
|
+
|
16
|
+
const isDmkTransport = (
|
17
|
+
transport: Transport,
|
18
|
+
): transport is Transport & { dmk: DeviceManagementKit; sessionId: string } => {
|
19
|
+
return (
|
20
|
+
"dmk" in transport &&
|
21
|
+
transport.dmk !== undefined &&
|
22
|
+
"sessionId" in transport &&
|
23
|
+
transport.sessionId !== undefined
|
24
|
+
);
|
25
|
+
};
|
26
|
+
|
27
|
+
const createLiveSigner: CreateSigner<EvmSigner> = (transport: Transport) => {
|
28
|
+
if (isDmkTransport(transport)) {
|
29
|
+
return new DmkSignerEth(transport.dmk, transport.sessionId);
|
30
|
+
}
|
31
|
+
|
32
|
+
return new LegacySignerEth(transport);
|
33
|
+
};
|
34
|
+
|
35
|
+
export const createSigner: CreateSigner<Signer> = (transport: Transport) => {
|
36
|
+
const signer = createLiveSigner(transport);
|
37
|
+
|
38
|
+
return {
|
39
|
+
getAddress: signer.getAddress.bind(signer),
|
40
|
+
signTransaction: async (path, tx) => {
|
41
|
+
// Configure type of resolutions necessary for the clear signing
|
42
|
+
const resolutionConfig: ResolutionConfig = {
|
43
|
+
externalPlugins: true,
|
44
|
+
erc20: true,
|
45
|
+
nft: false,
|
46
|
+
uniswapV3: true,
|
47
|
+
};
|
48
|
+
const loadConfig: LoadConfig = {
|
49
|
+
cryptoassetsBaseURL: getEnv("DYNAMIC_CAL_BASE_URL"),
|
50
|
+
nftExplorerBaseURL: getEnv("NFT_METADATA_SERVICE") + "/v1/ethereum",
|
51
|
+
};
|
52
|
+
|
53
|
+
signer.setLoadConfig(loadConfig);
|
54
|
+
|
55
|
+
const observable = signer.clearSignTransaction(path, tx.substring(2), resolutionConfig, true);
|
56
|
+
const event = observable.pipe(
|
57
|
+
filter((event): event is { type: "signer.evm.signed"; value: EvmSignature } => {
|
58
|
+
return event.type === "signer.evm.signed";
|
59
|
+
}),
|
60
|
+
);
|
61
|
+
const { value } = await firstValueFrom(event);
|
62
|
+
|
63
|
+
return Signature.from({
|
64
|
+
r: "0x" + value.r,
|
65
|
+
s: "0x" + value.s,
|
66
|
+
v: typeof value.v === "number" ? value.v : parseInt(value.v, 16),
|
67
|
+
}).serialized;
|
68
|
+
},
|
69
|
+
};
|
70
|
+
};
|
@@ -1,22 +1,12 @@
|
|
1
|
-
import { GetAddressFn } from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
|
2
1
|
import xrpGetAddress from "@ledgerhq/coin-xrp/signer/getAddress";
|
3
2
|
import stellarGetAddress from "@ledgerhq/coin-stellar/signer/getAddress";
|
4
|
-
import { CreateSigner, executeWithSigner } from "../../setup";
|
5
|
-
import Xrp from "@ledgerhq/hw-app-xrp";
|
6
3
|
import Stellar from "@ledgerhq/hw-app-str";
|
7
|
-
|
8
|
-
import Transport from "@ledgerhq/hw-transport";
|
9
4
|
import { signTransaction, stellarSignTransaction } from "./signTransaction";
|
10
|
-
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
11
|
-
import { SignTransactionOptions } from "./types";
|
12
5
|
import { StrKey } from "@stellar/stellar-sdk";
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
signMessage?: (message: string) => Promise<string>;
|
18
|
-
context: SignerContext<any>;
|
19
|
-
};
|
6
|
+
import { CreateSigner, executeWithSigner } from "../../setup";
|
7
|
+
import Xrp from "@ledgerhq/hw-app-xrp";
|
8
|
+
import Transport from "@ledgerhq/hw-transport";
|
9
|
+
import { AlpacaSigner } from "./types";
|
20
10
|
|
21
11
|
const createSignerXrp: CreateSigner<Xrp> = (transport: Transport) => {
|
22
12
|
return new Xrp(transport);
|
@@ -47,7 +37,7 @@ const createSignerStellar: CreateSigner<Stellar> = (transport: Transport) => {
|
|
47
37
|
|
48
38
|
const signerContextStellar = executeWithSigner(createSignerStellar);
|
49
39
|
|
50
|
-
export function getSigner(network): AlpacaSigner {
|
40
|
+
export function getSigner(network: string): AlpacaSigner {
|
51
41
|
switch (network) {
|
52
42
|
case "ripple":
|
53
43
|
case "xrp": {
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
2
|
-
import { XrpSigner } from "@ledgerhq/coin-xrp/index";
|
3
|
-
import { SignTransactionOptions } from "./types";
|
4
2
|
import { StellarSigner } from "@ledgerhq/coin-stellar/types/signer";
|
3
|
+
import { LegacySigner, SignTransactionOptions } from "./types";
|
5
4
|
|
6
|
-
export const signTransaction =
|
5
|
+
export const signTransaction = <Signer extends LegacySigner>(
|
6
|
+
signerContext: SignerContext<Signer>,
|
7
|
+
) => {
|
7
8
|
return async (deviceId: string, { path, rawTxHex }: SignTransactionOptions) => {
|
8
9
|
const signedTx = await signerContext(deviceId, signer =>
|
9
10
|
signer.signTransaction(path, rawTxHex),
|
@@ -1,3 +1,17 @@
|
|
1
|
+
import { GetAddressFn } from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
|
2
|
+
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
3
|
+
|
4
|
+
export type LegacySigner = {
|
5
|
+
signTransaction: (path: string, rawTxHex: string) => Promise<string>;
|
6
|
+
};
|
7
|
+
|
8
|
+
export type AlpacaSigner<S = unknown> = {
|
9
|
+
getAddress: GetAddressFn;
|
10
|
+
signTransaction?: (deviceId: string, opts: SignTransactionOptions) => Promise<string>;
|
11
|
+
signMessage?: (message: string) => Promise<string>;
|
12
|
+
context: SignerContext<S>;
|
13
|
+
};
|
14
|
+
|
1
15
|
export type SignTransactionOptions = {
|
2
16
|
rawTxHex: string;
|
3
17
|
path: string;
|
@@ -0,0 +1,173 @@
|
|
1
|
+
import BigNumber from "bignumber.js";
|
2
|
+
import { genericGetAccountShape } from "../getAccountShape";
|
3
|
+
|
4
|
+
jest.mock("@ledgerhq/coin-framework/account/index", () => ({
|
5
|
+
encodeAccountId: jest.fn(() => "accId"),
|
6
|
+
}));
|
7
|
+
|
8
|
+
const mergeOpsMock = jest.fn();
|
9
|
+
jest.mock("@ledgerhq/coin-framework/bridge/jsHelpers", () => ({
|
10
|
+
mergeOps: (...args: any[]) => mergeOpsMock(...args),
|
11
|
+
}));
|
12
|
+
|
13
|
+
const listOperationsMock = jest.fn();
|
14
|
+
const getBalanceMock = jest.fn();
|
15
|
+
const lastBlockMock = jest.fn();
|
16
|
+
const getTokenFromAssetMock = jest.fn();
|
17
|
+
const chainSpecificGetAccountShapeMock = jest.fn();
|
18
|
+
jest.mock("../alpaca", () => ({
|
19
|
+
getAlpacaApi: () => ({
|
20
|
+
lastBlock: (...a: any[]) => lastBlockMock(...a),
|
21
|
+
getBalance: (...a: any[]) => getBalanceMock(...a),
|
22
|
+
listOperations: (...a: any[]) => listOperationsMock(...a),
|
23
|
+
getTokenFromAsset: (...a: any[]) => getTokenFromAssetMock(...a),
|
24
|
+
getChainSpecificRules: () => ({
|
25
|
+
getAccountShape: (...a: any[]) => chainSpecificGetAccountShapeMock(...a),
|
26
|
+
}),
|
27
|
+
}),
|
28
|
+
}));
|
29
|
+
|
30
|
+
const adaptCoreOperationToLiveOperationMock = jest.fn();
|
31
|
+
const extractBalanceMock = jest.fn();
|
32
|
+
jest.mock("../utils", () => ({
|
33
|
+
adaptCoreOperationToLiveOperation: (...a: any[]) => adaptCoreOperationToLiveOperationMock(...a),
|
34
|
+
extractBalance: (...a: any[]) => extractBalanceMock(...a),
|
35
|
+
}));
|
36
|
+
|
37
|
+
const inferSubOperationsMock = jest.fn();
|
38
|
+
jest.mock("@ledgerhq/coin-framework/serialization", () => ({
|
39
|
+
inferSubOperations: (...a: any[]) => inferSubOperationsMock(...a),
|
40
|
+
}));
|
41
|
+
|
42
|
+
const buildSubAccountsMock = jest.fn();
|
43
|
+
jest.mock("../buildSubAccounts", () => ({
|
44
|
+
buildSubAccounts: (...a: any[]) => buildSubAccountsMock(...a),
|
45
|
+
}));
|
46
|
+
|
47
|
+
// Test matrix for Stellar & XRP
|
48
|
+
const chains = [
|
49
|
+
{ currency: { id: "stellar", name: "Stellar" }, network: "testnet" },
|
50
|
+
{ currency: { id: "ripple", name: "XRP" }, network: "mainnet" },
|
51
|
+
];
|
52
|
+
|
53
|
+
describe("genericGetAccountShape (stellar & xrp)", () => {
|
54
|
+
beforeEach(() => {
|
55
|
+
jest.clearAllMocks();
|
56
|
+
});
|
57
|
+
|
58
|
+
describe.each(chains)("$currency.id", ({ currency, network }) => {
|
59
|
+
test("builds account shape with existing operations, pagination and sub accounts", async () => {
|
60
|
+
const oldOp = {
|
61
|
+
hash: "h1",
|
62
|
+
blockHeight: 10,
|
63
|
+
type: "OPT_IN",
|
64
|
+
extra: { pagingToken: "pt1", assetReference: "ar1", assetOwner: "ow1" },
|
65
|
+
};
|
66
|
+
const initialAccount = { operations: [oldOp], blockHeight: 10 };
|
67
|
+
|
68
|
+
extractBalanceMock.mockReturnValue({ value: "1000", locked: "300" });
|
69
|
+
getBalanceMock.mockResolvedValue([
|
70
|
+
{ asset: { type: "native" }, value: "1000", locked: "300" },
|
71
|
+
{ asset: { type: "token", symbol: "TOK1" }, value: "42" },
|
72
|
+
{ asset: { type: "token", symbol: "TOK_IGNORE" }, value: "5" },
|
73
|
+
]);
|
74
|
+
|
75
|
+
getTokenFromAssetMock.mockImplementation(asset =>
|
76
|
+
asset.symbol === "TOK1" ? { id: `${currency.id}_token1` } : null,
|
77
|
+
);
|
78
|
+
|
79
|
+
const coreOp = { hash: "h2", height: 12 };
|
80
|
+
listOperationsMock.mockResolvedValue([[coreOp]]);
|
81
|
+
|
82
|
+
adaptCoreOperationToLiveOperationMock.mockImplementation((_accId, op) => ({
|
83
|
+
hash: op.hash,
|
84
|
+
type: "IN",
|
85
|
+
blockHeight: 12,
|
86
|
+
extra: { assetReference: "ar2", assetOwner: "ow2" },
|
87
|
+
}));
|
88
|
+
|
89
|
+
mergeOpsMock.mockImplementation((oldOps, newOps) => [...newOps, ...oldOps]);
|
90
|
+
|
91
|
+
buildSubAccountsMock.mockReturnValue([
|
92
|
+
{ id: `${currency.id}_subAcc1`, type: "TokenAccount" },
|
93
|
+
]);
|
94
|
+
|
95
|
+
inferSubOperationsMock.mockImplementation(hash =>
|
96
|
+
hash === "h2" ? [{ id: `${currency.id}_subOp1` }] : [],
|
97
|
+
);
|
98
|
+
|
99
|
+
lastBlockMock.mockResolvedValue({ height: 123 });
|
100
|
+
|
101
|
+
const getShape = genericGetAccountShape(network, currency.id);
|
102
|
+
const result = await getShape(
|
103
|
+
{
|
104
|
+
address: `${currency.id}_addr1`,
|
105
|
+
initialAccount,
|
106
|
+
currency,
|
107
|
+
derivationMode: "",
|
108
|
+
} as any,
|
109
|
+
{ paginationConfig: {} as any },
|
110
|
+
);
|
111
|
+
|
112
|
+
expect(chainSpecificGetAccountShapeMock).toHaveBeenCalledWith(`${currency.id}_addr1`);
|
113
|
+
|
114
|
+
expect(listOperationsMock).toHaveBeenCalledWith(`${currency.id}_addr1`, {
|
115
|
+
minHeight: 11,
|
116
|
+
order: "asc",
|
117
|
+
lastPagingToken: "pt1",
|
118
|
+
});
|
119
|
+
|
120
|
+
const assetsBalancePassed = buildSubAccountsMock.mock.calls[0][0].assetsBalance;
|
121
|
+
expect(assetsBalancePassed).toHaveLength(1);
|
122
|
+
expect(assetsBalancePassed[0].asset.symbol).toBe("TOK1");
|
123
|
+
|
124
|
+
const assetOpsPassed = buildSubAccountsMock.mock.calls[0][0].operations;
|
125
|
+
expect(assetOpsPassed).toHaveLength(1);
|
126
|
+
expect(assetOpsPassed[0].hash).toBe("h2");
|
127
|
+
|
128
|
+
expect(result).toMatchObject({
|
129
|
+
balance: new BigNumber(1000),
|
130
|
+
spendableBalance: new BigNumber(700),
|
131
|
+
blockHeight: 123,
|
132
|
+
operationsCount: 2,
|
133
|
+
subAccounts: [{ id: `${currency.id}_subAcc1`, type: "TokenAccount" }],
|
134
|
+
operations: [
|
135
|
+
{
|
136
|
+
hash: "h2",
|
137
|
+
type: "IN",
|
138
|
+
blockHeight: 12,
|
139
|
+
subOperations: [{ id: `${currency.id}_subOp1` }],
|
140
|
+
extra: { assetReference: "ar2", assetOwner: "ow2" },
|
141
|
+
},
|
142
|
+
oldOp,
|
143
|
+
],
|
144
|
+
});
|
145
|
+
});
|
146
|
+
|
147
|
+
test("handles empty operations (no old ops, no new ops) and blockHeight=0", async () => {
|
148
|
+
getBalanceMock.mockResolvedValue([{ asset: { type: "native" }, value: "0", locked: "0" }]);
|
149
|
+
extractBalanceMock.mockReturnValue({ value: "0", locked: "0" });
|
150
|
+
listOperationsMock.mockResolvedValue([[]]);
|
151
|
+
buildSubAccountsMock.mockReturnValue([]);
|
152
|
+
|
153
|
+
const getShape = genericGetAccountShape(network, currency.id);
|
154
|
+
const result = await getShape(
|
155
|
+
{
|
156
|
+
address: `${currency.id}_addr2`,
|
157
|
+
initialAccount: undefined,
|
158
|
+
currency,
|
159
|
+
derivationMode: "",
|
160
|
+
} as any,
|
161
|
+
{ paginationConfig: {} as any },
|
162
|
+
);
|
163
|
+
expect(result).toMatchObject({
|
164
|
+
operations: [], // Empty array check for `operations`
|
165
|
+
blockHeight: 0,
|
166
|
+
operationsCount: 0,
|
167
|
+
subAccounts: [], // Empty array check for `subAccounts`
|
168
|
+
balance: new BigNumber(0),
|
169
|
+
spendableBalance: new BigNumber(0),
|
170
|
+
});
|
171
|
+
});
|
172
|
+
});
|
173
|
+
});
|
@@ -2,7 +2,6 @@ import { genericPrepareTransaction } from "../prepareTransaction";
|
|
2
2
|
import { getAlpacaApi } from "../alpaca";
|
3
3
|
import { transactionToIntent } from "../utils";
|
4
4
|
import BigNumber from "bignumber.js";
|
5
|
-
import type { TransactionCommon } from "@ledgerhq/types-live";
|
6
5
|
|
7
6
|
jest.mock("../alpaca", () => ({
|
8
7
|
getAlpacaApi: jest.fn(),
|
@@ -19,12 +18,14 @@ describe("genericPrepareTransaction", () => {
|
|
19
18
|
const account = {
|
20
19
|
id: "test-account",
|
21
20
|
address: "0xabc",
|
21
|
+
currency: { id: "ethereum" },
|
22
22
|
} as any;
|
23
23
|
|
24
|
-
const baseTransaction
|
24
|
+
const baseTransaction = {
|
25
25
|
amount: new BigNumber(100_000),
|
26
26
|
fees: new BigNumber(500),
|
27
27
|
recipient: "0xrecipient",
|
28
|
+
family: "family",
|
28
29
|
};
|
29
30
|
|
30
31
|
const txIntent = { mock: "intent" };
|
@@ -23,11 +23,6 @@ describe("genericSignOperation", () => {
|
|
23
23
|
signTransaction: jest.fn(),
|
24
24
|
};
|
25
25
|
|
26
|
-
const account = {
|
27
|
-
freshAddressPath: "44'/144'/0'/0/0",
|
28
|
-
address: "rTestAddress",
|
29
|
-
} as any;
|
30
|
-
|
31
26
|
const transaction = {
|
32
27
|
amount: 100_000n,
|
33
28
|
fees: 500n,
|
@@ -66,6 +61,12 @@ describe("genericSignOperation", () => {
|
|
66
61
|
});
|
67
62
|
|
68
63
|
networks.forEach(network => {
|
64
|
+
const account = {
|
65
|
+
freshAddressPath: "44'/144'/0'/0/0",
|
66
|
+
address: "rTestAddress",
|
67
|
+
currency: { id: network },
|
68
|
+
} as any;
|
69
|
+
|
69
70
|
it(`emits full sign operation flow for ${network}`, async () => {
|
70
71
|
const signOperation = genericSignOperation(network, kind)(mockSignerContext);
|
71
72
|
const observable = signOperation({ account, transaction, deviceId });
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { TransactionCommon } from "@ledgerhq/types-live";
|
2
|
+
import BigNumber from "bignumber.js";
|
3
|
+
import type { Unit } from "@ledgerhq/types-cryptoassets";
|
4
|
+
|
5
|
+
type NetworkInfo = {
|
6
|
+
fees: BigNumber;
|
7
|
+
};
|
8
|
+
|
9
|
+
export type GenericTransaction = TransactionCommon & {
|
10
|
+
family: string;
|
11
|
+
fees?: BigNumber | null;
|
12
|
+
customFees?: {
|
13
|
+
parameters: { fees?: BigNumber | null };
|
14
|
+
};
|
15
|
+
tag?: number | null | undefined;
|
16
|
+
feeCustomUnit?: Unit | null | undefined;
|
17
|
+
memoType?: string | null;
|
18
|
+
memoValue?: string | null;
|
19
|
+
mode?: "send" | "changeTrust" | "send-legacy" | "send-eip1559";
|
20
|
+
assetReference?: string;
|
21
|
+
assetOwner?: string;
|
22
|
+
networkInfo?: NetworkInfo | null;
|
23
|
+
};
|