@ledgerhq/live-common 27.0.0 → 27.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/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 +2 -0
- package/lib/account/serialization.d.ts.map +1 -1
- package/lib/account/serialization.js +105 -47
- package/lib/account/serialization.js.map +1 -1
- package/lib/apps/support.d.ts.map +1 -1
- package/lib/apps/support.js +1 -0
- package/lib/apps/support.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/api/hubble.d.ts +6 -1
- package/lib/families/celo/api/hubble.d.ts.map +1 -1
- package/lib/families/celo/api/hubble.js +135 -13
- package/lib/families/celo/api/hubble.js.map +1 -1
- package/lib/families/celo/api/index.d.ts +1 -1
- package/lib/families/celo/api/index.d.ts.map +1 -1
- package/lib/families/celo/api/index.js +2 -1
- package/lib/families/celo/api/index.js.map +1 -1
- package/lib/families/celo/api/sdk.d.ts +22 -0
- package/lib/families/celo/api/sdk.d.ts.map +1 -1
- package/lib/families/celo/api/sdk.js +168 -1
- package/lib/families/celo/api/sdk.js.map +1 -1
- package/lib/families/celo/bridge/js.d.ts.map +1 -1
- package/lib/families/celo/bridge/js.js +4 -42
- package/lib/families/celo/bridge/js.js.map +1 -1
- package/lib/families/celo/cli-transaction.d.ts +12 -2
- package/lib/families/celo/cli-transaction.d.ts.map +1 -1
- package/lib/families/celo/cli-transaction.js +38 -4
- package/lib/families/celo/cli-transaction.js.map +1 -1
- package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts +1 -0
- package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts.map +1 -1
- package/lib/families/celo/datasets/celo.scanAccounts.1.js +298 -2
- package/lib/families/celo/datasets/celo.scanAccounts.1.js.map +1 -1
- package/lib/families/celo/errors.d.ts +2 -0
- package/lib/families/celo/errors.d.ts.map +1 -0
- package/lib/families/celo/errors.js +6 -0
- package/lib/families/celo/errors.js.map +1 -0
- package/lib/families/celo/js-buildTransaction.d.ts +2 -3
- package/lib/families/celo/js-buildTransaction.d.ts.map +1 -1
- package/lib/families/celo/js-buildTransaction.js +194 -19
- package/lib/families/celo/js-buildTransaction.js.map +1 -1
- package/lib/families/celo/js-createTransaction.d.ts.map +1 -1
- package/lib/families/celo/js-createTransaction.js +3 -1
- package/lib/families/celo/js-createTransaction.js.map +1 -1
- package/lib/families/celo/js-estimateMaxSpendable.d.ts.map +1 -1
- package/lib/families/celo/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/celo/js-getFeesForTransaction.d.ts +2 -3
- package/lib/families/celo/js-getFeesForTransaction.d.ts.map +1 -1
- package/lib/families/celo/js-getFeesForTransaction.js +137 -10
- package/lib/families/celo/js-getFeesForTransaction.js.map +1 -1
- package/lib/families/celo/js-getTransactionStatus.d.ts +2 -3
- package/lib/families/celo/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/celo/js-getTransactionStatus.js +97 -41
- package/lib/families/celo/js-getTransactionStatus.js.map +1 -1
- package/lib/families/celo/js-prepareTransaction.d.ts +2 -3
- package/lib/families/celo/js-prepareTransaction.d.ts.map +1 -1
- package/lib/families/celo/js-prepareTransaction.js +8 -3
- package/lib/families/celo/js-prepareTransaction.js.map +1 -1
- package/lib/families/celo/js-signOperation.d.ts.map +1 -1
- package/lib/families/celo/js-signOperation.js +17 -3
- package/lib/families/celo/js-signOperation.js.map +1 -1
- package/lib/families/celo/js-synchronisation.d.ts.map +1 -1
- package/lib/families/celo/js-synchronisation.js +51 -6
- package/lib/families/celo/js-synchronisation.js.map +1 -1
- package/lib/families/celo/logic.d.ts +21 -0
- package/lib/families/celo/logic.d.ts.map +1 -0
- package/lib/families/celo/logic.js +132 -0
- package/lib/families/celo/logic.js.map +1 -0
- package/lib/families/celo/preload.d.ts +10 -0
- package/lib/families/celo/preload.d.ts.map +1 -0
- package/lib/families/celo/preload.js +118 -0
- package/lib/families/celo/preload.js.map +1 -0
- package/lib/families/celo/react.d.ts +4 -0
- package/lib/families/celo/react.d.ts.map +1 -0
- package/lib/families/celo/react.js +47 -0
- package/lib/families/celo/react.js.map +1 -0
- package/lib/families/celo/serialization.d.ts +4 -0
- package/lib/families/celo/serialization.d.ts.map +1 -0
- package/lib/families/celo/serialization.js +55 -0
- package/lib/families/celo/serialization.js.map +1 -0
- package/lib/families/celo/specs/createActivateVoteMutation.d.ts +4 -0
- package/lib/families/celo/specs/createActivateVoteMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createActivateVoteMutation.js +38 -0
- package/lib/families/celo/specs/createActivateVoteMutation.js.map +1 -0
- package/lib/families/celo/specs/createLockMutation.d.ts +4 -0
- package/lib/families/celo/specs/createLockMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createLockMutation.js +40 -0
- package/lib/families/celo/specs/createLockMutation.js.map +1 -0
- package/lib/families/celo/specs/createRegisterAccountMutation.d.ts +4 -0
- package/lib/families/celo/specs/createRegisterAccountMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createRegisterAccountMutation.js +31 -0
- package/lib/families/celo/specs/createRegisterAccountMutation.js.map +1 -0
- package/lib/families/celo/specs/createRevokeVoteMutation.d.ts +4 -0
- package/lib/families/celo/specs/createRevokeVoteMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createRevokeVoteMutation.js +39 -0
- package/lib/families/celo/specs/createRevokeVoteMutation.js.map +1 -0
- package/lib/families/celo/specs/createSendMutation.d.ts +5 -0
- package/lib/families/celo/specs/createSendMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createSendMutation.js +44 -0
- package/lib/families/celo/specs/createSendMutation.js.map +1 -0
- package/lib/families/celo/specs/createUnlockMutation.d.ts +4 -0
- package/lib/families/celo/specs/createUnlockMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createUnlockMutation.js +37 -0
- package/lib/families/celo/specs/createUnlockMutation.js.map +1 -0
- package/lib/families/celo/specs/createVoteMutation.d.ts +4 -0
- package/lib/families/celo/specs/createVoteMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createVoteMutation.js +51 -0
- package/lib/families/celo/specs/createVoteMutation.js.map +1 -0
- package/lib/families/celo/specs/createWithdrawMutation.d.ts +4 -0
- package/lib/families/celo/specs/createWithdrawMutation.d.ts.map +1 -0
- package/lib/families/celo/specs/createWithdrawMutation.js +36 -0
- package/lib/families/celo/specs/createWithdrawMutation.js.map +1 -0
- package/lib/families/celo/specs/index.d.ts +9 -0
- package/lib/families/celo/specs/index.d.ts.map +1 -0
- package/lib/families/celo/specs/index.js +25 -0
- package/lib/families/celo/specs/index.js.map +1 -0
- package/lib/families/celo/specs.d.ts +1 -1
- package/lib/families/celo/specs.d.ts.map +1 -1
- package/lib/families/celo/specs.js +22 -37
- 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 +24 -4
- package/lib/families/celo/speculos-deviceActions.js.map +1 -1
- package/lib/families/celo/transaction.d.ts.map +1 -1
- package/lib/families/celo/transaction.js +8 -6
- package/lib/families/celo/transaction.js.map +1 -1
- package/lib/families/celo/types.d.ts +102 -1
- package/lib/families/celo/types.d.ts.map +1 -1
- package/lib/families/celo/validators.d.ts +3 -0
- package/lib/families/celo/validators.d.ts.map +1 -0
- package/lib/families/celo/validators.js +6 -0
- package/lib/families/celo/validators.js.map +1 -0
- 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/api/chain/instruction/token/types.d.ts +2 -2
- 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/generated/cli-transaction.d.ts +12 -2
- package/lib/generated/cli-transaction.d.ts.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/operation.d.ts.map +1 -1
- package/lib/operation.js +6 -0
- package/lib/operation.js.map +1 -1
- 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 +39 -10
- package/lib/reconciliation.js.map +1 -1
- package/package.json +5 -7
- 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 +125 -66
- package/src/apps/support.ts +1 -0
- 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/__snapshots__/bridge.integration.test.ts.snap +134 -857
- package/src/families/celo/api/hubble.ts +113 -16
- package/src/families/celo/api/index.ts +1 -1
- package/src/families/celo/api/sdk.ts +88 -0
- package/src/families/celo/bridge/js.ts +2 -3
- package/src/families/celo/cli-transaction.ts +46 -2
- package/src/families/celo/datasets/celo.scanAccounts.1.ts +365 -5
- package/src/families/celo/errors.ts +5 -0
- package/src/families/celo/js-buildTransaction.ts +173 -20
- package/src/families/celo/js-createTransaction.ts +2 -0
- package/src/families/celo/js-estimateMaxSpendable.ts +2 -2
- package/src/families/celo/js-getFeesForTransaction.ts +118 -19
- package/src/families/celo/js-getTransactionStatus.ts +72 -17
- package/src/families/celo/js-prepareTransaction.ts +13 -7
- package/src/families/celo/js-signOperation.ts +22 -5
- package/src/families/celo/js-synchronisation.ts +32 -0
- package/src/families/celo/logic.ts +184 -0
- package/src/families/celo/preload.ts +78 -0
- package/src/families/celo/react.ts +35 -0
- package/src/families/celo/serialization.ts +61 -0
- package/src/families/celo/specs/createActivateVoteMutation.ts +44 -0
- package/src/families/celo/specs/createLockMutation.ts +46 -0
- package/src/families/celo/specs/createRegisterAccountMutation.ts +34 -0
- package/src/families/celo/specs/createRevokeVoteMutation.ts +43 -0
- package/src/families/celo/specs/createSendMutation.ts +44 -0
- package/src/families/celo/specs/createUnlockMutation.ts +44 -0
- package/src/families/celo/specs/createVoteMutation.ts +67 -0
- package/src/families/celo/specs/createWithdrawMutation.ts +44 -0
- package/src/families/celo/specs/index.ts +8 -0
- package/src/families/celo/specs.ts +34 -34
- package/src/families/celo/speculos-deviceActions.ts +63 -45
- package/src/families/celo/transaction.ts +12 -4
- package/src/families/celo/types.ts +113 -0
- package/src/families/celo/validators.ts +2 -0
- 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/operation.ts +6 -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 +88 -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
|
@@ -7,11 +7,12 @@ import sampleSize from "lodash/sampleSize";
|
|
|
7
7
|
import get from "lodash/get";
|
|
8
8
|
import type { Transaction, TronAccount } from "./types";
|
|
9
9
|
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
10
|
-
import { pickSiblings } from "../../bot/specs";
|
|
10
|
+
import { botTest, pickSiblings } from "../../bot/specs";
|
|
11
11
|
import type { AppSpec } from "../../bot/types";
|
|
12
12
|
import { getUnfreezeData, getNextRewardDate } from "./react";
|
|
13
13
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
14
14
|
import { SubAccount } from "@ledgerhq/types-live";
|
|
15
|
+
import { acceptTransaction } from "./speculos-deviceActions";
|
|
15
16
|
const currency = getCryptoCurrencyById("tron");
|
|
16
17
|
const minimalAmount = parseCurrencyUnit(currency.units[0], "1");
|
|
17
18
|
const maxAccount = 10;
|
|
@@ -19,6 +20,16 @@ const maxAccount = 10;
|
|
|
19
20
|
const getDecimalPart = (value: BigNumber, magnitude: number) =>
|
|
20
21
|
value.minus(value.modulo(10 ** magnitude));
|
|
21
22
|
|
|
23
|
+
const expectedApproximate = (
|
|
24
|
+
value: BigNumber,
|
|
25
|
+
expected: BigNumber,
|
|
26
|
+
delta = 50
|
|
27
|
+
) => {
|
|
28
|
+
if (value.minus(expected).abs().gt(delta)) {
|
|
29
|
+
expect(value.toString()).toEqual(value.toString());
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
22
33
|
const tron: AppSpec<Transaction> = {
|
|
23
34
|
name: "Tron",
|
|
24
35
|
currency,
|
|
@@ -26,6 +37,7 @@ const tron: AppSpec<Transaction> = {
|
|
|
26
37
|
model: DeviceModelId.nanoS,
|
|
27
38
|
appName: "Tron",
|
|
28
39
|
},
|
|
40
|
+
genericDeviceAction: acceptTransaction,
|
|
29
41
|
testTimeout: 2 * 60 * 1000,
|
|
30
42
|
mutations: [
|
|
31
43
|
{
|
|
@@ -49,10 +61,11 @@ const tron: AppSpec<Transaction> = {
|
|
|
49
61
|
};
|
|
50
62
|
},
|
|
51
63
|
test: ({ accountBeforeTransaction, operation, account }) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.
|
|
55
|
-
.
|
|
64
|
+
botTest("account spendable balance decreased with operation", () =>
|
|
65
|
+
expectedApproximate(
|
|
66
|
+
account.spendableBalance,
|
|
67
|
+
accountBeforeTransaction.spendableBalance.minus(operation.value)
|
|
68
|
+
)
|
|
56
69
|
);
|
|
57
70
|
},
|
|
58
71
|
},
|
|
@@ -76,7 +89,9 @@ const tron: AppSpec<Transaction> = {
|
|
|
76
89
|
};
|
|
77
90
|
},
|
|
78
91
|
test: ({ account }) => {
|
|
79
|
-
|
|
92
|
+
botTest("account spendable balance is zero", () =>
|
|
93
|
+
expect(account.spendableBalance.toString()).toBe("0")
|
|
94
|
+
);
|
|
80
95
|
},
|
|
81
96
|
},
|
|
82
97
|
{
|
|
@@ -124,8 +139,10 @@ const tron: AppSpec<Transaction> = {
|
|
|
124
139
|
`tronResources.frozen.${resourceType}.amount`,
|
|
125
140
|
new BigNumber(0)
|
|
126
141
|
);
|
|
127
|
-
|
|
128
|
-
|
|
142
|
+
botTest("frozen amount is accumulated in resources", () =>
|
|
143
|
+
expect(expectedAmount.toString()).toBe(
|
|
144
|
+
currentRessourceAmount.toString()
|
|
145
|
+
)
|
|
129
146
|
);
|
|
130
147
|
},
|
|
131
148
|
},
|
|
@@ -164,7 +181,9 @@ const tron: AppSpec<Transaction> = {
|
|
|
164
181
|
`tronResources.frozen.${TxResource}`,
|
|
165
182
|
undefined
|
|
166
183
|
);
|
|
167
|
-
|
|
184
|
+
botTest("no current frozen", () =>
|
|
185
|
+
expect(currentFrozen).toBeUndefined()
|
|
186
|
+
);
|
|
168
187
|
const TPBeforeTx = new BigNumber(
|
|
169
188
|
get(accountBeforeTransaction, "tronResources.tronPower", 0)
|
|
170
189
|
);
|
|
@@ -172,7 +191,9 @@ const tron: AppSpec<Transaction> = {
|
|
|
172
191
|
get(account, "tronResources.tronPower", 0)
|
|
173
192
|
);
|
|
174
193
|
const expectedTronPower = TPBeforeTx.minus(transaction.amount);
|
|
175
|
-
|
|
194
|
+
botTest("tron power", () =>
|
|
195
|
+
expectedApproximate(currentTP, expectedTronPower)
|
|
196
|
+
);
|
|
176
197
|
},
|
|
177
198
|
},
|
|
178
199
|
{
|
|
@@ -225,7 +246,7 @@ const tron: AppSpec<Transaction> = {
|
|
|
225
246
|
const currentVotes = sortBy(get(account, "tronResources.votes", []), [
|
|
226
247
|
"address",
|
|
227
248
|
]);
|
|
228
|
-
expect(currentVotes).toEqual(votes);
|
|
249
|
+
botTest("current votes", () => expect(currentVotes).toEqual(votes));
|
|
229
250
|
},
|
|
230
251
|
},
|
|
231
252
|
{
|
|
@@ -277,10 +298,14 @@ const tron: AppSpec<Transaction> = {
|
|
|
277
298
|
if (!trc10account) throw new Error("no trc10 account");
|
|
278
299
|
|
|
279
300
|
if (transaction.useAllAmount) {
|
|
280
|
-
|
|
301
|
+
botTest("trc10 balance became zero", () =>
|
|
302
|
+
expect(trc10account.balance.toString()).toBe("0")
|
|
303
|
+
);
|
|
281
304
|
} else {
|
|
282
|
-
|
|
283
|
-
|
|
305
|
+
botTest("trc10 balance decreased with operation", () =>
|
|
306
|
+
expect(trc10account.balance.toString()).toBe(
|
|
307
|
+
trc10accountBefore.balance.minus(transaction.amount).toString()
|
|
308
|
+
)
|
|
284
309
|
);
|
|
285
310
|
}
|
|
286
311
|
},
|
|
@@ -337,10 +362,14 @@ const tron: AppSpec<Transaction> = {
|
|
|
337
362
|
if (!trc20account) throw new Error("no trc20 account");
|
|
338
363
|
|
|
339
364
|
if (transaction.useAllAmount) {
|
|
340
|
-
|
|
365
|
+
botTest("trc10 balance became zero", () =>
|
|
366
|
+
expect(trc20account.balance.toString()).toBe("0")
|
|
367
|
+
);
|
|
341
368
|
} else {
|
|
342
|
-
|
|
343
|
-
|
|
369
|
+
botTest("trc10 balance decreased with operation", () =>
|
|
370
|
+
expect(trc20account.balance.toString()).toBe(
|
|
371
|
+
trc20accountBefore.balance.minus(transaction.amount).toString()
|
|
372
|
+
)
|
|
344
373
|
);
|
|
345
374
|
}
|
|
346
375
|
|
|
@@ -349,21 +378,27 @@ const tron: AppSpec<Transaction> = {
|
|
|
349
378
|
0
|
|
350
379
|
)
|
|
351
380
|
) {
|
|
352
|
-
|
|
353
|
-
|
|
381
|
+
botTest("account balance decreased", () =>
|
|
382
|
+
expect(account.balance.lt(accountBeforeTransaction.balance)).toBe(
|
|
383
|
+
true
|
|
384
|
+
)
|
|
354
385
|
);
|
|
355
386
|
} else {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
get(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
387
|
+
botTest("energy decreased", () =>
|
|
388
|
+
expect(
|
|
389
|
+
get(account, "tronResources.energy", new BigNumber(0)).lt(
|
|
390
|
+
get(
|
|
391
|
+
accountBeforeTransaction,
|
|
392
|
+
"tronResources.energy",
|
|
393
|
+
new BigNumber(0)
|
|
394
|
+
)
|
|
362
395
|
)
|
|
396
|
+
).toBe(true)
|
|
397
|
+
);
|
|
398
|
+
botTest("balance didn't change", () =>
|
|
399
|
+
expect(account.balance.eq(accountBeforeTransaction.balance)).toBe(
|
|
400
|
+
true
|
|
363
401
|
)
|
|
364
|
-
).toBe(true);
|
|
365
|
-
expect(account.balance.eq(accountBeforeTransaction.balance)).toBe(
|
|
366
|
-
true
|
|
367
402
|
);
|
|
368
403
|
}
|
|
369
404
|
},
|
|
@@ -396,8 +431,10 @@ const tron: AppSpec<Transaction> = {
|
|
|
396
431
|
get(account, "tronResources.unwithdrawnReward", "0")
|
|
397
432
|
);
|
|
398
433
|
const nextRewardDate = getNextRewardDate(account as TronAccount);
|
|
399
|
-
expect(rewards.eq(0)).toBe(true);
|
|
400
|
-
|
|
434
|
+
botTest("rewards is zero", () => expect(rewards.eq(0)).toBe(true));
|
|
435
|
+
botTest("next reward date settled", () =>
|
|
436
|
+
expect(nextRewardDate && nextRewardDate > Date.now()).toBe(true)
|
|
437
|
+
);
|
|
401
438
|
},
|
|
402
439
|
},
|
|
403
440
|
],
|
|
@@ -15,89 +15,90 @@ const resourceExpected = ({ transaction: { resource } }) =>
|
|
|
15
15
|
? resource.slice(0, 1).toUpperCase() + resource.slice(1).toLowerCase()
|
|
16
16
|
: "";
|
|
17
17
|
|
|
18
|
-
const acceptTransaction: DeviceAction<Transaction, any> =
|
|
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
|
-
transaction
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
vote.address.
|
|
92
|
-
|
|
18
|
+
export const acceptTransaction: DeviceAction<Transaction, any> =
|
|
19
|
+
deviceActionFlow({
|
|
20
|
+
steps: [
|
|
21
|
+
{
|
|
22
|
+
title: "Review",
|
|
23
|
+
button: "Rr", // TODO define expectedValue
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: "Claim",
|
|
27
|
+
button: "Rr",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "Gain",
|
|
31
|
+
button: "Rr",
|
|
32
|
+
expectedValue: (arg) => resourceExpected(arg),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "Resource",
|
|
36
|
+
button: "Rr",
|
|
37
|
+
expectedValue: (arg) => resourceExpected(arg),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "Amount",
|
|
41
|
+
button: "Rr",
|
|
42
|
+
expectedValue: ({ account, status }) =>
|
|
43
|
+
formatCurrencyUnit(
|
|
44
|
+
{
|
|
45
|
+
...account.unit,
|
|
46
|
+
code: account.currency.deviceTicker || account.unit.code,
|
|
47
|
+
},
|
|
48
|
+
status.amount,
|
|
49
|
+
{
|
|
50
|
+
disableRounding: true,
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: "Token",
|
|
56
|
+
button: "Rr",
|
|
57
|
+
expectedValue: ({ account, transaction }) =>
|
|
58
|
+
transaction.subAccountId
|
|
59
|
+
? subAccount(transaction.subAccountId, account).token.ticker
|
|
60
|
+
: "TRX",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: "From Address",
|
|
64
|
+
button: "Rr",
|
|
65
|
+
expectedValue: ({ account }) => account.freshAddress,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: "Freeze To",
|
|
69
|
+
button: "Rr",
|
|
70
|
+
expectedValue: ({ account }) => account.freshAddress,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: "Delegated To",
|
|
74
|
+
button: "Rr",
|
|
75
|
+
expectedValue: ({ account }) => account.freshAddress,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: "Send To",
|
|
79
|
+
button: "Rr",
|
|
80
|
+
expectedValue: ({ transaction }) => transaction.recipient,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: "Sign",
|
|
84
|
+
button: "LRlr",
|
|
85
|
+
final: true,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
fallback: ({ event, transaction }) => {
|
|
89
|
+
if (transaction.mode === "vote") {
|
|
90
|
+
for (const vote of transaction.votes) {
|
|
91
|
+
const title = `${vote.address.slice(0, 5)}...${vote.address.slice(
|
|
92
|
+
vote.address.length - 5
|
|
93
|
+
)}`;
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
if (event.text === title) {
|
|
96
|
+
return voteAction(vote, title);
|
|
97
|
+
}
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
100
|
+
},
|
|
101
|
+
});
|
|
101
102
|
|
|
102
103
|
function voteAction(
|
|
103
104
|
vote: Vote,
|
|
@@ -109,7 +110,3 @@ function voteAction(
|
|
|
109
110
|
expectedValue: () => String(vote.voteCount),
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
-
export default {
|
|
114
|
-
acceptTransaction,
|
|
115
|
-
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { from, of } from "rxjs";
|
|
2
|
+
import { delay } from "rxjs/operators";
|
|
3
|
+
import Transport from "@ledgerhq/hw-transport";
|
|
4
|
+
import { withDevice } from "./deviceAccess";
|
|
5
|
+
import getDeviceInfo from "./getDeviceInfo";
|
|
6
|
+
import genuineCheck from "./genuineCheck";
|
|
7
|
+
import { DeviceInfo } from "@ledgerhq/types-live";
|
|
8
|
+
import {
|
|
9
|
+
getGenuineCheckFromDeviceId,
|
|
10
|
+
GetGenuineCheckFromDeviceIdResult,
|
|
11
|
+
} from "./getGenuineCheckFromDeviceId";
|
|
12
|
+
|
|
13
|
+
jest.mock("./deviceAccess");
|
|
14
|
+
jest.mock("./getDeviceInfo");
|
|
15
|
+
jest.mock("./genuineCheck");
|
|
16
|
+
jest.useFakeTimers();
|
|
17
|
+
|
|
18
|
+
const mockedGetDeviceInfo = jest.mocked(getDeviceInfo);
|
|
19
|
+
const mockedGenuineCheck = jest.mocked(genuineCheck);
|
|
20
|
+
const mockedWithDevice = jest.mocked(withDevice);
|
|
21
|
+
|
|
22
|
+
mockedWithDevice.mockReturnValue((job) => from(job(new Transport())));
|
|
23
|
+
|
|
24
|
+
const aDeviceInfo = {
|
|
25
|
+
mcuVersion: "A_MCU_VERSION",
|
|
26
|
+
version: "A_VERSION",
|
|
27
|
+
majMin: "A_MAJ_MIN",
|
|
28
|
+
targetId: "0.0",
|
|
29
|
+
isBootloader: true,
|
|
30
|
+
isOSU: true,
|
|
31
|
+
providerName: undefined,
|
|
32
|
+
managerAllowed: false,
|
|
33
|
+
pinValidated: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
describe("getGenuineCheckFromDeviceId", () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
mockedGetDeviceInfo.mockResolvedValue(aDeviceInfo);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
mockedGetDeviceInfo.mockClear();
|
|
43
|
+
mockedGenuineCheck.mockClear();
|
|
44
|
+
jest.clearAllTimers();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe("When the device is locked before doing a genuine check, and it timed out", () => {
|
|
48
|
+
it("should notify the function consumer of the need to unlock the device, and once done, continue the genuine check flow", (done) => {
|
|
49
|
+
// Delays the device info response
|
|
50
|
+
mockedGetDeviceInfo.mockReturnValue(
|
|
51
|
+
of(aDeviceInfo as DeviceInfo)
|
|
52
|
+
.pipe(delay(1001))
|
|
53
|
+
.toPromise()
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
mockedGenuineCheck.mockReturnValue(
|
|
57
|
+
of({
|
|
58
|
+
type: "device-permission-requested",
|
|
59
|
+
wording: "",
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
let step = 0;
|
|
64
|
+
getGenuineCheckFromDeviceId({
|
|
65
|
+
deviceId: "A_DEVICE_ID",
|
|
66
|
+
lockedDeviceTimeoutMs: 1000,
|
|
67
|
+
}).subscribe({
|
|
68
|
+
next: ({
|
|
69
|
+
socketEvent,
|
|
70
|
+
deviceIsLocked,
|
|
71
|
+
}: GetGenuineCheckFromDeviceIdResult) => {
|
|
72
|
+
switch (step) {
|
|
73
|
+
case 0:
|
|
74
|
+
expect(socketEvent).toBeNull();
|
|
75
|
+
expect(deviceIsLocked).toBe(true);
|
|
76
|
+
break;
|
|
77
|
+
case 1:
|
|
78
|
+
expect(socketEvent).toBeNull();
|
|
79
|
+
expect(deviceIsLocked).toBe(false);
|
|
80
|
+
break;
|
|
81
|
+
case 2:
|
|
82
|
+
expect(socketEvent).toEqual({
|
|
83
|
+
type: "device-permission-requested",
|
|
84
|
+
wording: "",
|
|
85
|
+
});
|
|
86
|
+
expect(deviceIsLocked).toBe(false);
|
|
87
|
+
done();
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
jest.advanceTimersByTime(1);
|
|
91
|
+
step += 1;
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
jest.advanceTimersByTime(1000);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { SocketEvent } from "@ledgerhq/types-live";
|
|
2
|
+
import { from, Observable } from "rxjs";
|
|
3
|
+
import { mergeMap } from "rxjs/operators";
|
|
4
|
+
import getDeviceInfo from "./getDeviceInfo";
|
|
5
|
+
import { withDevice } from "./deviceAccess";
|
|
6
|
+
import genuineCheck from "./genuineCheck";
|
|
7
|
+
|
|
8
|
+
export type GetGenuineCheckFromDeviceIdArgs = {
|
|
9
|
+
deviceId: string;
|
|
10
|
+
lockedDeviceTimeoutMs?: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type GetGenuineCheckFromDeviceIdResult = {
|
|
14
|
+
socketEvent: SocketEvent | null;
|
|
15
|
+
deviceIsLocked: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type GetGenuineCheckFromDeviceIdOutput =
|
|
19
|
+
Observable<GetGenuineCheckFromDeviceIdResult>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get a genuine check for a device only from its id
|
|
23
|
+
* @param deviceId A device id, or an empty string if device is usb plugged
|
|
24
|
+
* @param lockedDeviceTimeoutMs Time of no response from device after which the device is considered locked, in ms. Default 1000ms.
|
|
25
|
+
* @returns An Observable pushing objects containing:
|
|
26
|
+
* - socketEvent: a SocketEvent giving the current status of the genuine check,
|
|
27
|
+
* null if the genuine check process did not reach any state yet
|
|
28
|
+
* - deviceIsLocked: a boolean set to true if the device is currently locked, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
export const getGenuineCheckFromDeviceId = ({
|
|
31
|
+
deviceId,
|
|
32
|
+
lockedDeviceTimeoutMs = 1000,
|
|
33
|
+
}: GetGenuineCheckFromDeviceIdArgs): GetGenuineCheckFromDeviceIdOutput => {
|
|
34
|
+
return new Observable((o) => {
|
|
35
|
+
// In order to know if a device is locked or not.
|
|
36
|
+
// As we're not timing out inside the genuineCheckObservable flow (with rxjs timeout for ex)
|
|
37
|
+
// once the device is unlock, getDeviceInfo should return the device info and
|
|
38
|
+
// the flow will continue. No need to handle a retry strategy
|
|
39
|
+
const lockedDeviceTimeout = setTimeout(() => {
|
|
40
|
+
o.next({ socketEvent: null, deviceIsLocked: true });
|
|
41
|
+
}, lockedDeviceTimeoutMs);
|
|
42
|
+
|
|
43
|
+
// withDevice handles the unsubscribing cleaning when leaving the useEffect
|
|
44
|
+
withDevice(deviceId)((t) =>
|
|
45
|
+
from(getDeviceInfo(t)).pipe(
|
|
46
|
+
mergeMap((deviceInfo) => {
|
|
47
|
+
clearTimeout(lockedDeviceTimeout);
|
|
48
|
+
o.next({ socketEvent: null, deviceIsLocked: false });
|
|
49
|
+
return genuineCheck(t, deviceInfo);
|
|
50
|
+
})
|
|
51
|
+
)
|
|
52
|
+
).subscribe({
|
|
53
|
+
next: (socketEvent: SocketEvent) => {
|
|
54
|
+
o.next({ socketEvent, deviceIsLocked: false });
|
|
55
|
+
},
|
|
56
|
+
error: (e) => {
|
|
57
|
+
o.error(e);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { from, Observable } from "rxjs";
|
|
2
|
+
import { map, mergeMap } from "rxjs/operators";
|
|
3
|
+
import type { FirmwareUpdateContext, DeviceId } from "@ledgerhq/types-live";
|
|
4
|
+
import manager from "../manager";
|
|
5
|
+
import { withDevice } from "./deviceAccess";
|
|
6
|
+
import getDeviceInfo from "./getDeviceInfo";
|
|
7
|
+
|
|
8
|
+
export type GetLatestAvailableFirmwareFromDeviceIdArgs = {
|
|
9
|
+
deviceId: DeviceId;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type GetLatestAvailableFirmwareFromDeviceIdResult = {
|
|
13
|
+
firmwareUpdateContext: FirmwareUpdateContext | null | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type GetLatestAvailableFirmwareFromDeviceIdOutput =
|
|
17
|
+
Observable<GetLatestAvailableFirmwareFromDeviceIdResult>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the latest available firmware for a device only from its id
|
|
21
|
+
* @param deviceId A device id, or an empty string if device is usb plugged
|
|
22
|
+
* @returns An Observable pushing objects containing:
|
|
23
|
+
* - firmwareUpdateContext A FirmwareUpdateContext if found, or null or undefined otherwise
|
|
24
|
+
*/
|
|
25
|
+
export const getLatestAvailableFirmwareFromDeviceId = ({
|
|
26
|
+
deviceId,
|
|
27
|
+
}: GetLatestAvailableFirmwareFromDeviceIdArgs): GetLatestAvailableFirmwareFromDeviceIdOutput => {
|
|
28
|
+
return withDevice(deviceId)((t) =>
|
|
29
|
+
from(getDeviceInfo(t)).pipe(
|
|
30
|
+
mergeMap((deviceInfo) =>
|
|
31
|
+
from(manager.getLatestFirmwareForDevice(deviceInfo)).pipe(
|
|
32
|
+
map((firmwareUpdateContext) => ({ firmwareUpdateContext }))
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
};
|