@ledgerhq/live-common 34.51.0-nightly.9 → 34.52.0-nightly.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/account/helpers.d.ts +10 -0
- package/lib/account/helpers.d.ts.map +1 -1
- package/lib/account/helpers.js +43 -16
- package/lib/account/helpers.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +45 -37
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +20 -0
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +1 -1
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/config/index.d.ts +2 -2
- package/lib/config/index.d.ts.map +1 -1
- package/lib/config/index.js.map +1 -1
- package/lib/dada-client/hooks/useDrawerConfiguration.d.ts +19 -0
- package/lib/dada-client/hooks/useDrawerConfiguration.d.ts.map +1 -0
- package/lib/dada-client/hooks/useDrawerConfiguration.js +45 -0
- package/lib/dada-client/hooks/useDrawerConfiguration.js.map +1 -0
- package/lib/e2e/data/deviceLabelsData.d.ts +8 -0
- package/lib/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib/e2e/data/deviceLabelsData.js +62 -2
- package/lib/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +3 -0
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +1 -0
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js +26 -0
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +1 -0
- package/lib/e2e/deviceInteraction/TouchDeviceSimulator.d.ts +4 -0
- package/lib/e2e/deviceInteraction/TouchDeviceSimulator.d.ts.map +1 -0
- package/lib/e2e/deviceInteraction/TouchDeviceSimulator.js +50 -0
- package/lib/e2e/deviceInteraction/TouchDeviceSimulator.js.map +1 -0
- package/lib/e2e/enum/Account.d.ts +2 -4
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +5 -8
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/Device.d.ts +1 -0
- package/lib/e2e/enum/Device.d.ts.map +1 -1
- package/lib/e2e/enum/Device.js +1 -0
- package/lib/e2e/enum/Device.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +10 -2
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +9 -1
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/families/algorand.d.ts.map +1 -1
- package/lib/e2e/families/algorand.js +10 -2
- package/lib/e2e/families/algorand.js.map +1 -1
- package/lib/e2e/families/aptos.d.ts +2 -1
- package/lib/e2e/families/aptos.d.ts.map +1 -1
- package/lib/e2e/families/aptos.js +12 -4
- package/lib/e2e/families/aptos.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +25 -15
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/cardano.d.ts.map +1 -1
- package/lib/e2e/families/cardano.js +122 -46
- package/lib/e2e/families/cardano.js.map +1 -1
- package/lib/e2e/families/celo.d.ts.map +1 -1
- package/lib/e2e/families/celo.js +11 -1
- 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 +16 -3
- package/lib/e2e/families/cosmos.js.map +1 -1
- package/lib/e2e/families/evm.d.ts +1 -2
- package/lib/e2e/families/evm.d.ts.map +1 -1
- package/lib/e2e/families/evm.js +28 -13
- package/lib/e2e/families/evm.js.map +1 -1
- package/lib/e2e/families/hedera.d.ts.map +1 -1
- package/lib/e2e/families/hedera.js +3 -2
- package/lib/e2e/families/hedera.js.map +1 -1
- package/lib/e2e/families/kaspa.d.ts +2 -1
- package/lib/e2e/families/kaspa.d.ts.map +1 -1
- package/lib/e2e/families/kaspa.js +12 -4
- package/lib/e2e/families/kaspa.js.map +1 -1
- package/lib/e2e/families/multiversX.d.ts.map +1 -1
- package/lib/e2e/families/multiversX.js +11 -1
- 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 +15 -4
- 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 +11 -1
- package/lib/e2e/families/osmosis.js.map +1 -1
- package/lib/e2e/families/polkadot.d.ts.map +1 -1
- package/lib/e2e/families/polkadot.js +10 -2
- package/lib/e2e/families/polkadot.js.map +1 -1
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +16 -3
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/families/stellar.d.ts.map +1 -1
- package/lib/e2e/families/stellar.js +10 -2
- package/lib/e2e/families/stellar.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +2 -1
- package/lib/e2e/families/sui.d.ts.map +1 -1
- package/lib/e2e/families/sui.js +11 -3
- package/lib/e2e/families/sui.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +12 -3
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/families/tron.d.ts.map +1 -1
- package/lib/e2e/families/tron.js +10 -2
- package/lib/e2e/families/tron.js.map +1 -1
- package/lib/e2e/families/xrp.d.ts.map +1 -1
- package/lib/e2e/families/xrp.js +10 -2
- package/lib/e2e/families/xrp.js.map +1 -1
- package/lib/e2e/index.d.ts +4 -2
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/models/Transaction.d.ts +0 -5
- package/lib/e2e/models/Transaction.d.ts.map +1 -1
- package/lib/e2e/models/Transaction.js +1 -9
- package/lib/e2e/models/Transaction.js.map +1 -1
- package/lib/e2e/speculos.d.ts +13 -4
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +141 -75
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/speculosAppVersion.d.ts +1 -0
- package/lib/e2e/speculosAppVersion.d.ts.map +1 -1
- package/lib/e2e/speculosAppVersion.js +9 -1
- package/lib/e2e/speculosAppVersion.js.map +1 -1
- package/lib/exchange/index.d.ts.map +1 -1
- package/lib/exchange/index.js +4 -15
- package/lib/exchange/index.js.map +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.d.ts +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.d.ts.map +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.js +5 -5
- package/lib/exchange/swap/getCompleteSwapHistory.js.map +1 -1
- package/lib/exchange/swap/hooks/useSelectableCurrencies.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js +16 -4
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +2 -1
- 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/specs.d.ts +1 -1
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +1 -0
- package/lib/load/speculos.js.map +1 -1
- package/lib/market/hooks/useLargeMoverChartData.d.ts +1 -2
- package/lib/market/hooks/useLargeMoverChartData.d.ts.map +1 -1
- package/lib/market/hooks/useLargeMoverChartData.js.map +1 -1
- package/lib/market/hooks/useLargeMoverCurrencies.d.ts +1 -2
- package/lib/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -1
- package/lib/market/hooks/useLargeMoverCurrencies.js +1 -3
- package/lib/market/hooks/useLargeMoverCurrencies.js.map +1 -1
- package/lib/market/utils/currencyFormatter.d.ts +1 -1
- package/lib/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib/market/utils/currencyFormatter.js +1 -1
- package/lib/market/utils/currencyFormatter.js.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +1 -2
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +3 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +1 -1
- package/lib/wallet-api/constants.d.ts +2 -2
- package/lib-es/account/helpers.d.ts +10 -0
- package/lib-es/account/helpers.d.ts.map +1 -1
- package/lib-es/account/helpers.js +26 -0
- package/lib-es/account/helpers.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +45 -37
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +17 -0
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/config/index.d.ts +2 -2
- package/lib-es/config/index.d.ts.map +1 -1
- package/lib-es/config/index.js.map +1 -1
- package/lib-es/dada-client/hooks/useDrawerConfiguration.d.ts +19 -0
- package/lib-es/dada-client/hooks/useDrawerConfiguration.d.ts.map +1 -0
- package/lib-es/dada-client/hooks/useDrawerConfiguration.js +38 -0
- package/lib-es/dada-client/hooks/useDrawerConfiguration.js.map +1 -0
- package/lib-es/e2e/data/deviceLabelsData.d.ts +8 -0
- package/lib-es/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.js +62 -2
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +3 -0
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +1 -0
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js +18 -0
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +1 -0
- package/lib-es/e2e/deviceInteraction/TouchDeviceSimulator.d.ts +4 -0
- package/lib-es/e2e/deviceInteraction/TouchDeviceSimulator.d.ts.map +1 -0
- package/lib-es/e2e/deviceInteraction/TouchDeviceSimulator.js +41 -0
- package/lib-es/e2e/deviceInteraction/TouchDeviceSimulator.js.map +1 -0
- package/lib-es/e2e/enum/Account.d.ts +2 -4
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +5 -8
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/Device.d.ts +1 -0
- package/lib-es/e2e/enum/Device.d.ts.map +1 -1
- package/lib-es/e2e/enum/Device.js +1 -0
- package/lib-es/e2e/enum/Device.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +10 -2
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +9 -1
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/families/algorand.d.ts.map +1 -1
- package/lib-es/e2e/families/algorand.js +11 -3
- package/lib-es/e2e/families/algorand.js.map +1 -1
- package/lib-es/e2e/families/aptos.d.ts +2 -1
- package/lib-es/e2e/families/aptos.d.ts.map +1 -1
- package/lib-es/e2e/families/aptos.js +12 -4
- package/lib-es/e2e/families/aptos.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +27 -17
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/cardano.d.ts.map +1 -1
- package/lib-es/e2e/families/cardano.js +121 -45
- package/lib-es/e2e/families/cardano.js.map +1 -1
- package/lib-es/e2e/families/celo.d.ts.map +1 -1
- package/lib-es/e2e/families/celo.js +12 -2
- 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 +17 -4
- package/lib-es/e2e/families/cosmos.js.map +1 -1
- package/lib-es/e2e/families/evm.d.ts +1 -2
- package/lib-es/e2e/families/evm.d.ts.map +1 -1
- package/lib-es/e2e/families/evm.js +25 -9
- package/lib-es/e2e/families/evm.js.map +1 -1
- package/lib-es/e2e/families/hedera.d.ts.map +1 -1
- package/lib-es/e2e/families/hedera.js +2 -1
- package/lib-es/e2e/families/hedera.js.map +1 -1
- package/lib-es/e2e/families/kaspa.d.ts +2 -1
- package/lib-es/e2e/families/kaspa.d.ts.map +1 -1
- package/lib-es/e2e/families/kaspa.js +12 -4
- package/lib-es/e2e/families/kaspa.js.map +1 -1
- package/lib-es/e2e/families/multiversX.d.ts.map +1 -1
- package/lib-es/e2e/families/multiversX.js +12 -2
- 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 +16 -5
- 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 +12 -2
- package/lib-es/e2e/families/osmosis.js.map +1 -1
- package/lib-es/e2e/families/polkadot.d.ts.map +1 -1
- package/lib-es/e2e/families/polkadot.js +11 -3
- package/lib-es/e2e/families/polkadot.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +17 -4
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/families/stellar.d.ts.map +1 -1
- package/lib-es/e2e/families/stellar.js +11 -3
- package/lib-es/e2e/families/stellar.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +2 -1
- package/lib-es/e2e/families/sui.d.ts.map +1 -1
- package/lib-es/e2e/families/sui.js +12 -4
- package/lib-es/e2e/families/sui.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +12 -3
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/families/tron.d.ts.map +1 -1
- package/lib-es/e2e/families/tron.js +11 -3
- package/lib-es/e2e/families/tron.js.map +1 -1
- package/lib-es/e2e/families/xrp.d.ts.map +1 -1
- package/lib-es/e2e/families/xrp.js +11 -3
- package/lib-es/e2e/families/xrp.js.map +1 -1
- package/lib-es/e2e/index.d.ts +4 -2
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/models/Transaction.d.ts +0 -5
- package/lib-es/e2e/models/Transaction.d.ts.map +1 -1
- package/lib-es/e2e/models/Transaction.js +0 -7
- package/lib-es/e2e/models/Transaction.js.map +1 -1
- package/lib-es/e2e/speculos.d.ts +13 -4
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +134 -71
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/speculosAppVersion.d.ts +1 -0
- package/lib-es/e2e/speculosAppVersion.d.ts.map +1 -1
- package/lib-es/e2e/speculosAppVersion.js +7 -0
- package/lib-es/e2e/speculosAppVersion.js.map +1 -1
- package/lib-es/exchange/index.d.ts.map +1 -1
- package/lib-es/exchange/index.js +4 -15
- package/lib-es/exchange/index.js.map +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.d.ts +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.d.ts.map +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.js +5 -5
- package/lib-es/exchange/swap/getCompleteSwapHistory.js.map +1 -1
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js +18 -6
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +2 -1
- 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/specs.d.ts +1 -1
- package/lib-es/load/speculos.d.ts.map +1 -1
- package/lib-es/load/speculos.js +1 -0
- package/lib-es/load/speculos.js.map +1 -1
- package/lib-es/market/hooks/useLargeMoverChartData.d.ts +1 -2
- package/lib-es/market/hooks/useLargeMoverChartData.d.ts.map +1 -1
- package/lib-es/market/hooks/useLargeMoverChartData.js.map +1 -1
- package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts +1 -2
- package/lib-es/market/hooks/useLargeMoverCurrencies.d.ts.map +1 -1
- package/lib-es/market/hooks/useLargeMoverCurrencies.js +1 -3
- package/lib-es/market/hooks/useLargeMoverCurrencies.js.map +1 -1
- package/lib-es/market/utils/currencyFormatter.d.ts +1 -1
- package/lib-es/market/utils/currencyFormatter.d.ts.map +1 -1
- package/lib-es/market/utils/currencyFormatter.js +1 -1
- package/lib-es/market/utils/currencyFormatter.js.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftMarketTrendModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/modules/useRightMarketTrendModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts +1 -2
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +3 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +1 -1
- package/lib-es/wallet-api/constants.d.ts +2 -2
- package/package.json +55 -55
- package/src/account/helpers.test.ts +209 -0
- package/src/account/helpers.ts +34 -0
- package/src/bridge/cache.test.ts +2 -2
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +1 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +69 -46
- package/src/bridge/generic-alpaca/signOperation.ts +20 -0
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +109 -191
- package/src/bridge/generic-alpaca/utils.test.ts +15 -12
- package/src/bridge/generic-alpaca/utils.ts +1 -1
- package/src/config/index.ts +2 -4
- package/src/currencies/sortByMarketcap.test.ts +10 -7
- package/src/dada-client/hooks/useDrawerConfiguration.ts +65 -0
- package/src/e2e/data/deviceLabelsData.ts +70 -2
- package/src/e2e/deviceInteraction/ButtonDeviceSimulator.ts +23 -0
- package/src/e2e/deviceInteraction/TouchDeviceSimulator.ts +52 -0
- package/src/e2e/enum/Account.ts +1 -16
- package/src/e2e/enum/Device.ts +1 -0
- package/src/e2e/enum/DeviceLabels.ts +9 -1
- package/src/e2e/families/algorand.ts +10 -4
- package/src/e2e/families/aptos.ts +12 -4
- package/src/e2e/families/bitcoin.ts +25 -18
- package/src/e2e/families/cardano.ts +137 -50
- package/src/e2e/families/celo.ts +11 -2
- package/src/e2e/families/cosmos.ts +15 -9
- package/src/e2e/families/evm.ts +28 -11
- package/src/e2e/families/hedera.ts +2 -1
- package/src/e2e/families/kaspa.ts +12 -4
- package/src/e2e/families/multiversX.ts +11 -2
- package/src/e2e/families/near.ts +15 -6
- package/src/e2e/families/osmosis.ts +11 -2
- package/src/e2e/families/polkadot.ts +10 -3
- package/src/e2e/families/solana.ts +15 -9
- package/src/e2e/families/stellar.ts +10 -3
- package/src/e2e/families/sui.ts +12 -4
- package/src/e2e/families/tezos.ts +11 -3
- package/src/e2e/families/tron.ts +10 -3
- package/src/e2e/families/xrp.ts +10 -3
- package/src/e2e/models/Transaction.ts +0 -13
- package/src/e2e/speculos.ts +160 -89
- package/src/e2e/speculosAppVersion.ts +8 -0
- package/src/exchange/index.ts +4 -15
- package/src/exchange/swap/getCompleteSwapHistory.ts +5 -5
- package/src/exchange/swap/hooks/useFromState.test.ts +11 -4
- package/src/exchange/swap/hooks/useReverseAccounts.test.ts +11 -4
- package/src/exchange/swap/hooks/useSelectableCurrencies.test.ts +14 -8
- package/src/exchange/swap/hooks/useSelectableCurrencies.ts +23 -6
- package/src/exchange/swap/hooks/useToState.test.ts +11 -4
- package/src/exchange/swap/hooks/useUpdateMaxAmount.test.ts +11 -4
- package/src/exchange/swap/utils/index.test.ts +10 -4
- package/src/families/algorand/bridge.integration.test.ts +1 -1
- package/src/families/bitcoin/__snapshots__/bridge.integration.test.ts.snap +3 -3
- package/src/families/cardano/bridge.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +25 -2
- package/src/families/evm/bridge.integration.test.ts +1 -1
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +25 -5
- package/src/families/icon/bridge.integration.test.ts +1 -1
- package/src/families/multiversx/bridge.integration.test.ts +1 -2
- package/src/families/near/bridge.integration.test.ts +1 -1
- package/src/families/solana/bridge.integration.test.ts +1 -1
- package/src/families/sui/bridge.integration.test.ts +1 -1
- package/src/families/ton/bridge.integration.test.ts +1 -1
- package/src/featureFlags/defaultFeatures.ts +2 -1
- package/src/load/speculos.ts +1 -0
- package/src/market/hooks/useLargeMoverChartData.ts +1 -2
- package/src/market/hooks/useLargeMoverCurrencies.ts +3 -6
- package/src/market/utils/currencyFormatter.ts +2 -2
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +3 -0
- package/lib/e2e/enum/Nft.d.ts +0 -15
- package/lib/e2e/enum/Nft.d.ts.map +0 -1
- package/lib/e2e/enum/Nft.js +0 -25
- package/lib/e2e/enum/Nft.js.map +0 -1
- package/lib-es/e2e/enum/Nft.d.ts +0 -15
- package/lib-es/e2e/enum/Nft.d.ts.map +0 -1
- package/lib-es/e2e/enum/Nft.js +0 -21
- package/lib-es/e2e/enum/Nft.js.map +0 -1
- package/src/e2e/enum/Nft.ts +0 -57
|
@@ -1,254 +1,172 @@
|
|
|
1
1
|
import { genericPrepareTransaction } from "../prepareTransaction";
|
|
2
2
|
import { getAlpacaApi } from "../alpaca";
|
|
3
|
+
import { transactionToIntent } from "../utils";
|
|
3
4
|
import BigNumber from "bignumber.js";
|
|
4
|
-
import * as accountModule from "@ledgerhq/coin-framework/account/index";
|
|
5
|
-
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
6
|
-
import { Account } from "@ledgerhq/types-live";
|
|
7
5
|
|
|
8
6
|
jest.mock("../alpaca", () => ({
|
|
9
7
|
getAlpacaApi: jest.fn(),
|
|
10
8
|
}));
|
|
11
9
|
|
|
10
|
+
jest.mock("../utils", () => ({
|
|
11
|
+
transactionToIntent: jest.fn(),
|
|
12
|
+
}));
|
|
13
|
+
|
|
12
14
|
describe("genericPrepareTransaction", () => {
|
|
13
15
|
const network = "testnet";
|
|
14
16
|
const kind = "local";
|
|
15
17
|
|
|
18
|
+
const account = {
|
|
19
|
+
id: "test-account",
|
|
20
|
+
address: "0xabc",
|
|
21
|
+
currency: { id: "ethereum" },
|
|
22
|
+
} as any;
|
|
23
|
+
|
|
24
|
+
const baseTransaction = {
|
|
25
|
+
amount: new BigNumber(100_000),
|
|
26
|
+
fees: new BigNumber(500),
|
|
27
|
+
recipient: "0xrecipient",
|
|
28
|
+
family: "family",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const txIntent = { mock: "intent" };
|
|
32
|
+
|
|
16
33
|
beforeEach(() => {
|
|
17
34
|
jest.clearAllMocks();
|
|
35
|
+
(transactionToIntent as jest.Mock).mockReturnValue(txIntent);
|
|
18
36
|
});
|
|
19
37
|
|
|
20
|
-
it("
|
|
21
|
-
|
|
22
|
-
estimateFees: jest.fn().mockResolvedValue({ value: 500n }),
|
|
23
|
-
getAssetFromToken: jest.fn().mockImplementation((token, owner) => {
|
|
24
|
-
return {
|
|
25
|
-
assetOwner: owner,
|
|
26
|
-
assetReference: token.contractAddress,
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
jest.spyOn(accountModule, "decodeTokenAccountId").mockImplementation(accountId => {
|
|
31
|
-
const token =
|
|
32
|
-
accountId === "ethereum_usdc_sub_account"
|
|
33
|
-
? ({ contractAddress: "usdc_contract" } as TokenCurrency)
|
|
34
|
-
: undefined;
|
|
38
|
+
it("updates fees if they differ", async () => {
|
|
39
|
+
const newFee = new BigNumber(700);
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
42
|
+
estimateFees: jest.fn().mockResolvedValue({ value: newFee }),
|
|
37
43
|
});
|
|
38
44
|
|
|
39
45
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
40
|
-
const
|
|
41
|
-
{ currency: { id: "ethereum", units: [{}] }, freshAddress: "0xabc" } as Account,
|
|
42
|
-
{
|
|
43
|
-
amount: new BigNumber(100_000),
|
|
44
|
-
fees: new BigNumber(500),
|
|
45
|
-
recipient: "0xrecipient",
|
|
46
|
-
family: "family",
|
|
47
|
-
subAccountId: "ethereum_usdc_sub_account",
|
|
48
|
-
},
|
|
49
|
-
);
|
|
46
|
+
const result = await prepareTransaction(account, { ...baseTransaction });
|
|
50
47
|
|
|
51
|
-
expect(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
assetReference: "usdc_contract",
|
|
57
|
-
assetOwner: "0xabc",
|
|
58
|
-
subAccountId: "ethereum_usdc_sub_account",
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const resultUnknownToken = await prepareTransaction(
|
|
62
|
-
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
63
|
-
{
|
|
64
|
-
amount: new BigNumber(100_000),
|
|
65
|
-
fees: new BigNumber(500),
|
|
66
|
-
recipient: "0xrecipient",
|
|
67
|
-
family: "family",
|
|
68
|
-
subAccountId: "ethereum_unknown_sub_account",
|
|
69
|
-
},
|
|
48
|
+
expect((result as any).fees.toString()).toBe(newFee.toString());
|
|
49
|
+
expect(transactionToIntent).toHaveBeenCalledWith(
|
|
50
|
+
account,
|
|
51
|
+
expect.objectContaining(baseTransaction),
|
|
52
|
+
undefined,
|
|
70
53
|
);
|
|
71
|
-
|
|
72
|
-
expect(resultUnknownToken).toEqual({
|
|
73
|
-
amount: new BigNumber(100_000),
|
|
74
|
-
fees: new BigNumber(500),
|
|
75
|
-
recipient: "0xrecipient",
|
|
76
|
-
family: "family",
|
|
77
|
-
assetReference: "",
|
|
78
|
-
assetOwner: "",
|
|
79
|
-
subAccountId: "ethereum_unknown_sub_account",
|
|
80
|
-
});
|
|
81
54
|
});
|
|
82
55
|
|
|
83
|
-
it
|
|
84
|
-
|
|
85
|
-
["all native amount on staking scenarios", { mode: "stake" }, new BigNumber(42)],
|
|
86
|
-
["all native amount on unstaking scenarios", { mode: "unstake" }, new BigNumber(42)],
|
|
87
|
-
[
|
|
88
|
-
"all token amount",
|
|
89
|
-
{ subAccountId: "ethereum_usdc_sub_account", useAllAmount: true },
|
|
90
|
-
new BigNumber(5),
|
|
91
|
-
],
|
|
92
|
-
[
|
|
93
|
-
"all token amount on staking scenarios",
|
|
94
|
-
{ subAccountId: "ethereum_usdc_sub_account", mode: "stake" },
|
|
95
|
-
new BigNumber(5),
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
"all token amount on unstaking scenarios",
|
|
99
|
-
{ subAccountId: "ethereum_usdc_sub_account", mode: "unstake" },
|
|
100
|
-
new BigNumber(5),
|
|
101
|
-
],
|
|
102
|
-
] as const)("uses %s, updating the amount", async (_s, partialTransaction, expectedAmount) => {
|
|
103
|
-
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
104
|
-
estimateFees: jest.fn().mockResolvedValue({ value: 8n }),
|
|
105
|
-
getAssetFromToken: jest.fn().mockImplementation((token, owner) => {
|
|
106
|
-
return {
|
|
107
|
-
assetOwner: owner,
|
|
108
|
-
assetReference: token.contractAddress,
|
|
109
|
-
};
|
|
110
|
-
}),
|
|
111
|
-
});
|
|
112
|
-
jest.spyOn(accountModule, "decodeTokenAccountId").mockImplementation(accountId => {
|
|
113
|
-
const token =
|
|
114
|
-
accountId === "ethereum_usdc_sub_account"
|
|
115
|
-
? ({ contractAddress: "usdc_contract" } as TokenCurrency)
|
|
116
|
-
: undefined;
|
|
56
|
+
it("returns original transaction if fees are the same", async () => {
|
|
57
|
+
const sameFee = baseTransaction.fees;
|
|
117
58
|
|
|
118
|
-
|
|
59
|
+
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
60
|
+
estimateFees: jest.fn().mockResolvedValue({ value: sameFee }),
|
|
119
61
|
});
|
|
120
62
|
|
|
121
63
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
122
|
-
const result = await prepareTransaction(
|
|
123
|
-
{
|
|
124
|
-
currency: { id: "ethereum", units: [{}] },
|
|
125
|
-
spendableBalance: new BigNumber(50),
|
|
126
|
-
subAccounts: [{ id: "ethereum_usdc_sub_account", spendableBalance: new BigNumber(5) }],
|
|
127
|
-
} as Account,
|
|
128
|
-
{
|
|
129
|
-
amount: new BigNumber(0),
|
|
130
|
-
recipient: "0xrecipient",
|
|
131
|
-
family: "family",
|
|
132
|
-
...partialTransaction,
|
|
133
|
-
},
|
|
134
|
-
);
|
|
64
|
+
const result = await prepareTransaction(account, baseTransaction);
|
|
135
65
|
|
|
136
|
-
expect(result).
|
|
137
|
-
amount: expectedAmount,
|
|
138
|
-
fees: new BigNumber(8),
|
|
139
|
-
recipient: "0xrecipient",
|
|
140
|
-
family: "family",
|
|
141
|
-
});
|
|
66
|
+
expect(result).toBe(baseTransaction);
|
|
142
67
|
});
|
|
143
68
|
|
|
144
|
-
it("
|
|
69
|
+
it("sets fee if original fees are undefined", async () => {
|
|
70
|
+
const newFee = new BigNumber(1234);
|
|
145
71
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
146
|
-
estimateFees: jest.fn().mockResolvedValue({ value:
|
|
72
|
+
estimateFees: jest.fn().mockResolvedValue({ value: newFee }),
|
|
147
73
|
});
|
|
148
74
|
|
|
75
|
+
const txWithoutFees = { ...baseTransaction, fees: undefined as any };
|
|
149
76
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
150
|
-
const result = await prepareTransaction(
|
|
151
|
-
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
152
|
-
{
|
|
153
|
-
amount: new BigNumber(100_000),
|
|
154
|
-
fees: new BigNumber(500),
|
|
155
|
-
recipient: "0xrecipient",
|
|
156
|
-
family: "family",
|
|
157
|
-
},
|
|
158
|
-
);
|
|
77
|
+
const result = await prepareTransaction(account, txWithoutFees);
|
|
159
78
|
|
|
160
|
-
expect(result).
|
|
161
|
-
|
|
162
|
-
fees: new BigNumber(700),
|
|
163
|
-
recipient: "0xrecipient",
|
|
164
|
-
family: "family",
|
|
165
|
-
assetReference: "",
|
|
166
|
-
assetOwner: "",
|
|
167
|
-
});
|
|
79
|
+
expect((result as any).fees.toString()).toBe(newFee.toString());
|
|
80
|
+
expect(result).not.toBe(txWithoutFees);
|
|
168
81
|
});
|
|
169
82
|
|
|
170
|
-
it("
|
|
83
|
+
it("returns original if fees are BigNumber-equal but different instance", async () => {
|
|
84
|
+
const sameValue = new BigNumber(baseTransaction.fees.toString()); // different instance
|
|
171
85
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
172
|
-
estimateFees: jest.fn().mockResolvedValue({ value:
|
|
86
|
+
estimateFees: jest.fn().mockResolvedValue({ value: sameValue }),
|
|
173
87
|
});
|
|
174
88
|
|
|
175
89
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
176
|
-
const result = await prepareTransaction(
|
|
177
|
-
{ currency: { id: "ethereum", units: [{}] } } as Account,
|
|
178
|
-
{
|
|
179
|
-
amount: new BigNumber(100_000),
|
|
180
|
-
fees: new BigNumber(500),
|
|
181
|
-
recipient: "0xrecipient",
|
|
182
|
-
family: "family",
|
|
183
|
-
customFees: { parameters: { fees: new BigNumber(600) } },
|
|
184
|
-
},
|
|
185
|
-
);
|
|
90
|
+
const result = await prepareTransaction(account, baseTransaction);
|
|
186
91
|
|
|
187
|
-
expect(result).
|
|
188
|
-
amount: new BigNumber(100_000),
|
|
189
|
-
fees: new BigNumber(600),
|
|
190
|
-
customFees: { parameters: { fees: new BigNumber(600) } },
|
|
191
|
-
recipient: "0xrecipient",
|
|
192
|
-
family: "family",
|
|
193
|
-
assetReference: "",
|
|
194
|
-
assetOwner: "",
|
|
195
|
-
});
|
|
92
|
+
expect(result).toBe(baseTransaction); // still same reference
|
|
196
93
|
});
|
|
197
94
|
|
|
198
|
-
it("propagates
|
|
95
|
+
it("propagates storageLimit from second estimation", async () => {
|
|
96
|
+
const estimatedFee = new BigNumber(491);
|
|
97
|
+
|
|
98
|
+
const estimateFeesFirstCall = jest.fn().mockResolvedValue({
|
|
99
|
+
value: estimatedFee,
|
|
100
|
+
parameters: { storageLimit: 300 },
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const estimateFeesSecondCall = jest.fn().mockResolvedValue({
|
|
104
|
+
value: estimatedFee,
|
|
105
|
+
parameters: { storageLimit: 0 },
|
|
106
|
+
});
|
|
107
|
+
|
|
199
108
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
200
109
|
estimateFees: jest
|
|
201
110
|
.fn()
|
|
202
|
-
.
|
|
111
|
+
.mockImplementationOnce(() => estimateFeesFirstCall())
|
|
112
|
+
.mockImplementationOnce(() => estimateFeesSecondCall()),
|
|
203
113
|
});
|
|
204
114
|
|
|
115
|
+
const txWithoutCustomFees = { ...baseTransaction, customFees: undefined };
|
|
205
116
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
206
|
-
const result = await prepareTransaction(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
fees:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
117
|
+
const result = await prepareTransaction(account, txWithoutCustomFees);
|
|
118
|
+
|
|
119
|
+
expect(result).toEqual(
|
|
120
|
+
expect.objectContaining({
|
|
121
|
+
fees: estimatedFee,
|
|
122
|
+
storageLimit: new BigNumber(0),
|
|
123
|
+
customFees: {
|
|
124
|
+
parameters: {
|
|
125
|
+
fees: undefined,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
214
129
|
);
|
|
215
130
|
|
|
216
|
-
expect(
|
|
217
|
-
amount: new BigNumber(100_000),
|
|
218
|
-
fees: new BigNumber(700),
|
|
219
|
-
storageLimit: new BigNumber(277),
|
|
220
|
-
recipient: "0xrecipient",
|
|
221
|
-
family: "family",
|
|
222
|
-
assetReference: "",
|
|
223
|
-
assetOwner: "",
|
|
224
|
-
});
|
|
131
|
+
expect((getAlpacaApi as jest.Mock)().estimateFees).toHaveBeenCalledTimes(2);
|
|
225
132
|
});
|
|
226
133
|
|
|
227
|
-
it("
|
|
134
|
+
it("propagates storageLimit showing new account scenario", async () => {
|
|
135
|
+
const estimatedFee = new BigNumber(491);
|
|
136
|
+
|
|
137
|
+
const estimateFeesFirstCall = jest.fn().mockResolvedValue({
|
|
138
|
+
value: estimatedFee,
|
|
139
|
+
parameters: { storageLimit: 300 },
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const estimateFeesSecondCall = jest.fn().mockResolvedValue({
|
|
143
|
+
value: estimatedFee,
|
|
144
|
+
parameters: { storageLimit: 277 },
|
|
145
|
+
});
|
|
146
|
+
|
|
228
147
|
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
229
|
-
estimateFees: jest
|
|
148
|
+
estimateFees: jest
|
|
149
|
+
.fn()
|
|
150
|
+
.mockImplementationOnce(() => estimateFeesFirstCall())
|
|
151
|
+
.mockImplementationOnce(() => estimateFeesSecondCall()),
|
|
230
152
|
});
|
|
231
153
|
|
|
154
|
+
const txWithoutCustomFees = { ...baseTransaction, customFees: undefined };
|
|
232
155
|
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
233
|
-
const result = await prepareTransaction(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
fees:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
156
|
+
const result = await prepareTransaction(account, txWithoutCustomFees);
|
|
157
|
+
|
|
158
|
+
expect(result).toEqual(
|
|
159
|
+
expect.objectContaining({
|
|
160
|
+
fees: estimatedFee,
|
|
161
|
+
storageLimit: new BigNumber(277),
|
|
162
|
+
customFees: {
|
|
163
|
+
parameters: {
|
|
164
|
+
fees: undefined,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}),
|
|
242
168
|
);
|
|
243
169
|
|
|
244
|
-
expect(
|
|
245
|
-
amount: new BigNumber(1000),
|
|
246
|
-
fees: new BigNumber(700),
|
|
247
|
-
recipient: "0xrecipient",
|
|
248
|
-
family: "family",
|
|
249
|
-
assetReference: "",
|
|
250
|
-
assetOwner: "",
|
|
251
|
-
useAllAmount: true,
|
|
252
|
-
});
|
|
170
|
+
expect((getAlpacaApi as jest.Mock)().estimateFees).toHaveBeenCalledTimes(2);
|
|
253
171
|
});
|
|
254
172
|
});
|
|
@@ -197,18 +197,21 @@ describe("Alpaca utils", () => {
|
|
|
197
197
|
});
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
it("
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
200
|
+
it.each([["FEES"], ["DELEGATE"], ["UNDELEGATE"]])(
|
|
201
|
+
"handles %s operation where value = value + fees",
|
|
202
|
+
operationType => {
|
|
203
|
+
const op = {
|
|
204
|
+
...baseOp,
|
|
205
|
+
type: operationType,
|
|
206
|
+
value: BigInt(5),
|
|
207
|
+
tx: { ...baseOp.tx, fees: BigInt(2) },
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const result = adaptCoreOperationToLiveOperation(accountId, op);
|
|
211
|
+
|
|
212
|
+
expect(result.value.toString()).toEqual("7");
|
|
213
|
+
},
|
|
214
|
+
);
|
|
212
215
|
|
|
213
216
|
it("handles non-FEES/OUT operation where value = value only", () => {
|
|
214
217
|
const op = {
|
|
@@ -61,7 +61,7 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
|
61
61
|
accountId,
|
|
62
62
|
type: opType,
|
|
63
63
|
value:
|
|
64
|
-
op.asset.type === "native" && ["OUT", "FEES"].includes(opType)
|
|
64
|
+
op.asset.type === "native" && ["OUT", "FEES", "DELEGATE", "UNDELEGATE"].includes(opType)
|
|
65
65
|
? new BigNumber(op.value.toString()).plus(bnFees)
|
|
66
66
|
: new BigNumber(op.value.toString()),
|
|
67
67
|
fee: bnFees,
|
package/src/config/index.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { CryptoCurrency
|
|
1
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
2
|
import { ConfigInfo, LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
3
3
|
import { CurrencyConfig } from "@ledgerhq/coin-framework/config";
|
|
4
4
|
|
|
5
|
-
export type CurrencyLiveConfigDefinition =
|
|
6
|
-
Record<`config_currency_${CryptoCurrencyId}`, ConfigInfo>
|
|
7
|
-
>;
|
|
5
|
+
export type CurrencyLiveConfigDefinition = Record<`config_currency_${string}`, ConfigInfo>;
|
|
8
6
|
|
|
9
7
|
const getCurrencyConfiguration = <T extends CurrencyConfig>(
|
|
10
8
|
currency: CryptoCurrency,
|
|
@@ -2,18 +2,21 @@ import { sortCurrenciesByIds } from "./sortByMarketcap";
|
|
|
2
2
|
import { listCryptoCurrencies, listTokens } from ".";
|
|
3
3
|
import { getBTCValues } from "@ledgerhq/live-countervalues/mock";
|
|
4
4
|
import { CURRENCIES_LIST, IDS } from "./mock";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
5
|
+
import { findCryptoCurrencyByTicker, findFiatCurrencyByTicker } from "@ledgerhq/cryptoassets/index";
|
|
6
|
+
import { getCryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/index";
|
|
7
|
+
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/tokens";
|
|
8
|
+
import { setup } from "../bridge/impl";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
setCryptoAssetsStoreForCoinFramework({} as CryptoAssetsStore);
|
|
10
|
+
setup(legacyCryptoAssetsStore);
|
|
11
11
|
|
|
12
|
-
test("sortCurrenciesByIds snapshot", () => {
|
|
12
|
+
test("sortCurrenciesByIds snapshot", async () => {
|
|
13
13
|
const list = [...listCryptoCurrencies(), ...listTokens()];
|
|
14
14
|
const ids: string[] = [];
|
|
15
15
|
for (const k in getBTCValues()) {
|
|
16
|
-
const c =
|
|
16
|
+
const c =
|
|
17
|
+
findCryptoCurrencyByTicker(k) ||
|
|
18
|
+
findFiatCurrencyByTicker(k) ||
|
|
19
|
+
(await getCryptoAssetsStore().findTokenById(k));
|
|
17
20
|
if (c && (c.type == "CryptoCurrency" || c.type == "TokenCurrency")) {
|
|
18
21
|
ids.push(c.id);
|
|
19
22
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import useFeature from "../../featureFlags/useFeature";
|
|
3
|
+
|
|
4
|
+
interface DrawerConfiguration {
|
|
5
|
+
assets?: Record<string, unknown>;
|
|
6
|
+
networks?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface UseCaseConfig {
|
|
10
|
+
assets?: Record<string, unknown>;
|
|
11
|
+
networks?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type UseCaseConfigs = Record<string, UseCaseConfig>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hook that provides drawer configuration functionality with feature flag integration.
|
|
18
|
+
*
|
|
19
|
+
* @returns An object containing the createDrawerConfiguration function
|
|
20
|
+
*/
|
|
21
|
+
export function useDrawerConfiguration() {
|
|
22
|
+
const earnDrawerConfigurationFlag = useFeature("ptxEarnDrawerConfiguration");
|
|
23
|
+
|
|
24
|
+
const createDrawerConfiguration = useCallback(
|
|
25
|
+
(
|
|
26
|
+
drawerConfiguration: unknown,
|
|
27
|
+
useCase: string | undefined,
|
|
28
|
+
customUseCaseConfigs?: UseCaseConfigs,
|
|
29
|
+
): DrawerConfiguration => {
|
|
30
|
+
const config: DrawerConfiguration | undefined = drawerConfiguration!;
|
|
31
|
+
|
|
32
|
+
// Default use case configs with earn configuration from feature flag
|
|
33
|
+
const earnAppDrawerConfig: UseCaseConfig =
|
|
34
|
+
earnDrawerConfigurationFlag?.enabled && earnDrawerConfigurationFlag.params
|
|
35
|
+
? earnDrawerConfigurationFlag.params
|
|
36
|
+
: {};
|
|
37
|
+
|
|
38
|
+
const defaultUseCaseConfigs: UseCaseConfigs = {
|
|
39
|
+
earn: earnAppDrawerConfig,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Merge with any custom use case configs provided
|
|
43
|
+
const useCaseConfigs = {
|
|
44
|
+
...defaultUseCaseConfigs,
|
|
45
|
+
...customUseCaseConfigs,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const useCaseConfig = useCase ? useCaseConfigs[useCase] : undefined;
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
assets: {
|
|
52
|
+
...useCaseConfig?.assets,
|
|
53
|
+
...config?.assets,
|
|
54
|
+
},
|
|
55
|
+
networks: {
|
|
56
|
+
...useCaseConfig?.networks,
|
|
57
|
+
...config?.networks,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
[earnDrawerConfigurationFlag],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return { createDrawerConfiguration };
|
|
65
|
+
}
|
|
@@ -19,6 +19,14 @@ type LabelConfig = {
|
|
|
19
19
|
[key: string]: string;
|
|
20
20
|
default: string;
|
|
21
21
|
};
|
|
22
|
+
sendVerify: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
sendConfirm: {
|
|
27
|
+
[key: string]: string;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
22
30
|
};
|
|
23
31
|
|
|
24
32
|
type DeviceLabelsConfig = {
|
|
@@ -57,6 +65,47 @@ export const DEVICE_LABELS_CONFIG: DeviceLabelsConfig = {
|
|
|
57
65
|
[AppInfos.TEZOS.name]: DeviceLabels.ACCEPT_RISK,
|
|
58
66
|
default: DeviceLabels.CAPS_APPROVE,
|
|
59
67
|
},
|
|
68
|
+
sendVerify: {
|
|
69
|
+
default: DeviceLabels.REVIEW_OPERATION,
|
|
70
|
+
},
|
|
71
|
+
sendConfirm: {
|
|
72
|
+
[AppInfos.SOLANA.name]: DeviceLabels.SIGN_TRANSACTION,
|
|
73
|
+
[AppInfos.TRON.name]: DeviceLabels.SIGN,
|
|
74
|
+
[AppInfos.STELLAR.name]: DeviceLabels.SIGN,
|
|
75
|
+
[AppInfos.RIPPLE.name]: DeviceLabels.SIGN,
|
|
76
|
+
[AppInfos.APTOS.name]: DeviceLabels.APPROVE,
|
|
77
|
+
[AppInfos.SUI.name]: DeviceLabels.ACCEPT,
|
|
78
|
+
[AppInfos.BITCOIN.name]: DeviceLabels.CONTINUE,
|
|
79
|
+
default: DeviceLabels.CAPS_APPROVE,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
[DeviceModelId.stax]: {
|
|
83
|
+
receiveVerify: {
|
|
84
|
+
[AppInfos.BNB_CHAIN.name]: DeviceLabels.VERIFY_BSC,
|
|
85
|
+
[AppInfos.COSMOS.name]: DeviceLabels.PLEASE_REVIEW,
|
|
86
|
+
[AppInfos.ETHEREUM.name]: DeviceLabels.VERIFY_ETHEREUM,
|
|
87
|
+
[AppInfos.POLKADOT.name]: DeviceLabels.PLEASE_REVIEW,
|
|
88
|
+
[AppInfos.POLYGON.name]: DeviceLabels.VERIFY_POLYGON,
|
|
89
|
+
[AppInfos.SOLANA.name]: DeviceLabels.VERIFY_SOLANA_ADDRESS,
|
|
90
|
+
default: DeviceLabels.ADDRESS,
|
|
91
|
+
},
|
|
92
|
+
receiveConfirm: {
|
|
93
|
+
default: DeviceLabels.CONFIRM,
|
|
94
|
+
},
|
|
95
|
+
delegateVerify: {
|
|
96
|
+
[AppInfos.NEAR.name]: DeviceLabels.VIEW_HEADER,
|
|
97
|
+
default: DeviceLabels.REVIEW_OPERATION,
|
|
98
|
+
},
|
|
99
|
+
delegateConfirm: {
|
|
100
|
+
[AppInfos.NEAR.name]: DeviceLabels.CONTINUE_TO_ACTION,
|
|
101
|
+
default: DeviceLabels.HOLD_TO_SIGN,
|
|
102
|
+
},
|
|
103
|
+
sendVerify: {
|
|
104
|
+
default: DeviceLabels.REVIEW_OPERATION,
|
|
105
|
+
},
|
|
106
|
+
sendConfirm: {
|
|
107
|
+
default: DeviceLabels.HOLD_TO_SIGN,
|
|
108
|
+
},
|
|
60
109
|
},
|
|
61
110
|
default: {
|
|
62
111
|
receiveVerify: {
|
|
@@ -65,7 +114,7 @@ export const DEVICE_LABELS_CONFIG: DeviceLabelsConfig = {
|
|
|
65
114
|
[AppInfos.ETHEREUM.name]: DeviceLabels.VERIFY_ETHEREUM,
|
|
66
115
|
[AppInfos.POLKADOT.name]: DeviceLabels.PLEASE_REVIEW,
|
|
67
116
|
[AppInfos.POLYGON.name]: DeviceLabels.VERIFY_POLYGON,
|
|
68
|
-
[AppInfos.SOLANA.name]: DeviceLabels.
|
|
117
|
+
[AppInfos.SOLANA.name]: DeviceLabels.VERIFY_SOLANA_ADDRESS,
|
|
69
118
|
default: DeviceLabels.ADDRESS,
|
|
70
119
|
},
|
|
71
120
|
receiveConfirm: {
|
|
@@ -75,13 +124,14 @@ export const DEVICE_LABELS_CONFIG: DeviceLabelsConfig = {
|
|
|
75
124
|
[AppInfos.ETHEREUM.name]: DeviceLabels.CONFIRM,
|
|
76
125
|
[AppInfos.POLKADOT.name]: DeviceLabels.CAPS_APPROVE,
|
|
77
126
|
[AppInfos.POLYGON.name]: DeviceLabels.CONFIRM,
|
|
127
|
+
[AppInfos.SOLANA.name]: DeviceLabels.CONFIRM,
|
|
78
128
|
default: DeviceLabels.APPROVE,
|
|
79
129
|
},
|
|
80
130
|
delegateVerify: {
|
|
81
131
|
[AppInfos.COSMOS.name]: DeviceLabels.PLEASE_REVIEW,
|
|
82
132
|
[AppInfos.MULTIVERS_X.name]: DeviceLabels.RECEIVER,
|
|
83
133
|
[AppInfos.NEAR.name]: DeviceLabels.VIEW_HEADER,
|
|
84
|
-
[AppInfos.SOLANA.name]: DeviceLabels.
|
|
134
|
+
[AppInfos.SOLANA.name]: DeviceLabels.REVIEW_TRANSACTION,
|
|
85
135
|
default: DeviceLabels.REVIEW_OPERATION,
|
|
86
136
|
},
|
|
87
137
|
delegateConfirm: {
|
|
@@ -91,8 +141,26 @@ export const DEVICE_LABELS_CONFIG: DeviceLabelsConfig = {
|
|
|
91
141
|
[AppInfos.INJECTIVE.name]: DeviceLabels.CAPS_APPROVE,
|
|
92
142
|
[AppInfos.MULTIVERS_X.name]: DeviceLabels.SIGN,
|
|
93
143
|
[AppInfos.NEAR.name]: DeviceLabels.CONTINUE_TO_ACTION,
|
|
144
|
+
[AppInfos.SOLANA.name]: DeviceLabels.SIGN_TRANSACTION,
|
|
94
145
|
[AppInfos.OSMOSIS.name]: DeviceLabels.CAPS_APPROVE,
|
|
95
146
|
default: DeviceLabels.APPROVE,
|
|
96
147
|
},
|
|
148
|
+
sendVerify: {
|
|
149
|
+
[AppInfos.SOLANA.name]: DeviceLabels.TRANSFER,
|
|
150
|
+
[AppInfos.RIPPLE.name]: DeviceLabels.TRANSACTION_TYPE,
|
|
151
|
+
default: DeviceLabels.REVIEW_OPERATION,
|
|
152
|
+
},
|
|
153
|
+
sendConfirm: {
|
|
154
|
+
[AppInfos.SOLANA.name]: DeviceLabels.APPROVE,
|
|
155
|
+
[AppInfos.TRON.name]: DeviceLabels.SIGN,
|
|
156
|
+
[AppInfos.STELLAR.name]: DeviceLabels.SIGN,
|
|
157
|
+
[AppInfos.RIPPLE.name]: DeviceLabels.SIGN,
|
|
158
|
+
[AppInfos.APTOS.name]: DeviceLabels.APPROVE,
|
|
159
|
+
[AppInfos.SUI.name]: DeviceLabels.ACCEPT,
|
|
160
|
+
[AppInfos.BITCOIN.name]: DeviceLabels.SIGN_TRANSACTION,
|
|
161
|
+
[AppInfos.KASPA.name]: DeviceLabels.APPROVE,
|
|
162
|
+
[AppInfos.DOGECOIN.name]: DeviceLabels.ACCEPT,
|
|
163
|
+
default: DeviceLabels.CAPS_APPROVE,
|
|
164
|
+
},
|
|
97
165
|
},
|
|
98
166
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getEnv } from "@ledgerhq/live-env";
|
|
2
|
+
import { getSpeculosAddress, retryAxiosRequest } from "../speculos";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
|
|
5
|
+
export async function pressBoth() {
|
|
6
|
+
const speculosApiPort = getEnv("SPECULOS_API_PORT");
|
|
7
|
+
const speculosAddress = getSpeculosAddress();
|
|
8
|
+
await retryAxiosRequest(() =>
|
|
9
|
+
axios.post(`${speculosAddress}:${speculosApiPort}/button/both`, {
|
|
10
|
+
action: "press-and-release",
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function pressRightButton(): Promise<void> {
|
|
16
|
+
const speculosApiPort = getEnv("SPECULOS_API_PORT");
|
|
17
|
+
const speculosAddress = getSpeculosAddress();
|
|
18
|
+
await retryAxiosRequest(() =>
|
|
19
|
+
axios.post(`${speculosAddress}:${speculosApiPort}/button/right`, {
|
|
20
|
+
action: "press-and-release",
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
}
|