@ledgerhq/live-common 34.53.0-nightly.20251119110540 → 34.53.0-nightly.20251120135143
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/setup.integration.d.ts +2 -0
- package/lib/__tests__/test-helpers/setup.integration.d.ts.map +1 -0
- package/lib/__tests__/test-helpers/{setup.js → setup.integration.js} +4 -8
- package/lib/__tests__/test-helpers/setup.integration.js.map +1 -0
- package/lib/account/helpers.js +17 -17
- package/lib/account/helpers.js.map +1 -1
- package/lib/bridge/impl.d.ts +0 -2
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +4 -8
- package/lib/bridge/impl.js.map +1 -1
- package/lib/currencies/index.d.ts +1 -1
- package/lib/currencies/index.d.ts.map +1 -1
- package/lib/currencies/index.js +1 -4
- package/lib/currencies/index.js.map +1 -1
- package/lib/e2e/deviceInteraction/DeviceController.d.ts +41 -0
- package/lib/e2e/deviceInteraction/DeviceController.d.ts.map +1 -0
- package/lib/e2e/deviceInteraction/DeviceController.js +68 -0
- package/lib/e2e/deviceInteraction/DeviceController.js.map +1 -0
- package/lib/e2e/families/algorand.d.ts +1 -1
- package/lib/e2e/families/algorand.d.ts.map +1 -1
- package/lib/e2e/families/algorand.js +5 -5
- package/lib/e2e/families/algorand.js.map +1 -1
- package/lib/e2e/families/aptos.d.ts +2 -2
- package/lib/e2e/families/aptos.d.ts.map +1 -1
- package/lib/e2e/families/aptos.js +9 -9
- package/lib/e2e/families/aptos.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts +2 -2
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +11 -11
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/cardano.d.ts +6 -0
- package/lib/e2e/families/cardano.d.ts.map +1 -1
- package/lib/e2e/families/cardano.js +28 -26
- 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 +5 -5
- package/lib/e2e/families/celo.js.map +1 -1
- package/lib/e2e/families/cosmos.d.ts +2 -2
- package/lib/e2e/families/cosmos.d.ts.map +1 -1
- package/lib/e2e/families/cosmos.js +9 -9
- package/lib/e2e/families/cosmos.js.map +1 -1
- package/lib/e2e/families/evm.d.ts +2 -0
- package/lib/e2e/families/evm.d.ts.map +1 -1
- package/lib/e2e/families/evm.js +13 -12
- package/lib/e2e/families/evm.js.map +1 -1
- package/lib/e2e/families/hedera.d.ts +1 -1
- package/lib/e2e/families/hedera.d.ts.map +1 -1
- package/lib/e2e/families/hedera.js +5 -5
- package/lib/e2e/families/hedera.js.map +1 -1
- package/lib/e2e/families/kaspa.d.ts +2 -2
- package/lib/e2e/families/kaspa.d.ts.map +1 -1
- package/lib/e2e/families/kaspa.js +9 -9
- package/lib/e2e/families/kaspa.js.map +1 -1
- package/lib/e2e/families/multiversX.d.ts +1 -1
- package/lib/e2e/families/multiversX.d.ts.map +1 -1
- package/lib/e2e/families/multiversX.js +5 -5
- package/lib/e2e/families/multiversX.js.map +1 -1
- package/lib/e2e/families/near.d.ts +1 -1
- package/lib/e2e/families/near.d.ts.map +1 -1
- package/lib/e2e/families/near.js +6 -6
- package/lib/e2e/families/near.js.map +1 -1
- package/lib/e2e/families/osmosis.d.ts +1 -1
- package/lib/e2e/families/osmosis.d.ts.map +1 -1
- package/lib/e2e/families/osmosis.js +5 -5
- package/lib/e2e/families/osmosis.js.map +1 -1
- package/lib/e2e/families/polkadot.d.ts +1 -1
- package/lib/e2e/families/polkadot.d.ts.map +1 -1
- package/lib/e2e/families/polkadot.js +5 -5
- package/lib/e2e/families/polkadot.js.map +1 -1
- package/lib/e2e/families/solana.d.ts +2 -2
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +9 -9
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/families/stellar.d.ts +1 -1
- package/lib/e2e/families/stellar.d.ts.map +1 -1
- package/lib/e2e/families/stellar.js +5 -5
- package/lib/e2e/families/stellar.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +1 -1
- package/lib/e2e/families/sui.d.ts.map +1 -1
- package/lib/e2e/families/sui.js +5 -5
- package/lib/e2e/families/sui.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +7 -8
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/families/tron.d.ts +1 -1
- package/lib/e2e/families/tron.d.ts.map +1 -1
- package/lib/e2e/families/tron.js +5 -5
- package/lib/e2e/families/tron.js.map +1 -1
- package/lib/e2e/families/xrp.d.ts +1 -1
- package/lib/e2e/families/xrp.d.ts.map +1 -1
- package/lib/e2e/families/xrp.js +5 -5
- package/lib/e2e/families/xrp.js.map +1 -1
- package/lib/e2e/index.d.ts +9 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +11 -11
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +78 -78
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.js +2 -2
- package/lib/exchange/swap/getCompleteSwapHistory.js.map +1 -1
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js +2 -2
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +1 -0
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/canton/react.d.ts +15 -0
- package/lib/families/canton/react.d.ts.map +1 -0
- package/lib/families/canton/react.js +14 -0
- package/lib/families/canton/react.js.map +1 -0
- package/lib/families/cosmos/datasets/dydx.integration.FIXME.d.ts +1 -1
- package/lib/families/cosmos/datasets/dydx.integration.FIXME.d.ts.map +1 -1
- package/lib/families/cosmos/datasets/dydx.integration.FIXME.js +1 -1
- package/lib/families/cosmos/datasets/dydx.integration.FIXME.js.map +1 -1
- package/lib/families/cosmos/datasets/secretNetwork.integration.FIXME.d.ts +1 -1
- package/lib/families/cosmos/datasets/secretNetwork.integration.FIXME.d.ts.map +1 -1
- package/lib/families/cosmos/datasets/secretNetwork.integration.FIXME.js +1 -1
- package/lib/families/cosmos/datasets/secretNetwork.integration.FIXME.js.map +1 -1
- package/lib/families/evm/setup.d.ts.map +1 -1
- package/lib/families/evm/setup.js +1 -11
- package/lib/families/evm/setup.js.map +1 -1
- package/lib/families/solana/setup.d.ts +8 -0
- package/lib/families/solana/setup.d.ts.map +1 -1
- package/lib/families/solana/setup.js +29 -16
- package/lib/families/solana/setup.js.map +1 -1
- package/lib/families/tron/data.mock.d.ts.map +1 -1
- package/lib/families/tron/data.mock.js +3 -6
- package/lib/families/tron/data.mock.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +3 -0
- 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/test-helpers/cryptoAssetsStore.d.ts +2 -0
- package/lib/test-helpers/cryptoAssetsStore.d.ts.map +1 -0
- package/lib/test-helpers/cryptoAssetsStore.js +8 -0
- package/lib/test-helpers/cryptoAssetsStore.js.map +1 -0
- package/lib/wallet-api/ACRE/server.js +5 -5
- package/lib/wallet-api/ACRE/server.js.map +1 -1
- package/lib/wallet-api/Exchange/server.js +4 -4
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/logic.js +8 -8
- package/lib/wallet-api/logic.js.map +1 -1
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +4 -2
- package/lib/wallet-api/react.js.map +1 -1
- package/lib/wallet-api/useDappLogic.js +2 -2
- package/lib/wallet-api/useDappLogic.js.map +1 -1
- package/lib-es/__tests__/test-helpers/setup.integration.d.ts +2 -0
- package/lib-es/__tests__/test-helpers/setup.integration.d.ts.map +1 -0
- package/lib-es/__tests__/test-helpers/setup.integration.js +14 -0
- package/lib-es/__tests__/test-helpers/setup.integration.js.map +1 -0
- package/lib-es/account/helpers.js +1 -1
- package/lib-es/account/helpers.js.map +1 -1
- package/lib-es/bridge/impl.d.ts +0 -2
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +3 -6
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/currencies/index.d.ts +1 -1
- package/lib-es/currencies/index.d.ts.map +1 -1
- package/lib-es/currencies/index.js +1 -1
- package/lib-es/currencies/index.js.map +1 -1
- package/lib-es/e2e/deviceInteraction/DeviceController.d.ts +41 -0
- package/lib-es/e2e/deviceInteraction/DeviceController.d.ts.map +1 -0
- package/lib-es/e2e/deviceInteraction/DeviceController.js +63 -0
- package/lib-es/e2e/deviceInteraction/DeviceController.js.map +1 -0
- package/lib-es/e2e/families/algorand.d.ts +1 -1
- package/lib-es/e2e/families/algorand.d.ts.map +1 -1
- package/lib-es/e2e/families/algorand.js +5 -4
- package/lib-es/e2e/families/algorand.js.map +1 -1
- package/lib-es/e2e/families/aptos.d.ts +2 -2
- package/lib-es/e2e/families/aptos.d.ts.map +1 -1
- package/lib-es/e2e/families/aptos.js +9 -7
- package/lib-es/e2e/families/aptos.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts +2 -2
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +11 -9
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/cardano.d.ts +6 -0
- package/lib-es/e2e/families/cardano.d.ts.map +1 -1
- package/lib-es/e2e/families/cardano.js +23 -21
- 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 +5 -4
- package/lib-es/e2e/families/celo.js.map +1 -1
- package/lib-es/e2e/families/cosmos.d.ts +2 -2
- package/lib-es/e2e/families/cosmos.d.ts.map +1 -1
- package/lib-es/e2e/families/cosmos.js +9 -7
- package/lib-es/e2e/families/cosmos.js.map +1 -1
- package/lib-es/e2e/families/evm.d.ts +2 -0
- package/lib-es/e2e/families/evm.d.ts.map +1 -1
- package/lib-es/e2e/families/evm.js +10 -9
- package/lib-es/e2e/families/evm.js.map +1 -1
- package/lib-es/e2e/families/hedera.d.ts +1 -1
- package/lib-es/e2e/families/hedera.d.ts.map +1 -1
- package/lib-es/e2e/families/hedera.js +5 -4
- package/lib-es/e2e/families/hedera.js.map +1 -1
- package/lib-es/e2e/families/kaspa.d.ts +2 -2
- package/lib-es/e2e/families/kaspa.d.ts.map +1 -1
- package/lib-es/e2e/families/kaspa.js +9 -7
- package/lib-es/e2e/families/kaspa.js.map +1 -1
- package/lib-es/e2e/families/multiversX.d.ts +1 -1
- package/lib-es/e2e/families/multiversX.d.ts.map +1 -1
- package/lib-es/e2e/families/multiversX.js +5 -4
- package/lib-es/e2e/families/multiversX.js.map +1 -1
- package/lib-es/e2e/families/near.d.ts +1 -1
- package/lib-es/e2e/families/near.d.ts.map +1 -1
- package/lib-es/e2e/families/near.js +6 -5
- package/lib-es/e2e/families/near.js.map +1 -1
- package/lib-es/e2e/families/osmosis.d.ts +1 -1
- package/lib-es/e2e/families/osmosis.d.ts.map +1 -1
- package/lib-es/e2e/families/osmosis.js +5 -4
- package/lib-es/e2e/families/osmosis.js.map +1 -1
- package/lib-es/e2e/families/polkadot.d.ts +1 -1
- package/lib-es/e2e/families/polkadot.d.ts.map +1 -1
- package/lib-es/e2e/families/polkadot.js +5 -4
- package/lib-es/e2e/families/polkadot.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts +2 -2
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +9 -7
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/families/stellar.d.ts +1 -1
- package/lib-es/e2e/families/stellar.d.ts.map +1 -1
- package/lib-es/e2e/families/stellar.js +5 -4
- package/lib-es/e2e/families/stellar.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +1 -1
- package/lib-es/e2e/families/sui.d.ts.map +1 -1
- package/lib-es/e2e/families/sui.js +5 -4
- package/lib-es/e2e/families/sui.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +8 -8
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/families/tron.d.ts +1 -1
- package/lib-es/e2e/families/tron.d.ts.map +1 -1
- package/lib-es/e2e/families/tron.js +5 -4
- package/lib-es/e2e/families/tron.js.map +1 -1
- package/lib-es/e2e/families/xrp.d.ts +1 -1
- package/lib-es/e2e/families/xrp.d.ts.map +1 -1
- package/lib-es/e2e/families/xrp.js +5 -4
- package/lib-es/e2e/families/xrp.js.map +1 -1
- package/lib-es/e2e/index.d.ts +9 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +11 -11
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +54 -43
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.js +1 -1
- package/lib-es/exchange/swap/getCompleteSwapHistory.js.map +1 -1
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js +1 -1
- package/lib-es/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +1 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/canton/react.d.ts +15 -0
- package/lib-es/families/canton/react.d.ts.map +1 -0
- package/lib-es/families/canton/react.js +10 -0
- package/lib-es/families/canton/react.js.map +1 -0
- package/lib-es/families/cosmos/datasets/dydx.integration.FIXME.d.ts +1 -1
- package/lib-es/families/cosmos/datasets/dydx.integration.FIXME.d.ts.map +1 -1
- package/lib-es/families/cosmos/datasets/dydx.integration.FIXME.js +1 -1
- package/lib-es/families/cosmos/datasets/dydx.integration.FIXME.js.map +1 -1
- package/lib-es/families/cosmos/datasets/secretNetwork.integration.FIXME.d.ts +1 -1
- package/lib-es/families/cosmos/datasets/secretNetwork.integration.FIXME.d.ts.map +1 -1
- package/lib-es/families/cosmos/datasets/secretNetwork.integration.FIXME.js +1 -1
- package/lib-es/families/cosmos/datasets/secretNetwork.integration.FIXME.js.map +1 -1
- package/lib-es/families/evm/setup.d.ts.map +1 -1
- package/lib-es/families/evm/setup.js +1 -11
- package/lib-es/families/evm/setup.js.map +1 -1
- package/lib-es/families/solana/setup.d.ts +8 -0
- package/lib-es/families/solana/setup.d.ts.map +1 -1
- package/lib-es/families/solana/setup.js +28 -17
- package/lib-es/families/solana/setup.js.map +1 -1
- package/lib-es/families/tron/data.mock.d.ts.map +1 -1
- package/lib-es/families/tron/data.mock.js +3 -6
- package/lib-es/families/tron/data.mock.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +3 -0
- 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/test-helpers/cryptoAssetsStore.d.ts +2 -0
- package/lib-es/test-helpers/cryptoAssetsStore.d.ts.map +1 -0
- package/lib-es/test-helpers/cryptoAssetsStore.js +2 -0
- package/lib-es/test-helpers/cryptoAssetsStore.js.map +1 -0
- package/lib-es/wallet-api/ACRE/server.js +1 -1
- package/lib-es/wallet-api/ACRE/server.js.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +1 -1
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/logic.js +1 -1
- package/lib-es/wallet-api/logic.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +3 -1
- package/lib-es/wallet-api/react.js.map +1 -1
- package/lib-es/wallet-api/useDappLogic.js +1 -1
- package/lib-es/wallet-api/useDappLogic.js.map +1 -1
- package/package.json +67 -53
- package/src/DataModel.test.ts +2 -8
- package/src/__tests__/__snapshots__/csvExport.ts.snap +0 -718
- package/src/__tests__/accounts/groupPerDay.ts +2 -4
- package/src/__tests__/csvExport.ts +3 -3
- package/src/__tests__/currencies.ts +0 -38
- package/src/__tests__/test-helpers/setup.integration.ts +17 -0
- package/src/__tests__/test-helpers/setup.ts +3 -8
- package/src/account/helpers.test.ts +2 -2
- package/src/account/helpers.ts +1 -1
- package/src/account/serialization.test.ts +2 -2
- package/src/bridge/crypto-assets/index.test.ts +15 -44
- package/src/bridge/impl.ts +3 -7
- package/src/currencies/cryptoIcons.test.ts +23 -4
- package/src/currencies/helpers.test.ts +13 -0
- package/src/currencies/index.ts +0 -3
- package/src/currencies/sortByMarketcap.test.ts +0 -26
- package/src/domain/getTokensWithFunds.test.ts +32 -3
- package/src/e2e/deviceInteraction/DeviceController.ts +85 -0
- package/src/e2e/families/algorand.ts +20 -13
- package/src/e2e/families/aptos.ts +28 -16
- package/src/e2e/families/bitcoin.ts +53 -39
- package/src/e2e/families/cardano.ts +47 -36
- package/src/e2e/families/celo.ts +18 -12
- package/src/e2e/families/cosmos.ts +35 -23
- package/src/e2e/families/evm.ts +24 -13
- package/src/e2e/families/hedera.ts +6 -4
- package/src/e2e/families/kaspa.ts +28 -16
- package/src/e2e/families/multiversX.ts +16 -10
- package/src/e2e/families/near.ts +23 -17
- package/src/e2e/families/osmosis.ts +19 -13
- package/src/e2e/families/polkadot.ts +19 -13
- package/src/e2e/families/solana.ts +35 -23
- package/src/e2e/families/stellar.ts +18 -13
- package/src/e2e/families/sui.ts +15 -9
- package/src/e2e/families/tezos.ts +25 -18
- package/src/e2e/families/tron.ts +19 -13
- package/src/e2e/families/xrp.ts +19 -13
- package/src/e2e/speculos.ts +168 -140
- package/src/exchange/swap/getCompleteSwapHistory.ts +1 -1
- package/src/exchange/swap/hooks/useSelectableCurrencies.test.ts +4 -0
- package/src/exchange/swap/hooks/useSelectableCurrencies.ts +1 -1
- package/src/families/algorand/__snapshots__/bridge.integration.test.ts.snap +11 -11
- package/src/families/algorand/bridge.integration.test.ts +1 -1
- package/src/families/aptos/__snapshots__/bridge.integration.test.ts.snap +111 -1
- package/src/families/aptos/bridge.integration.test.ts +1 -1
- package/src/families/bitcoin/bridge.integration.test.ts +1 -1
- package/src/families/bitcoin/satstack.test.ts +5 -8
- package/src/families/canton/bridge/mock.ts +1 -0
- package/src/families/canton/react.ts +50 -0
- package/src/families/cardano/__snapshots__/bridge.integration.test.ts.snap +2 -2
- package/src/families/cardano/bridge.integration.test.ts +1 -1
- package/src/families/casper/bridge.integration.test.ts +1 -1
- package/src/families/celo/bridge.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/__snapshots__/cosmos.integration.test.ts.snap +1 -1
- package/src/families/cosmos/datasets/axelar.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/babylon.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/coreum.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/cosmos.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/cryptoOrg.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/desmos.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/dydx.integration.FIXME.ts +1 -1
- package/src/families/cosmos/datasets/injective.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/mantra.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/onomy.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/osmosis.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/persistence.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/quicksilver.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/secretNetwork.integration.FIXME.ts +1 -1
- package/src/families/cosmos/datasets/seiNetwork.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/stargaze.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/umee.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/xion.integration.test.ts +1 -1
- package/src/families/cosmos/datasets/zenrock.integration.test.ts +1 -1
- package/src/families/evm/bridge.integration.test.ts +1 -1
- package/src/families/evm/setup.ts +0 -12
- package/src/families/filecoin/bridge.integration.test.ts +1 -1
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +191 -596
- package/src/families/hedera/bridge.integration.test.ts +1 -1
- package/src/families/icon/bridge.integration.test.ts +1 -1
- package/src/families/internet_computer/bridge.integration.test.ts +1 -1
- package/src/families/kaspa/bridge.integration.test.ts +1 -1
- package/src/families/mina/bridge.integration.test.ts +1 -1
- package/src/families/multiversx/bridge.integration.test.ts +1 -1
- package/src/families/multiversx/synchronisation.integration.test.ts +1 -1
- package/src/families/near/bridge.integration.test.ts +1 -1
- package/src/families/polkadot/bridge.integration.test.ts +1 -1
- package/src/families/solana/__snapshots__/bridge.integration.test.ts.snap +14 -44
- package/src/families/solana/bridge.integration.test.ts +1 -1
- package/src/families/solana/setup.ts +37 -24
- package/src/families/stacks/__tests__/sync.integration.test.ts +1 -1
- package/src/families/stacks/bridge.integration.test.ts +1 -1
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +3 -3
- package/src/families/stellar/bridge.integration.test.ts +1 -1
- package/src/families/sui/bridge.integration.test.ts +1 -1
- package/src/families/tezos/bridge.integration.test.ts +1 -1
- package/src/families/ton/bridge.integration.test.ts +1 -1
- package/src/families/tron/bridge.integration.test.ts +1 -1
- package/src/families/tron/data.mock.ts +4 -8
- package/src/families/vechain/bridge.integration.test.ts +1 -1
- package/src/families/xrp/bridge.integration.test.ts +1 -1
- package/src/featureFlags/defaultFeatures.ts +3 -0
- package/src/test-helpers/cryptoAssetsStore.ts +5 -0
- package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +3 -3
- package/src/wallet-api/ACRE/server.test.ts +3 -4
- package/src/wallet-api/ACRE/server.ts +1 -1
- package/src/wallet-api/Exchange/server.ts +1 -1
- package/src/wallet-api/logic.test.ts +3 -3
- package/src/wallet-api/logic.ts +1 -1
- package/src/wallet-api/react.ts +3 -1
- package/src/wallet-api/useDappLogic.ts +1 -1
- package/lib/__tests__/test-helpers/setup.d.ts +0 -2
- package/lib/__tests__/test-helpers/setup.d.ts.map +0 -1
- package/lib/__tests__/test-helpers/setup.js.map +0 -1
- package/lib/bridge/crypto-assets/index.d.ts +0 -4
- package/lib/bridge/crypto-assets/index.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/index.js +0 -22
- package/lib/bridge/crypto-assets/index.js.map +0 -1
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +0 -3
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +0 -1
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js +0 -26
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +0 -1
- package/lib-es/__tests__/test-helpers/setup.d.ts +0 -2
- package/lib-es/__tests__/test-helpers/setup.d.ts.map +0 -1
- package/lib-es/__tests__/test-helpers/setup.js +0 -18
- package/lib-es/__tests__/test-helpers/setup.js.map +0 -1
- package/lib-es/bridge/crypto-assets/index.d.ts +0 -4
- package/lib-es/bridge/crypto-assets/index.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/index.js +0 -17
- package/lib-es/bridge/crypto-assets/index.js.map +0 -1
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +0 -3
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +0 -1
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js +0 -18
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +0 -1
- package/src/bridge/crypto-assets/index.ts +0 -23
- package/src/e2e/deviceInteraction/ButtonDeviceSimulator.ts +0 -23
|
@@ -2,8 +2,7 @@ import flatMap from "lodash/flatMap";
|
|
|
2
2
|
import { fromAccountRaw, groupAccountOperationsByDay } from "../../account";
|
|
3
3
|
import { TezosAccountRaw } from "../../families/tezos/types";
|
|
4
4
|
import { setSupportedCurrencies } from "../../currencies";
|
|
5
|
-
import
|
|
6
|
-
import { setup } from "../../bridge/impl";
|
|
5
|
+
import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
|
|
7
6
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
8
7
|
setSupportedCurrencies(["tezos"]);
|
|
9
8
|
|
|
@@ -14,8 +13,7 @@ LiveConfig.setConfig({
|
|
|
14
13
|
},
|
|
15
14
|
});
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
setup({} as CryptoAssetsStore);
|
|
16
|
+
setupMockCryptoAssetsStore();
|
|
19
17
|
|
|
20
18
|
let account: Awaited<ReturnType<typeof fromAccountRaw>>;
|
|
21
19
|
|
|
@@ -5,10 +5,10 @@ import { getCryptoCurrencyById } from "../currencies";
|
|
|
5
5
|
import { accountsOpToCSV } from "../csvExport";
|
|
6
6
|
import { initialState, loadCountervalues } from "@ledgerhq/live-countervalues/logic";
|
|
7
7
|
import { getFiatCurrencyByTicker, setSupportedCurrencies } from "../currencies";
|
|
8
|
-
import {
|
|
9
|
-
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
8
|
+
import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
// Setup mock store for unit tests
|
|
11
|
+
setupMockCryptoAssetsStore();
|
|
12
12
|
setSupportedCurrencies(["ethereum", "ripple"]);
|
|
13
13
|
setEnv("MOCK", "1");
|
|
14
14
|
setEnv("MOCK_COUNTERVALUES", "1");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
2
|
import {
|
|
3
|
-
listTokens,
|
|
4
3
|
getCryptoCurrencyById,
|
|
5
4
|
getFiatCurrencyByTicker,
|
|
6
5
|
formatCurrencyUnit,
|
|
@@ -10,43 +9,6 @@ import {
|
|
|
10
9
|
encodeURIScheme,
|
|
11
10
|
sanitizeValueString,
|
|
12
11
|
} from "../currencies";
|
|
13
|
-
import { byContractAddressAndChainId } from "@ledgerhq/hw-app-eth/erc20";
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
skipped because ledgerjs data is now lighter (from the POV of hw-app-eth)
|
|
17
|
-
(using cryptoassets-evm-signatures instead of cryptoassets)
|
|
18
|
-
*/
|
|
19
|
-
test.skip("erc20 are all consistent with those on ledgerjs side", () => {
|
|
20
|
-
const normalList = listTokens();
|
|
21
|
-
const delistedList = listTokens({
|
|
22
|
-
withDelisted: true,
|
|
23
|
-
});
|
|
24
|
-
expect(delistedList.length).toBeGreaterThan(normalList.length);
|
|
25
|
-
|
|
26
|
-
for (const token of delistedList) {
|
|
27
|
-
if (token.delisted) {
|
|
28
|
-
expect(normalList.find(o => o.id === token.id)).toBeUndefined();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (token.tokenType === "erc20") {
|
|
32
|
-
if (token.parentCurrency.family === "filecoin") {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
const tokenData = byContractAddressAndChainId(
|
|
36
|
-
token.contractAddress,
|
|
37
|
-
token.parentCurrency.ethereumLikeInfo?.chainId || 0,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
if (!tokenData) {
|
|
41
|
-
throw new Error(token.name + " not available in ledgerjs data");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
expect(token.ticker.toLowerCase()).toBe(tokenData.ticker.toLowerCase());
|
|
45
|
-
expect(token.contractAddress.toLowerCase()).toBe(tokenData.contractAddress.toLowerCase());
|
|
46
|
-
expect(token.units[0].magnitude).toBe(tokenData.decimals);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
12
|
|
|
51
13
|
test("can format a currency unit", () => {
|
|
52
14
|
const btc = getCryptoCurrencyById("bitcoin").units[0];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { setupCalClientStore } from "../../test-helpers/cryptoAssetsStore";
|
|
2
|
+
import "./environment";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
|
|
5
|
+
// Integration tests use the real CAL API
|
|
6
|
+
setupCalClientStore();
|
|
7
|
+
|
|
8
|
+
jest.setTimeout(360000);
|
|
9
|
+
|
|
10
|
+
expect.extend({
|
|
11
|
+
toBeBigNumber(value) {
|
|
12
|
+
const pass = BigNumber.isBigNumber(value);
|
|
13
|
+
const message = pass ? () => `${value} is a BigNumber` : () => `${value} is not a BigNumber`;
|
|
14
|
+
|
|
15
|
+
return { message, pass };
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
|
|
3
|
-
import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
|
|
4
|
-
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
1
|
+
import { setupMockCryptoAssetsStore } from "../../test-helpers/cryptoAssetsStore";
|
|
5
2
|
import "./environment";
|
|
6
3
|
import BigNumber from "bignumber.js";
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
// Unit tests use mock store
|
|
6
|
+
setupMockCryptoAssetsStore();
|
|
9
7
|
|
|
10
8
|
jest.setTimeout(360000);
|
|
11
9
|
|
|
@@ -17,6 +15,3 @@ expect.extend({
|
|
|
17
15
|
return { message, pass };
|
|
18
16
|
},
|
|
19
17
|
});
|
|
20
|
-
|
|
21
|
-
// Use legacyCryptoAssetsStore for integration tests so tokens can be found
|
|
22
|
-
setCryptoAssetsStoreForCoinFramework(legacyCryptoAssetsStore);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { loadBlacklistedTokenSections } from "./helpers";
|
|
2
|
-
import { getCryptoAssetsStore } from "
|
|
2
|
+
import { getCryptoAssetsStore } from "@ledgerhq/cryptoassets/state";
|
|
3
3
|
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
4
|
|
|
5
|
-
jest.mock("
|
|
5
|
+
jest.mock("@ledgerhq/cryptoassets/state");
|
|
6
6
|
|
|
7
7
|
const mockGetCryptoAssetsStore = getCryptoAssetsStore as jest.MockedFunction<
|
|
8
8
|
typeof getCryptoAssetsStore
|
package/src/account/helpers.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { isAccountEmpty as isVechainAccountEmpty } from "@ledgerhq/coin-vechain/
|
|
|
15
15
|
import type { Account, AccountLike } from "@ledgerhq/types-live";
|
|
16
16
|
import { isAccountDelegating } from "../families/tezos/staking";
|
|
17
17
|
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
18
|
-
import { getCryptoAssetsStore } from "
|
|
18
|
+
import { getCryptoAssetsStore } from "@ledgerhq/cryptoassets/state";
|
|
19
19
|
|
|
20
20
|
// TODO: remove this export and prefer import from root file.
|
|
21
21
|
export {
|
|
@@ -3,7 +3,7 @@ import { genAccount, genTokenAccount } from "@ledgerhq/coin-framework/mocks/acco
|
|
|
3
3
|
import { toAccountRaw, fromAccountRaw } from "./serialization";
|
|
4
4
|
import { setWalletAPIVersion } from "../wallet-api/version";
|
|
5
5
|
import { WALLET_API_VERSION } from "../wallet-api/constants";
|
|
6
|
-
import { setCryptoAssetsStore
|
|
6
|
+
import { setCryptoAssetsStore } from "@ledgerhq/cryptoassets/state";
|
|
7
7
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
|
8
8
|
import solanaSplTokenData from "../__fixtures__/solana-spl-epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v.json";
|
|
9
9
|
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
@@ -17,7 +17,7 @@ const Solana = getCryptoCurrencyById("solana");
|
|
|
17
17
|
const USDC = solanaSplTokenData as TokenCurrency;
|
|
18
18
|
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
20
|
-
|
|
20
|
+
setCryptoAssetsStore({
|
|
21
21
|
findTokenById: async (id: string) => {
|
|
22
22
|
if (id === "solana/spl/epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v") {
|
|
23
23
|
return USDC;
|
|
@@ -1,54 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getCryptoAssetsStore, setCryptoAssetsStore } from ".";
|
|
3
|
-
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
|
|
1
|
+
import { getCryptoAssetsStore, setCryptoAssetsStore } from "@ledgerhq/cryptoassets/state";
|
|
4
2
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
|
3
|
+
import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
|
|
5
4
|
|
|
6
5
|
describe("Testing CryptoAssetStore", () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
default: true,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const store = getCryptoAssetsStore();
|
|
16
|
-
expect(store).toBe(legacyCryptoAssetsStore);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should return the default methods from cryptoassets libs when feature flag is disabled", () => {
|
|
20
|
-
LiveConfig.setConfig({
|
|
21
|
-
feature_cal_lazy_loading: {
|
|
22
|
-
type: "boolean",
|
|
23
|
-
default: false,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const store = getCryptoAssetsStore();
|
|
28
|
-
expect(store).toBe(legacyCryptoAssetsStore);
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
// Reset the store before each test
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
9
|
+
setCryptoAssetsStore(undefined as unknown as CryptoAssetsStore);
|
|
29
10
|
});
|
|
30
11
|
|
|
31
|
-
it("should throw an error when no store is set
|
|
32
|
-
|
|
33
|
-
feature_cal_lazy_loading: {
|
|
34
|
-
type: "boolean",
|
|
35
|
-
default: true,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
expect(() => getCryptoAssetsStore()).toThrow(
|
|
40
|
-
"CryptoAssetsStore is not set. Please call setCryptoAssetsStore first.",
|
|
41
|
-
);
|
|
12
|
+
it("should throw an error when no store is set", () => {
|
|
13
|
+
expect(() => getCryptoAssetsStore()).toThrow("CryptoAssetsStore is not set");
|
|
42
14
|
});
|
|
43
15
|
|
|
44
|
-
it("should
|
|
45
|
-
LiveConfig.setConfig({
|
|
46
|
-
feature_cal_lazy_loading: {
|
|
47
|
-
type: "boolean",
|
|
48
|
-
default: true,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
16
|
+
it("should return the store when it is set", () => {
|
|
52
17
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
53
18
|
const newStore = {} as unknown as CryptoAssetsStore;
|
|
54
19
|
setCryptoAssetsStore(newStore);
|
|
@@ -56,4 +21,10 @@ describe("Testing CryptoAssetStore", () => {
|
|
|
56
21
|
const store = getCryptoAssetsStore();
|
|
57
22
|
expect(store).toBe(newStore);
|
|
58
23
|
});
|
|
24
|
+
|
|
25
|
+
it("should work with mock store", () => {
|
|
26
|
+
const mockStore = setupMockCryptoAssetsStore();
|
|
27
|
+
const store = getCryptoAssetsStore();
|
|
28
|
+
expect(store).toBe(mockStore);
|
|
29
|
+
});
|
|
59
30
|
});
|
package/src/bridge/impl.ts
CHANGED
|
@@ -20,9 +20,7 @@ import {
|
|
|
20
20
|
import { getAlpacaAccountBridge } from "./generic-alpaca/accountBridge";
|
|
21
21
|
import { getAlpacaCurrencyBridge } from "./generic-alpaca/currencyBridge";
|
|
22
22
|
import { AddressesSanctionedError } from "@ledgerhq/coin-framework/sanction/errors";
|
|
23
|
-
|
|
24
|
-
import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
|
|
25
|
-
import { getCryptoAssetsStore, setCryptoAssetsStore } from "./crypto-assets";
|
|
23
|
+
// Removed: stores are now managed globally by @ledgerhq/cryptoassets/cal-client/store
|
|
26
24
|
|
|
27
25
|
const alpacaized = {
|
|
28
26
|
xrp: true,
|
|
@@ -105,10 +103,8 @@ export function getAccountBridgeByFamily(family: string, accountId?: string): Ac
|
|
|
105
103
|
return wrapAccountBridge(jsBridge.accountBridge);
|
|
106
104
|
}
|
|
107
105
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
setCryptoAssetsStoreForCoinFramework(getCryptoAssetsStore());
|
|
111
|
-
}
|
|
106
|
+
// Removed: setup() is no longer needed. The store is now managed globally by @ledgerhq/cryptoassets/cal-client/store.
|
|
107
|
+
// Use setupCalClientStore() or setupMockCryptoAssetsStore() from @ledgerhq/cryptoassets/cal-client/test-helpers instead.
|
|
112
108
|
|
|
113
109
|
function wrapAccountBridge<T extends TransactionCommon>(
|
|
114
110
|
bridge: AccountBridge<T>,
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
2
|
-
import {
|
|
3
|
-
import { addTokens as addTokensLegacy } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
2
|
+
import { setupMockCryptoAssetsStore } from "../test-helpers/cryptoAssetsStore";
|
|
4
3
|
import { inferCryptoCurrencyIcon } from "./cryptoIcons";
|
|
5
|
-
import { getCryptoAssetsStore } from "
|
|
4
|
+
import { getCryptoAssetsStore } from "@ledgerhq/cryptoassets/state";
|
|
6
5
|
|
|
7
6
|
beforeAll(() => {
|
|
8
|
-
|
|
7
|
+
// Setup mock store for unit tests
|
|
8
|
+
setupMockCryptoAssetsStore({
|
|
9
|
+
findTokenById: async (id: string) => {
|
|
10
|
+
// Return a mock token for the test
|
|
11
|
+
if (id === "ethereum/erc20/usd_tether__erc20_") {
|
|
12
|
+
return {
|
|
13
|
+
type: "TokenCurrency",
|
|
14
|
+
id: "ethereum/erc20/usd_tether__erc20_",
|
|
15
|
+
contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
16
|
+
parentCurrency: getCryptoCurrencyById("ethereum"),
|
|
17
|
+
tokenType: "erc20",
|
|
18
|
+
name: "Tether USD",
|
|
19
|
+
ticker: "USDT",
|
|
20
|
+
delisted: false,
|
|
21
|
+
disableCountervalue: false,
|
|
22
|
+
units: [{ name: "USDT", code: "USDT", magnitude: 6 }],
|
|
23
|
+
} as any;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
9
28
|
});
|
|
10
29
|
|
|
11
30
|
describe("inferCryptoCurrencyIcon", () => {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../__tests__/test-helpers/setup";
|
|
2
|
+
import { isCryptoCurrency } from "./helpers";
|
|
3
|
+
import { listCryptoCurrencies } from ".";
|
|
4
|
+
|
|
5
|
+
describe("Currencies helpers", () => {
|
|
6
|
+
test("listCryptoCurrencies returns only crypto currencies", () => {
|
|
7
|
+
const currencies = listCryptoCurrencies();
|
|
8
|
+
|
|
9
|
+
currencies.forEach(currency => {
|
|
10
|
+
expect(isCryptoCurrency(currency)).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
});
|
package/src/currencies/index.ts
CHANGED
|
@@ -11,9 +11,6 @@ export {
|
|
|
11
11
|
findCryptoCurrencyByScheme,
|
|
12
12
|
findCryptoCurrencyByKeyword,
|
|
13
13
|
findCryptoCurrencyByTicker,
|
|
14
|
-
listTokens,
|
|
15
|
-
listTokensForCryptoCurrency,
|
|
16
|
-
listTokenTypesForCryptoCurrency,
|
|
17
14
|
getAbandonSeedAddress,
|
|
18
15
|
} from "@ledgerhq/cryptoassets";
|
|
19
16
|
export {
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
import { sortCurrenciesByIds } from "./sortByMarketcap";
|
|
2
|
-
import { listCryptoCurrencies, listTokens } from ".";
|
|
3
|
-
import { getBTCValues } from "@ledgerhq/live-countervalues/mock";
|
|
4
2
|
import { CURRENCIES_LIST, IDS } from "./mock";
|
|
5
|
-
import { findCryptoCurrencyByTicker, findFiatCurrencyByTicker } from "@ledgerhq/cryptoassets/index";
|
|
6
|
-
import { getCryptoAssetsStore } from "@ledgerhq/coin-framework/crypto-assets/index";
|
|
7
|
-
import { legacyCryptoAssetsStore } from "@ledgerhq/cryptoassets/legacy/legacy-store";
|
|
8
|
-
import { initializeLegacyTokens } from "@ledgerhq/cryptoassets/legacy/legacy-data";
|
|
9
|
-
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
10
|
-
import { setup } from "../bridge/impl";
|
|
11
|
-
|
|
12
|
-
initializeLegacyTokens(addTokens);
|
|
13
|
-
setup(legacyCryptoAssetsStore);
|
|
14
|
-
|
|
15
|
-
test("sortCurrenciesByIds snapshot", async () => {
|
|
16
|
-
const list = [...listCryptoCurrencies(), ...listTokens()];
|
|
17
|
-
const ids: string[] = [];
|
|
18
|
-
for (const k in getBTCValues()) {
|
|
19
|
-
const c =
|
|
20
|
-
findCryptoCurrencyByTicker(k) ||
|
|
21
|
-
findFiatCurrencyByTicker(k) ||
|
|
22
|
-
(await getCryptoAssetsStore().findTokenById(k));
|
|
23
|
-
if (c && (c.type == "CryptoCurrency" || c.type == "TokenCurrency")) {
|
|
24
|
-
ids.push(c.id);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
expect(sortCurrenciesByIds(list, ids).map(c => c.id)[0]).toEqual("bitcoin");
|
|
28
|
-
});
|
|
29
3
|
|
|
30
4
|
test("sortCurrenciesByIds simulate staking from portfolio", () => {
|
|
31
5
|
expect(sortCurrenciesByIds(CURRENCIES_LIST, IDS).map(c => c.id)).toEqual([
|
|
@@ -1,18 +1,47 @@
|
|
|
1
1
|
import { genAccount } from "@ledgerhq/coin-framework/lib/mocks/account";
|
|
2
2
|
import { getCryptoCurrencyById } from "../currencies/index";
|
|
3
3
|
import { Account } from "@ledgerhq/types-live";
|
|
4
|
+
import type { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
5
|
import BigNumber from "bignumber.js";
|
|
5
6
|
import { getTokensWithFunds } from "./getTokensWithFunds";
|
|
6
|
-
import {
|
|
7
|
-
import { addTokens } from "@ledgerhq/cryptoassets/legacy/legacy-utils";
|
|
7
|
+
import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// Setup mock store for unit tests
|
|
10
|
+
setupMockCryptoAssetsStore();
|
|
10
11
|
|
|
11
12
|
const ETH = getCryptoCurrencyById("ethereum");
|
|
12
13
|
|
|
14
|
+
// Create mock tokens for tests
|
|
15
|
+
const ZRX_TOKEN: TokenCurrency = {
|
|
16
|
+
type: "TokenCurrency",
|
|
17
|
+
id: "ethereum/erc20/0x_project",
|
|
18
|
+
contractAddress: "0xE41d2489571d322189246DaFA5ebDe1F4699F498",
|
|
19
|
+
parentCurrency: ETH,
|
|
20
|
+
tokenType: "erc20",
|
|
21
|
+
name: "0x Project",
|
|
22
|
+
ticker: "ZRX",
|
|
23
|
+
delisted: false,
|
|
24
|
+
disableCountervalue: false,
|
|
25
|
+
units: [{ name: "ZRX", code: "ZRX", magnitude: 18 }],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const REP_TOKEN: TokenCurrency = {
|
|
29
|
+
type: "TokenCurrency",
|
|
30
|
+
id: "ethereum/erc20/augur",
|
|
31
|
+
contractAddress: "0x1985365e9f78359a9B6AD760e32412f4a445E862",
|
|
32
|
+
parentCurrency: ETH,
|
|
33
|
+
tokenType: "erc20",
|
|
34
|
+
name: "Augur",
|
|
35
|
+
ticker: "REP",
|
|
36
|
+
delisted: false,
|
|
37
|
+
disableCountervalue: false,
|
|
38
|
+
units: [{ name: "REP", code: "REP", magnitude: 18 }],
|
|
39
|
+
};
|
|
40
|
+
|
|
13
41
|
const mockedAccounts: Account[] = [
|
|
14
42
|
genAccount("mocked-account-2", {
|
|
15
43
|
currency: ETH,
|
|
44
|
+
tokensData: [ZRX_TOKEN, REP_TOKEN],
|
|
16
45
|
}),
|
|
17
46
|
];
|
|
18
47
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { getEnv } from "@ledgerhq/live-env";
|
|
2
|
+
import { getSpeculosAddress } from "../speculos";
|
|
3
|
+
import {
|
|
4
|
+
deviceControllerClientFactory,
|
|
5
|
+
type DeviceControllerClient,
|
|
6
|
+
type ButtonKey,
|
|
7
|
+
} from "@ledgerhq/speculos-device-controller";
|
|
8
|
+
|
|
9
|
+
// temp type until DeviceControllerClient exposes buttonFactory type
|
|
10
|
+
type ButtonsController = {
|
|
11
|
+
left(): Promise<void>;
|
|
12
|
+
right(): Promise<void>;
|
|
13
|
+
both(): Promise<void>;
|
|
14
|
+
pressSequence(keys: ButtonKey[], delayMs?: number): Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type DeviceControllerContext = {
|
|
18
|
+
getDeviceController: () => DeviceControllerClient;
|
|
19
|
+
getButtonsController: () => ButtonsController;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const endpointKey = () => `${getSpeculosAddress()}:${getEnv("SPECULOS_API_PORT")}`;
|
|
23
|
+
|
|
24
|
+
export const getDeviceControllerWithMemo = (() => {
|
|
25
|
+
let cache: { key: string; client: DeviceControllerClient } | null = null;
|
|
26
|
+
return () => {
|
|
27
|
+
const key = endpointKey();
|
|
28
|
+
if (!cache || cache.key !== key) {
|
|
29
|
+
cache = {
|
|
30
|
+
key,
|
|
31
|
+
client: deviceControllerClientFactory(key, {
|
|
32
|
+
timeoutMs: 10000,
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return cache.client;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
|
|
40
|
+
export const getButtonsWithMemo = (getController: () => DeviceControllerClient) => {
|
|
41
|
+
let cache: { ctrl: DeviceControllerClient; buttons: ButtonsController } | null = null;
|
|
42
|
+
return () => {
|
|
43
|
+
const ctrl = getController();
|
|
44
|
+
if (!cache || cache.ctrl !== ctrl) {
|
|
45
|
+
cache = { ctrl, buttons: ctrl.buttonFactory() };
|
|
46
|
+
}
|
|
47
|
+
return cache.buttons;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Wraps a function with access to speculos-device-controller via a tiny DI context.
|
|
53
|
+
*
|
|
54
|
+
* @description
|
|
55
|
+
* Pass a factory that receives a context exposing `getDeviceController()` and `getButtonsController()`.
|
|
56
|
+
* The factory returns the actual implementation. The returned wrapper preserves the implementation’s
|
|
57
|
+
* parameter and return types.
|
|
58
|
+
*
|
|
59
|
+
* Both accessors are lazy, they get or refresh the underlying controller only when called.
|
|
60
|
+
*
|
|
61
|
+
* @param factory - Function invoked immediately with the device context, must return the implementation.
|
|
62
|
+
* @returns A function with the same parameters and return type as the implementation returned by `factory`.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const accept = withDeviceController(({ getButtonsController }) => async (timeoutMS: number) => {
|
|
67
|
+
* const buttons = getButtonsController();
|
|
68
|
+
* await waitFor(timeoutMS);
|
|
69
|
+
* await buttons.both();
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* await accept(1000);
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
export function withDeviceController<A extends unknown[], R>(
|
|
77
|
+
factory: (ctx: DeviceControllerContext) => (...args: A) => R | Promise<R>,
|
|
78
|
+
): (...args: A) => R | Promise<R> {
|
|
79
|
+
const ctx: DeviceControllerContext = {
|
|
80
|
+
getDeviceController: getDeviceControllerWithMemo,
|
|
81
|
+
getButtonsController: getButtonsWithMemo(getDeviceControllerWithMemo),
|
|
82
|
+
};
|
|
83
|
+
const implementation = factory(ctx);
|
|
84
|
+
return (...args: A) => implementation(...args);
|
|
85
|
+
}
|
|
@@ -2,19 +2,26 @@ import expect from "expect";
|
|
|
2
2
|
import { Transaction } from "../models/Transaction";
|
|
3
3
|
import { containsSubstringInEvent, getSendEvents } from "../speculos";
|
|
4
4
|
import { isTouchDevice } from "../speculosAppVersion";
|
|
5
|
-
import { pressBoth } from "../deviceInteraction/ButtonDeviceSimulator";
|
|
6
5
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
7
6
|
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
|
|
7
|
+
import { withDeviceController } from "../deviceInteraction/DeviceController";
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
export const sendAlgorand = withDeviceController(
|
|
10
|
+
({ getButtonsController }) =>
|
|
11
|
+
async (tx: Transaction) => {
|
|
12
|
+
const buttons = getButtonsController();
|
|
13
|
+
|
|
14
|
+
const events = await getSendEvents(tx);
|
|
15
|
+
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
|
+
expect(isAmountCorrect).toBeTruthy();
|
|
17
|
+
|
|
18
|
+
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
|
+
expect(isAddressCorrect).toBeTruthy();
|
|
20
|
+
|
|
21
|
+
if (isTouchDevice()) {
|
|
22
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
23
|
+
} else {
|
|
24
|
+
await buttons.both();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
);
|
|
@@ -2,24 +2,36 @@ import expect from "expect";
|
|
|
2
2
|
import { Transaction } from "../models/Transaction";
|
|
3
3
|
import { waitFor, pressUntilTextFound, containsSubstringInEvent, getSendEvents } from "../speculos";
|
|
4
4
|
import { isTouchDevice } from "../speculosAppVersion";
|
|
5
|
-
import { pressBoth } from "../deviceInteraction/ButtonDeviceSimulator";
|
|
6
5
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
7
6
|
import { Delegate } from "../models/Delegate";
|
|
8
7
|
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
|
|
8
|
+
import { withDeviceController } from "../deviceInteraction/DeviceController";
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} else {
|
|
15
|
-
await pressBoth();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
10
|
+
export const sendAptos = withDeviceController(
|
|
11
|
+
({ getButtonsController }) =>
|
|
12
|
+
async (tx: Transaction) => {
|
|
13
|
+
const buttons = getButtonsController();
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
15
|
+
await getSendEvents(tx);
|
|
16
|
+
|
|
17
|
+
if (isTouchDevice()) {
|
|
18
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
19
|
+
} else {
|
|
20
|
+
await buttons.both();
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const delegateAptos = withDeviceController(
|
|
26
|
+
({ getButtonsController }) =>
|
|
27
|
+
async (delegatingAccount: Delegate) => {
|
|
28
|
+
const buttons = getButtonsController();
|
|
29
|
+
|
|
30
|
+
await waitFor(DeviceLabels.REVIEW_OPERATION);
|
|
31
|
+
const events = await pressUntilTextFound(DeviceLabels.APPROVE);
|
|
32
|
+
const isAmountCorrect = containsSubstringInEvent(delegatingAccount.amount, events);
|
|
33
|
+
expect(isAmountCorrect).toBeTruthy();
|
|
34
|
+
|
|
35
|
+
await buttons.both();
|
|
36
|
+
},
|
|
37
|
+
);
|