@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
package/src/types.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import {
|
|
3
|
+
ProtoNFT,
|
|
4
|
+
ProtoNFTRaw,
|
|
3
5
|
TransactionCommon,
|
|
4
6
|
TransactionCommonRaw,
|
|
5
7
|
TransactionStatusCommon,
|
|
6
8
|
TransactionStatusCommonRaw,
|
|
7
9
|
} from "@ledgerhq/types-live";
|
|
8
10
|
|
|
9
|
-
export type EvmTransactionMode = "send";
|
|
10
|
-
|
|
11
|
-
export type GasOptions = {
|
|
12
|
-
[key in "slow" | "medium" | "fast"]: FeeData;
|
|
13
|
-
};
|
|
11
|
+
export type EvmTransactionMode = "send" | "erc721" | "erc1155";
|
|
14
12
|
|
|
15
13
|
export type EvmTransactionBase = TransactionCommon & {
|
|
16
14
|
family: "evm";
|
|
@@ -30,16 +28,41 @@ export type EvmTransactionBase = TransactionCommon & {
|
|
|
30
28
|
additionalFees?: BigNumber;
|
|
31
29
|
// available gas options for the transaction, used to display sensible default fees choices to the user
|
|
32
30
|
gasOptions?: GasOptions;
|
|
31
|
+
// additional informations related to an NFT in order to craft the real evm transaction at `signOperation` level
|
|
32
|
+
nft?: EvmTransactionNftParam;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Send mode transactions are used for coin transactions & token transactions (erc20)
|
|
36
|
+
type EvmSendTransaction = EvmTransactionBase & {
|
|
37
|
+
mode: "send";
|
|
38
|
+
nft?: never;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// NFT transactions are used for ERC721 & ERC1155 transactions
|
|
42
|
+
export type EvmNftTransaction = EvmTransactionBase & {
|
|
43
|
+
mode: "erc721" | "erc1155";
|
|
44
|
+
nft: EvmTransactionNftParam;
|
|
33
45
|
};
|
|
34
46
|
|
|
35
|
-
|
|
47
|
+
// Once the kind of transaction defined, we still need to "type" it
|
|
48
|
+
// regarding EVM standards (@see https://eips.ethereum.org/EIPS/eip-2718)
|
|
49
|
+
type EvmTransactionUntyped = EvmSendTransaction | EvmNftTransaction;
|
|
50
|
+
|
|
51
|
+
// Legacy transaction types are type 0 & 1
|
|
52
|
+
// (type 1 is not creating breaking changes, but we're not supporting the feature implied by this new type as of today)
|
|
53
|
+
// (@see https://eips.ethereum.org/EIPS/eip-2930)
|
|
54
|
+
export type EvmTransactionLegacy = EvmTransactionUntyped & {
|
|
36
55
|
type?: 0 | 1;
|
|
37
56
|
gasPrice: BigNumber;
|
|
38
57
|
maxPriorityFeePerGas?: never;
|
|
39
58
|
maxFeePerGas?: never;
|
|
40
59
|
};
|
|
41
60
|
|
|
42
|
-
|
|
61
|
+
// Transactions type 2 are transaction supporting the new fee system
|
|
62
|
+
// applied with the EIP-1559, introducing new keys for fees and
|
|
63
|
+
// removing gasPrice.
|
|
64
|
+
// (@see https://eips.ethereum.org/EIPS/eip-1559)
|
|
65
|
+
export type EvmTransactionEIP1559 = EvmTransactionUntyped & {
|
|
43
66
|
type: 2;
|
|
44
67
|
gasPrice?: never;
|
|
45
68
|
maxPriorityFeePerGas: BigNumber;
|
|
@@ -48,7 +71,7 @@ export type EvmTransactionEIP1559 = EvmTransactionBase & {
|
|
|
48
71
|
|
|
49
72
|
export type Transaction = EvmTransactionLegacy | EvmTransactionEIP1559;
|
|
50
73
|
|
|
51
|
-
|
|
74
|
+
type EvmTransactionBaseRaw = TransactionCommonRaw & {
|
|
52
75
|
family: "evm";
|
|
53
76
|
mode: EvmTransactionMode;
|
|
54
77
|
nonce: number;
|
|
@@ -57,16 +80,29 @@ export type EvmTransactionBaseRaw = TransactionCommonRaw & {
|
|
|
57
80
|
data?: string | null;
|
|
58
81
|
type?: number;
|
|
59
82
|
additionalFees?: string;
|
|
83
|
+
nft?: EvmTransactionNftParamRaw;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type EvmSendTransactionRaw = EvmTransactionBaseRaw & {
|
|
87
|
+
mode: "send";
|
|
88
|
+
nft?: never;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type EvmNftTransactionRaw = EvmTransactionBaseRaw & {
|
|
92
|
+
mode: "erc721" | "erc1155";
|
|
93
|
+
nft: EvmTransactionNftParamRaw;
|
|
60
94
|
};
|
|
61
95
|
|
|
62
|
-
|
|
96
|
+
type EvmTransactionUntypedRaw = EvmSendTransactionRaw | EvmNftTransactionRaw;
|
|
97
|
+
|
|
98
|
+
export type EvmTransactionLegacyRaw = EvmTransactionUntypedRaw & {
|
|
63
99
|
type?: 0 | 1;
|
|
64
100
|
gasPrice: string;
|
|
65
101
|
maxPriorityFeePerGas?: never;
|
|
66
102
|
maxFeePerGas?: never;
|
|
67
103
|
};
|
|
68
104
|
|
|
69
|
-
export type EvmTransactionEIP1559Raw =
|
|
105
|
+
export type EvmTransactionEIP1559Raw = EvmTransactionUntypedRaw & {
|
|
70
106
|
type: 2;
|
|
71
107
|
gasPrice?: never;
|
|
72
108
|
maxPriorityFeePerGas: string;
|
|
@@ -120,6 +156,50 @@ export type EtherscanERC20Event = {
|
|
|
120
156
|
confirmations: string;
|
|
121
157
|
};
|
|
122
158
|
|
|
159
|
+
export type EtherscanERC721Event = {
|
|
160
|
+
blockNumber: string;
|
|
161
|
+
timeStamp: string;
|
|
162
|
+
hash: string;
|
|
163
|
+
nonce: string;
|
|
164
|
+
blockHash: string;
|
|
165
|
+
from: string;
|
|
166
|
+
contractAddress: string;
|
|
167
|
+
to: string;
|
|
168
|
+
tokenID: string;
|
|
169
|
+
tokenName: string;
|
|
170
|
+
tokenSymbol: string;
|
|
171
|
+
tokenDecimal: string;
|
|
172
|
+
transactionIndex: string;
|
|
173
|
+
gas: string;
|
|
174
|
+
gasPrice: string;
|
|
175
|
+
gasUsed: string;
|
|
176
|
+
cumulativeGasUsed: string;
|
|
177
|
+
input: string;
|
|
178
|
+
confirmations: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type EtherscanERC1155Event = {
|
|
182
|
+
blockNumber: string;
|
|
183
|
+
timeStamp: string;
|
|
184
|
+
hash: string;
|
|
185
|
+
nonce: string;
|
|
186
|
+
blockHash: string;
|
|
187
|
+
transactionIndex: string;
|
|
188
|
+
gas: string;
|
|
189
|
+
gasPrice: string;
|
|
190
|
+
gasUsed: string;
|
|
191
|
+
cumulativeGasUsed: string;
|
|
192
|
+
input: string;
|
|
193
|
+
contractAddress: string;
|
|
194
|
+
from: string;
|
|
195
|
+
to: string;
|
|
196
|
+
tokenID: string;
|
|
197
|
+
tokenValue: string;
|
|
198
|
+
tokenName: string;
|
|
199
|
+
tokenSymbol: string;
|
|
200
|
+
confirmations: string;
|
|
201
|
+
};
|
|
202
|
+
|
|
123
203
|
export type TransactionStatus = TransactionStatusCommon;
|
|
124
204
|
|
|
125
205
|
export type TransactionStatusRaw = TransactionStatusCommonRaw;
|
|
@@ -136,3 +216,21 @@ export type FeeData = {
|
|
|
136
216
|
maxPriorityFeePerGas: null | BigNumber;
|
|
137
217
|
gasPrice: null | BigNumber;
|
|
138
218
|
};
|
|
219
|
+
|
|
220
|
+
export type GasOptions = {
|
|
221
|
+
[key in "slow" | "medium" | "fast"]: FeeData;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export type EvmTransactionNftParam = {
|
|
225
|
+
tokenId: ProtoNFT["tokenId"];
|
|
226
|
+
contract: ProtoNFT["contract"];
|
|
227
|
+
quantity: ProtoNFT["amount"];
|
|
228
|
+
collectionName: string;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
type EvmTransactionNftParamRaw = {
|
|
232
|
+
tokenId: ProtoNFTRaw["tokenId"];
|
|
233
|
+
contract: ProtoNFTRaw["contract"];
|
|
234
|
+
quantity: ProtoNFTRaw["amount"];
|
|
235
|
+
collectionName: string;
|
|
236
|
+
};
|
package/.eslintrc.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
browser: true,
|
|
4
|
-
es6: true,
|
|
5
|
-
},
|
|
6
|
-
overrides: [
|
|
7
|
-
{
|
|
8
|
-
files: ["src/**/*.test.{ts,tsx}"],
|
|
9
|
-
env: {
|
|
10
|
-
"jest/globals": true,
|
|
11
|
-
},
|
|
12
|
-
plugins: ["jest"],
|
|
13
|
-
rules: {
|
|
14
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
rules: {
|
|
19
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
20
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
21
|
-
},
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/adapters.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const index_1 = require("@ledgerhq/coin-framework/account/index");
|
|
7
|
-
const cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
|
8
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
-
const ethers_1 = require("ethers");
|
|
10
|
-
const adapters_1 = require("../adapters");
|
|
11
|
-
const testData = Buffer.from("testBufferString").toString("hex");
|
|
12
|
-
const eip1559Tx = {
|
|
13
|
-
amount: new bignumber_js_1.default(100),
|
|
14
|
-
useAllAmount: false,
|
|
15
|
-
subAccountId: "id",
|
|
16
|
-
recipient: "0xkvn",
|
|
17
|
-
feesStrategy: "custom",
|
|
18
|
-
family: "evm",
|
|
19
|
-
mode: "send",
|
|
20
|
-
nonce: 0,
|
|
21
|
-
gasLimit: new bignumber_js_1.default(21000),
|
|
22
|
-
chainId: 1,
|
|
23
|
-
data: Buffer.from(testData, "hex"),
|
|
24
|
-
maxFeePerGas: new bignumber_js_1.default(10000),
|
|
25
|
-
maxPriorityFeePerGas: new bignumber_js_1.default(10000),
|
|
26
|
-
type: 2,
|
|
27
|
-
};
|
|
28
|
-
const legacyTx = {
|
|
29
|
-
amount: new bignumber_js_1.default(100),
|
|
30
|
-
useAllAmount: false,
|
|
31
|
-
subAccountId: "id",
|
|
32
|
-
recipient: "0xkvn",
|
|
33
|
-
feesStrategy: "custom",
|
|
34
|
-
family: "evm",
|
|
35
|
-
mode: "send",
|
|
36
|
-
nonce: 0,
|
|
37
|
-
gasLimit: new bignumber_js_1.default(21000),
|
|
38
|
-
chainId: 1,
|
|
39
|
-
data: Buffer.from(testData, "hex"),
|
|
40
|
-
gasPrice: new bignumber_js_1.default(10000),
|
|
41
|
-
type: 0,
|
|
42
|
-
};
|
|
43
|
-
describe("EVM Family", () => {
|
|
44
|
-
describe("adapters.ts", () => {
|
|
45
|
-
describe("transactionToEthersTransaction", () => {
|
|
46
|
-
it("should build convert an EIP1559 ledger live transaction to an ethers transaction", () => {
|
|
47
|
-
const ethers1559Tx = {
|
|
48
|
-
to: "0xkvn",
|
|
49
|
-
nonce: 0,
|
|
50
|
-
gasLimit: ethers_1.ethers.BigNumber.from(21000),
|
|
51
|
-
data: "0x" + testData,
|
|
52
|
-
value: ethers_1.ethers.BigNumber.from(100),
|
|
53
|
-
chainId: 1,
|
|
54
|
-
type: 2,
|
|
55
|
-
maxFeePerGas: ethers_1.ethers.BigNumber.from(10000),
|
|
56
|
-
maxPriorityFeePerGas: ethers_1.ethers.BigNumber.from(10000),
|
|
57
|
-
};
|
|
58
|
-
expect((0, adapters_1.transactionToEthersTransaction)(eip1559Tx)).toEqual(ethers1559Tx);
|
|
59
|
-
});
|
|
60
|
-
it("should build convert an legacy ledger live transaction to an ethers transaction", () => {
|
|
61
|
-
const legacyEthersTx = {
|
|
62
|
-
to: "0xkvn",
|
|
63
|
-
nonce: 0,
|
|
64
|
-
gasLimit: ethers_1.ethers.BigNumber.from(21000),
|
|
65
|
-
data: "0x" + testData,
|
|
66
|
-
value: ethers_1.ethers.BigNumber.from(100),
|
|
67
|
-
chainId: 1,
|
|
68
|
-
type: 0,
|
|
69
|
-
gasPrice: ethers_1.ethers.BigNumber.from(10000),
|
|
70
|
-
};
|
|
71
|
-
expect((0, adapters_1.transactionToEthersTransaction)(legacyTx)).toEqual(legacyEthersTx);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe("etherscanOperationToOperation", () => {
|
|
75
|
-
it("should convert a etherscan-like smart contract operation (from their API) to a Ledger Live Operation", () => {
|
|
76
|
-
const etherscanOp = {
|
|
77
|
-
blockNumber: "14923692",
|
|
78
|
-
timeStamp: "1654646570",
|
|
79
|
-
hash: "0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338",
|
|
80
|
-
nonce: "7",
|
|
81
|
-
blockHash: "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
|
|
82
|
-
transactionIndex: "27",
|
|
83
|
-
from: "0x9aa99c23f67c81701c772b106b4f83f6e858dd2e",
|
|
84
|
-
to: "0xc5102fe9359fd9a28f877a67e36b0f050d81a3cc",
|
|
85
|
-
value: "0",
|
|
86
|
-
gas: "6000000",
|
|
87
|
-
gasPrice: "125521409858",
|
|
88
|
-
isError: "0",
|
|
89
|
-
txreceipt_status: "1",
|
|
90
|
-
input: "0xa9059cbb000000000000000000000000313143c4088a47c469d06fe3fa5fd4196be6a4d600000000000000000000000000000000000000000003b8e97d229a2d54800000",
|
|
91
|
-
contractAddress: "",
|
|
92
|
-
cumulativeGasUsed: "1977481",
|
|
93
|
-
gasUsed: "57168",
|
|
94
|
-
confirmations: "122471",
|
|
95
|
-
methodId: "0xa9059cbb",
|
|
96
|
-
functionName: "transfer(address _to, uint256 _value)",
|
|
97
|
-
};
|
|
98
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
99
|
-
type: "js",
|
|
100
|
-
version: "2",
|
|
101
|
-
currencyId: "ethereum",
|
|
102
|
-
xpubOrAddress: "0x9aa99c23f67c81701c772b106b4f83f6e858dd2e",
|
|
103
|
-
derivationMode: "",
|
|
104
|
-
});
|
|
105
|
-
const expectedOperation = {
|
|
106
|
-
id: "js:2:ethereum:0x9aa99c23f67c81701c772b106b4f83f6e858dd2e:-0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338-FEES",
|
|
107
|
-
hash: "0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338",
|
|
108
|
-
accountId,
|
|
109
|
-
blockHash: "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
|
|
110
|
-
blockHeight: 14923692,
|
|
111
|
-
recipients: ["0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC"],
|
|
112
|
-
senders: ["0x9AA99C23F67c81701C772B106b4F83f6e858dd2E"],
|
|
113
|
-
value: new bignumber_js_1.default("7175807958762144"),
|
|
114
|
-
fee: new bignumber_js_1.default("7175807958762144"),
|
|
115
|
-
date: new Date("2022-06-08T00:02:50.000Z"),
|
|
116
|
-
transactionSequenceNumber: 7,
|
|
117
|
-
type: "FEES",
|
|
118
|
-
extra: {},
|
|
119
|
-
};
|
|
120
|
-
expect((0, adapters_1.etherscanOperationToOperation)(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
121
|
-
});
|
|
122
|
-
it("should convert a etherscan-like coin out operation (from their API) to a Ledger Live Operation", () => {
|
|
123
|
-
const etherscanOp = {
|
|
124
|
-
blockNumber: "13807766",
|
|
125
|
-
timeStamp: "1639544926",
|
|
126
|
-
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
127
|
-
nonce: "11898499",
|
|
128
|
-
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
129
|
-
transactionIndex: "394",
|
|
130
|
-
from: "0x829bd824b016326a401d083b33d092293333a830",
|
|
131
|
-
to: "0x26e3fd2dec89bf645ba7b41c4ddfad8454ee6245",
|
|
132
|
-
value: "143141441418750645",
|
|
133
|
-
gas: "210000",
|
|
134
|
-
gasPrice: "68363841693",
|
|
135
|
-
isError: "0",
|
|
136
|
-
txreceipt_status: "1",
|
|
137
|
-
input: "0x",
|
|
138
|
-
contractAddress: "",
|
|
139
|
-
cumulativeGasUsed: "14788393",
|
|
140
|
-
gasUsed: "21000",
|
|
141
|
-
confirmations: "2582470",
|
|
142
|
-
methodId: "0x",
|
|
143
|
-
functionName: "",
|
|
144
|
-
};
|
|
145
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
146
|
-
type: "js",
|
|
147
|
-
version: "2",
|
|
148
|
-
currencyId: "ethereum",
|
|
149
|
-
xpubOrAddress: "0x829BD824B016326A401d083B33D092293333A830",
|
|
150
|
-
derivationMode: "",
|
|
151
|
-
});
|
|
152
|
-
const expectedOperation = {
|
|
153
|
-
id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-OUT",
|
|
154
|
-
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
155
|
-
accountId,
|
|
156
|
-
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
157
|
-
blockHeight: 13807766,
|
|
158
|
-
recipients: ["0x26E3fd2dEc89bF645BA7b41c4DdFad8454Ee6245"],
|
|
159
|
-
senders: ["0x829BD824B016326A401d083B33D092293333A830"],
|
|
160
|
-
value: new bignumber_js_1.default("143141441418750645").plus("1435640675553000"),
|
|
161
|
-
fee: new bignumber_js_1.default("1435640675553000"),
|
|
162
|
-
date: new Date("2021-12-15T05:08:46.000Z"),
|
|
163
|
-
transactionSequenceNumber: 11898499,
|
|
164
|
-
type: "OUT",
|
|
165
|
-
extra: {},
|
|
166
|
-
};
|
|
167
|
-
expect((0, adapters_1.etherscanOperationToOperation)(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
168
|
-
});
|
|
169
|
-
it("should convert a etherscan-like coin in operation (from their API) to a Ledger Live Operation", () => {
|
|
170
|
-
const etherscanOp = {
|
|
171
|
-
blockNumber: "13807766",
|
|
172
|
-
timeStamp: "1639544926",
|
|
173
|
-
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
174
|
-
nonce: "11898499",
|
|
175
|
-
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
176
|
-
transactionIndex: "394",
|
|
177
|
-
from: "0x26e3fd2dec89bf645ba7b41c4ddfad8454ee6245",
|
|
178
|
-
to: "0x829bd824b016326a401d083b33d092293333a830",
|
|
179
|
-
value: "143141441418750645",
|
|
180
|
-
gas: "210000",
|
|
181
|
-
gasPrice: "68363841693",
|
|
182
|
-
isError: "0",
|
|
183
|
-
txreceipt_status: "1",
|
|
184
|
-
input: "0x",
|
|
185
|
-
contractAddress: "",
|
|
186
|
-
cumulativeGasUsed: "14788393",
|
|
187
|
-
gasUsed: "21000",
|
|
188
|
-
confirmations: "2582470",
|
|
189
|
-
methodId: "0x",
|
|
190
|
-
functionName: "",
|
|
191
|
-
};
|
|
192
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
193
|
-
type: "js",
|
|
194
|
-
version: "2",
|
|
195
|
-
currencyId: "ethereum",
|
|
196
|
-
xpubOrAddress: "0x829BD824B016326A401d083B33D092293333A830",
|
|
197
|
-
derivationMode: "",
|
|
198
|
-
});
|
|
199
|
-
const expectedOperation = {
|
|
200
|
-
id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-IN",
|
|
201
|
-
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
202
|
-
accountId,
|
|
203
|
-
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
204
|
-
blockHeight: 13807766,
|
|
205
|
-
recipients: ["0x829BD824B016326A401d083B33D092293333A830"],
|
|
206
|
-
senders: ["0x26E3fd2dEc89bF645BA7b41c4DdFad8454Ee6245"],
|
|
207
|
-
value: new bignumber_js_1.default("143141441418750645"),
|
|
208
|
-
fee: new bignumber_js_1.default("1435640675553000"),
|
|
209
|
-
date: new Date("2021-12-15T05:08:46.000Z"),
|
|
210
|
-
transactionSequenceNumber: 11898499,
|
|
211
|
-
type: "IN",
|
|
212
|
-
extra: {},
|
|
213
|
-
};
|
|
214
|
-
expect((0, adapters_1.etherscanOperationToOperation)(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
215
|
-
});
|
|
216
|
-
it("should convert a etherscan-like coin none operation (from their API) to a Ledger Live Operation", () => {
|
|
217
|
-
const etherscanOp = {
|
|
218
|
-
blockNumber: "13807766",
|
|
219
|
-
timeStamp: "1639544926",
|
|
220
|
-
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
221
|
-
nonce: "11898499",
|
|
222
|
-
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
223
|
-
transactionIndex: "394",
|
|
224
|
-
from: "0x6bfd74c0996f269bcece59191eff667b3dfd73b9",
|
|
225
|
-
to: "0x02a357476a300c89ce27d7d4c7e57bbd2dd3f006",
|
|
226
|
-
value: "143141441418750645",
|
|
227
|
-
gas: "210000",
|
|
228
|
-
gasPrice: "68363841693",
|
|
229
|
-
isError: "0",
|
|
230
|
-
txreceipt_status: "1",
|
|
231
|
-
input: "0x",
|
|
232
|
-
contractAddress: "",
|
|
233
|
-
cumulativeGasUsed: "14788393",
|
|
234
|
-
gasUsed: "21000",
|
|
235
|
-
confirmations: "2582470",
|
|
236
|
-
methodId: "0x",
|
|
237
|
-
functionName: "",
|
|
238
|
-
};
|
|
239
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
240
|
-
type: "js",
|
|
241
|
-
version: "2",
|
|
242
|
-
currencyId: "ethereum",
|
|
243
|
-
xpubOrAddress: "0x829BD824B016326A401d083B33D092293333A830",
|
|
244
|
-
derivationMode: "",
|
|
245
|
-
});
|
|
246
|
-
const expectedOperation = {
|
|
247
|
-
id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-NONE",
|
|
248
|
-
hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
|
|
249
|
-
accountId,
|
|
250
|
-
blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
|
|
251
|
-
blockHeight: 13807766,
|
|
252
|
-
recipients: ["0x02a357476A300c89Ce27D7D4C7E57Bbd2DD3f006"],
|
|
253
|
-
senders: ["0x6bfD74C0996F269Bcece59191EFf667b3dFD73b9"],
|
|
254
|
-
value: new bignumber_js_1.default("143141441418750645"),
|
|
255
|
-
fee: new bignumber_js_1.default("1435640675553000"),
|
|
256
|
-
date: new Date("2021-12-15T05:08:46.000Z"),
|
|
257
|
-
transactionSequenceNumber: 11898499,
|
|
258
|
-
type: "NONE",
|
|
259
|
-
extra: {},
|
|
260
|
-
};
|
|
261
|
-
expect((0, adapters_1.etherscanOperationToOperation)(accountId, etherscanOp)).toEqual(expectedOperation);
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
describe("etherscanERC20EventToOperation", () => {
|
|
265
|
-
it("should return null for an unknown token", () => {
|
|
266
|
-
const etherscanOp = {
|
|
267
|
-
blockNumber: "16240731",
|
|
268
|
-
timeStamp: "1671717983",
|
|
269
|
-
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
270
|
-
nonce: "53",
|
|
271
|
-
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
272
|
-
from: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
273
|
-
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb41",
|
|
274
|
-
to: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
|
|
275
|
-
value: "2000000",
|
|
276
|
-
tokenName: "USD Coin",
|
|
277
|
-
tokenSymbol: "USDC",
|
|
278
|
-
tokenDecimal: "6",
|
|
279
|
-
transactionIndex: "65",
|
|
280
|
-
gas: "79381",
|
|
281
|
-
gasPrice: "24314367325",
|
|
282
|
-
gasUsed: "65613",
|
|
283
|
-
cumulativeGasUsed: "4557746",
|
|
284
|
-
input: "deprecated",
|
|
285
|
-
confirmations: "150032",
|
|
286
|
-
};
|
|
287
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
288
|
-
type: "js",
|
|
289
|
-
version: "2",
|
|
290
|
-
currencyId: "ethereum",
|
|
291
|
-
xpubOrAddress: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
292
|
-
derivationMode: "",
|
|
293
|
-
});
|
|
294
|
-
expect((0, adapters_1.etherscanERC20EventToOperation)(accountId, etherscanOp)).toEqual(null);
|
|
295
|
-
});
|
|
296
|
-
it("should convert a etherscan-like usdc out event (from their API) to a Ledger Live Operation", () => {
|
|
297
|
-
const etherscanOp = {
|
|
298
|
-
blockNumber: "16240731",
|
|
299
|
-
timeStamp: "1671717983",
|
|
300
|
-
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
301
|
-
nonce: "53",
|
|
302
|
-
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
303
|
-
from: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
304
|
-
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
305
|
-
to: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
|
|
306
|
-
value: "2000000",
|
|
307
|
-
tokenName: "USD Coin",
|
|
308
|
-
tokenSymbol: "USDC",
|
|
309
|
-
tokenDecimal: "6",
|
|
310
|
-
transactionIndex: "65",
|
|
311
|
-
gas: "79381",
|
|
312
|
-
gasPrice: "24314367325",
|
|
313
|
-
gasUsed: "65613",
|
|
314
|
-
cumulativeGasUsed: "4557746",
|
|
315
|
-
input: "deprecated",
|
|
316
|
-
confirmations: "150032",
|
|
317
|
-
};
|
|
318
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
319
|
-
type: "js",
|
|
320
|
-
version: "2",
|
|
321
|
-
currencyId: "ethereum",
|
|
322
|
-
xpubOrAddress: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
323
|
-
derivationMode: "",
|
|
324
|
-
});
|
|
325
|
-
const tokenCurrency = (0, cryptoassets_1.findTokenById)("ethereum/erc20/usd__coin");
|
|
326
|
-
const tokenAccountId = (0, index_1.encodeTokenAccountId)(accountId, tokenCurrency);
|
|
327
|
-
const expectedOperation = {
|
|
328
|
-
id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-OUT",
|
|
329
|
-
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
330
|
-
accountId: tokenAccountId,
|
|
331
|
-
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
332
|
-
blockHeight: 16240731,
|
|
333
|
-
senders: ["0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"],
|
|
334
|
-
recipients: ["0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"],
|
|
335
|
-
value: new bignumber_js_1.default("2000000"),
|
|
336
|
-
fee: new bignumber_js_1.default("1595338583295225"),
|
|
337
|
-
contract: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
338
|
-
date: new Date("2022-12-22T14:06:23.000Z"),
|
|
339
|
-
transactionSequenceNumber: 53,
|
|
340
|
-
type: "OUT",
|
|
341
|
-
extra: {},
|
|
342
|
-
};
|
|
343
|
-
expect((0, adapters_1.etherscanERC20EventToOperation)(accountId, etherscanOp)).toEqual({
|
|
344
|
-
operation: expectedOperation,
|
|
345
|
-
tokenCurrency,
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
it("should convert a etherscan-like usdc in event (from their API) to a Ledger Live Operation", () => {
|
|
349
|
-
const etherscanOp = {
|
|
350
|
-
blockNumber: "16240731",
|
|
351
|
-
timeStamp: "1671717983",
|
|
352
|
-
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
353
|
-
nonce: "53",
|
|
354
|
-
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
355
|
-
from: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
|
|
356
|
-
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
357
|
-
to: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
358
|
-
value: "2000000",
|
|
359
|
-
tokenName: "USD Coin",
|
|
360
|
-
tokenSymbol: "USDC",
|
|
361
|
-
tokenDecimal: "6",
|
|
362
|
-
transactionIndex: "65",
|
|
363
|
-
gas: "79381",
|
|
364
|
-
gasPrice: "24314367325",
|
|
365
|
-
gasUsed: "65613",
|
|
366
|
-
cumulativeGasUsed: "4557746",
|
|
367
|
-
input: "deprecated",
|
|
368
|
-
confirmations: "150032",
|
|
369
|
-
};
|
|
370
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
371
|
-
type: "js",
|
|
372
|
-
version: "2",
|
|
373
|
-
currencyId: "ethereum",
|
|
374
|
-
xpubOrAddress: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
375
|
-
derivationMode: "",
|
|
376
|
-
});
|
|
377
|
-
const tokenCurrency = (0, cryptoassets_1.findTokenById)("ethereum/erc20/usd__coin");
|
|
378
|
-
const tokenAccountId = (0, index_1.encodeTokenAccountId)(accountId, tokenCurrency);
|
|
379
|
-
const expectedOperation = {
|
|
380
|
-
id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-IN",
|
|
381
|
-
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
382
|
-
accountId: tokenAccountId,
|
|
383
|
-
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
384
|
-
blockHeight: 16240731,
|
|
385
|
-
senders: ["0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"],
|
|
386
|
-
recipients: ["0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"],
|
|
387
|
-
value: new bignumber_js_1.default("2000000"),
|
|
388
|
-
fee: new bignumber_js_1.default("1595338583295225"),
|
|
389
|
-
contract: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
390
|
-
date: new Date("2022-12-22T14:06:23.000Z"),
|
|
391
|
-
transactionSequenceNumber: 53,
|
|
392
|
-
type: "IN",
|
|
393
|
-
extra: {},
|
|
394
|
-
};
|
|
395
|
-
expect((0, adapters_1.etherscanERC20EventToOperation)(accountId, etherscanOp)).toEqual({
|
|
396
|
-
operation: expectedOperation,
|
|
397
|
-
tokenCurrency,
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
it("should convert a etherscan-like usdc none event (from their API) to a Ledger Live Operation", () => {
|
|
401
|
-
const etherscanOp = {
|
|
402
|
-
blockNumber: "16240731",
|
|
403
|
-
timeStamp: "1671717983",
|
|
404
|
-
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
405
|
-
nonce: "53",
|
|
406
|
-
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
407
|
-
from: "0x6bfd74c0996f269bcece59191eff667b3dfd73b9",
|
|
408
|
-
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
409
|
-
to: "0x02a357476a300c89ce27d7d4c7e57bbd2dd3f006",
|
|
410
|
-
value: "2000000",
|
|
411
|
-
tokenName: "USD Coin",
|
|
412
|
-
tokenSymbol: "USDC",
|
|
413
|
-
tokenDecimal: "6",
|
|
414
|
-
transactionIndex: "65",
|
|
415
|
-
gas: "79381",
|
|
416
|
-
gasPrice: "24314367325",
|
|
417
|
-
gasUsed: "65613",
|
|
418
|
-
cumulativeGasUsed: "4557746",
|
|
419
|
-
input: "deprecated",
|
|
420
|
-
confirmations: "150032",
|
|
421
|
-
};
|
|
422
|
-
const accountId = (0, index_1.encodeAccountId)({
|
|
423
|
-
type: "js",
|
|
424
|
-
version: "2",
|
|
425
|
-
currencyId: "ethereum",
|
|
426
|
-
xpubOrAddress: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
|
|
427
|
-
derivationMode: "",
|
|
428
|
-
});
|
|
429
|
-
const tokenCurrency = (0, cryptoassets_1.findTokenById)("ethereum/erc20/usd__coin");
|
|
430
|
-
const tokenAccountId = (0, index_1.encodeTokenAccountId)(accountId, tokenCurrency);
|
|
431
|
-
const expectedOperation = {
|
|
432
|
-
id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-NONE",
|
|
433
|
-
hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
|
|
434
|
-
accountId: tokenAccountId,
|
|
435
|
-
blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
|
|
436
|
-
blockHeight: 16240731,
|
|
437
|
-
recipients: ["0x02a357476A300c89Ce27D7D4C7E57Bbd2DD3f006"],
|
|
438
|
-
senders: ["0x6bfD74C0996F269Bcece59191EFf667b3dFD73b9"],
|
|
439
|
-
value: new bignumber_js_1.default("2000000"),
|
|
440
|
-
fee: new bignumber_js_1.default("1595338583295225"),
|
|
441
|
-
contract: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
442
|
-
date: new Date("2022-12-22T14:06:23.000Z"),
|
|
443
|
-
transactionSequenceNumber: 53,
|
|
444
|
-
type: "NONE",
|
|
445
|
-
extra: {},
|
|
446
|
-
};
|
|
447
|
-
expect((0, adapters_1.etherscanERC20EventToOperation)(accountId, etherscanOp)).toEqual({
|
|
448
|
-
operation: expectedOperation,
|
|
449
|
-
tokenCurrency,
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
});
|
|
453
|
-
});
|
|
454
|
-
});
|
|
455
|
-
//# sourceMappingURL=adapters.unit.test.js.map
|