@ledgerhq/coin-evm 0.2.1 → 0.2.2-nightly.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +11 -46
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +29 -1
- package/lib/__tests__/adapters.unit.test.d.ts +2 -0
- package/lib/__tests__/adapters.unit.test.d.ts.map +1 -0
- package/lib/__tests__/adapters.unit.test.js +455 -0
- package/lib/__tests__/adapters.unit.test.js.map +1 -0
- package/lib/__tests__/broadcast.unit.test.d.ts +2 -0
- package/lib/__tests__/broadcast.unit.test.d.ts.map +1 -0
- package/lib/__tests__/broadcast.unit.test.js +181 -0
- package/lib/__tests__/broadcast.unit.test.js.map +1 -0
- package/lib/__tests__/buildOptimisticOperation.unit.test.d.ts +2 -0
- package/lib/__tests__/buildOptimisticOperation.unit.test.d.ts.map +1 -0
- package/lib/__tests__/buildOptimisticOperation.unit.test.js +166 -0
- package/lib/__tests__/buildOptimisticOperation.unit.test.js.map +1 -0
- package/lib/__tests__/createTransaction.unit.test.d.ts +2 -0
- package/lib/__tests__/createTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/createTransaction.unit.test.js +50 -0
- package/lib/__tests__/createTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/deviceTransactionConfig.unit.test.d.ts +2 -0
- package/lib/__tests__/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib/__tests__/deviceTransactionConfig.unit.test.js +231 -0
- package/lib/__tests__/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib/__tests__/estimateMaxSpendable.unit.test.d.ts +2 -0
- package/lib/__tests__/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib/__tests__/estimateMaxSpendable.unit.test.js +145 -0
- package/lib/__tests__/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib/__tests__/gasTracker/index.unit.test.d.ts +2 -0
- package/lib/__tests__/gasTracker/index.unit.test.d.ts.map +1 -0
- package/lib/__tests__/gasTracker/index.unit.test.js +35 -0
- package/lib/__tests__/gasTracker/index.unit.test.js.map +1 -0
- package/lib/__tests__/gasTracker/ledger.unit.test.d.ts +2 -0
- package/lib/__tests__/gasTracker/ledger.unit.test.d.ts.map +1 -0
- package/lib/__tests__/gasTracker/ledger.unit.test.js +110 -0
- package/lib/__tests__/gasTracker/ledger.unit.test.js.map +1 -0
- package/lib/__tests__/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib/__tests__/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib/__tests__/getTransactionStatus.unit.test.js +216 -0
- package/lib/__tests__/getTransactionStatus.unit.test.js.map +1 -0
- package/lib/__tests__/hw-getAddress.unit.test.d.ts +2 -0
- package/lib/__tests__/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/hw-getAddress.unit.test.js +47 -0
- package/lib/__tests__/hw-getAddress.unit.test.js.map +1 -0
- package/lib/__tests__/logic.unit.test.d.ts +2 -0
- package/lib/__tests__/logic.unit.test.d.ts.map +1 -0
- package/lib/__tests__/logic.unit.test.js +296 -0
- package/lib/__tests__/logic.unit.test.js.map +1 -0
- package/lib/__tests__/preload.unit.test.d.ts +2 -0
- package/lib/__tests__/preload.unit.test.d.ts.map +1 -0
- package/lib/__tests__/preload.unit.test.js +149 -0
- package/lib/__tests__/preload.unit.test.js.map +1 -0
- package/lib/__tests__/prepareTransaction.unit.test.d.ts +2 -0
- package/lib/__tests__/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/prepareTransaction.unit.test.js +248 -0
- package/lib/__tests__/prepareTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/rpc.unit.test.d.ts +2 -0
- package/lib/__tests__/rpc.unit.test.d.ts.map +1 -0
- package/lib/__tests__/rpc.unit.test.js +444 -0
- package/lib/__tests__/rpc.unit.test.js.map +1 -0
- package/lib/__tests__/signOperation.unit.test.d.ts +2 -0
- package/lib/__tests__/signOperation.unit.test.d.ts.map +1 -0
- package/lib/__tests__/signOperation.unit.test.js +160 -0
- package/lib/__tests__/signOperation.unit.test.js.map +1 -0
- package/lib/__tests__/synchronization.unit.test.d.ts +2 -0
- package/lib/__tests__/synchronization.unit.test.d.ts.map +1 -0
- package/lib/__tests__/synchronization.unit.test.js +499 -0
- package/lib/__tests__/synchronization.unit.test.js.map +1 -0
- package/lib/__tests__/transaction.unit.test.d.ts +2 -0
- package/lib/__tests__/transaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/transaction.unit.test.js +201 -0
- package/lib/__tests__/transaction.unit.test.js.map +1 -0
- package/lib/abis/erc20.abi.json +222 -0
- package/lib/abis/optimismGasPriceOracle.abi.json +252 -0
- package/lib/adapters.d.ts +21 -0
- package/lib/adapters.d.ts.map +1 -0
- package/lib/adapters.js +118 -0
- package/lib/adapters.js.map +1 -0
- package/lib/api/explorer/etherscan.d.ts +24 -0
- package/lib/api/explorer/etherscan.d.ts.map +1 -0
- package/lib/api/explorer/etherscan.js +90 -0
- package/lib/api/explorer/etherscan.js.map +1 -0
- package/lib/api/explorer/index.d.ts +26 -0
- package/lib/api/explorer/index.d.ts.map +1 -0
- package/lib/api/explorer/index.js +23 -0
- package/lib/api/explorer/index.js.map +1 -0
- package/lib/api/gasTracker/index.d.ts +13 -0
- package/lib/api/gasTracker/index.d.ts.map +1 -0
- package/lib/api/gasTracker/index.js +21 -0
- package/lib/api/gasTracker/index.js.map +1 -0
- package/lib/api/gasTracker/ledger.d.ts +9 -0
- package/lib/api/gasTracker/ledger.d.ts.map +1 -0
- package/lib/api/gasTracker/ledger.js +90 -0
- package/lib/api/gasTracker/ledger.js.map +1 -0
- package/lib/api/rpc/index.d.ts +3 -0
- package/lib/api/rpc/index.d.ts.map +1 -0
- package/lib/api/rpc/index.js +32 -0
- package/lib/api/rpc/index.js.map +1 -0
- package/lib/api/rpc/rpc.common.d.ts +93 -0
- package/lib/api/rpc/rpc.common.d.ts.map +1 -0
- package/lib/api/rpc/rpc.common.js +284 -0
- package/lib/api/rpc/rpc.common.js.map +1 -0
- package/lib/api/rpc/rpc.native.d.ts +6 -0
- package/lib/api/rpc/rpc.native.d.ts.map +1 -0
- package/lib/api/rpc/rpc.native.js +35 -0
- package/lib/api/rpc/rpc.native.js.map +1 -0
- package/lib/bridge/js.d.ts +11 -0
- package/lib/bridge/js.d.ts.map +1 -0
- package/lib/bridge/js.js +58 -0
- package/lib/bridge/js.js.map +1 -0
- package/lib/bridge.integration.test.d.ts +14 -0
- package/lib/bridge.integration.test.d.ts.map +1 -0
- package/lib/bridge.integration.test.js +85 -0
- package/lib/bridge.integration.test.js.map +1 -0
- package/lib/broadcast.d.ts +8 -0
- package/lib/broadcast.d.ts.map +1 -0
- package/lib/broadcast.js +25 -0
- package/lib/broadcast.js.map +1 -0
- package/lib/buildOptimisticOperation.d.ts +16 -0
- package/lib/buildOptimisticOperation.d.ts.map +1 -0
- package/lib/buildOptimisticOperation.js +80 -0
- package/lib/buildOptimisticOperation.js.map +1 -0
- package/lib/cli-transaction.d.ts +2 -0
- package/lib/cli-transaction.d.ts.map +1 -0
- package/lib/cli-transaction.js +9 -0
- package/lib/cli-transaction.js.map +1 -0
- package/lib/createTransaction.d.ts +9 -0
- package/lib/createTransaction.d.ts.map +1 -0
- package/lib/createTransaction.js +32 -0
- package/lib/createTransaction.js.map +1 -0
- package/lib/datasets/ethereum.scanAccounts.1.d.ts +7 -0
- package/lib/datasets/ethereum.scanAccounts.1.d.ts.map +1 -0
- package/lib/datasets/ethereum.scanAccounts.1.js +51 -0
- package/lib/datasets/ethereum.scanAccounts.1.js.map +1 -0
- package/lib/datasets/ethereum1.d.ts +3 -0
- package/lib/datasets/ethereum1.d.ts.map +1 -0
- package/lib/datasets/ethereum1.js +22 -0
- package/lib/datasets/ethereum1.js.map +1 -0
- package/lib/datasets/ethereum2.d.ts +3 -0
- package/lib/datasets/ethereum2.d.ts.map +1 -0
- package/lib/datasets/ethereum2.js +22 -0
- package/lib/datasets/ethereum2.js.map +1 -0
- package/lib/datasets/ethereum_classic.d.ts +5 -0
- package/lib/datasets/ethereum_classic.d.ts.map +1 -0
- package/lib/datasets/ethereum_classic.js +69 -0
- package/lib/datasets/ethereum_classic.js.map +1 -0
- package/lib/deviceTransactionConfig.d.ts +15 -0
- package/lib/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/deviceTransactionConfig.js +44 -0
- package/lib/deviceTransactionConfig.js.map +1 -0
- package/lib/errors.d.ts +16 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +11 -0
- package/lib/errors.js.map +1 -0
- package/lib/estimateMaxSpendable.d.ts +4 -0
- package/lib/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/estimateMaxSpendable.js +23 -0
- package/lib/estimateMaxSpendable.js.map +1 -0
- package/lib/getTransactionStatus.d.ts +23 -0
- package/lib/getTransactionStatus.d.ts.map +1 -0
- package/lib/getTransactionStatus.js +132 -0
- package/lib/getTransactionStatus.js.map +1 -0
- package/lib/hw-getAddress.d.ts +6 -0
- package/lib/hw-getAddress.d.ts.map +1 -0
- package/lib/hw-getAddress.js +28 -0
- package/lib/hw-getAddress.js.map +1 -0
- package/lib/logic.d.ts +31 -0
- package/lib/logic.d.ts.map +1 -0
- package/lib/logic.js +131 -0
- package/lib/logic.js.map +1 -0
- package/lib/preload.d.ts +6 -0
- package/lib/preload.d.ts.map +1 -0
- package/lib/preload.js +58 -0
- package/lib/preload.js.map +1 -0
- package/lib/prepareTransaction.d.ts +26 -0
- package/lib/prepareTransaction.d.ts.map +1 -0
- package/lib/prepareTransaction.js +128 -0
- package/lib/prepareTransaction.js.map +1 -0
- package/lib/signOperation.d.ts +18 -0
- package/lib/signOperation.d.ts.map +1 -0
- package/lib/signOperation.js +88 -0
- package/lib/signOperation.js.map +1 -0
- package/lib/signer.d.ts +27 -0
- package/lib/signer.d.ts.map +1 -0
- package/lib/signer.js +3 -0
- package/lib/signer.js.map +1 -0
- package/lib/specs.d.ts +3 -0
- package/lib/specs.d.ts.map +1 -0
- package/lib/specs.js +238 -0
- package/lib/specs.js.map +1 -0
- package/lib/speculos-deviceActions.d.ts +8 -0
- package/lib/speculos-deviceActions.d.ts.map +1 -0
- package/lib/speculos-deviceActions.js +66 -0
- package/lib/speculos-deviceActions.js.map +1 -0
- package/lib/synchronization.d.ts +27 -0
- package/lib/synchronization.d.ts.map +1 -0
- package/lib/synchronization.js +220 -0
- package/lib/synchronization.js.map +1 -0
- package/lib/testUtils.d.ts +6 -0
- package/lib/testUtils.d.ts.map +1 -0
- package/lib/testUtils.js +111 -0
- package/lib/testUtils.js.map +1 -0
- package/lib/transaction.d.ts +43 -0
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js +124 -0
- package/lib/transaction.js.map +1 -0
- package/lib/types.d.ts +111 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib-es/__tests__/adapters.unit.test.d.ts +2 -0
- package/lib-es/__tests__/adapters.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/adapters.unit.test.js +450 -0
- package/lib-es/__tests__/adapters.unit.test.js.map +1 -0
- package/lib-es/__tests__/broadcast.unit.test.d.ts +2 -0
- package/lib-es/__tests__/broadcast.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/broadcast.unit.test.js +153 -0
- package/lib-es/__tests__/broadcast.unit.test.js.map +1 -0
- package/lib-es/__tests__/buildOptimisticOperation.unit.test.d.ts +2 -0
- package/lib-es/__tests__/buildOptimisticOperation.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/buildOptimisticOperation.unit.test.js +161 -0
- package/lib-es/__tests__/buildOptimisticOperation.unit.test.js.map +1 -0
- package/lib-es/__tests__/createTransaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/createTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/createTransaction.unit.test.js +45 -0
- package/lib-es/__tests__/createTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/deviceTransactionConfig.unit.test.d.ts +2 -0
- package/lib-es/__tests__/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/deviceTransactionConfig.unit.test.js +226 -0
- package/lib-es/__tests__/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib-es/__tests__/estimateMaxSpendable.unit.test.d.ts +2 -0
- package/lib-es/__tests__/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/estimateMaxSpendable.unit.test.js +117 -0
- package/lib-es/__tests__/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib-es/__tests__/gasTracker/index.unit.test.d.ts +2 -0
- package/lib-es/__tests__/gasTracker/index.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/gasTracker/index.unit.test.js +33 -0
- package/lib-es/__tests__/gasTracker/index.unit.test.js.map +1 -0
- package/lib-es/__tests__/gasTracker/ledger.unit.test.d.ts +2 -0
- package/lib-es/__tests__/gasTracker/ledger.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/gasTracker/ledger.unit.test.js +105 -0
- package/lib-es/__tests__/gasTracker/ledger.unit.test.js.map +1 -0
- package/lib-es/__tests__/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib-es/__tests__/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/getTransactionStatus.unit.test.js +211 -0
- package/lib-es/__tests__/getTransactionStatus.unit.test.js.map +1 -0
- package/lib-es/__tests__/hw-getAddress.unit.test.d.ts +2 -0
- package/lib-es/__tests__/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/hw-getAddress.unit.test.js +42 -0
- package/lib-es/__tests__/hw-getAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/logic.unit.test.d.ts +2 -0
- package/lib-es/__tests__/logic.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/logic.unit.test.js +268 -0
- package/lib-es/__tests__/logic.unit.test.js.map +1 -0
- package/lib-es/__tests__/preload.unit.test.d.ts +2 -0
- package/lib-es/__tests__/preload.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/preload.unit.test.js +121 -0
- package/lib-es/__tests__/preload.unit.test.js.map +1 -0
- package/lib-es/__tests__/prepareTransaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/prepareTransaction.unit.test.js +220 -0
- package/lib-es/__tests__/prepareTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/rpc.unit.test.d.ts +2 -0
- package/lib-es/__tests__/rpc.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/rpc.unit.test.js +416 -0
- package/lib-es/__tests__/rpc.unit.test.js.map +1 -0
- package/lib-es/__tests__/signOperation.unit.test.d.ts +2 -0
- package/lib-es/__tests__/signOperation.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/signOperation.unit.test.js +132 -0
- package/lib-es/__tests__/signOperation.unit.test.js.map +1 -0
- package/lib-es/__tests__/synchronization.unit.test.d.ts +2 -0
- package/lib-es/__tests__/synchronization.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/synchronization.unit.test.js +471 -0
- package/lib-es/__tests__/synchronization.unit.test.js.map +1 -0
- package/lib-es/__tests__/transaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/transaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/transaction.unit.test.js +173 -0
- package/lib-es/__tests__/transaction.unit.test.js.map +1 -0
- package/lib-es/abis/erc20.abi.json +222 -0
- package/lib-es/abis/optimismGasPriceOracle.abi.json +252 -0
- package/lib-es/adapters.d.ts +21 -0
- package/lib-es/adapters.d.ts.map +1 -0
- package/lib-es/adapters.js +109 -0
- package/lib-es/adapters.js.map +1 -0
- package/lib-es/api/explorer/etherscan.d.ts +24 -0
- package/lib-es/api/explorer/etherscan.d.ts.map +1 -0
- package/lib-es/api/explorer/etherscan.js +84 -0
- package/lib-es/api/explorer/etherscan.js.map +1 -0
- package/lib-es/api/explorer/index.d.ts +26 -0
- package/lib-es/api/explorer/index.d.ts.map +1 -0
- package/lib-es/api/explorer/index.js +16 -0
- package/lib-es/api/explorer/index.js.map +1 -0
- package/lib-es/api/gasTracker/index.d.ts +13 -0
- package/lib-es/api/gasTracker/index.d.ts.map +1 -0
- package/lib-es/api/gasTracker/index.js +17 -0
- package/lib-es/api/gasTracker/index.js.map +1 -0
- package/lib-es/api/gasTracker/ledger.d.ts +9 -0
- package/lib-es/api/gasTracker/ledger.d.ts.map +1 -0
- package/lib-es/api/gasTracker/ledger.js +83 -0
- package/lib-es/api/gasTracker/ledger.js.map +1 -0
- package/lib-es/api/rpc/index.d.ts +3 -0
- package/lib-es/api/rpc/index.d.ts.map +1 -0
- package/lib-es/api/rpc/index.js +4 -0
- package/lib-es/api/rpc/index.js.map +1 -0
- package/lib-es/api/rpc/rpc.common.d.ts +93 -0
- package/lib-es/api/rpc/rpc.common.d.ts.map +1 -0
- package/lib-es/api/rpc/rpc.common.js +267 -0
- package/lib-es/api/rpc/rpc.common.js.map +1 -0
- package/lib-es/api/rpc/rpc.native.d.ts +6 -0
- package/lib-es/api/rpc/rpc.native.d.ts.map +1 -0
- package/lib-es/api/rpc/rpc.native.js +7 -0
- package/lib-es/api/rpc/rpc.native.js.map +1 -0
- package/lib-es/bridge/js.d.ts +11 -0
- package/lib-es/bridge/js.d.ts.map +1 -0
- package/lib-es/bridge/js.js +49 -0
- package/lib-es/bridge/js.js.map +1 -0
- package/lib-es/bridge.integration.test.d.ts +14 -0
- package/lib-es/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/bridge.integration.test.js +79 -0
- package/lib-es/bridge.integration.test.js.map +1 -0
- package/lib-es/broadcast.d.ts +8 -0
- package/lib-es/broadcast.d.ts.map +1 -0
- package/lib-es/broadcast.js +21 -0
- package/lib-es/broadcast.js.map +1 -0
- package/lib-es/buildOptimisticOperation.d.ts +16 -0
- package/lib-es/buildOptimisticOperation.d.ts.map +1 -0
- package/lib-es/buildOptimisticOperation.js +71 -0
- package/lib-es/buildOptimisticOperation.js.map +1 -0
- package/lib-es/cli-transaction.d.ts +2 -0
- package/lib-es/cli-transaction.d.ts.map +1 -0
- package/lib-es/cli-transaction.js +6 -0
- package/lib-es/cli-transaction.js.map +1 -0
- package/lib-es/createTransaction.d.ts +9 -0
- package/lib-es/createTransaction.d.ts.map +1 -0
- package/lib-es/createTransaction.js +25 -0
- package/lib-es/createTransaction.js.map +1 -0
- package/lib-es/datasets/ethereum.scanAccounts.1.d.ts +7 -0
- package/lib-es/datasets/ethereum.scanAccounts.1.d.ts.map +1 -0
- package/lib-es/datasets/ethereum.scanAccounts.1.js +49 -0
- package/lib-es/datasets/ethereum.scanAccounts.1.js.map +1 -0
- package/lib-es/datasets/ethereum1.d.ts +3 -0
- package/lib-es/datasets/ethereum1.d.ts.map +1 -0
- package/lib-es/datasets/ethereum1.js +19 -0
- package/lib-es/datasets/ethereum1.js.map +1 -0
- package/lib-es/datasets/ethereum2.d.ts +3 -0
- package/lib-es/datasets/ethereum2.d.ts.map +1 -0
- package/lib-es/datasets/ethereum2.js +19 -0
- package/lib-es/datasets/ethereum2.js.map +1 -0
- package/lib-es/datasets/ethereum_classic.d.ts +5 -0
- package/lib-es/datasets/ethereum_classic.d.ts.map +1 -0
- package/lib-es/datasets/ethereum_classic.js +67 -0
- package/lib-es/datasets/ethereum_classic.js.map +1 -0
- package/lib-es/deviceTransactionConfig.d.ts +15 -0
- package/lib-es/deviceTransactionConfig.d.ts.map +1 -0
- package/lib-es/deviceTransactionConfig.js +42 -0
- package/lib-es/deviceTransactionConfig.js.map +1 -0
- package/lib-es/errors.d.ts +16 -0
- package/lib-es/errors.d.ts.map +1 -0
- package/lib-es/errors.js +8 -0
- package/lib-es/errors.js.map +1 -0
- package/lib-es/estimateMaxSpendable.d.ts +4 -0
- package/lib-es/estimateMaxSpendable.d.ts.map +1 -0
- package/lib-es/estimateMaxSpendable.js +19 -0
- package/lib-es/estimateMaxSpendable.js.map +1 -0
- package/lib-es/getTransactionStatus.d.ts +23 -0
- package/lib-es/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/getTransactionStatus.js +125 -0
- package/lib-es/getTransactionStatus.js.map +1 -0
- package/lib-es/hw-getAddress.d.ts +6 -0
- package/lib-es/hw-getAddress.d.ts.map +1 -0
- package/lib-es/hw-getAddress.js +23 -0
- package/lib-es/hw-getAddress.js.map +1 -0
- package/lib-es/logic.d.ts +31 -0
- package/lib-es/logic.d.ts.map +1 -0
- package/lib-es/logic.js +119 -0
- package/lib-es/logic.js.map +1 -0
- package/lib-es/preload.d.ts +6 -0
- package/lib-es/preload.d.ts.map +1 -0
- package/lib-es/preload.js +49 -0
- package/lib-es/preload.js.map +1 -0
- package/lib-es/prepareTransaction.d.ts +26 -0
- package/lib-es/prepareTransaction.d.ts.map +1 -0
- package/lib-es/prepareTransaction.js +118 -0
- package/lib-es/prepareTransaction.js.map +1 -0
- package/lib-es/signOperation.d.ts +18 -0
- package/lib-es/signOperation.d.ts.map +1 -0
- package/lib-es/signOperation.js +83 -0
- package/lib-es/signOperation.js.map +1 -0
- package/lib-es/signer.d.ts +27 -0
- package/lib-es/signer.d.ts.map +1 -0
- package/lib-es/signer.js +2 -0
- package/lib-es/signer.js.map +1 -0
- package/lib-es/specs.d.ts +3 -0
- package/lib-es/specs.d.ts.map +1 -0
- package/lib-es/specs.js +233 -0
- package/lib-es/specs.js.map +1 -0
- package/lib-es/speculos-deviceActions.d.ts +8 -0
- package/lib-es/speculos-deviceActions.d.ts.map +1 -0
- package/lib-es/speculos-deviceActions.js +63 -0
- package/lib-es/speculos-deviceActions.js.map +1 -0
- package/lib-es/synchronization.d.ts +27 -0
- package/lib-es/synchronization.d.ts.map +1 -0
- package/lib-es/synchronization.js +212 -0
- package/lib-es/synchronization.js.map +1 -0
- package/lib-es/testUtils.d.ts +6 -0
- package/lib-es/testUtils.d.ts.map +1 -0
- package/lib-es/testUtils.js +102 -0
- package/lib-es/testUtils.js.map +1 -0
- package/lib-es/transaction.d.ts +43 -0
- package/lib-es/transaction.d.ts.map +1 -0
- package/lib-es/transaction.js +112 -0
- package/lib-es/transaction.js.map +1 -0
- package/lib-es/types.d.ts +111 -0
- package/lib-es/types.d.ts.map +1 -0
- package/lib-es/types.js +2 -0
- package/lib-es/types.js.map +1 -0
- package/package.json +8 -23
- package/src/__tests__/adapters.unit.test.ts +22 -52
- package/src/__tests__/broadcast.unit.test.ts +9 -27
- package/src/__tests__/buildOptimisticOperation.unit.test.ts +4 -4
- package/src/__tests__/deviceTransactionConfig.unit.test.ts +7 -7
- package/src/__tests__/estimateMaxSpendable.unit.test.ts +2 -4
- package/src/__tests__/gasTracker/index.unit.test.ts +36 -0
- package/src/__tests__/gasTracker/ledger.unit.test.ts +108 -0
- package/src/__tests__/getTransactionStatus.unit.test.ts +35 -40
- package/src/__tests__/hw-getAddress.unit.test.ts +15 -2
- package/src/__tests__/logic.unit.test.ts +25 -72
- package/src/__tests__/preload.unit.test.ts +3 -9
- package/src/__tests__/prepareTransaction.unit.test.ts +131 -76
- package/src/__tests__/rpc.unit.test.ts +46 -80
- package/src/__tests__/signOperation.unit.test.ts +27 -25
- package/src/__tests__/synchronization.unit.test.ts +101 -153
- package/src/__tests__/transaction.unit.test.ts +6 -14
- package/src/adapters.ts +8 -18
- package/src/api/{etherscan.ts → explorer/etherscan.ts} +14 -29
- package/src/api/explorer/index.ts +34 -0
- package/src/api/gasTracker/index.ts +31 -0
- package/src/api/gasTracker/ledger.ts +103 -0
- package/src/api/{rpc.common.ts → rpc/rpc.common.ts} +41 -64
- package/src/bridge/js.ts +15 -22
- package/src/bridge.integration.test.ts +3 -10
- package/src/broadcast.ts +3 -7
- package/src/buildOptimisticOperation.ts +7 -17
- package/src/cli-transaction.ts +1 -7
- package/src/createTransaction.ts +14 -15
- package/src/deviceTransactionConfig.ts +1 -1
- package/src/errors.ts +6 -0
- package/src/estimateMaxSpendable.ts +14 -11
- package/src/getTransactionStatus.ts +41 -52
- package/src/hw-getAddress.ts +18 -19
- package/src/logic.ts +5 -15
- package/src/preload.ts +6 -16
- package/src/prepareTransaction.ts +30 -31
- package/src/signOperation.ts +57 -69
- package/src/signer.ts +35 -0
- package/src/specs.ts +27 -52
- package/src/speculos-deviceActions.ts +56 -65
- package/src/synchronization.ts +21 -60
- package/src/testUtils.ts +5 -19
- package/src/transaction.ts +6 -10
- package/src/types.ts +6 -0
- /package/src/api/{rpc.ts → rpc/index.ts} +0 -0
- /package/src/api/{rpc.native.ts → rpc/rpc.native.ts} +0 -0
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
encodeAccountId,
|
|
3
|
-
encodeTokenAccountId,
|
|
4
|
-
} from "@ledgerhq/coin-framework/account/index";
|
|
1
|
+
import { encodeAccountId, encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
|
|
5
2
|
import { findTokenById } from "@ledgerhq/cryptoassets";
|
|
6
3
|
import { Operation } from "@ledgerhq/types-live";
|
|
7
4
|
import BigNumber from "bignumber.js";
|
|
@@ -82,9 +79,7 @@ describe("EVM Family", () => {
|
|
|
82
79
|
gasPrice: ethers.BigNumber.from(10000),
|
|
83
80
|
};
|
|
84
81
|
|
|
85
|
-
expect(transactionToEthersTransaction(legacyTx)).toEqual(
|
|
86
|
-
legacyEthersTx
|
|
87
|
-
);
|
|
82
|
+
expect(transactionToEthersTransaction(legacyTx)).toEqual(legacyEthersTx);
|
|
88
83
|
});
|
|
89
84
|
});
|
|
90
85
|
|
|
@@ -95,8 +90,7 @@ describe("EVM Family", () => {
|
|
|
95
90
|
timeStamp: "1654646570",
|
|
96
91
|
hash: "0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338",
|
|
97
92
|
nonce: "7",
|
|
98
|
-
blockHash:
|
|
99
|
-
"0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
|
|
93
|
+
blockHash: "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
|
|
100
94
|
transactionIndex: "27",
|
|
101
95
|
from: "0x9aa99c23f67c81701c772b106b4f83f6e858dd2e",
|
|
102
96
|
to: "0xc5102fe9359fd9a28f877a67e36b0f050d81a3cc",
|
|
@@ -127,8 +121,7 @@ describe("EVM Family", () => {
|
|
|
127
121
|
id: "js:2:ethereum:0x9aa99c23f67c81701c772b106b4f83f6e858dd2e:-0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338-FEES",
|
|
128
122
|
hash: "0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338",
|
|
129
123
|
accountId,
|
|
130
|
-
blockHash:
|
|
131
|
-
"0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
|
|
124
|
+
blockHash: "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
|
|
132
125
|
blockHeight: 14923692,
|
|
133
126
|
recipients: ["0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC"],
|
|
134
127
|
senders: ["0x9AA99C23F67c81701C772B106b4F83f6e858dd2E"],
|
|
@@ -140,9 +133,7 @@ describe("EVM Family", () => {
|
|
|
140
133
|
extra: {},
|
|
141
134
|
};
|
|
142
135
|
|
|
143
|
-
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
|
|
144
|
-
expectedOperation
|
|
145
|
-
);
|
|
136
|
+
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
146
137
|
});
|
|
147
138
|
|
|
148
139
|
it("should convert a etherscan-like coin out operation (from their API) to a Ledger Live Operation", () => {
|
|
@@ -151,8 +142,7 @@ describe("EVM Family", () => {
|
|
|
151
142
|
timeStamp: "1639544926",
|
|
152
143
|
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
153
144
|
nonce: "11898499",
|
|
154
|
-
blockHash:
|
|
155
|
-
"0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
145
|
+
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
156
146
|
transactionIndex: "394",
|
|
157
147
|
from: "0x829bd824b016326a401d083b33d092293333a830",
|
|
158
148
|
to: "0x26e3fd2dec89bf645ba7b41c4ddfad8454ee6245",
|
|
@@ -182,8 +172,7 @@ describe("EVM Family", () => {
|
|
|
182
172
|
id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-OUT",
|
|
183
173
|
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
184
174
|
accountId,
|
|
185
|
-
blockHash:
|
|
186
|
-
"0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
175
|
+
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
187
176
|
blockHeight: 13807766,
|
|
188
177
|
recipients: ["0x26E3fd2dEc89bF645BA7b41c4DdFad8454Ee6245"],
|
|
189
178
|
senders: ["0x829BD824B016326A401d083B33D092293333A830"],
|
|
@@ -195,9 +184,7 @@ describe("EVM Family", () => {
|
|
|
195
184
|
extra: {},
|
|
196
185
|
};
|
|
197
186
|
|
|
198
|
-
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
|
|
199
|
-
expectedOperation
|
|
200
|
-
);
|
|
187
|
+
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
201
188
|
});
|
|
202
189
|
|
|
203
190
|
it("should convert a etherscan-like coin in operation (from their API) to a Ledger Live Operation", () => {
|
|
@@ -206,8 +193,7 @@ describe("EVM Family", () => {
|
|
|
206
193
|
timeStamp: "1639544926",
|
|
207
194
|
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
208
195
|
nonce: "11898499",
|
|
209
|
-
blockHash:
|
|
210
|
-
"0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
196
|
+
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
211
197
|
transactionIndex: "394",
|
|
212
198
|
from: "0x26e3fd2dec89bf645ba7b41c4ddfad8454ee6245",
|
|
213
199
|
to: "0x829bd824b016326a401d083b33d092293333a830",
|
|
@@ -237,8 +223,7 @@ describe("EVM Family", () => {
|
|
|
237
223
|
id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-IN",
|
|
238
224
|
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
239
225
|
accountId,
|
|
240
|
-
blockHash:
|
|
241
|
-
"0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
226
|
+
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
242
227
|
blockHeight: 13807766,
|
|
243
228
|
recipients: ["0x829BD824B016326A401d083B33D092293333A830"],
|
|
244
229
|
senders: ["0x26E3fd2dEc89bF645BA7b41c4DdFad8454Ee6245"],
|
|
@@ -250,9 +235,7 @@ describe("EVM Family", () => {
|
|
|
250
235
|
extra: {},
|
|
251
236
|
};
|
|
252
237
|
|
|
253
|
-
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
|
|
254
|
-
expectedOperation
|
|
255
|
-
);
|
|
238
|
+
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
256
239
|
});
|
|
257
240
|
|
|
258
241
|
it("should convert a etherscan-like coin none operation (from their API) to a Ledger Live Operation", () => {
|
|
@@ -261,8 +244,7 @@ describe("EVM Family", () => {
|
|
|
261
244
|
timeStamp: "1639544926",
|
|
262
245
|
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
263
246
|
nonce: "11898499",
|
|
264
|
-
blockHash:
|
|
265
|
-
"0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
247
|
+
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
266
248
|
transactionIndex: "394",
|
|
267
249
|
from: "0x6bfd74c0996f269bcece59191eff667b3dfd73b9",
|
|
268
250
|
to: "0x02a357476a300c89ce27d7d4c7e57bbd2dd3f006",
|
|
@@ -292,8 +274,7 @@ describe("EVM Family", () => {
|
|
|
292
274
|
id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-NONE",
|
|
293
275
|
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
294
276
|
accountId,
|
|
295
|
-
blockHash:
|
|
296
|
-
"0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
277
|
+
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
297
278
|
blockHeight: 13807766,
|
|
298
279
|
recipients: ["0x02a357476A300c89Ce27D7D4C7E57Bbd2DD3f006"],
|
|
299
280
|
senders: ["0x6bfD74C0996F269Bcece59191EFf667b3dFD73b9"],
|
|
@@ -305,9 +286,7 @@ describe("EVM Family", () => {
|
|
|
305
286
|
extra: {},
|
|
306
287
|
};
|
|
307
288
|
|
|
308
|
-
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
|
|
309
|
-
expectedOperation
|
|
310
|
-
);
|
|
289
|
+
expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
311
290
|
});
|
|
312
291
|
});
|
|
313
292
|
|
|
@@ -318,8 +297,7 @@ describe("EVM Family", () => {
|
|
|
318
297
|
timeStamp: "1671717983",
|
|
319
298
|
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
320
299
|
nonce: "53",
|
|
321
|
-
blockHash:
|
|
322
|
-
"0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
300
|
+
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
323
301
|
from: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
324
302
|
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb41",
|
|
325
303
|
to: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
|
|
@@ -344,9 +322,7 @@ describe("EVM Family", () => {
|
|
|
344
322
|
derivationMode: "",
|
|
345
323
|
});
|
|
346
324
|
|
|
347
|
-
expect(etherscanERC20EventToOperation(accountId, etherscanOp)).toEqual(
|
|
348
|
-
null
|
|
349
|
-
);
|
|
325
|
+
expect(etherscanERC20EventToOperation(accountId, etherscanOp)).toEqual(null);
|
|
350
326
|
});
|
|
351
327
|
|
|
352
328
|
it("should convert a etherscan-like usdc out event (from their API) to a Ledger Live Operation", () => {
|
|
@@ -355,8 +331,7 @@ describe("EVM Family", () => {
|
|
|
355
331
|
timeStamp: "1671717983",
|
|
356
332
|
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
357
333
|
nonce: "53",
|
|
358
|
-
blockHash:
|
|
359
|
-
"0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
334
|
+
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
360
335
|
from: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
361
336
|
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
362
337
|
to: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
|
|
@@ -387,8 +362,7 @@ describe("EVM Family", () => {
|
|
|
387
362
|
id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-OUT",
|
|
388
363
|
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
389
364
|
accountId: tokenAccountId,
|
|
390
|
-
blockHash:
|
|
391
|
-
"0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
365
|
+
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
392
366
|
blockHeight: 16240731,
|
|
393
367
|
senders: ["0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"],
|
|
394
368
|
recipients: ["0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"],
|
|
@@ -413,8 +387,7 @@ describe("EVM Family", () => {
|
|
|
413
387
|
timeStamp: "1671717983",
|
|
414
388
|
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
415
389
|
nonce: "53",
|
|
416
|
-
blockHash:
|
|
417
|
-
"0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
390
|
+
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
418
391
|
from: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
|
|
419
392
|
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
420
393
|
to: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
@@ -445,8 +418,7 @@ describe("EVM Family", () => {
|
|
|
445
418
|
id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-IN",
|
|
446
419
|
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
447
420
|
accountId: tokenAccountId,
|
|
448
|
-
blockHash:
|
|
449
|
-
"0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
421
|
+
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
450
422
|
blockHeight: 16240731,
|
|
451
423
|
senders: ["0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"],
|
|
452
424
|
recipients: ["0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"],
|
|
@@ -471,8 +443,7 @@ describe("EVM Family", () => {
|
|
|
471
443
|
timeStamp: "1671717983",
|
|
472
444
|
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
473
445
|
nonce: "53",
|
|
474
|
-
blockHash:
|
|
475
|
-
"0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
446
|
+
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
476
447
|
from: "0x6bfd74c0996f269bcece59191eff667b3dfd73b9",
|
|
477
448
|
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
478
449
|
to: "0x02a357476a300c89ce27d7d4c7e57bbd2dd3f006",
|
|
@@ -503,8 +474,7 @@ describe("EVM Family", () => {
|
|
|
503
474
|
id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-NONE",
|
|
504
475
|
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
505
476
|
accountId: tokenAccountId,
|
|
506
|
-
blockHash:
|
|
507
|
-
"0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
477
|
+
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
508
478
|
blockHeight: 16240731,
|
|
509
479
|
recipients: ["0x02a357476A300c89Ce27D7D4C7E57Bbd2DD3f006"],
|
|
510
480
|
senders: ["0x6bfD74C0996F269Bcece59191EFf667b3dFD73b9"],
|
|
@@ -3,7 +3,7 @@ import { getCryptoCurrencyById, getTokenById } from "@ledgerhq/cryptoassets";
|
|
|
3
3
|
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
4
|
import { Account, TokenAccount } from "@ledgerhq/types-live";
|
|
5
5
|
import BigNumber from "bignumber.js";
|
|
6
|
-
import * as API from "../api/rpc.common";
|
|
6
|
+
import * as API from "../api/rpc/rpc.common";
|
|
7
7
|
import broadcast from "../broadcast";
|
|
8
8
|
import buildOptimisticOperation from "../buildOptimisticOperation";
|
|
9
9
|
import { getEstimatedFees } from "../logic";
|
|
@@ -14,12 +14,12 @@ const currency: CryptoCurrency = getCryptoCurrencyById("ethereum");
|
|
|
14
14
|
const tokenCurrency = getTokenById("ethereum/erc20/usd__coin");
|
|
15
15
|
const tokenAccount: TokenAccount = makeTokenAccount(
|
|
16
16
|
"0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
|
|
17
|
-
tokenCurrency
|
|
17
|
+
tokenCurrency,
|
|
18
18
|
);
|
|
19
19
|
const account: Account = makeAccount(
|
|
20
20
|
"0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
|
|
21
21
|
currency,
|
|
22
|
-
[tokenAccount]
|
|
22
|
+
[tokenAccount],
|
|
23
23
|
);
|
|
24
24
|
const mockedBroadcastResponse = {
|
|
25
25
|
hash: "0xH4sH",
|
|
@@ -58,10 +58,7 @@ describe("EVM Family", () => {
|
|
|
58
58
|
type: 2,
|
|
59
59
|
};
|
|
60
60
|
const estimatedFees = getEstimatedFees(coinTransaction);
|
|
61
|
-
const optimisticCoinOperation = buildOptimisticOperation(
|
|
62
|
-
account,
|
|
63
|
-
coinTransaction
|
|
64
|
-
);
|
|
61
|
+
const optimisticCoinOperation = buildOptimisticOperation(account, coinTransaction);
|
|
65
62
|
|
|
66
63
|
const finalOperation = await broadcast({
|
|
67
64
|
account,
|
|
@@ -74,11 +71,7 @@ describe("EVM Family", () => {
|
|
|
74
71
|
|
|
75
72
|
expect(API.broadcastTransaction).toBeCalled();
|
|
76
73
|
expect(finalOperation).toEqual({
|
|
77
|
-
id: encodeOperationId(
|
|
78
|
-
account.id,
|
|
79
|
-
mockedBroadcastResponse.hash,
|
|
80
|
-
"OUT"
|
|
81
|
-
),
|
|
74
|
+
id: encodeOperationId(account.id, mockedBroadcastResponse.hash, "OUT"),
|
|
82
75
|
hash: mockedBroadcastResponse.hash,
|
|
83
76
|
blockNumber: mockedBroadcastResponse.blockNumber,
|
|
84
77
|
blockHeight: mockedBroadcastResponse.blockNumber,
|
|
@@ -104,7 +97,7 @@ describe("EVM Family", () => {
|
|
|
104
97
|
recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
|
|
105
98
|
data: Buffer.from(
|
|
106
99
|
"a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
|
|
107
|
-
"hex"
|
|
100
|
+
"hex",
|
|
108
101
|
),
|
|
109
102
|
feesStrategy: "custom",
|
|
110
103
|
family: "evm",
|
|
@@ -117,10 +110,7 @@ describe("EVM Family", () => {
|
|
|
117
110
|
type: 2,
|
|
118
111
|
};
|
|
119
112
|
const estimatedFees = getEstimatedFees(tokenTransaction);
|
|
120
|
-
const optimisticTokenOperation = buildOptimisticOperation(
|
|
121
|
-
account,
|
|
122
|
-
tokenTransaction
|
|
123
|
-
);
|
|
113
|
+
const optimisticTokenOperation = buildOptimisticOperation(account, tokenTransaction);
|
|
124
114
|
|
|
125
115
|
const finalOperation = await broadcast({
|
|
126
116
|
account,
|
|
@@ -133,11 +123,7 @@ describe("EVM Family", () => {
|
|
|
133
123
|
|
|
134
124
|
expect(API.broadcastTransaction).toBeCalled();
|
|
135
125
|
expect(finalOperation).toEqual({
|
|
136
|
-
id: encodeOperationId(
|
|
137
|
-
account.id,
|
|
138
|
-
mockedBroadcastResponse.hash,
|
|
139
|
-
"FEES"
|
|
140
|
-
),
|
|
126
|
+
id: encodeOperationId(account.id, mockedBroadcastResponse.hash, "FEES"),
|
|
141
127
|
hash: mockedBroadcastResponse.hash,
|
|
142
128
|
blockNumber: mockedBroadcastResponse.blockNumber,
|
|
143
129
|
blockHeight: mockedBroadcastResponse.blockNumber,
|
|
@@ -152,11 +138,7 @@ describe("EVM Family", () => {
|
|
|
152
138
|
date: new Date(mockedBroadcastResponse.timestamp * 1000),
|
|
153
139
|
subOperations: [
|
|
154
140
|
{
|
|
155
|
-
id: encodeOperationId(
|
|
156
|
-
tokenAccount.id,
|
|
157
|
-
mockedBroadcastResponse.hash,
|
|
158
|
-
"OUT"
|
|
159
|
-
),
|
|
141
|
+
id: encodeOperationId(tokenAccount.id, mockedBroadcastResponse.hash, "OUT"),
|
|
160
142
|
hash: mockedBroadcastResponse.hash,
|
|
161
143
|
blockNumber: mockedBroadcastResponse.blockNumber,
|
|
162
144
|
blockHeight: mockedBroadcastResponse.blockNumber,
|
|
@@ -11,7 +11,7 @@ const tokenCurrency = getTokenById("ethereum/erc20/usd__coin");
|
|
|
11
11
|
const tokenAccount = {
|
|
12
12
|
...makeTokenAccount(
|
|
13
13
|
"0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
|
|
14
|
-
tokenCurrency
|
|
14
|
+
tokenCurrency,
|
|
15
15
|
),
|
|
16
16
|
balance: new BigNumber(150),
|
|
17
17
|
spendableBalance: new BigNumber(150),
|
|
@@ -19,7 +19,7 @@ const tokenAccount = {
|
|
|
19
19
|
const account = makeAccount(
|
|
20
20
|
"0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
|
|
21
21
|
currency,
|
|
22
|
-
[tokenAccount]
|
|
22
|
+
[tokenAccount],
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
describe("EVM Family", () => {
|
|
@@ -70,7 +70,7 @@ describe("EVM Family", () => {
|
|
|
70
70
|
recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
|
|
71
71
|
data: Buffer.from(
|
|
72
72
|
"a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
|
|
73
|
-
"hex"
|
|
73
|
+
"hex",
|
|
74
74
|
),
|
|
75
75
|
feesStrategy: "custom",
|
|
76
76
|
family: "evm",
|
|
@@ -128,7 +128,7 @@ describe("EVM Family", () => {
|
|
|
128
128
|
recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
|
|
129
129
|
data: Buffer.from(
|
|
130
130
|
"a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
|
|
131
|
-
"hex"
|
|
131
|
+
"hex",
|
|
132
132
|
),
|
|
133
133
|
feesStrategy: "custom",
|
|
134
134
|
family: "evm",
|
|
@@ -38,7 +38,7 @@ describe("EVM Family", () => {
|
|
|
38
38
|
parentAccount: undefined,
|
|
39
39
|
transaction: coinTransaction,
|
|
40
40
|
status,
|
|
41
|
-
})
|
|
41
|
+
}),
|
|
42
42
|
).toEqual([
|
|
43
43
|
{ type: "amount", label: "Amount" },
|
|
44
44
|
{
|
|
@@ -80,7 +80,7 @@ describe("EVM Family", () => {
|
|
|
80
80
|
parentAccount: undefined,
|
|
81
81
|
transaction: coinTransaction,
|
|
82
82
|
status,
|
|
83
|
-
})
|
|
83
|
+
}),
|
|
84
84
|
).toEqual([
|
|
85
85
|
{ type: "amount", label: "Amount" },
|
|
86
86
|
{
|
|
@@ -128,7 +128,7 @@ describe("EVM Family", () => {
|
|
|
128
128
|
parentAccount: undefined,
|
|
129
129
|
transaction: coinTransaction,
|
|
130
130
|
status,
|
|
131
|
-
})
|
|
131
|
+
}),
|
|
132
132
|
).toEqual([
|
|
133
133
|
{ type: "amount", label: "Amount" },
|
|
134
134
|
{
|
|
@@ -153,7 +153,7 @@ describe("EVM Family", () => {
|
|
|
153
153
|
recipient: "0x997e135e96114c0E84FFc58754552368E4abf329", // celinedion.eth
|
|
154
154
|
data: Buffer.from(
|
|
155
155
|
"a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
|
|
156
|
-
"hex"
|
|
156
|
+
"hex",
|
|
157
157
|
),
|
|
158
158
|
feesStrategy: "custom",
|
|
159
159
|
family: "evm",
|
|
@@ -173,7 +173,7 @@ describe("EVM Family", () => {
|
|
|
173
173
|
parentAccount: account,
|
|
174
174
|
transaction: tokenTransaction,
|
|
175
175
|
status,
|
|
176
|
-
})
|
|
176
|
+
}),
|
|
177
177
|
).toEqual([
|
|
178
178
|
{ type: "amount", label: "Amount" },
|
|
179
179
|
{
|
|
@@ -198,7 +198,7 @@ describe("EVM Family", () => {
|
|
|
198
198
|
recipient: "0x997e135e96114c0E84FFc58754552368E4abf329", // celinedion.eth
|
|
199
199
|
data: Buffer.from(
|
|
200
200
|
"a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
|
|
201
|
-
"hex"
|
|
201
|
+
"hex",
|
|
202
202
|
),
|
|
203
203
|
feesStrategy: "custom",
|
|
204
204
|
family: "evm",
|
|
@@ -224,7 +224,7 @@ describe("EVM Family", () => {
|
|
|
224
224
|
parentAccount: account,
|
|
225
225
|
transaction: tokenTransaction,
|
|
226
226
|
status,
|
|
227
|
-
})
|
|
227
|
+
}),
|
|
228
228
|
).toEqual([
|
|
229
229
|
{ type: "amount", label: "Amount" },
|
|
230
230
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCryptoCurrencyById, getTokenById } from "@ledgerhq/cryptoassets";
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
|
-
import * as rpcAPI from "../api/rpc.common";
|
|
3
|
+
import * as rpcAPI from "../api/rpc/rpc.common";
|
|
4
4
|
import { estimateMaxSpendable } from "../estimateMaxSpendable";
|
|
5
5
|
import { makeAccount, makeTokenAccount } from "../testUtils";
|
|
6
6
|
import { EvmTransactionEIP1559, EvmTransactionLegacy } from "../types";
|
|
@@ -14,9 +14,7 @@ const account = {
|
|
|
14
14
|
balance: new BigNumber(42069000000),
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
jest
|
|
18
|
-
.spyOn(rpcAPI, "getGasEstimation")
|
|
19
|
-
.mockImplementation(async () => new BigNumber(21000));
|
|
17
|
+
jest.spyOn(rpcAPI, "getGasEstimation").mockImplementation(async () => new BigNumber(21000));
|
|
20
18
|
jest.spyOn(rpcAPI, "getFeesEstimation").mockImplementation(async () => ({
|
|
21
19
|
gasPrice: new BigNumber(10000),
|
|
22
20
|
maxFeePerGas: new BigNumber(10000),
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CryptoCurrency, CryptoCurrencyId } from "@ledgerhq/types-cryptoassets";
|
|
2
|
+
import { getGasTracker } from "../../api/gasTracker";
|
|
3
|
+
import { getGasOptions as ledgerGetGasOptions } from "../../api/gasTracker/ledger";
|
|
4
|
+
|
|
5
|
+
const fakeCurrency: Partial<CryptoCurrency> = {
|
|
6
|
+
id: "my_new_chain" as CryptoCurrencyId,
|
|
7
|
+
ethereumLikeInfo: {
|
|
8
|
+
chainId: 1,
|
|
9
|
+
gasTracker: {
|
|
10
|
+
type: "ledger",
|
|
11
|
+
uri: "my-gas-tracker.com",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
units: [{ code: "ETH", name: "ETH", magnitude: 18 }],
|
|
15
|
+
};
|
|
16
|
+
const fakeCurrencyWithoutGasTracker: Partial<CryptoCurrency> = {
|
|
17
|
+
id: "my_new_chain" as CryptoCurrencyId,
|
|
18
|
+
ethereumLikeInfo: {
|
|
19
|
+
chainId: 1,
|
|
20
|
+
},
|
|
21
|
+
units: [{ code: "ETH", name: "ETH", magnitude: 18 }],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
describe("EVM Family", () => {
|
|
25
|
+
describe("gasTracker", () => {
|
|
26
|
+
it("should return null if no gas tracker is found", () => {
|
|
27
|
+
expect(getGasTracker(fakeCurrencyWithoutGasTracker as CryptoCurrency)).toBeNull();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should return a gas tracker for type 'ledger'", () => {
|
|
31
|
+
expect(getGasTracker(fakeCurrency as CryptoCurrency)).toEqual({
|
|
32
|
+
getGasOptions: ledgerGetGasOptions,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import network from "@ledgerhq/live-network/network";
|
|
2
|
+
import { CryptoCurrency, CryptoCurrencyId } from "@ledgerhq/types-cryptoassets";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
import { GasOptions } from "../../types";
|
|
5
|
+
import { getEnv, setEnv } from "@ledgerhq/live-env";
|
|
6
|
+
import { getGasOptions } from "../../api/gasTracker/ledger";
|
|
7
|
+
jest.mock("@ledgerhq/live-network/network");
|
|
8
|
+
|
|
9
|
+
const fakeCurrency: Partial<CryptoCurrency> = {
|
|
10
|
+
id: "ethereum" as CryptoCurrencyId,
|
|
11
|
+
ethereumLikeInfo: {
|
|
12
|
+
chainId: 1,
|
|
13
|
+
gasTracker: {
|
|
14
|
+
type: "ledger",
|
|
15
|
+
uri: "my-gas-tracker.com",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
units: [{ code: "ETH", name: "ETH", magnitude: 18 }],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
describe("EVM Family", () => {
|
|
22
|
+
describe("gasTracker", () => {
|
|
23
|
+
const originalEIP1559_BASE_FEE_MULTIPLIER: number = getEnv("EIP1559_BASE_FEE_MULTIPLIER");
|
|
24
|
+
|
|
25
|
+
beforeAll(() => {
|
|
26
|
+
setEnv("EIP1559_BASE_FEE_MULTIPLIER", 2);
|
|
27
|
+
});
|
|
28
|
+
afterAll(() => {
|
|
29
|
+
setEnv("EIP1559_BASE_FEE_MULTIPLIER", originalEIP1559_BASE_FEE_MULTIPLIER);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
const gastrackerBarometerMock = new Promise((resolve, _) => {
|
|
34
|
+
resolve({
|
|
35
|
+
data: {
|
|
36
|
+
low: "1",
|
|
37
|
+
medium: "2",
|
|
38
|
+
high: "3",
|
|
39
|
+
next_base: "4",
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// @ts-expect-error method is mocked
|
|
45
|
+
network.mockReturnValueOnce(gastrackerBarometerMock);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe("ledger", () => {
|
|
49
|
+
it("should return EIP-1559 gas options", async () => {
|
|
50
|
+
const gasOptions: GasOptions = await getGasOptions({
|
|
51
|
+
currency: fakeCurrency as CryptoCurrency,
|
|
52
|
+
options: {
|
|
53
|
+
useEIP1559: true,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const expectedGasOptions: GasOptions = {
|
|
58
|
+
slow: {
|
|
59
|
+
maxFeePerGas: new BigNumber(9),
|
|
60
|
+
maxPriorityFeePerGas: new BigNumber(1),
|
|
61
|
+
gasPrice: null,
|
|
62
|
+
},
|
|
63
|
+
medium: {
|
|
64
|
+
maxFeePerGas: new BigNumber(10),
|
|
65
|
+
maxPriorityFeePerGas: new BigNumber(2),
|
|
66
|
+
gasPrice: null,
|
|
67
|
+
},
|
|
68
|
+
fast: {
|
|
69
|
+
maxFeePerGas: new BigNumber(11),
|
|
70
|
+
maxPriorityFeePerGas: new BigNumber(3),
|
|
71
|
+
gasPrice: null,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
expect(gasOptions).toEqual(expectedGasOptions);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("should return legacy gas options", async () => {
|
|
79
|
+
const gasOptions: GasOptions = await getGasOptions({
|
|
80
|
+
currency: fakeCurrency as CryptoCurrency,
|
|
81
|
+
options: {
|
|
82
|
+
useEIP1559: false,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const expectedGasOptions: GasOptions = {
|
|
87
|
+
slow: {
|
|
88
|
+
maxFeePerGas: null,
|
|
89
|
+
maxPriorityFeePerGas: null,
|
|
90
|
+
gasPrice: new BigNumber(1),
|
|
91
|
+
},
|
|
92
|
+
medium: {
|
|
93
|
+
maxFeePerGas: null,
|
|
94
|
+
maxPriorityFeePerGas: null,
|
|
95
|
+
gasPrice: new BigNumber(2),
|
|
96
|
+
},
|
|
97
|
+
fast: {
|
|
98
|
+
maxFeePerGas: null,
|
|
99
|
+
maxPriorityFeePerGas: null,
|
|
100
|
+
gasPrice: new BigNumber(3),
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
expect(gasOptions).toEqual(expectedGasOptions);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|