@ledgerhq/live-common 27.0.0 → 27.0.1-next.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/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js +2 -2
- package/lib/__tests__/test-helpers/environment.d.ts +2 -0
- package/lib/__tests__/test-helpers/environment.d.ts.map +1 -0
- package/lib/__tests__/test-helpers/environment.js +107 -0
- package/lib/__tests__/test-helpers/environment.js.map +1 -0
- package/lib/__tests__/test-helpers/setup.d.ts +1 -1
- package/lib/__tests__/test-helpers/setup.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/setup.js +1 -101
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/account/serialization.d.ts.map +1 -1
- package/lib/account/serialization.js +83 -40
- package/lib/account/serialization.js.map +1 -1
- package/lib/bot/bot-test-context.d.ts +3 -0
- package/lib/bot/bot-test-context.d.ts.map +1 -0
- package/lib/bot/bot-test-context.js +26 -0
- package/lib/bot/bot-test-context.js.map +1 -0
- package/lib/bot/bot-test-context.test.d.ts +2 -0
- package/lib/bot/bot-test-context.test.d.ts.map +1 -0
- package/lib/bot/bot-test-context.test.js +41 -0
- package/lib/bot/bot-test-context.test.js.map +1 -0
- package/lib/bot/cli.d.ts +2 -0
- package/lib/bot/cli.d.ts.map +1 -0
- package/lib/bot/cli.js +14 -0
- package/lib/bot/cli.js.map +1 -0
- package/lib/bot/engine.d.ts +5 -5
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js +161 -112
- package/lib/bot/engine.js.map +1 -1
- package/lib/bot/formatters.d.ts +2 -2
- package/lib/bot/formatters.d.ts.map +1 -1
- package/lib/bot/formatters.js +41 -15
- package/lib/bot/formatters.js.map +1 -1
- package/lib/bot/index.d.ts +1 -1
- package/lib/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +90 -15
- package/lib/bot/index.js.map +1 -1
- package/lib/bot/specs.d.ts +2 -1
- package/lib/bot/specs.d.ts.map +1 -1
- package/lib/bot/specs.js +13 -9
- package/lib/bot/specs.js.map +1 -1
- package/lib/bot/types.d.ts +5 -2
- package/lib/bot/types.d.ts.map +1 -1
- package/lib/countervalues/logic.integration.test.js +65 -0
- package/lib/countervalues/logic.integration.test.js.map +1 -1
- package/lib/countervalues/modules/weth.d.ts.map +1 -1
- package/lib/countervalues/modules/weth.js +5 -10
- package/lib/countervalues/modules/weth.js.map +1 -1
- package/lib/currencies/sortByMarketcap.d.ts +0 -2
- package/lib/currencies/sortByMarketcap.d.ts.map +1 -1
- package/lib/currencies/sortByMarketcap.js +3 -17
- package/lib/currencies/sortByMarketcap.js.map +1 -1
- package/lib/currencies/sortByMarketcap.test.js +0 -5
- package/lib/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib/env.js +1 -1
- package/lib/families/algorand/specs.d.ts.map +1 -1
- package/lib/families/algorand/specs.js +18 -10
- package/lib/families/algorand/specs.js.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.d.ts +1 -4
- package/lib/families/algorand/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/algorand/speculos-deviceActions.js +25 -8
- package/lib/families/algorand/speculos-deviceActions.js.map +1 -1
- package/lib/families/bitcoin/bridge/mock.d.ts.map +1 -1
- package/lib/families/bitcoin/bridge/mock.js +6 -1
- package/lib/families/bitcoin/bridge/mock.js.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.js +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.js.map +1 -1
- package/lib/families/bitcoin/datasets/dash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/dash.js +1 -1
- package/lib/families/bitcoin/datasets/dash.js.map +1 -1
- package/lib/families/bitcoin/datasets/decred.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/decred.js +1 -1
- package/lib/families/bitcoin/datasets/decred.js.map +1 -1
- package/lib/families/bitcoin/datasets/digibyte.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/digibyte.js +8 -2
- package/lib/families/bitcoin/datasets/digibyte.js.map +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.js +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/komodo.js +1 -1
- package/lib/families/bitcoin/datasets/komodo.js.map +1 -1
- package/lib/families/bitcoin/datasets/litecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/litecoin.js +8 -2
- package/lib/families/bitcoin/datasets/litecoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/peercoin.js +1 -1
- package/lib/families/bitcoin/datasets/peercoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/pivx.js +1 -1
- package/lib/families/bitcoin/datasets/pivx.js.map +1 -1
- package/lib/families/bitcoin/datasets/qtum.js +1 -1
- package/lib/families/bitcoin/datasets/qtum.js.map +1 -1
- package/lib/families/bitcoin/datasets/stakenet.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/stakenet.js +1 -1
- package/lib/families/bitcoin/datasets/stakenet.js.map +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.js +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/viacoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/viacoin.js +1 -1
- package/lib/families/bitcoin/datasets/viacoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/zcash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/zcash.js +1 -1
- package/lib/families/bitcoin/datasets/zcash.js.map +1 -1
- package/lib/families/bitcoin/datasets/zencash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/zencash.js +1 -1
- package/lib/families/bitcoin/datasets/zencash.js.map +1 -1
- package/lib/families/bitcoin/platformAdapter.test.d.ts +2 -0
- package/lib/families/bitcoin/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/bitcoin/platformAdapter.test.js +48 -0
- package/lib/families/bitcoin/platformAdapter.test.js.map +1 -0
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +62 -24
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.d.ts +1 -4
- package/lib/families/bitcoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.js +2 -4
- package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/cardano/js-estimateMaxSpendable.js +1 -1
- package/lib/families/cardano/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/cardano/specs.d.ts.map +1 -1
- package/lib/families/cardano/specs.js +19 -8
- package/lib/families/cardano/specs.js.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.d.ts +1 -4
- package/lib/families/cardano/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/cardano/speculos-deviceActions.js +2 -2
- package/lib/families/cardano/speculos-deviceActions.js.map +1 -1
- package/lib/families/celo/specs.d.ts.map +1 -1
- package/lib/families/celo/specs.js +2 -0
- package/lib/families/celo/specs.js.map +1 -1
- package/lib/families/celo/speculos-deviceActions.d.ts +1 -4
- package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/celo/speculos-deviceActions.js +2 -4
- package/lib/families/celo/speculos-deviceActions.js.map +1 -1
- package/lib/families/cosmos/specs.d.ts.map +1 -1
- package/lib/families/cosmos/specs.js +41 -25
- package/lib/families/cosmos/specs.js.map +1 -1
- package/lib/families/cosmos/speculos-deviceActions.d.ts +1 -4
- package/lib/families/cosmos/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/cosmos/speculos-deviceActions.js +2 -4
- package/lib/families/cosmos/speculos-deviceActions.js.map +1 -1
- package/lib/families/crypto_org/specs.d.ts.map +1 -1
- package/lib/families/crypto_org/specs.js +3 -0
- package/lib/families/crypto_org/specs.js.map +1 -1
- package/lib/families/crypto_org/speculos-deviceActions.d.ts +1 -4
- package/lib/families/crypto_org/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/crypto_org/speculos-deviceActions.js +2 -2
- package/lib/families/crypto_org/speculos-deviceActions.js.map +1 -1
- package/lib/families/elrond/specs.d.ts.map +1 -1
- package/lib/families/elrond/specs.js +15 -2
- package/lib/families/elrond/specs.js.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.d.ts +1 -4
- package/lib/families/elrond/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/elrond/speculos-deviceActions.js +2 -4
- package/lib/families/elrond/speculos-deviceActions.js.map +1 -1
- package/lib/families/ethereum/platformAdapter.test.d.ts +2 -0
- package/lib/families/ethereum/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/ethereum/platformAdapter.test.js +88 -0
- package/lib/families/ethereum/platformAdapter.test.js.map +1 -0
- package/lib/families/ethereum/specs.d.ts.map +1 -1
- package/lib/families/ethereum/specs.js +36 -12
- package/lib/families/ethereum/specs.js.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.d.ts +1 -4
- package/lib/families/ethereum/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ethereum/speculos-deviceActions.js +2 -4
- package/lib/families/ethereum/speculos-deviceActions.js.map +1 -1
- package/lib/families/filecoin/specs.d.ts.map +1 -1
- package/lib/families/filecoin/specs.js +2 -0
- package/lib/families/filecoin/specs.js.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.d.ts +1 -4
- package/lib/families/filecoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/filecoin/speculos-deviceActions.js +2 -2
- package/lib/families/filecoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/hedera/specs.d.ts.map +1 -1
- package/lib/families/hedera/specs.js +11 -3
- package/lib/families/hedera/specs.js.map +1 -1
- package/lib/families/hedera/speculos-deviceActions.d.ts +1 -4
- package/lib/families/hedera/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/hedera/speculos-deviceActions.js +4 -4
- package/lib/families/hedera/speculos-deviceActions.js.map +1 -1
- package/lib/families/osmosis/specs.d.ts.map +1 -1
- package/lib/families/osmosis/specs.js +13 -5
- package/lib/families/osmosis/specs.js.map +1 -1
- package/lib/families/osmosis/speculos-deviceActions.d.ts +1 -4
- package/lib/families/osmosis/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/osmosis/speculos-deviceActions.js +2 -4
- package/lib/families/osmosis/speculos-deviceActions.js.map +1 -1
- package/lib/families/polkadot/platformAdapter.test.d.ts +2 -0
- package/lib/families/polkadot/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/polkadot/platformAdapter.test.js +51 -0
- package/lib/families/polkadot/platformAdapter.test.js.map +1 -0
- package/lib/families/polkadot/specs.d.ts.map +1 -1
- package/lib/families/polkadot/specs.js +12 -1
- package/lib/families/polkadot/specs.js.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.d.ts +1 -4
- package/lib/families/polkadot/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/polkadot/speculos-deviceActions.js +2 -4
- package/lib/families/polkadot/speculos-deviceActions.js.map +1 -1
- package/lib/families/ripple/platformAdapter.test.d.ts +2 -0
- package/lib/families/ripple/platformAdapter.test.d.ts.map +1 -0
- package/lib/families/ripple/platformAdapter.test.js +51 -0
- package/lib/families/ripple/platformAdapter.test.js.map +1 -0
- package/lib/families/ripple/specs.d.ts.map +1 -1
- package/lib/families/ripple/specs.js +9 -4
- package/lib/families/ripple/specs.js.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.d.ts +1 -4
- package/lib/families/ripple/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/ripple/speculos-deviceActions.js +2 -4
- package/lib/families/ripple/speculos-deviceActions.js.map +1 -1
- package/lib/families/solana/specs.d.ts.map +1 -1
- package/lib/families/solana/specs.js +29 -11
- package/lib/families/solana/specs.js.map +1 -1
- package/lib/families/solana/speculos-deviceActions.d.ts +0 -5
- package/lib/families/solana/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/solana/speculos-deviceActions.js +0 -4
- package/lib/families/solana/speculos-deviceActions.js.map +1 -1
- package/lib/families/stellar/api/horizon.d.ts.map +1 -1
- package/lib/families/stellar/api/horizon.js +15 -10
- package/lib/families/stellar/api/horizon.js.map +1 -1
- package/lib/families/stellar/specs.d.ts.map +1 -1
- package/lib/families/stellar/specs.js +30 -12
- package/lib/families/stellar/specs.js.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.d.ts +1 -4
- package/lib/families/stellar/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.js +2 -4
- package/lib/families/stellar/speculos-deviceActions.js.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
- package/lib/families/tezos/specs.d.ts.map +1 -1
- package/lib/families/tezos/specs.js +2 -0
- package/lib/families/tezos/specs.js.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.d.ts +1 -4
- package/lib/families/tezos/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tezos/speculos-deviceActions.js +2 -2
- package/lib/families/tezos/speculos-deviceActions.js.map +1 -1
- package/lib/families/tron/specs.d.ts.map +1 -1
- package/lib/families/tron/specs.js +49 -17
- package/lib/families/tron/specs.js.map +1 -1
- package/lib/families/tron/speculos-deviceActions.d.ts +1 -4
- package/lib/families/tron/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/tron/speculos-deviceActions.js +2 -4
- package/lib/families/tron/speculos-deviceActions.js.map +1 -1
- package/lib/hw/getGenuineCheckFromDeviceId.d.ts +22 -0
- package/lib/hw/getGenuineCheckFromDeviceId.d.ts.map +1 -0
- package/lib/hw/getGenuineCheckFromDeviceId.js +49 -0
- package/lib/hw/getGenuineCheckFromDeviceId.js.map +1 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.d.ts +2 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.d.ts.map +1 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.js +84 -0
- package/lib/hw/getGenuineCheckFromDeviceId.test.js.map +1 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.d.ts +17 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.d.ts.map +1 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.js +27 -0
- package/lib/hw/getLatestAvailableFirmwareFromDeviceId.js.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.d.ts +34 -0
- package/lib/hw/hooks/useGenuineCheck.d.ts.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.js +115 -0
- package/lib/hw/hooks/useGenuineCheck.js.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.test.d.ts +2 -0
- package/lib/hw/hooks/useGenuineCheck.test.d.ts.map +1 -0
- package/lib/hw/hooks/useGenuineCheck.test.js +316 -0
- package/lib/hw/hooks/useGenuineCheck.test.js.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.d.ts +29 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.d.ts.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.js +72 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.js.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.d.ts +2 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.d.ts.map +1 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.js +155 -0
- package/lib/hw/hooks/useGetLatestAvailableFirmware.test.js.map +1 -0
- package/lib/load/speculos.d.ts +1 -0
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +2 -1
- package/lib/load/speculos.js.map +1 -1
- package/lib/mock/fixtures/cryptoCurrencies.d.ts +5 -0
- package/lib/mock/fixtures/cryptoCurrencies.d.ts.map +1 -0
- package/lib/mock/fixtures/cryptoCurrencies.js +91 -0
- package/lib/mock/fixtures/cryptoCurrencies.js.map +1 -0
- package/lib/platform/converters.test.js +44 -218
- package/lib/platform/converters.test.js.map +1 -1
- package/lib/platform/logic.d.ts +44 -0
- package/lib/platform/logic.d.ts.map +1 -1
- package/lib/platform/logic.js +147 -1
- package/lib/platform/logic.js.map +1 -1
- package/lib/platform/logic.test.d.ts +2 -0
- package/lib/platform/logic.test.d.ts.map +1 -0
- package/lib/platform/logic.test.js +903 -0
- package/lib/platform/logic.test.js.map +1 -0
- package/lib/platform/react.d.ts +6 -0
- package/lib/platform/react.d.ts.map +1 -1
- package/lib/platform/react.js +6 -0
- package/lib/platform/react.js.map +1 -1
- package/lib/platform/tracking.d.ts +1 -1
- package/lib/platform/tracking.d.ts.map +1 -1
- package/lib/platform/tracking.test.js +14 -41
- package/lib/platform/tracking.test.js.map +1 -1
- package/lib/reconciliation.d.ts.map +1 -1
- package/lib/reconciliation.js +28 -10
- package/lib/reconciliation.js.map +1 -1
- package/package.json +5 -6
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.ts +2 -2
- package/src/__tests__/test-helpers/environment.ts +91 -0
- package/src/__tests__/test-helpers/setup.ts +2 -91
- package/src/account/serialization.ts +103 -64
- package/src/bot/bot-test-context.test.ts +37 -0
- package/src/bot/bot-test-context.ts +24 -0
- package/src/bot/cli.ts +18 -0
- package/src/bot/engine.ts +109 -73
- package/src/bot/formatters.ts +40 -14
- package/src/bot/index.ts +124 -18
- package/src/bot/specs.ts +10 -5
- package/src/bot/types.ts +7 -3
- package/src/countervalues/logic.integration.test.ts +50 -0
- package/src/countervalues/modules/weth.ts +9 -12
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +59 -1
- package/src/currencies/sortByMarketcap.test.ts +1 -12
- package/src/currencies/sortByMarketcap.ts +2 -22
- package/src/env.ts +1 -1
- package/src/families/algorand/__snapshots__/bridge.integration.test.ts.snap +733 -8
- package/src/families/algorand/specs.ts +26 -16
- package/src/families/algorand/speculos-deviceActions.ts +31 -10
- package/src/families/bitcoin/__snapshots__/bridge.integration.test.ts.snap +43309 -7957
- package/src/families/bitcoin/bridge/mock.ts +7 -1
- package/src/families/bitcoin/datasets/bitcoin_cash.ts +73 -13
- package/src/families/bitcoin/datasets/dash.ts +29 -17
- package/src/families/bitcoin/datasets/decred.ts +42 -12
- package/src/families/bitcoin/datasets/digibyte.ts +9 -3
- package/src/families/bitcoin/datasets/dogecoin.ts +29 -17
- package/src/families/bitcoin/datasets/komodo.ts +22 -22
- package/src/families/bitcoin/datasets/litecoin.ts +9 -3
- package/src/families/bitcoin/datasets/peercoin.ts +17 -17
- package/src/families/bitcoin/datasets/pivx.ts +17 -17
- package/src/families/bitcoin/datasets/qtum.ts +40 -40
- package/src/families/bitcoin/datasets/stakenet.ts +56 -26
- package/src/families/bitcoin/datasets/vertcoin.ts +43 -55
- package/src/families/bitcoin/datasets/viacoin.ts +35 -23
- package/src/families/bitcoin/datasets/zcash.ts +78 -12
- package/src/families/bitcoin/datasets/zencash.ts +56 -10
- package/src/families/bitcoin/platformAdapter.test.ts +58 -0
- package/src/families/bitcoin/specs.ts +81 -41
- package/src/families/bitcoin/speculos-deviceActions.ts +68 -69
- package/src/families/cardano/js-estimateMaxSpendable.ts +1 -1
- package/src/families/cardano/specs.ts +28 -11
- package/src/families/cardano/speculos-deviceActions.ts +65 -66
- package/src/families/celo/specs.ts +2 -0
- package/src/families/celo/speculos-deviceActions.ts +42 -43
- package/src/families/cosmos/__snapshots__/bridge.integration.test.ts.snap +246 -5
- package/src/families/cosmos/specs.ts +44 -28
- package/src/families/cosmos/speculos-deviceActions.ts +82 -83
- package/src/families/crypto_org/specs.ts +3 -0
- package/src/families/crypto_org/speculos-deviceActions.ts +58 -59
- package/src/families/elrond/specs.ts +21 -4
- package/src/families/elrond/speculos-deviceActions.ts +41 -42
- package/src/families/ethereum/__snapshots__/bridge.integration.test.ts.snap +90 -90
- package/src/families/ethereum/platformAdapter.test.ts +112 -0
- package/src/families/ethereum/specs.ts +47 -23
- package/src/families/ethereum/speculos-deviceActions.ts +93 -95
- package/src/families/filecoin/specs.ts +2 -1
- package/src/families/filecoin/speculos-deviceActions.ts +61 -62
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +57 -2
- package/src/families/hedera/specs.ts +13 -5
- package/src/families/hedera/speculos-deviceActions.ts +59 -60
- package/src/families/osmosis/specs.ts +15 -7
- package/src/families/osmosis/speculos-deviceActions.ts +82 -83
- package/src/families/polkadot/platformAdapter.test.ts +61 -0
- package/src/families/polkadot/specs.ts +20 -2
- package/src/families/polkadot/speculos-deviceActions.ts +83 -82
- package/src/families/ripple/platformAdapter.test.ts +54 -0
- package/src/families/ripple/specs.ts +14 -7
- package/src/families/ripple/speculos-deviceActions.ts +72 -73
- package/src/families/solana/specs.ts +33 -14
- package/src/families/solana/speculos-deviceActions.ts +0 -5
- package/src/families/stellar/api/horizon.ts +10 -6
- package/src/families/stellar/specs.ts +37 -19
- package/src/families/stellar/speculos-deviceActions.ts +85 -87
- package/src/families/tezos/bakers.whitelist-default.ts +0 -1
- package/src/families/tezos/specs.ts +2 -0
- package/src/families/tezos/speculos-deviceActions.ts +76 -77
- package/src/families/tron/specs.ts +67 -30
- package/src/families/tron/speculos-deviceActions.ts +81 -84
- package/src/hw/getGenuineCheckFromDeviceId.test.ts +98 -0
- package/src/hw/getGenuineCheckFromDeviceId.ts +61 -0
- package/src/hw/getLatestAvailableFirmwareFromDeviceId.ts +37 -0
- package/src/hw/hooks/useGenuineCheck.test.ts +232 -0
- package/src/hw/hooks/useGenuineCheck.ts +138 -0
- package/src/hw/hooks/useGetLatestAvailableFirmware.test.ts +111 -0
- package/src/hw/hooks/useGetLatestAvailableFirmware.ts +90 -0
- package/src/load/speculos.ts +2 -0
- package/src/mock/fixtures/cryptoCurrencies.ts +88 -0
- package/src/platform/converters.test.ts +49 -282
- package/src/platform/logic.test.ts +756 -0
- package/src/platform/logic.ts +285 -0
- package/src/platform/react.ts +6 -0
- package/src/platform/tracking.test.ts +6 -7
- package/src/platform/tracking.ts +1 -1
- package/src/reconciliation.ts +66 -43
- package/lib/bot/test.bot.d.ts +0 -2
- package/lib/bot/test.bot.d.ts.map +0 -1
- package/lib/bot/test.bot.js +0 -62
- package/lib/bot/test.bot.js.map +0 -1
- package/lib/generated/speculos-deviceActions.d.ts +0 -56
- package/lib/generated/speculos-deviceActions.d.ts.map +0 -1
- package/lib/generated/speculos-deviceActions.js +0 -42
- package/lib/generated/speculos-deviceActions.js.map +0 -1
- package/src/bot/test.bot.ts +0 -21
- package/src/generated/speculos-deviceActions.ts +0 -37
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import eth from "./platformAdapter";
|
|
2
|
+
import { EthereumTransaction as PlatformTransaction } from "@ledgerhq/live-app-sdk";
|
|
3
|
+
import { FAMILIES } from "@ledgerhq/live-app-sdk";
|
|
4
|
+
import BigNumber from "bignumber.js";
|
|
5
|
+
import { Transaction } from "./types";
|
|
6
|
+
|
|
7
|
+
describe("getPlatformTransactionSignFlowInfos", () => {
|
|
8
|
+
describe("should properly get infos for ETH platform tx", () => {
|
|
9
|
+
it("without fees provided", () => {
|
|
10
|
+
const ethPlatformTx: PlatformTransaction = {
|
|
11
|
+
family: FAMILIES.ETHEREUM,
|
|
12
|
+
amount: new BigNumber(100000),
|
|
13
|
+
recipient: "0xABCDEF",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const expectedLiveTx: Partial<Transaction> = {
|
|
17
|
+
family: ethPlatformTx.family,
|
|
18
|
+
amount: ethPlatformTx.amount,
|
|
19
|
+
recipient: ethPlatformTx.recipient,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const { canEditFees, hasFeesProvided, liveTx } =
|
|
23
|
+
eth.getPlatformTransactionSignFlowInfos(ethPlatformTx);
|
|
24
|
+
|
|
25
|
+
expect(canEditFees).toBe(true);
|
|
26
|
+
|
|
27
|
+
expect(hasFeesProvided).toBe(false);
|
|
28
|
+
|
|
29
|
+
expect(liveTx).toEqual(expectedLiveTx);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("with fees provided", () => {
|
|
33
|
+
const ethPlatformTx: PlatformTransaction = {
|
|
34
|
+
family: FAMILIES.ETHEREUM,
|
|
35
|
+
amount: new BigNumber(100000),
|
|
36
|
+
recipient: "0xABCDEF",
|
|
37
|
+
gasPrice: new BigNumber(15),
|
|
38
|
+
gasLimit: new BigNumber(21000),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const expectedLiveTx: Partial<Transaction> = {
|
|
42
|
+
family: ethPlatformTx.family,
|
|
43
|
+
amount: ethPlatformTx.amount,
|
|
44
|
+
recipient: ethPlatformTx.recipient,
|
|
45
|
+
gasPrice: ethPlatformTx.gasPrice,
|
|
46
|
+
userGasLimit: ethPlatformTx.gasLimit,
|
|
47
|
+
feesStrategy: "custom",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const { canEditFees, hasFeesProvided, liveTx } =
|
|
51
|
+
eth.getPlatformTransactionSignFlowInfos(ethPlatformTx);
|
|
52
|
+
|
|
53
|
+
expect(canEditFees).toBe(true);
|
|
54
|
+
|
|
55
|
+
expect(hasFeesProvided).toBe(true);
|
|
56
|
+
|
|
57
|
+
expect(liveTx).toEqual(expectedLiveTx);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("with only gasPrice provided", () => {
|
|
61
|
+
const ethPlatformTx: PlatformTransaction = {
|
|
62
|
+
family: FAMILIES.ETHEREUM,
|
|
63
|
+
amount: new BigNumber(100000),
|
|
64
|
+
recipient: "0xABCDEF",
|
|
65
|
+
gasPrice: new BigNumber(15),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const expectedLiveTx: Partial<Transaction> = {
|
|
69
|
+
family: ethPlatformTx.family,
|
|
70
|
+
amount: ethPlatformTx.amount,
|
|
71
|
+
recipient: ethPlatformTx.recipient,
|
|
72
|
+
gasPrice: ethPlatformTx.gasPrice,
|
|
73
|
+
feesStrategy: "custom",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const { canEditFees, hasFeesProvided, liveTx } =
|
|
77
|
+
eth.getPlatformTransactionSignFlowInfos(ethPlatformTx);
|
|
78
|
+
|
|
79
|
+
expect(canEditFees).toBe(true);
|
|
80
|
+
|
|
81
|
+
expect(hasFeesProvided).toBe(true);
|
|
82
|
+
|
|
83
|
+
expect(liveTx).toEqual(expectedLiveTx);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("with only gasLimit provided", () => {
|
|
87
|
+
const ethPlatformTx: PlatformTransaction = {
|
|
88
|
+
family: FAMILIES.ETHEREUM,
|
|
89
|
+
amount: new BigNumber(100000),
|
|
90
|
+
recipient: "0xABCDEF",
|
|
91
|
+
gasLimit: new BigNumber(21000),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const expectedLiveTx: Partial<Transaction> = {
|
|
95
|
+
family: ethPlatformTx.family,
|
|
96
|
+
amount: ethPlatformTx.amount,
|
|
97
|
+
recipient: ethPlatformTx.recipient,
|
|
98
|
+
userGasLimit: ethPlatformTx.gasLimit,
|
|
99
|
+
feesStrategy: "custom",
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const { canEditFees, hasFeesProvided, liveTx } =
|
|
103
|
+
eth.getPlatformTransactionSignFlowInfos(ethPlatformTx);
|
|
104
|
+
|
|
105
|
+
expect(canEditFees).toBe(true);
|
|
106
|
+
|
|
107
|
+
expect(hasFeesProvided).toBe(true);
|
|
108
|
+
|
|
109
|
+
expect(liveTx).toEqual(expectedLiveTx);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -13,12 +13,13 @@ import {
|
|
|
13
13
|
getAccountCapabilities,
|
|
14
14
|
} from "../../compound/logic";
|
|
15
15
|
import { getSupplyMax } from "./modules/compound";
|
|
16
|
-
import { pickSiblings } from "../../bot/specs";
|
|
16
|
+
import { botTest, pickSiblings } from "../../bot/specs";
|
|
17
17
|
import type { AppSpec } from "../../bot/types";
|
|
18
18
|
import { getGasLimit } from "./transaction";
|
|
19
19
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
20
20
|
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
21
21
|
import { CompoundAccountSummary } from "../../compound/types";
|
|
22
|
+
import { acceptTransaction } from "./speculos-deviceActions";
|
|
22
23
|
|
|
23
24
|
const testTimeout = 5 * 60 * 1000;
|
|
24
25
|
|
|
@@ -49,11 +50,15 @@ const ethereumBasicMutations = ({ maxAccount }) => [
|
|
|
49
50
|
const estimatedGas = getGasLimit(transaction).times(
|
|
50
51
|
transaction.gasPrice || 0
|
|
51
52
|
);
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
botTest("operation fee is not exceeding estimated gas", () =>
|
|
54
|
+
expect(operation.fee.toNumber()).toBeLessThanOrEqual(
|
|
55
|
+
estimatedGas.toNumber()
|
|
56
|
+
)
|
|
54
57
|
);
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
botTest("account balance moved with operation value", () =>
|
|
59
|
+
expect(account.balance.toString()).toBe(
|
|
60
|
+
accountBeforeTransaction.balance.minus(operation.value).toString()
|
|
61
|
+
)
|
|
57
62
|
);
|
|
58
63
|
},
|
|
59
64
|
},
|
|
@@ -121,6 +126,7 @@ const ethereum: AppSpec<Transaction> = {
|
|
|
121
126
|
model: DeviceModelId.nanoS,
|
|
122
127
|
appName: "Ethereum",
|
|
123
128
|
},
|
|
129
|
+
genericDeviceAction: acceptTransaction,
|
|
124
130
|
testTimeout,
|
|
125
131
|
transactionCheck: ({ maxSpendable }) => {
|
|
126
132
|
invariant(
|
|
@@ -159,7 +165,9 @@ const ethereum: AppSpec<Transaction> = {
|
|
|
159
165
|
},
|
|
160
166
|
test: (arg) => {
|
|
161
167
|
const { capabilities } = getCompoundResult(arg);
|
|
162
|
-
|
|
168
|
+
botTest("enabledAmountIsUnlimited is true", () =>
|
|
169
|
+
expect((capabilities as any).enabledAmountIsUnlimited).toBe(true)
|
|
170
|
+
);
|
|
163
171
|
},
|
|
164
172
|
},
|
|
165
173
|
{
|
|
@@ -192,11 +200,13 @@ const ethereum: AppSpec<Transaction> = {
|
|
|
192
200
|
"could not find compound summary for account %s",
|
|
193
201
|
transaction.subAccountId
|
|
194
202
|
);
|
|
195
|
-
|
|
196
|
-
(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
botTest("totalSupplied matches", () =>
|
|
204
|
+
expect(
|
|
205
|
+
(summary as CompoundAccountSummary).totalSupplied.gt(
|
|
206
|
+
previous.summary?.totalSupplied || new BigNumber(0)
|
|
207
|
+
)
|
|
208
|
+
).toBe(true)
|
|
209
|
+
);
|
|
200
210
|
},
|
|
201
211
|
},
|
|
202
212
|
{
|
|
@@ -248,16 +258,20 @@ const ethereum: AppSpec<Transaction> = {
|
|
|
248
258
|
);
|
|
249
259
|
|
|
250
260
|
if (arg.transaction.useAllAmount) {
|
|
251
|
-
|
|
252
|
-
|
|
261
|
+
botTest("totalSupplies matches (2)", () =>
|
|
262
|
+
expect(
|
|
263
|
+
(summary as CompoundAccountSummary).totalSupplied.eq(0)
|
|
264
|
+
).toBe(true)
|
|
253
265
|
);
|
|
254
266
|
} else {
|
|
255
|
-
|
|
256
|
-
(
|
|
257
|
-
(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
267
|
+
botTest("totalSupplies matches (3)", () =>
|
|
268
|
+
expect(
|
|
269
|
+
(summary as CompoundAccountSummary).totalSupplied.lt(
|
|
270
|
+
(previous.summary as CompoundAccountSummary).totalSupplied ||
|
|
271
|
+
new BigNumber(0)
|
|
272
|
+
)
|
|
273
|
+
).toBe(true)
|
|
274
|
+
);
|
|
261
275
|
}
|
|
262
276
|
},
|
|
263
277
|
},
|
|
@@ -291,7 +305,9 @@ const ethereum: AppSpec<Transaction> = {
|
|
|
291
305
|
},
|
|
292
306
|
test: (arg) => {
|
|
293
307
|
const { capabilities } = getCompoundResult(arg);
|
|
294
|
-
|
|
308
|
+
botTest("enabledAmount is zero", () =>
|
|
309
|
+
expect((capabilities as any).enabledAmount.eq(0)).toBe(true)
|
|
310
|
+
);
|
|
295
311
|
},
|
|
296
312
|
},
|
|
297
313
|
{
|
|
@@ -341,10 +357,14 @@ const ethereum: AppSpec<Transaction> = {
|
|
|
341
357
|
invariant(erc20account, "erc20 acc is still here");
|
|
342
358
|
|
|
343
359
|
if (transaction.useAllAmount) {
|
|
344
|
-
|
|
360
|
+
botTest("erc20 account is empty", () =>
|
|
361
|
+
expect(erc20account.balance.toString()).toBe("0")
|
|
362
|
+
);
|
|
345
363
|
} else {
|
|
346
|
-
|
|
347
|
-
|
|
364
|
+
botTest("account balance moved with tx amount", () =>
|
|
365
|
+
expect(erc20account.balance.toString()).toBe(
|
|
366
|
+
erc20accountBefore.balance.minus(transaction.amount).toString()
|
|
367
|
+
)
|
|
348
368
|
);
|
|
349
369
|
}
|
|
350
370
|
},
|
|
@@ -358,6 +378,7 @@ const ethereumClassic: AppSpec<Transaction> = {
|
|
|
358
378
|
model: DeviceModelId.nanoS,
|
|
359
379
|
appName: "Ethereum Classic",
|
|
360
380
|
},
|
|
381
|
+
genericDeviceAction: acceptTransaction,
|
|
361
382
|
dependency: "Ethereum",
|
|
362
383
|
testTimeout,
|
|
363
384
|
transactionCheck: ({ maxSpendable }) => {
|
|
@@ -382,6 +403,7 @@ const ethereumGoerli: AppSpec<Transaction> = {
|
|
|
382
403
|
model: DeviceModelId.nanoS,
|
|
383
404
|
appName: "Ethereum",
|
|
384
405
|
},
|
|
406
|
+
genericDeviceAction: acceptTransaction,
|
|
385
407
|
testTimeout,
|
|
386
408
|
transactionCheck: ({ maxSpendable }) => {
|
|
387
409
|
invariant(
|
|
@@ -406,6 +428,7 @@ const bsc: AppSpec<Transaction> = {
|
|
|
406
428
|
model: DeviceModelId.nanoS,
|
|
407
429
|
appName: "Binance Smart Chain",
|
|
408
430
|
},
|
|
431
|
+
genericDeviceAction: acceptTransaction,
|
|
409
432
|
dependency: "Ethereum",
|
|
410
433
|
testTimeout,
|
|
411
434
|
transactionCheck: ({ maxSpendable }) => {
|
|
@@ -453,6 +476,7 @@ const polygon: AppSpec<Transaction> = {
|
|
|
453
476
|
model: DeviceModelId.nanoS,
|
|
454
477
|
appName: "Polygon",
|
|
455
478
|
},
|
|
479
|
+
genericDeviceAction: acceptTransaction,
|
|
456
480
|
dependency: "Ethereum",
|
|
457
481
|
testTimeout,
|
|
458
482
|
transactionCheck: ({ maxSpendable }) => {
|
|
@@ -33,104 +33,102 @@ const maxFeesExpectedValue = ({ account, status }) =>
|
|
|
33
33
|
}
|
|
34
34
|
).replace(/\s/g, " ");
|
|
35
35
|
|
|
36
|
-
const acceptTransaction: DeviceAction<Transaction, any> =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
title: "Type",
|
|
44
|
-
button: "Rr",
|
|
45
|
-
expectedValue: ({ transaction }) => {
|
|
46
|
-
if (transaction.mode === "erc20.approve") return "Approve";
|
|
47
|
-
if (transaction.mode === "compound.supply") return "Lend Assets";
|
|
48
|
-
if (transaction.mode === "compound.withdraw") return "Redeem Assets";
|
|
49
|
-
return "";
|
|
36
|
+
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
37
|
+
deviceActionFlow({
|
|
38
|
+
steps: [
|
|
39
|
+
{
|
|
40
|
+
title: "Review",
|
|
41
|
+
button: "Rr",
|
|
50
42
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
{
|
|
44
|
+
title: "Type",
|
|
45
|
+
button: "Rr",
|
|
46
|
+
expectedValue: ({ transaction }) => {
|
|
47
|
+
if (transaction.mode === "erc20.approve") return "Approve";
|
|
48
|
+
if (transaction.mode === "compound.supply") return "Lend Assets";
|
|
49
|
+
if (transaction.mode === "compound.withdraw") return "Redeem Assets";
|
|
50
|
+
return "";
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: "Amount",
|
|
55
|
+
button: "Rr",
|
|
56
|
+
expectedValue: ({ account, status, transaction }) => {
|
|
57
|
+
const a = transaction.subAccountId
|
|
58
|
+
? subAccount(transaction.subAccountId, account)
|
|
59
|
+
: null;
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
if (
|
|
62
|
+
transaction.mode === "erc20.approve" &&
|
|
63
|
+
transaction.useAllAmount &&
|
|
64
|
+
a
|
|
65
|
+
) {
|
|
66
|
+
return "Unlimited " + a.token.ticker;
|
|
67
|
+
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const unit = !a
|
|
70
|
+
? {
|
|
71
|
+
...account.unit,
|
|
72
|
+
code: account.currency.deviceTicker || account.unit.code,
|
|
73
|
+
}
|
|
74
|
+
: (transaction.mode === "compound.withdraw" &&
|
|
75
|
+
transaction.useAllAmount
|
|
76
|
+
? expectedCompoundToken(findCompoundToken(a.token))
|
|
77
|
+
: a.token
|
|
78
|
+
).units[0];
|
|
79
|
+
const amount =
|
|
80
|
+
a &&
|
|
81
|
+
a.compoundBalance &&
|
|
82
|
+
transaction.mode === "compound.withdraw" &&
|
|
83
|
+
transaction.useAllAmount
|
|
84
|
+
? a.compoundBalance
|
|
85
|
+
: status.amount;
|
|
86
|
+
return formatCurrencyUnit(
|
|
87
|
+
{
|
|
88
|
+
...unit,
|
|
71
89
|
code: account.currency.deviceTicker || account.unit.code,
|
|
90
|
+
prefixCode: true,
|
|
91
|
+
},
|
|
92
|
+
amount,
|
|
93
|
+
{
|
|
94
|
+
showCode: true,
|
|
95
|
+
disableRounding: true,
|
|
96
|
+
joinFragmentsSeparator: " ",
|
|
72
97
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
? expectedCompoundToken(findCompoundToken(a.token))
|
|
76
|
-
: a.token
|
|
77
|
-
).units[0];
|
|
78
|
-
const amount =
|
|
79
|
-
a &&
|
|
80
|
-
a.compoundBalance &&
|
|
81
|
-
transaction.mode === "compound.withdraw" &&
|
|
82
|
-
transaction.useAllAmount
|
|
83
|
-
? a.compoundBalance
|
|
84
|
-
: status.amount;
|
|
85
|
-
return formatCurrencyUnit(
|
|
86
|
-
{
|
|
87
|
-
...unit,
|
|
88
|
-
code: account.currency.deviceTicker || account.unit.code,
|
|
89
|
-
prefixCode: true,
|
|
90
|
-
},
|
|
91
|
-
amount,
|
|
92
|
-
{
|
|
93
|
-
showCode: true,
|
|
94
|
-
disableRounding: true,
|
|
95
|
-
joinFragmentsSeparator: " ",
|
|
96
|
-
}
|
|
97
|
-
).replace(/\s/g, " ");
|
|
98
|
+
).replace(/\s/g, " ");
|
|
99
|
+
},
|
|
98
100
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
export default {
|
|
135
|
-
acceptTransaction,
|
|
136
|
-
};
|
|
101
|
+
{
|
|
102
|
+
title: "Contract",
|
|
103
|
+
button: "Rr",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: "Network",
|
|
107
|
+
button: "Rr",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
title: "Max fees",
|
|
111
|
+
button: "Rr",
|
|
112
|
+
expectedValue: maxFeesExpectedValue,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
// Legacy (ETC..)
|
|
116
|
+
title: "Max Fees",
|
|
117
|
+
button: "Rr",
|
|
118
|
+
expectedValue: maxFeesExpectedValue,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
title: "Address",
|
|
122
|
+
button: "Rr",
|
|
123
|
+
expectedValue: ({ transaction }) => transaction.recipient,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: "Accept",
|
|
127
|
+
button: "LRlr",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
title: "Approve",
|
|
131
|
+
button: "LRlr",
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
});
|
|
@@ -6,6 +6,7 @@ import type { Transaction } from "../../families/filecoin/types";
|
|
|
6
6
|
import { getCryptoCurrencyById } from "../../currencies";
|
|
7
7
|
import { pickSiblings } from "../../bot/specs";
|
|
8
8
|
import type { AppSpec } from "../../bot/types";
|
|
9
|
+
import { acceptTransaction } from "./speculos-deviceActions";
|
|
9
10
|
|
|
10
11
|
const MIN_SAFE = new BigNumber(100000);
|
|
11
12
|
const maxAccount = 6;
|
|
@@ -17,7 +18,7 @@ const filecoinSpecs: AppSpec<Transaction> = {
|
|
|
17
18
|
model: DeviceModelId.nanoS,
|
|
18
19
|
appName: "Filecoin",
|
|
19
20
|
},
|
|
20
|
-
|
|
21
|
+
genericDeviceAction: acceptTransaction,
|
|
21
22
|
testTimeout: 5 * 60 * 1000,
|
|
22
23
|
transactionCheck: ({ maxSpendable }) => {
|
|
23
24
|
invariant(maxSpendable.gt(MIN_SAFE), "balance is too low");
|
|
@@ -3,65 +3,64 @@ import type { Transaction } from "./types";
|
|
|
3
3
|
import { deviceActionFlow } from "../../bot/specs";
|
|
4
4
|
import { formatCurrencyUnit } from "../../currencies";
|
|
5
5
|
|
|
6
|
-
const acceptTransaction: DeviceAction<Transaction, any> =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
export default { acceptTransaction };
|
|
6
|
+
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
7
|
+
deviceActionFlow({
|
|
8
|
+
steps: [
|
|
9
|
+
{
|
|
10
|
+
title: "To",
|
|
11
|
+
button: "Rr",
|
|
12
|
+
expectedValue: ({ transaction }) => transaction.recipient,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: "From",
|
|
16
|
+
button: "Rr",
|
|
17
|
+
expectedValue: ({ account }) => account.freshAddress,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: "Nonce",
|
|
21
|
+
button: "Rr",
|
|
22
|
+
expectedValue: ({ transaction }) => transaction.nonce.toString(),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Value",
|
|
26
|
+
button: "Rr",
|
|
27
|
+
expectedValue: ({ account, status }) =>
|
|
28
|
+
formatCurrencyUnit(account.unit, status.amount, {
|
|
29
|
+
disableRounding: true,
|
|
30
|
+
showAllDigits: true,
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: "Gas Limit",
|
|
35
|
+
button: "Rr",
|
|
36
|
+
expectedValue: ({ transaction }) => transaction.gasLimit.toFixed(),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "Gas Premium",
|
|
40
|
+
button: "Rr",
|
|
41
|
+
expectedValue: ({ account, transaction }) =>
|
|
42
|
+
formatCurrencyUnit(account.unit, transaction.gasPremium, {
|
|
43
|
+
disableRounding: true,
|
|
44
|
+
showAllDigits: true,
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: "Gas Fee Cap",
|
|
49
|
+
button: "Rr",
|
|
50
|
+
expectedValue: ({ account, transaction }) =>
|
|
51
|
+
formatCurrencyUnit(account.unit, transaction.gasFeeCap, {
|
|
52
|
+
disableRounding: true,
|
|
53
|
+
showAllDigits: true,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: "Method",
|
|
58
|
+
button: "Rr",
|
|
59
|
+
expectedValue: () => "Transfer",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: "APPROVE",
|
|
63
|
+
button: "LRlr",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
3
|
+
exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Object {
|
|
6
|
+
"balance": "99870000",
|
|
7
|
+
"currencyId": "hedera",
|
|
8
|
+
"derivationMode": "hederaBip44",
|
|
9
|
+
"freshAddress": "0.0.1040977",
|
|
10
|
+
"freshAddressPath": "44/3030",
|
|
11
|
+
"freshAddresses": Array [
|
|
12
|
+
Object {
|
|
13
|
+
"address": "0.0.1040977",
|
|
14
|
+
"derivationPath": "44/3030",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
18
|
+
"index": 0,
|
|
19
|
+
"name": "Hedera 1",
|
|
20
|
+
"nfts": undefined,
|
|
21
|
+
"operationsCount": 1,
|
|
22
|
+
"pendingOperations": Array [],
|
|
23
|
+
"seedIdentifier": "9e92a312233d5fd6b5a723875aeea2cea81a8e48ffc00341cff6dffcfd3ab7f2",
|
|
24
|
+
"spendableBalance": "99870000",
|
|
25
|
+
"starred": false,
|
|
26
|
+
"swapHistory": Array [],
|
|
27
|
+
"syncHash": undefined,
|
|
28
|
+
"unitMagnitude": 8,
|
|
29
|
+
"used": true,
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
`;
|
|
4
33
|
|
|
5
|
-
exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
34
|
+
exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
35
|
+
Array [
|
|
36
|
+
Array [
|
|
37
|
+
Object {
|
|
38
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
39
|
+
"blockHash": null,
|
|
40
|
+
"blockHeight": 5,
|
|
41
|
+
"contract": undefined,
|
|
42
|
+
"extra": Object {},
|
|
43
|
+
"fee": "163081",
|
|
44
|
+
"hash": "iQ_oLq-PEMlwmoSEZBXpeK_J9ENApLJnz-uGB3_1XVqtRnMU-0VvdKmJV3E8ig5J",
|
|
45
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-iQ_oLq-PEMlwmoSEZBXpeK_J9ENApLJnz-uGB3_1XVqtRnMU-0VvdKmJV3E8ig5J-IN",
|
|
46
|
+
"operator": undefined,
|
|
47
|
+
"recipients": Array [
|
|
48
|
+
"0.0.1040977",
|
|
49
|
+
],
|
|
50
|
+
"senders": Array [
|
|
51
|
+
"0.0.880760",
|
|
52
|
+
],
|
|
53
|
+
"standard": undefined,
|
|
54
|
+
"tokenId": undefined,
|
|
55
|
+
"type": "IN",
|
|
56
|
+
"value": "99870000",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
]
|
|
60
|
+
`;
|