@ledgerhq/coin-evm 0.3.0 → 0.4.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/jest.config.js +4 -0
- package/lib/__tests__/fixtures/common.fixtures.d.ts +9 -0
- package/lib/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
- package/lib/{testUtils.js → __tests__/fixtures/common.fixtures.js} +40 -9
- package/lib/__tests__/fixtures/common.fixtures.js.map +1 -0
- package/lib/__tests__/fixtures/etherscan.fixtures.d.ts +86 -0
- package/lib/__tests__/fixtures/etherscan.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/etherscan.fixtures.js +267 -0
- package/lib/__tests__/fixtures/etherscan.fixtures.js.map +1 -0
- package/lib/__tests__/fixtures/prepareTransaction.fixtures.d.ts +10 -0
- package/lib/__tests__/fixtures/prepareTransaction.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/prepareTransaction.fixtures.js +69 -0
- package/lib/__tests__/fixtures/prepareTransaction.fixtures.js.map +1 -0
- package/lib/__tests__/fixtures/synchronization.fixtures.d.ts +44 -0
- package/lib/__tests__/fixtures/synchronization.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/synchronization.fixtures.js +219 -0
- package/lib/__tests__/fixtures/synchronization.fixtures.js.map +1 -0
- package/lib/__tests__/fixtures/transaction.fixtures.d.ts +47 -0
- package/lib/__tests__/fixtures/transaction.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/transaction.fixtures.js +182 -0
- package/lib/__tests__/fixtures/transaction.fixtures.js.map +1 -0
- package/lib/__tests__/integration/bridge.integration.test.d.ts +7 -0
- package/lib/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
- package/lib/__tests__/integration/bridge.integration.test.js +74 -0
- package/lib/__tests__/integration/bridge.integration.test.js.map +1 -0
- package/lib/__tests__/unit/adapters.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/adapters.unit.test.js +989 -0
- package/lib/__tests__/unit/adapters.unit.test.js.map +1 -0
- package/lib/__tests__/unit/api/explorer/etherscan.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/api/explorer/etherscan.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/api/explorer/etherscan.unit.test.js +430 -0
- package/lib/__tests__/unit/api/explorer/etherscan.unit.test.js.map +1 -0
- package/lib/__tests__/unit/api/explorer/index.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/api/explorer/index.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/api/explorer/index.unit.test.js +49 -0
- package/lib/__tests__/unit/api/explorer/index.unit.test.js.map +1 -0
- package/lib/__tests__/unit/api/gasTracker/index.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/api/gasTracker/index.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{gasTracker → unit/api/gasTracker}/index.unit.test.js +3 -3
- package/lib/__tests__/unit/api/gasTracker/index.unit.test.js.map +1 -0
- package/lib/__tests__/unit/api/gasTracker/ledger.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{gasTracker → unit/api/gasTracker}/ledger.unit.test.js +2 -2
- package/lib/__tests__/unit/api/gasTracker/ledger.unit.test.js.map +1 -0
- package/lib/__tests__/unit/api/rpc/rpc.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{rpc.unit.test.js → unit/api/rpc/rpc.unit.test.js} +14 -14
- package/lib/__tests__/unit/api/rpc/rpc.unit.test.js.map +1 -0
- package/lib/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/broadcast.unit.test.js +335 -0
- package/lib/__tests__/unit/broadcast.unit.test.js.map +1 -0
- package/lib/__tests__/unit/buildOptimisticOperation.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{buildOptimisticOperation.unit.test.js → unit/buildOptimisticOperation.unit.test.js} +132 -6
- package/lib/__tests__/unit/buildOptimisticOperation.unit.test.js.map +1 -0
- package/lib/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{createTransaction.unit.test.js → unit/createTransaction.unit.test.js} +5 -5
- package/lib/__tests__/unit/createTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{deviceTransactionConfig.unit.test.js → unit/deviceTransactionConfig.unit.test.js} +123 -6
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{estimateMaxSpendable.unit.test.js → unit/estimateMaxSpendable.unit.test.js} +6 -6
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{getTransactionStatus.unit.test.js → unit/getTransactionStatus.unit.test.js} +76 -6
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{hw-getAddress.unit.test.js → unit/hw-getAddress.unit.test.js} +5 -1
- package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
- package/lib/__tests__/unit/hw-signMessage.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/hw-signMessage.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/hw-signMessage.unit.test.js +188 -0
- package/lib/__tests__/unit/hw-signMessage.unit.test.js.map +1 -0
- package/lib/__tests__/unit/logic.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{logic.unit.test.js → unit/logic.unit.test.js} +111 -20
- package/lib/__tests__/unit/logic.unit.test.js.map +1 -0
- package/lib/__tests__/unit/nftResolvers.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/nftResolvers.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/nftResolvers.unit.test.js +163 -0
- package/lib/__tests__/unit/nftResolvers.unit.test.js.map +1 -0
- package/lib/__tests__/unit/preload.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{preload.unit.test.js → unit/preload.unit.test.js} +3 -3
- package/lib/__tests__/unit/preload.unit.test.js.map +1 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.js +300 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{signOperation.unit.test.js → unit/signOperation.unit.test.js} +14 -17
- package/lib/__tests__/unit/signOperation.unit.test.js.map +1 -0
- package/lib/__tests__/unit/synchronization.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{synchronization.unit.test.js → unit/synchronization.unit.test.js} +139 -231
- package/lib/__tests__/unit/synchronization.unit.test.js.map +1 -0
- package/lib/__tests__/unit/transaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/{transaction.unit.test.js → unit/transaction.unit.test.js} +48 -80
- package/lib/__tests__/unit/transaction.unit.test.js.map +1 -0
- package/lib/abis/erc1155.abi.json +314 -0
- package/lib/abis/erc721.abi.json +346 -0
- package/lib/adapters.d.ts +18 -7
- package/lib/adapters.d.ts.map +1 -1
- package/lib/adapters.js +131 -46
- package/lib/adapters.js.map +1 -1
- package/lib/api/explorer/etherscan.d.ts +39 -11
- package/lib/api/explorer/etherscan.d.ts.map +1 -1
- package/lib/api/explorer/etherscan.js +151 -9
- package/lib/api/explorer/etherscan.js.map +1 -1
- package/lib/api/explorer/index.d.ts +7 -16
- package/lib/api/explorer/index.d.ts.map +1 -1
- package/lib/api/explorer/index.js.map +1 -1
- package/lib/api/nft/index.d.ts +24 -0
- package/lib/api/nft/index.d.ts.map +1 -0
- package/lib/api/nft/index.js +54 -0
- package/lib/api/nft/index.js.map +1 -0
- package/lib/api/rpc/index.native.d.ts.map +1 -1
- package/lib/api/rpc/index.native.js +1 -0
- package/lib/api/rpc/index.native.js.map +1 -1
- package/lib/api/rpc/rpc.common.d.ts +2 -2
- package/lib/api/rpc/rpc.common.d.ts.map +1 -1
- package/lib/api/rpc/rpc.common.js +3 -3
- package/lib/api/rpc/rpc.common.js.map +1 -1
- package/lib/bridge/js.d.ts +1 -1
- package/lib/bridge/js.d.ts.map +1 -1
- package/lib/bridge/js.js +10 -10
- package/lib/bridge/js.js.map +1 -1
- package/lib/broadcast.d.ts.map +1 -1
- package/lib/broadcast.js +9 -2
- package/lib/broadcast.js.map +1 -1
- package/lib/buildOptimisticOperation.d.ts +5 -1
- package/lib/buildOptimisticOperation.d.ts.map +1 -1
- package/lib/buildOptimisticOperation.js +46 -4
- package/lib/buildOptimisticOperation.js.map +1 -1
- package/lib/cli-transaction.d.ts.map +1 -1
- package/lib/cli-transaction.js +1 -0
- package/lib/cli-transaction.js.map +1 -1
- package/lib/datasets/ethereum1.d.ts.map +1 -1
- package/lib/datasets/ethereum1.js +3 -2
- package/lib/datasets/ethereum1.js.map +1 -1
- package/lib/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/deviceTransactionConfig.js +50 -0
- package/lib/deviceTransactionConfig.js.map +1 -1
- package/lib/errors.d.ts +9 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +7 -1
- package/lib/errors.js.map +1 -1
- package/lib/getTransactionStatus.d.ts +1 -0
- package/lib/getTransactionStatus.d.ts.map +1 -1
- package/lib/getTransactionStatus.js +25 -3
- package/lib/getTransactionStatus.js.map +1 -1
- package/lib/hw-signMessage.d.ts +15 -0
- package/lib/hw-signMessage.d.ts.map +1 -0
- package/lib/hw-signMessage.js +86 -0
- package/lib/hw-signMessage.js.map +1 -0
- package/lib/logic.d.ts +63 -1
- package/lib/logic.d.ts.map +1 -1
- package/lib/logic.js +98 -2
- package/lib/logic.js.map +1 -1
- package/lib/nftResolvers.d.ts +19 -0
- package/lib/nftResolvers.d.ts.map +1 -0
- package/lib/nftResolvers.js +58 -0
- package/lib/nftResolvers.js.map +1 -0
- package/lib/preload.d.ts.map +1 -1
- package/lib/preload.js +7 -3
- package/lib/preload.js.map +1 -1
- package/lib/prepareTransaction.d.ts +6 -1
- package/lib/prepareTransaction.d.ts.map +1 -1
- package/lib/prepareTransaction.js +69 -18
- package/lib/prepareTransaction.js.map +1 -1
- package/lib/signOperation.d.ts +1 -1
- package/lib/signOperation.d.ts.map +1 -1
- package/lib/signOperation.js +17 -6
- package/lib/signOperation.js.map +1 -1
- package/lib/signer.d.ts +24 -1
- package/lib/signer.d.ts.map +1 -1
- package/lib/specs.d.ts +3 -1
- package/lib/specs.d.ts.map +1 -1
- package/lib/specs.js +3 -3
- package/lib/specs.js.map +1 -1
- package/lib/speculos-deviceActions.d.ts.map +1 -1
- package/lib/speculos-deviceActions.js +2 -1
- package/lib/speculos-deviceActions.js.map +1 -1
- package/lib/synchronization.d.ts +7 -2
- package/lib/synchronization.d.ts.map +1 -1
- package/lib/synchronization.js +45 -45
- package/lib/synchronization.js.map +1 -1
- package/lib/transaction.d.ts +3 -4
- package/lib/transaction.d.ts.map +1 -1
- package/lib/transaction.js +58 -12
- package/lib/transaction.js.map +1 -1
- package/lib/types.d.ts +85 -10
- package/lib/types.d.ts.map +1 -1
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts +9 -0
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
- package/lib-es/{testUtils.js → __tests__/fixtures/common.fixtures.js} +36 -8
- package/lib-es/__tests__/fixtures/common.fixtures.js.map +1 -0
- package/lib-es/__tests__/fixtures/etherscan.fixtures.d.ts +86 -0
- package/lib-es/__tests__/fixtures/etherscan.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/etherscan.fixtures.js +264 -0
- package/lib-es/__tests__/fixtures/etherscan.fixtures.js.map +1 -0
- package/lib-es/__tests__/fixtures/prepareTransaction.fixtures.d.ts +10 -0
- package/lib-es/__tests__/fixtures/prepareTransaction.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/prepareTransaction.fixtures.js +62 -0
- package/lib-es/__tests__/fixtures/prepareTransaction.fixtures.js.map +1 -0
- package/lib-es/__tests__/fixtures/synchronization.fixtures.d.ts +44 -0
- package/lib-es/__tests__/fixtures/synchronization.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/synchronization.fixtures.js +190 -0
- package/lib-es/__tests__/fixtures/synchronization.fixtures.js.map +1 -0
- package/lib-es/__tests__/fixtures/transaction.fixtures.d.ts +47 -0
- package/lib-es/__tests__/fixtures/transaction.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/transaction.fixtures.js +176 -0
- package/lib-es/__tests__/fixtures/transaction.fixtures.js.map +1 -0
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts +7 -0
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/__tests__/integration/bridge.integration.test.js +71 -0
- package/lib-es/__tests__/integration/bridge.integration.test.js.map +1 -0
- package/lib-es/__tests__/unit/adapters.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/adapters.unit.test.js +984 -0
- package/lib-es/__tests__/unit/adapters.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/api/explorer/etherscan.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/api/explorer/etherscan.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/api/explorer/etherscan.unit.test.js +402 -0
- package/lib-es/__tests__/unit/api/explorer/etherscan.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/api/explorer/index.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/api/explorer/index.unit.test.js +44 -0
- package/lib-es/__tests__/unit/api/explorer/index.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/api/gasTracker/index.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{gasTracker → unit/api/gasTracker}/index.unit.test.js +3 -3
- package/lib-es/__tests__/unit/api/gasTracker/index.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/api/gasTracker/ledger.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{gasTracker → unit/api/gasTracker}/ledger.unit.test.js +2 -2
- package/lib-es/__tests__/unit/api/gasTracker/ledger.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/api/rpc/rpc.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{rpc.unit.test.js → unit/api/rpc/rpc.unit.test.js} +13 -13
- package/lib-es/__tests__/unit/api/rpc/rpc.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.js +307 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/buildOptimisticOperation.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{buildOptimisticOperation.unit.test.js → unit/buildOptimisticOperation.unit.test.js} +130 -4
- package/lib-es/__tests__/unit/buildOptimisticOperation.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{createTransaction.unit.test.js → unit/createTransaction.unit.test.js} +3 -3
- package/lib-es/__tests__/unit/createTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{deviceTransactionConfig.unit.test.js → unit/deviceTransactionConfig.unit.test.js} +121 -4
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{estimateMaxSpendable.unit.test.js → unit/estimateMaxSpendable.unit.test.js} +4 -4
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{getTransactionStatus.unit.test.js → unit/getTransactionStatus.unit.test.js} +74 -4
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{hw-getAddress.unit.test.js → unit/hw-getAddress.unit.test.js} +5 -1
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/hw-signMessage.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/hw-signMessage.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/hw-signMessage.unit.test.js +186 -0
- package/lib-es/__tests__/unit/hw-signMessage.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/logic.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{logic.unit.test.js → unit/logic.unit.test.js} +97 -6
- package/lib-es/__tests__/unit/logic.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/nftResolvers.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/nftResolvers.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/nftResolvers.unit.test.js +158 -0
- package/lib-es/__tests__/unit/nftResolvers.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/preload.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{preload.unit.test.js → unit/preload.unit.test.js} +3 -3
- package/lib-es/__tests__/unit/preload.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{prepareTransaction.unit.test.js → unit/prepareTransaction.unit.test.js} +134 -82
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{signOperation.unit.test.js → unit/signOperation.unit.test.js} +13 -16
- package/lib-es/__tests__/unit/signOperation.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/synchronization.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{synchronization.unit.test.js → unit/synchronization.unit.test.js} +115 -207
- package/lib-es/__tests__/unit/synchronization.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/transaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/{transaction.unit.test.js → unit/transaction.unit.test.js} +40 -72
- package/lib-es/__tests__/unit/transaction.unit.test.js.map +1 -0
- package/lib-es/abis/erc1155.abi.json +314 -0
- package/lib-es/abis/erc721.abi.json +346 -0
- package/lib-es/adapters.d.ts +18 -7
- package/lib-es/adapters.d.ts.map +1 -1
- package/lib-es/adapters.js +127 -44
- package/lib-es/adapters.js.map +1 -1
- package/lib-es/api/explorer/etherscan.d.ts +39 -11
- package/lib-es/api/explorer/etherscan.d.ts.map +1 -1
- package/lib-es/api/explorer/etherscan.js +146 -10
- package/lib-es/api/explorer/etherscan.js.map +1 -1
- package/lib-es/api/explorer/index.d.ts +7 -16
- package/lib-es/api/explorer/index.d.ts.map +1 -1
- package/lib-es/api/explorer/index.js.map +1 -1
- package/lib-es/api/nft/index.d.ts +24 -0
- package/lib-es/api/nft/index.d.ts.map +1 -0
- package/lib-es/api/nft/index.js +46 -0
- package/lib-es/api/nft/index.js.map +1 -0
- package/lib-es/api/rpc/index.native.d.ts.map +1 -1
- package/lib-es/api/rpc/index.native.js +1 -0
- package/lib-es/api/rpc/index.native.js.map +1 -1
- package/lib-es/api/rpc/rpc.common.d.ts +2 -2
- package/lib-es/api/rpc/rpc.common.d.ts.map +1 -1
- package/lib-es/api/rpc/rpc.common.js +3 -3
- package/lib-es/api/rpc/rpc.common.js.map +1 -1
- package/lib-es/bridge/js.d.ts +1 -1
- package/lib-es/bridge/js.d.ts.map +1 -1
- package/lib-es/bridge/js.js +10 -10
- package/lib-es/bridge/js.js.map +1 -1
- package/lib-es/broadcast.d.ts.map +1 -1
- package/lib-es/broadcast.js +9 -2
- package/lib-es/broadcast.js.map +1 -1
- package/lib-es/buildOptimisticOperation.d.ts +5 -1
- package/lib-es/buildOptimisticOperation.d.ts.map +1 -1
- package/lib-es/buildOptimisticOperation.js +45 -4
- package/lib-es/buildOptimisticOperation.js.map +1 -1
- package/lib-es/cli-transaction.d.ts.map +1 -1
- package/lib-es/cli-transaction.js +1 -0
- package/lib-es/cli-transaction.js.map +1 -1
- package/lib-es/datasets/ethereum1.d.ts.map +1 -1
- package/lib-es/datasets/ethereum1.js +3 -2
- package/lib-es/datasets/ethereum1.js.map +1 -1
- package/lib-es/deviceTransactionConfig.d.ts.map +1 -1
- package/lib-es/deviceTransactionConfig.js +50 -0
- package/lib-es/deviceTransactionConfig.js.map +1 -1
- package/lib-es/errors.d.ts +9 -0
- package/lib-es/errors.d.ts.map +1 -1
- package/lib-es/errors.js +6 -0
- package/lib-es/errors.js.map +1 -1
- package/lib-es/getTransactionStatus.d.ts +1 -0
- package/lib-es/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/getTransactionStatus.js +23 -2
- package/lib-es/getTransactionStatus.js.map +1 -1
- package/lib-es/hw-signMessage.d.ts +15 -0
- package/lib-es/hw-signMessage.d.ts.map +1 -0
- package/lib-es/hw-signMessage.js +81 -0
- package/lib-es/hw-signMessage.js.map +1 -0
- package/lib-es/logic.d.ts +63 -1
- package/lib-es/logic.d.ts.map +1 -1
- package/lib-es/logic.js +95 -1
- package/lib-es/logic.js.map +1 -1
- package/lib-es/nftResolvers.d.ts +19 -0
- package/lib-es/nftResolvers.d.ts.map +1 -0
- package/lib-es/nftResolvers.js +50 -0
- package/lib-es/nftResolvers.js.map +1 -0
- package/lib-es/preload.d.ts.map +1 -1
- package/lib-es/preload.js +7 -3
- package/lib-es/preload.js.map +1 -1
- package/lib-es/prepareTransaction.d.ts +6 -1
- package/lib-es/prepareTransaction.d.ts.map +1 -1
- package/lib-es/prepareTransaction.js +68 -18
- package/lib-es/prepareTransaction.js.map +1 -1
- package/lib-es/signOperation.d.ts +1 -1
- package/lib-es/signOperation.d.ts.map +1 -1
- package/lib-es/signOperation.js +17 -6
- package/lib-es/signOperation.js.map +1 -1
- package/lib-es/signer.d.ts +24 -1
- package/lib-es/signer.d.ts.map +1 -1
- package/lib-es/specs.d.ts +3 -1
- package/lib-es/specs.d.ts.map +1 -1
- package/lib-es/specs.js +3 -3
- package/lib-es/specs.js.map +1 -1
- package/lib-es/speculos-deviceActions.d.ts.map +1 -1
- package/lib-es/speculos-deviceActions.js +2 -1
- package/lib-es/speculos-deviceActions.js.map +1 -1
- package/lib-es/synchronization.d.ts +7 -2
- package/lib-es/synchronization.d.ts.map +1 -1
- package/lib-es/synchronization.js +46 -46
- package/lib-es/synchronization.js.map +1 -1
- package/lib-es/transaction.d.ts +3 -4
- package/lib-es/transaction.d.ts.map +1 -1
- package/lib-es/transaction.js +58 -12
- package/lib-es/transaction.js.map +1 -1
- package/lib-es/types.d.ts +85 -10
- package/lib-es/types.d.ts.map +1 -1
- package/package.json +13 -12
- package/src/{testUtils.ts → __tests__/fixtures/common.fixtures.ts} +78 -11
- package/src/__tests__/fixtures/etherscan.fixtures.ts +266 -0
- package/src/__tests__/fixtures/prepareTransaction.fixtures.ts +86 -0
- package/src/__tests__/fixtures/synchronization.fixtures.ts +229 -0
- package/src/__tests__/fixtures/transaction.fixtures.ts +229 -0
- package/src/__tests__/integration/bridge.integration.test.ts +74 -0
- package/src/__tests__/unit/adapters.unit.test.ts +1076 -0
- package/src/__tests__/unit/api/explorer/etherscan.unit.test.ts +563 -0
- package/src/__tests__/unit/api/explorer/index.unit.test.ts +36 -0
- package/src/__tests__/{gasTracker → unit/api/gasTracker}/index.unit.test.ts +3 -3
- package/src/__tests__/{gasTracker → unit/api/gasTracker}/ledger.unit.test.ts +3 -3
- package/src/__tests__/{rpc.unit.test.ts → unit/api/rpc/rpc.unit.test.ts} +17 -14
- package/src/__tests__/unit/broadcast.unit.test.ts +332 -0
- package/src/__tests__/{buildOptimisticOperation.unit.test.ts → unit/buildOptimisticOperation.unit.test.ts} +144 -5
- package/src/__tests__/{createTransaction.unit.test.ts → unit/createTransaction.unit.test.ts} +4 -4
- package/src/__tests__/{deviceTransactionConfig.unit.test.ts → unit/deviceTransactionConfig.unit.test.ts} +130 -5
- package/src/__tests__/{estimateMaxSpendable.unit.test.ts → unit/estimateMaxSpendable.unit.test.ts} +5 -5
- package/src/__tests__/{getTransactionStatus.unit.test.ts → unit/getTransactionStatus.unit.test.ts} +121 -5
- package/src/__tests__/{hw-getAddress.unit.test.ts → unit/hw-getAddress.unit.test.ts} +6 -2
- package/src/__tests__/unit/hw-signMessage.unit.test.ts +192 -0
- package/src/__tests__/{logic.unit.test.ts → unit/logic.unit.test.ts} +143 -8
- package/src/__tests__/unit/nftResolvers.unit.test.ts +179 -0
- package/src/__tests__/{preload.unit.test.ts → unit/preload.unit.test.ts} +4 -4
- package/src/__tests__/{prepareTransaction.unit.test.ts → unit/prepareTransaction.unit.test.ts} +284 -109
- package/src/__tests__/{signOperation.unit.test.ts → unit/signOperation.unit.test.ts} +18 -20
- package/src/__tests__/{synchronization.unit.test.ts → unit/synchronization.unit.test.ts} +202 -280
- package/src/__tests__/unit/transaction.unit.test.ts +198 -0
- package/src/abis/erc1155.abi.json +314 -0
- package/src/abis/erc20.abi.json +4 -12
- package/src/abis/erc721.abi.json +346 -0
- package/src/adapters.ts +177 -64
- package/src/api/explorer/etherscan.ts +265 -49
- package/src/api/explorer/index.ts +24 -10
- package/src/api/nft/index.ts +49 -0
- package/src/api/rpc/index.native.ts +2 -0
- package/src/api/rpc/rpc.common.ts +3 -3
- package/src/bridge/js.ts +13 -16
- package/src/broadcast.ts +29 -2
- package/src/buildOptimisticOperation.ts +71 -6
- package/src/cli-transaction.ts +2 -0
- package/src/datasets/ethereum1.ts +4 -2
- package/src/deviceTransactionConfig.ts +65 -0
- package/src/errors.ts +8 -0
- package/src/getTransactionStatus.ts +26 -0
- package/src/hw-signMessage.ts +92 -0
- package/src/logic.ts +118 -2
- package/src/nftResolvers.ts +71 -0
- package/src/preload.ts +9 -3
- package/src/prepareTransaction.ts +102 -24
- package/src/signOperation.ts +21 -8
- package/src/signer.ts +44 -1
- package/src/specs.ts +11 -6
- package/src/speculos-deviceActions.ts +3 -1
- package/src/synchronization.ts +73 -59
- package/src/transaction.ts +68 -15
- package/src/types.ts +108 -10
- package/.eslintrc.js +0 -22
- package/lib/__tests__/adapters.unit.test.d.ts.map +0 -1
- package/lib/__tests__/adapters.unit.test.js +0 -455
- package/lib/__tests__/adapters.unit.test.js.map +0 -1
- package/lib/__tests__/broadcast.unit.test.d.ts.map +0 -1
- package/lib/__tests__/broadcast.unit.test.js +0 -181
- package/lib/__tests__/broadcast.unit.test.js.map +0 -1
- package/lib/__tests__/buildOptimisticOperation.unit.test.d.ts.map +0 -1
- package/lib/__tests__/buildOptimisticOperation.unit.test.js.map +0 -1
- package/lib/__tests__/createTransaction.unit.test.d.ts.map +0 -1
- package/lib/__tests__/createTransaction.unit.test.js.map +0 -1
- package/lib/__tests__/deviceTransactionConfig.unit.test.d.ts.map +0 -1
- package/lib/__tests__/deviceTransactionConfig.unit.test.js.map +0 -1
- package/lib/__tests__/estimateMaxSpendable.unit.test.d.ts.map +0 -1
- package/lib/__tests__/estimateMaxSpendable.unit.test.js.map +0 -1
- package/lib/__tests__/gasTracker/index.unit.test.d.ts.map +0 -1
- package/lib/__tests__/gasTracker/index.unit.test.js.map +0 -1
- package/lib/__tests__/gasTracker/ledger.unit.test.d.ts.map +0 -1
- package/lib/__tests__/gasTracker/ledger.unit.test.js.map +0 -1
- package/lib/__tests__/getTransactionStatus.unit.test.d.ts.map +0 -1
- package/lib/__tests__/getTransactionStatus.unit.test.js.map +0 -1
- package/lib/__tests__/hw-getAddress.unit.test.d.ts.map +0 -1
- package/lib/__tests__/hw-getAddress.unit.test.js.map +0 -1
- package/lib/__tests__/logic.unit.test.d.ts.map +0 -1
- package/lib/__tests__/logic.unit.test.js.map +0 -1
- package/lib/__tests__/preload.unit.test.d.ts.map +0 -1
- package/lib/__tests__/preload.unit.test.js.map +0 -1
- package/lib/__tests__/prepareTransaction.unit.test.d.ts.map +0 -1
- package/lib/__tests__/prepareTransaction.unit.test.js +0 -248
- package/lib/__tests__/prepareTransaction.unit.test.js.map +0 -1
- package/lib/__tests__/rpc.unit.test.d.ts.map +0 -1
- package/lib/__tests__/rpc.unit.test.js.map +0 -1
- package/lib/__tests__/signOperation.unit.test.d.ts.map +0 -1
- package/lib/__tests__/signOperation.unit.test.js.map +0 -1
- package/lib/__tests__/synchronization.unit.test.d.ts.map +0 -1
- package/lib/__tests__/synchronization.unit.test.js.map +0 -1
- package/lib/__tests__/transaction.unit.test.d.ts.map +0 -1
- package/lib/__tests__/transaction.unit.test.js.map +0 -1
- package/lib/bridge.integration.test.d.ts +0 -14
- package/lib/bridge.integration.test.d.ts.map +0 -1
- package/lib/bridge.integration.test.js +0 -85
- package/lib/bridge.integration.test.js.map +0 -1
- package/lib/datasets/ethereum.scanAccounts.1.d.ts +0 -7
- package/lib/datasets/ethereum.scanAccounts.1.d.ts.map +0 -1
- package/lib/datasets/ethereum.scanAccounts.1.js +0 -51
- package/lib/datasets/ethereum.scanAccounts.1.js.map +0 -1
- package/lib/datasets/ethereum2.d.ts +0 -3
- package/lib/datasets/ethereum2.d.ts.map +0 -1
- package/lib/datasets/ethereum2.js +0 -22
- package/lib/datasets/ethereum2.js.map +0 -1
- package/lib/datasets/ethereum_classic.d.ts +0 -5
- package/lib/datasets/ethereum_classic.d.ts.map +0 -1
- package/lib/datasets/ethereum_classic.js +0 -69
- package/lib/datasets/ethereum_classic.js.map +0 -1
- package/lib/testUtils.d.ts +0 -6
- package/lib/testUtils.d.ts.map +0 -1
- package/lib/testUtils.js.map +0 -1
- package/lib-es/__tests__/adapters.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/adapters.unit.test.js +0 -450
- package/lib-es/__tests__/adapters.unit.test.js.map +0 -1
- package/lib-es/__tests__/broadcast.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/broadcast.unit.test.js +0 -153
- package/lib-es/__tests__/broadcast.unit.test.js.map +0 -1
- package/lib-es/__tests__/buildOptimisticOperation.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/buildOptimisticOperation.unit.test.js.map +0 -1
- package/lib-es/__tests__/createTransaction.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/createTransaction.unit.test.js.map +0 -1
- package/lib-es/__tests__/deviceTransactionConfig.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/deviceTransactionConfig.unit.test.js.map +0 -1
- package/lib-es/__tests__/estimateMaxSpendable.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/estimateMaxSpendable.unit.test.js.map +0 -1
- package/lib-es/__tests__/gasTracker/index.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/gasTracker/index.unit.test.js.map +0 -1
- package/lib-es/__tests__/gasTracker/ledger.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/gasTracker/ledger.unit.test.js.map +0 -1
- package/lib-es/__tests__/getTransactionStatus.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/getTransactionStatus.unit.test.js.map +0 -1
- package/lib-es/__tests__/hw-getAddress.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/hw-getAddress.unit.test.js.map +0 -1
- package/lib-es/__tests__/logic.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/logic.unit.test.js.map +0 -1
- package/lib-es/__tests__/preload.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/preload.unit.test.js.map +0 -1
- package/lib-es/__tests__/prepareTransaction.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/prepareTransaction.unit.test.js.map +0 -1
- package/lib-es/__tests__/rpc.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/rpc.unit.test.js.map +0 -1
- package/lib-es/__tests__/signOperation.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/signOperation.unit.test.js.map +0 -1
- package/lib-es/__tests__/synchronization.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/synchronization.unit.test.js.map +0 -1
- package/lib-es/__tests__/transaction.unit.test.d.ts.map +0 -1
- package/lib-es/__tests__/transaction.unit.test.js.map +0 -1
- package/lib-es/bridge.integration.test.d.ts +0 -14
- package/lib-es/bridge.integration.test.d.ts.map +0 -1
- package/lib-es/bridge.integration.test.js +0 -79
- package/lib-es/bridge.integration.test.js.map +0 -1
- package/lib-es/datasets/ethereum.scanAccounts.1.d.ts +0 -7
- package/lib-es/datasets/ethereum.scanAccounts.1.d.ts.map +0 -1
- package/lib-es/datasets/ethereum.scanAccounts.1.js +0 -49
- package/lib-es/datasets/ethereum.scanAccounts.1.js.map +0 -1
- package/lib-es/datasets/ethereum2.d.ts +0 -3
- package/lib-es/datasets/ethereum2.d.ts.map +0 -1
- package/lib-es/datasets/ethereum2.js +0 -19
- package/lib-es/datasets/ethereum2.js.map +0 -1
- package/lib-es/datasets/ethereum_classic.d.ts +0 -5
- package/lib-es/datasets/ethereum_classic.d.ts.map +0 -1
- package/lib-es/datasets/ethereum_classic.js +0 -67
- package/lib-es/datasets/ethereum_classic.js.map +0 -1
- package/lib-es/testUtils.d.ts +0 -6
- package/lib-es/testUtils.d.ts.map +0 -1
- package/lib-es/testUtils.js.map +0 -1
- package/src/__tests__/adapters.unit.test.ts +0 -497
- package/src/__tests__/broadcast.unit.test.ts +0 -163
- package/src/__tests__/transaction.unit.test.ts +0 -188
- package/src/bridge.integration.test.ts +0 -86
- package/src/datasets/ethereum.scanAccounts.1.ts +0 -48
- package/src/datasets/ethereum2.ts +0 -20
- package/src/datasets/ethereum_classic.ts +0 -68
- /package/lib/__tests__/{adapters.unit.test.d.ts → unit/adapters.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{gasTracker → unit/api/gasTracker}/ledger.unit.test.d.ts +0 -0
- /package/lib/__tests__/{rpc.unit.test.d.ts → unit/api/rpc/rpc.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{broadcast.unit.test.d.ts → unit/broadcast.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{buildOptimisticOperation.unit.test.d.ts → unit/buildOptimisticOperation.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{createTransaction.unit.test.d.ts → unit/createTransaction.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{deviceTransactionConfig.unit.test.d.ts → unit/deviceTransactionConfig.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{estimateMaxSpendable.unit.test.d.ts → unit/estimateMaxSpendable.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{getTransactionStatus.unit.test.d.ts → unit/getTransactionStatus.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{hw-getAddress.unit.test.d.ts → unit/hw-getAddress.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{logic.unit.test.d.ts → unit/logic.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{preload.unit.test.d.ts → unit/preload.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{prepareTransaction.unit.test.d.ts → unit/prepareTransaction.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{signOperation.unit.test.d.ts → unit/signOperation.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{synchronization.unit.test.d.ts → unit/synchronization.unit.test.d.ts} +0 -0
- /package/lib/__tests__/{transaction.unit.test.d.ts → unit/transaction.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{adapters.unit.test.d.ts → unit/adapters.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{gasTracker → unit/api/explorer}/index.unit.test.d.ts +0 -0
- /package/{lib/__tests__ → lib-es/__tests__/unit/api}/gasTracker/index.unit.test.d.ts +0 -0
- /package/lib-es/__tests__/{gasTracker → unit/api/gasTracker}/ledger.unit.test.d.ts +0 -0
- /package/lib-es/__tests__/{rpc.unit.test.d.ts → unit/api/rpc/rpc.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{broadcast.unit.test.d.ts → unit/broadcast.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{buildOptimisticOperation.unit.test.d.ts → unit/buildOptimisticOperation.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{createTransaction.unit.test.d.ts → unit/createTransaction.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{deviceTransactionConfig.unit.test.d.ts → unit/deviceTransactionConfig.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{estimateMaxSpendable.unit.test.d.ts → unit/estimateMaxSpendable.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{getTransactionStatus.unit.test.d.ts → unit/getTransactionStatus.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{hw-getAddress.unit.test.d.ts → unit/hw-getAddress.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{logic.unit.test.d.ts → unit/logic.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{preload.unit.test.d.ts → unit/preload.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{prepareTransaction.unit.test.d.ts → unit/prepareTransaction.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{signOperation.unit.test.d.ts → unit/signOperation.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{synchronization.unit.test.d.ts → unit/synchronization.unit.test.d.ts} +0 -0
- /package/lib-es/__tests__/{transaction.unit.test.d.ts → unit/transaction.unit.test.d.ts} +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/* instanbul ignore file: don't test fixtures */
|
|
2
|
+
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
import { getTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
5
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
6
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
7
|
+
import * as logic from "../../logic";
|
|
8
|
+
import {
|
|
9
|
+
makeAccount,
|
|
10
|
+
makeNft,
|
|
11
|
+
makeNftOperation,
|
|
12
|
+
makeOperation,
|
|
13
|
+
makeTokenAccount,
|
|
14
|
+
} from "./common.fixtures";
|
|
15
|
+
|
|
16
|
+
jest.useFakeTimers().setSystemTime(new Date("2014-04-21"));
|
|
17
|
+
|
|
18
|
+
export const currency: CryptoCurrency = Object.freeze({
|
|
19
|
+
...getCryptoCurrencyById("ethereum"),
|
|
20
|
+
ethereumLikeInfo: {
|
|
21
|
+
chainId: 1,
|
|
22
|
+
rpc: "https://my-rpc.com",
|
|
23
|
+
explorer: {
|
|
24
|
+
uri: "https://api.com",
|
|
25
|
+
type: "etherscan" as const,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const tokenCurrencies = [
|
|
31
|
+
Object.freeze(getTokenById("ethereum/erc20/usd__coin")),
|
|
32
|
+
Object.freeze(getTokenById("ethereum/erc20/usd_tether__erc20_")),
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export const tokenAccount = makeTokenAccount("0xkvn", tokenCurrencies[0]);
|
|
36
|
+
export const account = Object.freeze({
|
|
37
|
+
...makeAccount("0xkvn", currency, [tokenAccount]),
|
|
38
|
+
syncHash: logic.getSyncHash(currency),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const coinOperations = [
|
|
42
|
+
makeOperation({
|
|
43
|
+
hash: "0xCoinOp1Hash",
|
|
44
|
+
accountId: "js:2:ethereum:0xkvn:",
|
|
45
|
+
blockHash: "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
|
|
46
|
+
senders: ["0xd48f2332Eeed88243Cb6b1D0d65a10368A5370f0"], // johnnyhallyday.eth
|
|
47
|
+
transactionSequenceNumber: 1,
|
|
48
|
+
date: new Date(),
|
|
49
|
+
blockHeight: 1,
|
|
50
|
+
}),
|
|
51
|
+
makeOperation({
|
|
52
|
+
hash: "0xCoinOp2Hash",
|
|
53
|
+
accountId: "js:2:ethereum:0xkvn:",
|
|
54
|
+
transactionSequenceNumber: 2,
|
|
55
|
+
date: new Date(Date.now() + 1),
|
|
56
|
+
blockHeight: 100,
|
|
57
|
+
}),
|
|
58
|
+
makeOperation({
|
|
59
|
+
hash: "0xCoinOp3Hash",
|
|
60
|
+
accountId: "js:2:ethereum:0xkvn:",
|
|
61
|
+
transactionSequenceNumber: 5,
|
|
62
|
+
date: new Date(Date.now() + 2),
|
|
63
|
+
blockHeight: 1000,
|
|
64
|
+
}),
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
export const tokenOperations = [
|
|
68
|
+
makeOperation({
|
|
69
|
+
hash: coinOperations[0].hash, // on purpose to make this token op a subOp of coinOp 1
|
|
70
|
+
accountId: "js:2:ethereum:0xkvn:+ethereum%2Ferc20%2Fusd__coin",
|
|
71
|
+
blockHash: "0x95dc138a02c1b0e3fd49305f785e8e27e88a885004af13a9b4c62ad94eed07dd",
|
|
72
|
+
recipients: ["0xB0B"],
|
|
73
|
+
senders: ["0x9b744C0451D73C0958d8aA566dAd33022E4Ee797"], // sbf.eth
|
|
74
|
+
contract: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
75
|
+
value: new BigNumber(152021496),
|
|
76
|
+
fee: new BigNumber(1935663357068271),
|
|
77
|
+
type: "OUT",
|
|
78
|
+
date: new Date(),
|
|
79
|
+
blockHeight: 10,
|
|
80
|
+
}),
|
|
81
|
+
makeOperation({
|
|
82
|
+
hash: "0xTokenHashAga1n",
|
|
83
|
+
accountId: "js:2:ethereum:0xkvn:+ethereum%2Ferc20%2Fusd__coin",
|
|
84
|
+
contract: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
85
|
+
date: new Date(Date.now() + 1),
|
|
86
|
+
blockHeight: 1000,
|
|
87
|
+
}),
|
|
88
|
+
makeOperation({
|
|
89
|
+
hash: "0xTokenHashAga1n",
|
|
90
|
+
accountId: "js:2:ethereum:0xkvn:+ethereum%2Ferc20%2Fusd__coin",
|
|
91
|
+
contract: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
92
|
+
date: new Date(Date.now() + 2),
|
|
93
|
+
blockHeight: 10000,
|
|
94
|
+
}),
|
|
95
|
+
makeOperation({
|
|
96
|
+
hash: "0xTokenHashOtherToken",
|
|
97
|
+
accountId: "js:2:ethereum:0xkvn:+ethereum%2Ferc20%2Fusd_tether__erc20_",
|
|
98
|
+
contract: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
99
|
+
date: new Date(Date.now() + 3),
|
|
100
|
+
blockHeight: 11000,
|
|
101
|
+
}),
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
export const erc721Operations = [
|
|
105
|
+
makeNftOperation(
|
|
106
|
+
{
|
|
107
|
+
hash: coinOperations[0].hash, // on purpose to make this erc721 op an nftOp of coinOp 1
|
|
108
|
+
accountId: coinOperations[0].accountId,
|
|
109
|
+
blockHash: coinOperations[0].blockHash,
|
|
110
|
+
recipients: ["0xB0B"],
|
|
111
|
+
senders: ["0x1084b55cB63dE549806A521036F7dad2d37E3fAE"], // chocolatine.eth
|
|
112
|
+
contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
|
|
113
|
+
tokenId: "1",
|
|
114
|
+
standard: "ERC721",
|
|
115
|
+
value: new BigNumber(1),
|
|
116
|
+
fee: coinOperations[0].fee,
|
|
117
|
+
type: "NFT_IN",
|
|
118
|
+
date: coinOperations[0].date,
|
|
119
|
+
blockHeight: coinOperations[0].blockHeight,
|
|
120
|
+
},
|
|
121
|
+
0,
|
|
122
|
+
),
|
|
123
|
+
makeNftOperation(
|
|
124
|
+
{
|
|
125
|
+
hash: coinOperations[1].hash, // on purpose to make this erc721 op an nftOp of coinOp 1
|
|
126
|
+
accountId: coinOperations[1].accountId,
|
|
127
|
+
blockHash: coinOperations[1].blockHash,
|
|
128
|
+
recipients: ["0xB0B"],
|
|
129
|
+
senders: ["0x1084b55cB63dE549806A521036F7dad2d37E3fAE"], // chocolatine.eth
|
|
130
|
+
contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
|
|
131
|
+
tokenId: "2",
|
|
132
|
+
standard: "ERC721",
|
|
133
|
+
value: new BigNumber(1),
|
|
134
|
+
fee: coinOperations[1].fee,
|
|
135
|
+
type: "NFT_IN",
|
|
136
|
+
date: coinOperations[1].date,
|
|
137
|
+
blockHeight: coinOperations[1].blockHeight,
|
|
138
|
+
},
|
|
139
|
+
0,
|
|
140
|
+
),
|
|
141
|
+
makeNftOperation(
|
|
142
|
+
{
|
|
143
|
+
hash: coinOperations[1].hash, // on purpose to make this erc721 op an nftOp of coinOp 1
|
|
144
|
+
accountId: coinOperations[1].accountId,
|
|
145
|
+
blockHash: coinOperations[1].blockHash,
|
|
146
|
+
recipients: ["0xB0B"],
|
|
147
|
+
senders: ["0x1084b55cB63dE549806A521036F7dad2d37E3fAE"], // chocolatine.eth
|
|
148
|
+
contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
|
|
149
|
+
tokenId: "1",
|
|
150
|
+
standard: "ERC721",
|
|
151
|
+
value: new BigNumber(1),
|
|
152
|
+
fee: coinOperations[1].fee,
|
|
153
|
+
type: "NFT_OUT",
|
|
154
|
+
date: coinOperations[1].date,
|
|
155
|
+
blockHeight: coinOperations[1].blockHeight,
|
|
156
|
+
},
|
|
157
|
+
1,
|
|
158
|
+
),
|
|
159
|
+
];
|
|
160
|
+
|
|
161
|
+
export const erc1155Operations = [
|
|
162
|
+
makeNftOperation(
|
|
163
|
+
{
|
|
164
|
+
hash: coinOperations[0].hash, // on purpose to make this erc1155 op an nftOp of coinOp 1
|
|
165
|
+
accountId: "js:2:ethereum:0xkvn:",
|
|
166
|
+
blockHash: "0x95dc138a02c1b0e3fd49305f785e8e27e88a885004af13a9b4c62ad94eed07dd",
|
|
167
|
+
recipients: ["0xB0B"],
|
|
168
|
+
senders: ["0x1084b55cB63dE549806A521036F7dad2d37E3fAE"], // painauchocolat.eth
|
|
169
|
+
contract: "0xBa98C7d6B25309FF097e88D24400c0EbC4D68e3a",
|
|
170
|
+
tokenId: "1",
|
|
171
|
+
standard: "ERC1155",
|
|
172
|
+
value: new BigNumber(10),
|
|
173
|
+
fee: new BigNumber(1935663357068271),
|
|
174
|
+
type: "NFT_IN",
|
|
175
|
+
date: new Date(),
|
|
176
|
+
blockHeight: 10,
|
|
177
|
+
},
|
|
178
|
+
0,
|
|
179
|
+
),
|
|
180
|
+
makeNftOperation(
|
|
181
|
+
{
|
|
182
|
+
hash: coinOperations[1].hash, // on purpose to make this erc1155 op an nftOp of coinOp 1
|
|
183
|
+
accountId: "js:2:ethereum:0xkvn:",
|
|
184
|
+
blockHash: "0x95dc138a02c1b0e3fd49305f785e8e27e88a885004af13a9b4c62ad94eed07dd",
|
|
185
|
+
recipients: ["0xB0B"],
|
|
186
|
+
senders: ["0x1084b55cB63dE549806A521036F7dad2d37E3fAE"], // painauchocolat.eth
|
|
187
|
+
contract: "0xBa98C7d6B25309FF097e88D24400c0EbC4D68e3a",
|
|
188
|
+
tokenId: "1",
|
|
189
|
+
standard: "ERC1155",
|
|
190
|
+
value: new BigNumber(9),
|
|
191
|
+
fee: new BigNumber(1935663357068271),
|
|
192
|
+
type: "NFT_OUT",
|
|
193
|
+
date: new Date(Date.now() + 1),
|
|
194
|
+
blockHeight: 11,
|
|
195
|
+
},
|
|
196
|
+
0,
|
|
197
|
+
),
|
|
198
|
+
];
|
|
199
|
+
|
|
200
|
+
export const ignoredTokenOperation = makeOperation({
|
|
201
|
+
hash: "0xigN0r3Me",
|
|
202
|
+
accountId: "js:2:ethereum:0xkvn:+ethereum%2Ferc20%2Fusd_tether__erc20_",
|
|
203
|
+
contract: "0xUnknownContract",
|
|
204
|
+
date: new Date(Date.now() + 4),
|
|
205
|
+
blockHeight: 12000,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
export const pendingOperation = makeOperation({
|
|
209
|
+
hash: "123",
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
export const nfts = [
|
|
213
|
+
makeNft({
|
|
214
|
+
amount: new BigNumber("1"),
|
|
215
|
+
contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
|
|
216
|
+
currencyId: "ethereum",
|
|
217
|
+
id: "js:2:ethereum:0xkvn:+0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D+2+ethereum",
|
|
218
|
+
standard: "ERC721",
|
|
219
|
+
tokenId: "2",
|
|
220
|
+
}),
|
|
221
|
+
makeNft({
|
|
222
|
+
amount: new BigNumber("1"),
|
|
223
|
+
contract: "0xBa98C7d6B25309FF097e88D24400c0EbC4D68e3a",
|
|
224
|
+
currencyId: "ethereum",
|
|
225
|
+
id: "js:2:ethereum:0xkvn:+0xBa98C7d6B25309FF097e88D24400c0EbC4D68e3a+1+ethereum",
|
|
226
|
+
standard: "ERC1155",
|
|
227
|
+
tokenId: "1",
|
|
228
|
+
}),
|
|
229
|
+
];
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { getTokenById } from "@ledgerhq/cryptoassets/tokens";
|
|
3
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
5
|
+
import { makeAccount, makeTokenAccount } from "./common.fixtures";
|
|
6
|
+
import {
|
|
7
|
+
EvmTransactionEIP1559,
|
|
8
|
+
EvmTransactionEIP1559Raw,
|
|
9
|
+
EvmTransactionLegacy,
|
|
10
|
+
EvmTransactionLegacyRaw,
|
|
11
|
+
Transaction as EvmTransaction,
|
|
12
|
+
EvmNftTransactionRaw,
|
|
13
|
+
EvmNftTransaction,
|
|
14
|
+
} from "../../types";
|
|
15
|
+
|
|
16
|
+
export const testData = Object.freeze(Buffer.from("testBufferString").toString("hex"));
|
|
17
|
+
|
|
18
|
+
const rawNft = Object.freeze({
|
|
19
|
+
tokenId: "123",
|
|
20
|
+
contract: "0xContract",
|
|
21
|
+
quantity: "10",
|
|
22
|
+
collectionName: "collectionName",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const nft = Object.freeze({
|
|
26
|
+
tokenId: "123",
|
|
27
|
+
contract: "0xContract",
|
|
28
|
+
quantity: new BigNumber("10"),
|
|
29
|
+
collectionName: "collectionName",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const rawEip1559Tx: EvmTransactionEIP1559Raw = Object.freeze(
|
|
33
|
+
Object.freeze({
|
|
34
|
+
amount: "100",
|
|
35
|
+
useAllAmount: false,
|
|
36
|
+
subAccountId: "id",
|
|
37
|
+
recipient: "0xkvn",
|
|
38
|
+
feesStrategy: "custom",
|
|
39
|
+
family: "evm",
|
|
40
|
+
mode: "send",
|
|
41
|
+
nonce: 0,
|
|
42
|
+
gasLimit: "21000",
|
|
43
|
+
chainId: 1,
|
|
44
|
+
data: testData,
|
|
45
|
+
maxFeePerGas: "10000",
|
|
46
|
+
maxPriorityFeePerGas: "10000",
|
|
47
|
+
additionalFees: "420",
|
|
48
|
+
type: 2,
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export const rawNftEip1559Tx: EvmTransactionEIP1559Raw & EvmNftTransactionRaw = Object.freeze({
|
|
53
|
+
...rawEip1559Tx,
|
|
54
|
+
mode: "erc721",
|
|
55
|
+
nft: rawNft,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const eip1559Tx: EvmTransactionEIP1559 = Object.freeze(
|
|
59
|
+
Object.freeze({
|
|
60
|
+
amount: new BigNumber(100),
|
|
61
|
+
useAllAmount: false,
|
|
62
|
+
subAccountId: "id",
|
|
63
|
+
recipient: "0xkvn",
|
|
64
|
+
feesStrategy: "custom",
|
|
65
|
+
family: "evm",
|
|
66
|
+
mode: "send",
|
|
67
|
+
nonce: 0,
|
|
68
|
+
gasLimit: new BigNumber(21000),
|
|
69
|
+
chainId: 1,
|
|
70
|
+
data: Buffer.from(testData, "hex"),
|
|
71
|
+
maxFeePerGas: new BigNumber(10000),
|
|
72
|
+
maxPriorityFeePerGas: new BigNumber(10000),
|
|
73
|
+
additionalFees: new BigNumber(420),
|
|
74
|
+
type: 2,
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export const nftEip1559tx = Object.freeze({
|
|
79
|
+
...eip1559Tx,
|
|
80
|
+
mode: "erc721",
|
|
81
|
+
nft,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export const rawLegacyTx: EvmTransactionLegacyRaw = Object.freeze({
|
|
85
|
+
amount: "100",
|
|
86
|
+
useAllAmount: false,
|
|
87
|
+
subAccountId: "id",
|
|
88
|
+
recipient: "0xkvn",
|
|
89
|
+
feesStrategy: "custom",
|
|
90
|
+
family: "evm",
|
|
91
|
+
mode: "send",
|
|
92
|
+
nonce: 0,
|
|
93
|
+
gasLimit: "21000",
|
|
94
|
+
chainId: 1,
|
|
95
|
+
data: testData,
|
|
96
|
+
gasPrice: "10000",
|
|
97
|
+
additionalFees: "420",
|
|
98
|
+
type: 0,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export const nftRawLegacyTx: EvmTransactionLegacyRaw & EvmNftTransactionRaw = Object.freeze({
|
|
102
|
+
...rawLegacyTx,
|
|
103
|
+
mode: "erc721",
|
|
104
|
+
nft: rawNft,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export const legacyTx: EvmTransactionLegacy = Object.freeze(
|
|
108
|
+
Object.freeze({
|
|
109
|
+
amount: new BigNumber(100),
|
|
110
|
+
useAllAmount: false,
|
|
111
|
+
subAccountId: "id",
|
|
112
|
+
recipient: "0xkvn",
|
|
113
|
+
feesStrategy: "custom",
|
|
114
|
+
family: "evm",
|
|
115
|
+
mode: "send",
|
|
116
|
+
nonce: 0,
|
|
117
|
+
gasLimit: new BigNumber(21000),
|
|
118
|
+
chainId: 1,
|
|
119
|
+
data: Buffer.from(testData, "hex"),
|
|
120
|
+
gasPrice: new BigNumber(10000),
|
|
121
|
+
additionalFees: new BigNumber(420),
|
|
122
|
+
type: 0,
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
export const nftLegacyTx: EvmTransactionLegacy & EvmNftTransaction = Object.freeze({
|
|
127
|
+
...legacyTx,
|
|
128
|
+
mode: "erc721",
|
|
129
|
+
nft,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const currency: CryptoCurrency = Object.freeze({
|
|
133
|
+
...getCryptoCurrencyById("ethereum"),
|
|
134
|
+
ethereumLikeInfo: {
|
|
135
|
+
chainId: 1,
|
|
136
|
+
rpc: "https://my-rpc.com",
|
|
137
|
+
explorer: {
|
|
138
|
+
uri: "https://api.com",
|
|
139
|
+
type: "etherscan" as const,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
export const tokenCurrency = Object.freeze(getTokenById("ethereum/erc20/usd__coin"));
|
|
144
|
+
export const tokenAccount = makeTokenAccount(
|
|
145
|
+
"0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d",
|
|
146
|
+
tokenCurrency,
|
|
147
|
+
);
|
|
148
|
+
export const account = makeAccount("0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d", currency, [
|
|
149
|
+
tokenAccount,
|
|
150
|
+
]);
|
|
151
|
+
|
|
152
|
+
export const tokenTransaction: EvmTransaction = Object.freeze({
|
|
153
|
+
family: "evm",
|
|
154
|
+
mode: "send",
|
|
155
|
+
amount: new BigNumber(100),
|
|
156
|
+
useAllAmount: false,
|
|
157
|
+
subAccountId: tokenAccount.id,
|
|
158
|
+
recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
|
|
159
|
+
feesStrategy: "custom",
|
|
160
|
+
nonce: 0,
|
|
161
|
+
gasLimit: new BigNumber(60000),
|
|
162
|
+
chainId: 1,
|
|
163
|
+
maxFeePerGas: new BigNumber(100),
|
|
164
|
+
maxPriorityFeePerGas: new BigNumber(100),
|
|
165
|
+
type: 2,
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
export const erc721Transaction: EvmTransaction = Object.freeze({
|
|
169
|
+
family: "evm",
|
|
170
|
+
mode: "erc721",
|
|
171
|
+
amount: new BigNumber(0),
|
|
172
|
+
useAllAmount: false,
|
|
173
|
+
recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
|
|
174
|
+
feesStrategy: "custom",
|
|
175
|
+
nonce: 0,
|
|
176
|
+
gasLimit: new BigNumber(60000),
|
|
177
|
+
chainId: 1,
|
|
178
|
+
nft: {
|
|
179
|
+
contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
|
|
180
|
+
tokenId: "1",
|
|
181
|
+
quantity: new BigNumber(1),
|
|
182
|
+
collectionName: "BAYC",
|
|
183
|
+
},
|
|
184
|
+
maxFeePerGas: new BigNumber(100),
|
|
185
|
+
maxPriorityFeePerGas: new BigNumber(100),
|
|
186
|
+
type: 2,
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
export const erc1155Transaction: EvmTransaction = Object.freeze({
|
|
190
|
+
family: "evm",
|
|
191
|
+
mode: "erc1155",
|
|
192
|
+
amount: new BigNumber(0),
|
|
193
|
+
useAllAmount: false,
|
|
194
|
+
recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
|
|
195
|
+
feesStrategy: "custom",
|
|
196
|
+
nonce: 0,
|
|
197
|
+
gasLimit: new BigNumber(60000),
|
|
198
|
+
chainId: 1,
|
|
199
|
+
nft: {
|
|
200
|
+
contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
|
|
201
|
+
tokenId: "1",
|
|
202
|
+
quantity: new BigNumber(10),
|
|
203
|
+
collectionName: "BAYC",
|
|
204
|
+
},
|
|
205
|
+
maxFeePerGas: new BigNumber(100),
|
|
206
|
+
maxPriorityFeePerGas: new BigNumber(100),
|
|
207
|
+
type: 2,
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
export const erc1155TransactionNonFinite: EvmTransaction = Object.freeze({
|
|
211
|
+
family: "evm",
|
|
212
|
+
mode: "erc1155",
|
|
213
|
+
amount: new BigNumber(0),
|
|
214
|
+
useAllAmount: false,
|
|
215
|
+
recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
|
|
216
|
+
feesStrategy: "custom",
|
|
217
|
+
nonce: 0,
|
|
218
|
+
gasLimit: new BigNumber(60000),
|
|
219
|
+
chainId: 1,
|
|
220
|
+
nft: {
|
|
221
|
+
contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
|
|
222
|
+
tokenId: "1",
|
|
223
|
+
quantity: new BigNumber(Infinity),
|
|
224
|
+
collectionName: "BAYC",
|
|
225
|
+
},
|
|
226
|
+
maxFeePerGas: new BigNumber(100),
|
|
227
|
+
maxPriorityFeePerGas: new BigNumber(100),
|
|
228
|
+
type: 2,
|
|
229
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ⚠️ In order to test this file, you must run the test from the live-common repo
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BigNumber } from "bignumber.js";
|
|
6
|
+
import { FeeNotLoaded, NotEnoughBalance } from "@ledgerhq/errors";
|
|
7
|
+
import type { AccountRaw, DatasetTest } from "@ledgerhq/types-live";
|
|
8
|
+
import { fromTransactionRaw } from "../../transaction";
|
|
9
|
+
import { ethereum1 } from "../../datasets/ethereum1";
|
|
10
|
+
import type { Transaction } from "../../types";
|
|
11
|
+
|
|
12
|
+
export const dataset: DatasetTest<Transaction> = {
|
|
13
|
+
implementations: ["mock", "js"],
|
|
14
|
+
currencies: {
|
|
15
|
+
ethereum_as_evm_test_only: {
|
|
16
|
+
accounts: [
|
|
17
|
+
{
|
|
18
|
+
FIXME_tests: ["balance is sum of ops"],
|
|
19
|
+
implementations: ["js"],
|
|
20
|
+
raw: ethereum1 as AccountRaw,
|
|
21
|
+
transactions: [
|
|
22
|
+
{
|
|
23
|
+
name: "Send",
|
|
24
|
+
transaction: fromTransactionRaw({
|
|
25
|
+
family: "evm",
|
|
26
|
+
mode: "send",
|
|
27
|
+
recipient: "0x17733CAb76d9A2112576443F21735789733B1ca3",
|
|
28
|
+
amount: (1e19).toString(), // 10 ETH
|
|
29
|
+
gasPrice: "0",
|
|
30
|
+
gasLimit: "21000",
|
|
31
|
+
chainId: 1,
|
|
32
|
+
nonce: 0,
|
|
33
|
+
}),
|
|
34
|
+
expectedStatus: (account, transaction) => {
|
|
35
|
+
const estimatedFees = transaction.gasLimit.times(transaction.maxFeePerGas || 0);
|
|
36
|
+
return {
|
|
37
|
+
amount: new BigNumber(1e19), // 10 ETH
|
|
38
|
+
estimatedFees, // fees are calculated during preparation and therefore cannot be guessed without mocks
|
|
39
|
+
totalSpent: new BigNumber(1e19).plus(estimatedFees), // fees are calculated during preparation and therefore cannot be guessed without mocks
|
|
40
|
+
errors: {
|
|
41
|
+
amount: new NotEnoughBalance(), // "The parent account balance is insufficient for network fees" since account is empty
|
|
42
|
+
gasLimit: new FeeNotLoaded(), // "Could not load fee rates. Please set manual fees" because gas estimation failed as the account is empty
|
|
43
|
+
},
|
|
44
|
+
warnings: {},
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "Send max",
|
|
50
|
+
transaction: fromTransactionRaw({
|
|
51
|
+
family: "evm",
|
|
52
|
+
mode: "send",
|
|
53
|
+
recipient: "0x17733CAb76d9A2112576443F21735789733B1ca3",
|
|
54
|
+
amount: "1",
|
|
55
|
+
gasPrice: "100000000",
|
|
56
|
+
gasLimit: "21000",
|
|
57
|
+
chainId: 1,
|
|
58
|
+
nonce: 0,
|
|
59
|
+
useAllAmount: true,
|
|
60
|
+
}),
|
|
61
|
+
expectedStatus: (account, _, status) => {
|
|
62
|
+
return {
|
|
63
|
+
amount: BigNumber.max(account.balance.minus(status.estimatedFees), 0),
|
|
64
|
+
errors: {},
|
|
65
|
+
warnings: {},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|