@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
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import { Observable, Subject } from "rxjs";
|
|
3
|
+
import { log } from "@ledgerhq/logs";
|
|
4
|
+
import { PRELOAD_MAX_AGE } from "./logic";
|
|
5
|
+
import type { CeloPreloadData, CeloValidatorGroup } from "./types";
|
|
6
|
+
import { getValidatorGroups } from "./validators";
|
|
7
|
+
|
|
8
|
+
let currentCeloPreloadedData: CeloPreloadData = {
|
|
9
|
+
validatorGroups: [],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function fromHydrateValidator(
|
|
13
|
+
validatorGroupRaw: Record<string, any>
|
|
14
|
+
): CeloValidatorGroup {
|
|
15
|
+
return {
|
|
16
|
+
address: validatorGroupRaw.address,
|
|
17
|
+
name: validatorGroupRaw.name,
|
|
18
|
+
votes: new BigNumber(validatorGroupRaw.votes),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function fromHydratePreloadData(data: any): CeloPreloadData {
|
|
23
|
+
let validatorGroups = [];
|
|
24
|
+
if (typeof data === "object" && data) {
|
|
25
|
+
if (Array.isArray(data.validatorGroups)) {
|
|
26
|
+
validatorGroups = data.validatorGroups.map(fromHydrateValidator);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
validatorGroups,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const updates = new Subject<CeloPreloadData>();
|
|
36
|
+
export function getCurrentCeloPreloadData(): CeloPreloadData {
|
|
37
|
+
return currentCeloPreloadedData;
|
|
38
|
+
}
|
|
39
|
+
function setCeloPreloadData(data: CeloPreloadData) {
|
|
40
|
+
if (data === currentCeloPreloadedData) return;
|
|
41
|
+
currentCeloPreloadedData = data;
|
|
42
|
+
updates.next(data);
|
|
43
|
+
}
|
|
44
|
+
export function getCeloPreloadDataUpdates(): Observable<CeloPreloadData> {
|
|
45
|
+
return updates.asObservable();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const getPreloadStrategy = () => ({
|
|
49
|
+
preloadMaxAge: PRELOAD_MAX_AGE,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const preload = async (): Promise<CeloPreloadData> => {
|
|
53
|
+
const { validatorGroups: previousValidatorGroups } = currentCeloPreloadedData;
|
|
54
|
+
let validatorGroups = previousValidatorGroups;
|
|
55
|
+
|
|
56
|
+
if (!validatorGroups || !validatorGroups.length) {
|
|
57
|
+
log("celo/preload", "refreshing celo validatorGroups...");
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
validatorGroups = await getValidatorGroups();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
log("celo/preload", "failed to fetch validatorGroups", {
|
|
63
|
+
error,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return { validatorGroups };
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const hydrate = (data: unknown) => {
|
|
72
|
+
const hydrated = fromHydratePreloadData(data);
|
|
73
|
+
log(
|
|
74
|
+
"celo/preload",
|
|
75
|
+
"hydrate " + hydrated.validatorGroups.length + " celo validatorGroups"
|
|
76
|
+
);
|
|
77
|
+
setCeloPreloadData(hydrated);
|
|
78
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
getCurrentCeloPreloadData,
|
|
4
|
+
getCeloPreloadDataUpdates,
|
|
5
|
+
} from "./preload";
|
|
6
|
+
import type { CeloPreloadData, CeloValidatorGroup } from "./types";
|
|
7
|
+
|
|
8
|
+
export function useCeloPreloadData(): CeloPreloadData {
|
|
9
|
+
const [state, setState] = useState(getCurrentCeloPreloadData);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const sub = getCeloPreloadDataUpdates().subscribe((data) => {
|
|
12
|
+
setState(data);
|
|
13
|
+
});
|
|
14
|
+
return () => sub.unsubscribe();
|
|
15
|
+
}, []);
|
|
16
|
+
return state;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function useValidatorGroups(search: string): CeloValidatorGroup[] {
|
|
20
|
+
const { validatorGroups } = useCeloPreloadData();
|
|
21
|
+
|
|
22
|
+
return useMemo(() => {
|
|
23
|
+
if (validatorGroups.length === 0 || !search) {
|
|
24
|
+
return validatorGroups;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const lowercaseSearch = search.toLowerCase();
|
|
28
|
+
|
|
29
|
+
return validatorGroups.filter(
|
|
30
|
+
(vg) =>
|
|
31
|
+
vg.name.toLowerCase().includes(lowercaseSearch) ||
|
|
32
|
+
vg.address.toLowerCase().includes(lowercaseSearch)
|
|
33
|
+
);
|
|
34
|
+
}, [validatorGroups, search]);
|
|
35
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import type { CeloResources, CeloResourcesRaw } from "./types";
|
|
3
|
+
import { BigNumber } from "bignumber.js";
|
|
4
|
+
|
|
5
|
+
export function toCeloResourcesRaw(r: CeloResources): CeloResourcesRaw {
|
|
6
|
+
const {
|
|
7
|
+
registrationStatus,
|
|
8
|
+
lockedBalance,
|
|
9
|
+
nonvotingLockedBalance,
|
|
10
|
+
pendingWithdrawals,
|
|
11
|
+
votes,
|
|
12
|
+
electionAddress,
|
|
13
|
+
lockedGoldAddress,
|
|
14
|
+
maxNumGroupsVotedFor,
|
|
15
|
+
} = r ?? {};
|
|
16
|
+
return {
|
|
17
|
+
registrationStatus,
|
|
18
|
+
lockedBalance: lockedBalance?.toString(),
|
|
19
|
+
nonvotingLockedBalance: nonvotingLockedBalance?.toString(),
|
|
20
|
+
pendingWithdrawals: pendingWithdrawals?.map((withdrawal) => ({
|
|
21
|
+
value: withdrawal.value.toString(),
|
|
22
|
+
time: withdrawal.time.toString(),
|
|
23
|
+
index: withdrawal.index.toString(),
|
|
24
|
+
})),
|
|
25
|
+
votes: votes?.map((vote) => ({
|
|
26
|
+
validatorGroup: vote.validatorGroup.toString(),
|
|
27
|
+
amount: vote.amount.toString(),
|
|
28
|
+
activatable: vote.activatable,
|
|
29
|
+
revokable: vote.revokable,
|
|
30
|
+
type: vote.type,
|
|
31
|
+
index: vote.index,
|
|
32
|
+
})),
|
|
33
|
+
electionAddress,
|
|
34
|
+
lockedGoldAddress,
|
|
35
|
+
maxNumGroupsVotedFor: maxNumGroupsVotedFor?.toString(),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function fromCeloResourcesRaw(r: CeloResourcesRaw): CeloResources {
|
|
40
|
+
return {
|
|
41
|
+
registrationStatus: r.registrationStatus,
|
|
42
|
+
lockedBalance: new BigNumber(r.lockedBalance),
|
|
43
|
+
nonvotingLockedBalance: new BigNumber(r.nonvotingLockedBalance),
|
|
44
|
+
pendingWithdrawals: r.pendingWithdrawals?.map((u) => ({
|
|
45
|
+
value: new BigNumber(u.value),
|
|
46
|
+
time: new BigNumber(u.time),
|
|
47
|
+
index: Number(u.index),
|
|
48
|
+
})),
|
|
49
|
+
votes: r.votes?.map((vote) => ({
|
|
50
|
+
validatorGroup: vote.validatorGroup,
|
|
51
|
+
amount: new BigNumber(vote.amount),
|
|
52
|
+
activatable: vote.activatable,
|
|
53
|
+
revokable: vote.revokable,
|
|
54
|
+
type: vote.type,
|
|
55
|
+
index: vote.index,
|
|
56
|
+
})),
|
|
57
|
+
electionAddress: r.electionAddress,
|
|
58
|
+
lockedGoldAddress: r.lockedGoldAddress,
|
|
59
|
+
maxNumGroupsVotedFor: new BigNumber(r.maxNumGroupsVotedFor),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
3
|
+
import { MutationSpec } from "../../../bot/types";
|
|
4
|
+
import type { CeloAccount, Transaction } from "../types";
|
|
5
|
+
|
|
6
|
+
const currency = getCryptoCurrencyById("celo");
|
|
7
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
8
|
+
|
|
9
|
+
export const createActivateVoteMutation = (): MutationSpec<Transaction> => ({
|
|
10
|
+
name: "Celo: Activate Vote",
|
|
11
|
+
maxRun: 5,
|
|
12
|
+
transaction: ({ account, bridge, maxSpendable }) => {
|
|
13
|
+
const { celoResources } = account as CeloAccount;
|
|
14
|
+
invariant(
|
|
15
|
+
celoResources?.registrationStatus,
|
|
16
|
+
"Celo: Activate Vote | Account is not registered"
|
|
17
|
+
);
|
|
18
|
+
invariant(
|
|
19
|
+
maxSpendable.gt(minimalAmount),
|
|
20
|
+
"Celo: Activate Vote | balance is too low"
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const activatableVote = celoResources?.votes?.find(
|
|
24
|
+
(vote) => vote.activatable
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
invariant(!!activatableVote, "Celo: Activate Vote | No activatable votes");
|
|
28
|
+
|
|
29
|
+
const transaction = {
|
|
30
|
+
recipient: activatableVote!.validatorGroup,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
transaction: bridge.createTransaction(account),
|
|
35
|
+
updates: [
|
|
36
|
+
{
|
|
37
|
+
memo: "LedgerLiveBot",
|
|
38
|
+
mode: "activate",
|
|
39
|
+
},
|
|
40
|
+
transaction,
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
3
|
+
import { MutationSpec } from "../../../bot/types";
|
|
4
|
+
import type { CeloAccount, Transaction } from "../types";
|
|
5
|
+
|
|
6
|
+
const currency = getCryptoCurrencyById("celo");
|
|
7
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.005");
|
|
8
|
+
|
|
9
|
+
export const createLockMutation = (): MutationSpec<Transaction> => ({
|
|
10
|
+
name: "Celo: Lock",
|
|
11
|
+
maxRun: 1,
|
|
12
|
+
transaction: ({ account, bridge, maxSpendable }) => {
|
|
13
|
+
const { celoResources } = account as CeloAccount;
|
|
14
|
+
invariant(
|
|
15
|
+
celoResources?.registrationStatus,
|
|
16
|
+
"Celo: Lock Vote | Account is not registered"
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
invariant(
|
|
20
|
+
maxSpendable.gt(minimalAmount),
|
|
21
|
+
"Celo: Lock | balance is too low"
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const amount = minimalAmount
|
|
25
|
+
.times(Math.random())
|
|
26
|
+
.integerValue()
|
|
27
|
+
.precision(8);
|
|
28
|
+
|
|
29
|
+
invariant(amount.gt(0), "Celo: Lock | Not enough funds to lock tokens");
|
|
30
|
+
|
|
31
|
+
const transaction = {
|
|
32
|
+
amount,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
transaction: bridge.createTransaction(account),
|
|
37
|
+
updates: [
|
|
38
|
+
{
|
|
39
|
+
memo: "LedgerLiveBot",
|
|
40
|
+
mode: "lock",
|
|
41
|
+
},
|
|
42
|
+
transaction,
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
3
|
+
import { MutationSpec } from "../../../bot/types";
|
|
4
|
+
import type { CeloAccount, Transaction } from "../types";
|
|
5
|
+
|
|
6
|
+
const currency = getCryptoCurrencyById("celo");
|
|
7
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
8
|
+
|
|
9
|
+
export const createRegisterAccountMutation = (): MutationSpec<Transaction> => ({
|
|
10
|
+
name: "Celo: Register Account",
|
|
11
|
+
maxRun: 1,
|
|
12
|
+
transaction: ({ account, bridge, maxSpendable }) => {
|
|
13
|
+
const { celoResources } = account as CeloAccount;
|
|
14
|
+
|
|
15
|
+
invariant(
|
|
16
|
+
!celoResources?.registrationStatus,
|
|
17
|
+
"Celo: Register Account | Celo account is already registered"
|
|
18
|
+
);
|
|
19
|
+
invariant(
|
|
20
|
+
maxSpendable.gt(minimalAmount),
|
|
21
|
+
"Celo: Register Account | Celo account balance is too low to register account"
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
transaction: bridge.createTransaction(account),
|
|
26
|
+
updates: [
|
|
27
|
+
{
|
|
28
|
+
memo: "LedgerLiveBot",
|
|
29
|
+
mode: "register",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
3
|
+
import { MutationSpec } from "../../../bot/types";
|
|
4
|
+
import type { CeloAccount, Transaction } from "../types";
|
|
5
|
+
|
|
6
|
+
const currency = getCryptoCurrencyById("celo");
|
|
7
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
8
|
+
|
|
9
|
+
export const createRevokeVoteMutation = (): MutationSpec<Transaction> => ({
|
|
10
|
+
name: "Celo: RevokeVote",
|
|
11
|
+
maxRun: 5,
|
|
12
|
+
transaction: ({ account, bridge, maxSpendable }) => {
|
|
13
|
+
invariant(
|
|
14
|
+
maxSpendable.gt(minimalAmount),
|
|
15
|
+
"Celo: Revoke Vote | balance is too low"
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const { celoResources } = account as CeloAccount;
|
|
19
|
+
invariant(
|
|
20
|
+
celoResources?.registrationStatus,
|
|
21
|
+
"Celo: RevokeVote | Account is not registered"
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const revokableVote = celoResources?.votes?.find((vote) => vote.revokable);
|
|
25
|
+
|
|
26
|
+
invariant(!!revokableVote, "Celo: RevokeVote | Revokable vote not found");
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
transaction: bridge.createTransaction(account),
|
|
30
|
+
updates: [
|
|
31
|
+
{
|
|
32
|
+
memo: "LedgerLiveBot",
|
|
33
|
+
mode: "revoke",
|
|
34
|
+
recipient: revokableVote!.validatorGroup,
|
|
35
|
+
group: revokableVote!.validatorGroup,
|
|
36
|
+
address: (account as CeloAccount).celoResources?.electionAddress,
|
|
37
|
+
index: revokableVote!.index,
|
|
38
|
+
amount: revokableVote!.amount,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
3
|
+
import { pickSiblings } from "../../../bot/specs";
|
|
4
|
+
import { MutationSpec } from "../../../bot/types";
|
|
5
|
+
import type { Transaction } from "../types";
|
|
6
|
+
|
|
7
|
+
const maxAccount = 3;
|
|
8
|
+
const currency = getCryptoCurrencyById("celo");
|
|
9
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
10
|
+
|
|
11
|
+
export const createSend50PercentMutation = (): MutationSpec<Transaction> => ({
|
|
12
|
+
name: "Celo: Move 50% to another account",
|
|
13
|
+
maxRun: 1,
|
|
14
|
+
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
15
|
+
invariant(
|
|
16
|
+
maxSpendable.gt(minimalAmount),
|
|
17
|
+
"Celo: Move 50% | balance is too low"
|
|
18
|
+
);
|
|
19
|
+
const sibling = pickSiblings(siblings, maxAccount);
|
|
20
|
+
const recipient = sibling.freshAddress;
|
|
21
|
+
const amount = maxSpendable.div(2).integerValue();
|
|
22
|
+
return {
|
|
23
|
+
transaction: bridge.createTransaction(account),
|
|
24
|
+
updates: [{ recipient }, { amount }],
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const createSendMaxMutation = (): MutationSpec<Transaction> => ({
|
|
30
|
+
name: "Celo: Send max to another account",
|
|
31
|
+
maxRun: 1,
|
|
32
|
+
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
33
|
+
invariant(
|
|
34
|
+
maxSpendable.gt(minimalAmount),
|
|
35
|
+
"Celo: Send Max | Balance is too low"
|
|
36
|
+
);
|
|
37
|
+
const sibling = pickSiblings(siblings, maxAccount);
|
|
38
|
+
const recipient = sibling.freshAddress;
|
|
39
|
+
return {
|
|
40
|
+
transaction: bridge.createTransaction(account),
|
|
41
|
+
updates: [{ recipient }, { useAllAmount: true }],
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
3
|
+
import { MutationSpec } from "../../../bot/types";
|
|
4
|
+
import type { CeloAccount, Transaction } from "../types";
|
|
5
|
+
import BigNumber from "bignumber.js";
|
|
6
|
+
|
|
7
|
+
const currency = getCryptoCurrencyById("celo");
|
|
8
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
9
|
+
|
|
10
|
+
export const createUnlockMutation = (): MutationSpec<Transaction> => ({
|
|
11
|
+
name: "Celo: Unlock",
|
|
12
|
+
maxRun: 1,
|
|
13
|
+
transaction: ({ account, bridge, maxSpendable }) => {
|
|
14
|
+
invariant(
|
|
15
|
+
maxSpendable.gt(minimalAmount),
|
|
16
|
+
"Celo: Unlock | balance is too low"
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const { celoResources } = account as CeloAccount;
|
|
20
|
+
invariant(
|
|
21
|
+
celoResources?.registrationStatus,
|
|
22
|
+
"Celo: Unlock | Account is not registered"
|
|
23
|
+
);
|
|
24
|
+
const nonvotingLockedBalance =
|
|
25
|
+
celoResources?.nonvotingLockedBalance || new BigNumber(0);
|
|
26
|
+
invariant(
|
|
27
|
+
nonvotingLockedBalance.gt(0),
|
|
28
|
+
"Celo: Unlock | No non voting locked balance"
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
transaction: bridge.createTransaction(account),
|
|
33
|
+
updates: [
|
|
34
|
+
{
|
|
35
|
+
memo: "LedgerLiveBot",
|
|
36
|
+
mode: "unlock",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
amount: nonvotingLockedBalance.dividedBy(2).integerValue(),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import sampleSize from "lodash/sampleSize";
|
|
4
|
+
import { MutationSpec } from "../../../bot/types";
|
|
5
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
6
|
+
import { getCurrentCeloPreloadData } from "../preload";
|
|
7
|
+
import { getValidatorGroupsWithoutVotes } from "../logic";
|
|
8
|
+
import type { CeloAccount, CeloResources, Transaction } from "../types";
|
|
9
|
+
|
|
10
|
+
const currency = getCryptoCurrencyById("celo");
|
|
11
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
12
|
+
|
|
13
|
+
export const createVoteMutation = (): MutationSpec<Transaction> => ({
|
|
14
|
+
name: "Celo: Vote",
|
|
15
|
+
maxRun: 1,
|
|
16
|
+
transaction: ({ account, bridge, maxSpendable }) => {
|
|
17
|
+
invariant(
|
|
18
|
+
maxSpendable.gt(minimalAmount),
|
|
19
|
+
"Celo: Vote | balance is too low"
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const { celoResources } = account as CeloAccount;
|
|
23
|
+
invariant(
|
|
24
|
+
celoResources?.registrationStatus,
|
|
25
|
+
"Celo: Vote | Account is not registered"
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const nonvotingLockedBalance =
|
|
29
|
+
celoResources?.nonvotingLockedBalance || new BigNumber(0);
|
|
30
|
+
invariant(
|
|
31
|
+
nonvotingLockedBalance.gt(0),
|
|
32
|
+
"Celo: Vote | No non voting locked balance"
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const votes = (celoResources as CeloResources).votes || [];
|
|
36
|
+
const { validatorGroups } = getCurrentCeloPreloadData();
|
|
37
|
+
|
|
38
|
+
// Get a random validator group that the account does not have locked tokens for.
|
|
39
|
+
const validatorGroupWithoutVotes = sampleSize(
|
|
40
|
+
getValidatorGroupsWithoutVotes(validatorGroups, votes),
|
|
41
|
+
1
|
|
42
|
+
)[0];
|
|
43
|
+
|
|
44
|
+
const amount = nonvotingLockedBalance
|
|
45
|
+
.times(0.5)
|
|
46
|
+
.precision(8)
|
|
47
|
+
.integerValue();
|
|
48
|
+
|
|
49
|
+
invariant(amount.gt(0), "Celo: Vote | Not enough funds to vote");
|
|
50
|
+
|
|
51
|
+
const transaction = {
|
|
52
|
+
recipient: validatorGroupWithoutVotes.address,
|
|
53
|
+
amount,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
transaction: bridge.createTransaction(account),
|
|
58
|
+
updates: [
|
|
59
|
+
{
|
|
60
|
+
memo: "LedgerLiveBot",
|
|
61
|
+
mode: "vote",
|
|
62
|
+
},
|
|
63
|
+
transaction,
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import { MutationSpec } from "../../../bot/types";
|
|
3
|
+
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../../currencies";
|
|
4
|
+
import { availablePendingWithdrawals } from "../logic";
|
|
5
|
+
import type { CeloAccount, Transaction } from "../types";
|
|
6
|
+
|
|
7
|
+
const currency = getCryptoCurrencyById("celo");
|
|
8
|
+
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
|
|
9
|
+
|
|
10
|
+
export const createWithdrawMutation = (): MutationSpec<Transaction> => ({
|
|
11
|
+
name: "Celo: Withdraw",
|
|
12
|
+
maxRun: 5,
|
|
13
|
+
transaction: ({ account, bridge, maxSpendable }) => {
|
|
14
|
+
const celoAccount = account as CeloAccount;
|
|
15
|
+
const { celoResources } = celoAccount;
|
|
16
|
+
invariant(
|
|
17
|
+
celoResources?.registrationStatus,
|
|
18
|
+
"Celo: Withdraw | Account is not registered"
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const pendingWithdrawals = availablePendingWithdrawals(celoAccount);
|
|
22
|
+
|
|
23
|
+
invariant(
|
|
24
|
+
pendingWithdrawals.length > 0,
|
|
25
|
+
"Celo: Withdraw | No withdrawable balance"
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
invariant(
|
|
29
|
+
maxSpendable.gt(minimalAmount),
|
|
30
|
+
"Celo: Withdraw Vote | balance is too low"
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
transaction: bridge.createTransaction(celoAccount),
|
|
35
|
+
updates: [
|
|
36
|
+
{
|
|
37
|
+
mode: "withdraw",
|
|
38
|
+
recipient: celoAccount.celoResources!.lockedGoldAddress!,
|
|
39
|
+
index: pendingWithdrawals[0].index,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./createSendMutation";
|
|
2
|
+
export * from "./createLockMutation";
|
|
3
|
+
export * from "./createUnlockMutation";
|
|
4
|
+
export * from "./createRegisterAccountMutation";
|
|
5
|
+
export * from "./createVoteMutation";
|
|
6
|
+
export * from "./createActivateVoteMutation";
|
|
7
|
+
export * from "./createRevokeVoteMutation";
|
|
8
|
+
export * from "./createWithdrawMutation";
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import invariant from "invariant";
|
|
2
|
-
import type { Transaction } from "./types";
|
|
3
|
-
import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
|
|
4
|
-
import { pickSiblings } from "../../bot/specs";
|
|
5
|
-
import type { AppSpec } from "../../bot/types";
|
|
6
1
|
import { DeviceModelId } from "@ledgerhq/devices";
|
|
2
|
+
import { getCryptoCurrencyById } from "../../currencies";
|
|
3
|
+
import {
|
|
4
|
+
createLockMutation,
|
|
5
|
+
createRegisterAccountMutation,
|
|
6
|
+
createSend50PercentMutation,
|
|
7
|
+
createSendMaxMutation,
|
|
8
|
+
createUnlockMutation,
|
|
9
|
+
createVoteMutation,
|
|
10
|
+
createActivateVoteMutation,
|
|
11
|
+
createRevokeVoteMutation,
|
|
12
|
+
createWithdrawMutation,
|
|
13
|
+
} from "./specs/index";
|
|
14
|
+
import type { AppSpec } from "../../bot/types";
|
|
15
|
+
import type { Transaction } from "./types";
|
|
16
|
+
import { acceptTransaction } from "./speculos-deviceActions";
|
|
7
17
|
|
|
8
18
|
const currency = getCryptoCurrencyById("celo");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
19
|
+
const send50PercentMutation = createSend50PercentMutation();
|
|
20
|
+
const sendMaxMutation = createSendMaxMutation();
|
|
21
|
+
const registerAccountMutation = createRegisterAccountMutation();
|
|
22
|
+
const unlockMutation = createUnlockMutation();
|
|
23
|
+
const lockMutation = createLockMutation();
|
|
24
|
+
const voteMutation = createVoteMutation();
|
|
25
|
+
const activateVoteMutation = createActivateVoteMutation();
|
|
26
|
+
const revokeVoteMutation = createRevokeVoteMutation();
|
|
27
|
+
const withdrawMutation = createWithdrawMutation();
|
|
11
28
|
|
|
12
29
|
const celo: AppSpec<Transaction> = {
|
|
13
30
|
name: "Celo",
|
|
@@ -17,34 +34,17 @@ const celo: AppSpec<Transaction> = {
|
|
|
17
34
|
appName: "Celo",
|
|
18
35
|
},
|
|
19
36
|
testTimeout: 2 * 60 * 1000,
|
|
37
|
+
genericDeviceAction: acceptTransaction,
|
|
20
38
|
mutations: [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
transaction: bridge.createTransaction(account),
|
|
31
|
-
updates: [{ recipient }, { amount }],
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "send max to another account",
|
|
37
|
-
maxRun: 1,
|
|
38
|
-
transaction: ({ account, siblings, bridge, maxSpendable }) => {
|
|
39
|
-
invariant(maxSpendable.gt(minimalAmount), "balance is too low");
|
|
40
|
-
const sibling = pickSiblings(siblings, maxAccount);
|
|
41
|
-
const recipient = sibling.freshAddress;
|
|
42
|
-
return {
|
|
43
|
-
transaction: bridge.createTransaction(account),
|
|
44
|
-
updates: [{ recipient }, { useAllAmount: true }],
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
},
|
|
39
|
+
send50PercentMutation,
|
|
40
|
+
sendMaxMutation,
|
|
41
|
+
registerAccountMutation,
|
|
42
|
+
unlockMutation,
|
|
43
|
+
lockMutation,
|
|
44
|
+
voteMutation,
|
|
45
|
+
activateVoteMutation,
|
|
46
|
+
revokeVoteMutation,
|
|
47
|
+
withdrawMutation,
|
|
48
48
|
],
|
|
49
49
|
};
|
|
50
50
|
|