@ledgerhq/coin-evm 10.0.0 → 15.0.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/.oxlintrc.json +2 -6
- package/CHANGELOG.md +54 -0
- package/docs/getBlock-internal-txs-schema.md +2 -2
- package/docs/network/node/index.md +1 -1
- package/lib/abis/index.d.ts +8 -0
- package/lib/abis/index.d.ts.map +1 -1
- package/lib/abis/index.js +30 -0
- package/lib/abis/index.js.map +1 -1
- package/lib/adapters/blockOperations.js +2 -2
- package/lib/adapters/blockOperations.js.map +1 -1
- package/lib/adapters/etherscan.d.ts +2 -1
- package/lib/adapters/etherscan.d.ts.map +1 -1
- package/lib/adapters/etherscan.js +2 -2
- package/lib/adapters/etherscan.js.map +1 -1
- package/lib/adapters/ledger.d.ts +2 -1
- package/lib/adapters/ledger.d.ts.map +1 -1
- package/lib/adapters/ledger.js +2 -2
- package/lib/adapters/ledger.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +3 -2
- package/lib/api/index.js.map +1 -1
- package/lib/chains.d.ts +94 -0
- package/lib/chains.d.ts.map +1 -0
- package/lib/chains.js +98 -0
- package/lib/chains.js.map +1 -0
- package/lib/config.d.ts +4 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -1
- package/lib/config.js.map +1 -1
- package/lib/internalTxSources.d.ts.map +1 -1
- package/lib/internalTxSources.js +21 -3
- package/lib/internalTxSources.js.map +1 -1
- package/lib/logic/broadcast.js +2 -2
- package/lib/logic/broadcast.js.map +1 -1
- package/lib/logic/common.d.ts +1 -1
- package/lib/logic/common.d.ts.map +1 -1
- package/lib/logic/common.js +22 -14
- package/lib/logic/common.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +7 -4
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +11 -8
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +9 -9
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBlock.d.ts.map +1 -1
- package/lib/logic/getBlock.js +17 -17
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/getBlockInfo.js +2 -2
- package/lib/logic/getBlockInfo.js.map +1 -1
- package/lib/logic/getNextSequence.d.ts.map +1 -1
- package/lib/logic/getNextSequence.js +1 -1
- package/lib/logic/getNextSequence.js.map +1 -1
- package/lib/logic/getStakes.d.ts.map +1 -1
- package/lib/logic/getStakes.js +10 -10
- package/lib/logic/getStakes.js.map +1 -1
- package/lib/logic/internalTransactionsFetcher.d.ts +2 -2
- package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib/logic/internalTransactionsFetcher.js +9 -9
- package/lib/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib/logic/lastBlock.js +2 -2
- package/lib/logic/lastBlock.js.map +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +1 -1
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/predicates.d.ts +17 -0
- package/lib/logic/predicates.d.ts.map +1 -0
- package/lib/logic/predicates.js +126 -0
- package/lib/logic/predicates.js.map +1 -0
- package/lib/logic/validateIntent.d.ts.map +1 -1
- package/lib/logic/validateIntent.js +9 -9
- package/lib/logic/validateIntent.js.map +1 -1
- package/lib/logic.d.ts +1 -1
- package/lib/logic.d.ts.map +1 -1
- package/lib/logic.js +14 -13
- package/lib/logic.js.map +1 -1
- package/lib/network/explorer/etherscan.d.ts +2 -3
- package/lib/network/explorer/etherscan.d.ts.map +1 -1
- package/lib/network/explorer/etherscan.js +6 -8
- package/lib/network/explorer/etherscan.js.map +1 -1
- package/lib/network/explorer/ledger.d.ts.map +1 -1
- package/lib/network/explorer/ledger.js +5 -5
- package/lib/network/explorer/ledger.js.map +1 -1
- package/lib/network/explorer/types.d.ts +2 -2
- package/lib/network/explorer/types.d.ts.map +1 -1
- package/lib/network/explorer/types.js +11 -1
- package/lib/network/explorer/types.js.map +1 -1
- package/lib/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib/network/gasTracker/ledger.js +1 -3
- package/lib/network/gasTracker/ledger.js.map +1 -1
- package/lib/network/node/explorerProxy.d.ts.map +1 -1
- package/lib/network/node/explorerProxy.js +22 -17
- package/lib/network/node/explorerProxy.js.map +1 -1
- package/lib/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
- package/lib/network/node/gethCallTracerToTraceBlockItems.js +10 -12
- package/lib/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
- package/lib/network/node/index.d.ts +1 -1
- package/lib/network/node/index.d.ts.map +1 -1
- package/lib/network/node/index.js +7 -7
- package/lib/network/node/index.js.map +1 -1
- package/lib/network/node/ledger.d.ts +3 -1
- package/lib/network/node/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js +38 -24
- package/lib/network/node/ledger.js.map +1 -1
- package/lib/network/node/rpc.common.d.ts +1 -1
- package/lib/network/node/rpc.common.d.ts.map +1 -1
- package/lib/network/node/rpc.common.js +104 -103
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +21 -22
- package/lib/network/node/types.d.ts.map +1 -1
- package/lib/network/node/types.js +0 -27
- package/lib/network/node/types.js.map +1 -1
- package/lib/network/node/withNodeSources.d.ts.map +1 -1
- package/lib/network/node/withNodeSources.js +15 -15
- package/lib/network/node/withNodeSources.js.map +1 -1
- package/lib/nodeSources.d.ts.map +1 -1
- package/lib/nodeSources.js +11 -3
- package/lib/nodeSources.js.map +1 -1
- package/lib/staking/abis.d.ts +3 -2
- package/lib/staking/abis.d.ts.map +1 -1
- package/lib/staking/abis.js +10 -9
- package/lib/staking/abis.js.map +1 -1
- package/lib/staking/contracts.d.ts +3 -2
- package/lib/staking/contracts.d.ts.map +1 -1
- package/lib/staking/contracts.js +12 -13
- package/lib/staking/contracts.js.map +1 -1
- package/lib/staking/detectOperationType.d.ts +2 -4
- package/lib/staking/detectOperationType.d.ts.map +1 -1
- package/lib/staking/detectOperationType.js +22 -21
- package/lib/staking/detectOperationType.js.map +1 -1
- package/lib/staking/encoder.d.ts +2 -1
- package/lib/staking/encoder.d.ts.map +1 -1
- package/lib/staking/encoder.js +8 -8
- package/lib/staking/encoder.js.map +1 -1
- package/lib/staking/fetchers.d.ts +2 -1
- package/lib/staking/fetchers.d.ts.map +1 -1
- package/lib/staking/fetchers.js +27 -27
- package/lib/staking/fetchers.js.map +1 -1
- package/lib/staking/logic.d.ts +6 -6
- package/lib/staking/logic.d.ts.map +1 -1
- package/lib/staking/logic.js +14 -13
- package/lib/staking/logic.js.map +1 -1
- package/lib/staking/operations/index.d.ts +2 -1
- package/lib/staking/operations/index.d.ts.map +1 -1
- package/lib/staking/operations/index.js +39 -20
- package/lib/staking/operations/index.js.map +1 -1
- package/lib/staking/prepareIntents.d.ts +1 -1
- package/lib/staking/prepareIntents.d.ts.map +1 -1
- package/lib/staking/prepareIntents.js +14 -12
- package/lib/staking/prepareIntents.js.map +1 -1
- package/lib/staking/redelegations.d.ts +4 -4
- package/lib/staking/redelegations.d.ts.map +1 -1
- package/lib/staking/redelegations.js +22 -27
- package/lib/staking/redelegations.js.map +1 -1
- package/lib/staking/rewards.d.ts +1 -1
- package/lib/staking/rewards.d.ts.map +1 -1
- package/lib/staking/rewards.js +2 -2
- package/lib/staking/rewards.js.map +1 -1
- package/lib/staking/rewardsFromReceipt.d.ts +2 -1
- package/lib/staking/rewardsFromReceipt.d.ts.map +1 -1
- package/lib/staking/rewardsFromReceipt.js +2 -2
- package/lib/staking/rewardsFromReceipt.js.map +1 -1
- package/lib/staking/transactionData.d.ts +2 -1
- package/lib/staking/transactionData.d.ts.map +1 -1
- package/lib/staking/transactionData.js +6 -6
- package/lib/staking/transactionData.js.map +1 -1
- package/lib/staking/unbondings.d.ts +1 -1
- package/lib/staking/unbondings.d.ts.map +1 -1
- package/lib/staking/unbondings.js +2 -2
- package/lib/staking/unbondings.js.map +1 -1
- package/lib/staking/utils.d.ts.map +1 -1
- package/lib/staking/utils.js +22 -27
- package/lib/staking/utils.js.map +1 -1
- package/lib/staking/validators/index.d.ts +14 -14
- package/lib/staking/validators/index.d.ts.map +1 -1
- package/lib/staking/validators/index.js +39 -38
- package/lib/staking/validators/index.js.map +1 -1
- package/lib/staking/validators/monad.d.ts +5 -5
- package/lib/staking/validators/monad.d.ts.map +1 -1
- package/lib/staking/validators/monad.js +44 -37
- package/lib/staking/validators/monad.js.map +1 -1
- package/lib/staking/validators/monadResolver.d.ts +1 -1
- package/lib/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib/staking/validators/monadResolver.js +7 -6
- package/lib/staking/validators/monadResolver.js.map +1 -1
- package/lib/staking/validators/sei.js +2 -2
- package/lib/staking/validators/sei.js.map +1 -1
- package/lib/staking/validators/somnia.d.ts +4 -4
- package/lib/staking/validators/somnia.d.ts.map +1 -1
- package/lib/staking/validators/somnia.js +25 -24
- package/lib/staking/validators/somnia.js.map +1 -1
- package/lib/staking/validators/types.d.ts +1 -1
- package/lib/staking/validators/types.d.ts.map +1 -1
- package/lib/staking/validators/zero_gravity.d.ts +1 -1
- package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib/staking/validators/zero_gravity.js +10 -9
- package/lib/staking/validators/zero_gravity.js.map +1 -1
- package/lib/types/staking.d.ts +5 -6
- package/lib/types/staking.d.ts.map +1 -1
- package/lib-es/abis/index.d.ts +8 -0
- package/lib-es/abis/index.d.ts.map +1 -1
- package/lib-es/abis/index.js +29 -0
- package/lib-es/abis/index.js.map +1 -1
- package/lib-es/adapters/blockOperations.js +1 -1
- package/lib-es/adapters/blockOperations.js.map +1 -1
- package/lib-es/adapters/etherscan.d.ts +2 -1
- package/lib-es/adapters/etherscan.d.ts.map +1 -1
- package/lib-es/adapters/etherscan.js +2 -2
- package/lib-es/adapters/etherscan.js.map +1 -1
- package/lib-es/adapters/ledger.d.ts +2 -1
- package/lib-es/adapters/ledger.d.ts.map +1 -1
- package/lib-es/adapters/ledger.js +2 -2
- package/lib-es/adapters/ledger.js.map +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +3 -2
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/chains.d.ts +94 -0
- package/lib-es/chains.d.ts.map +1 -0
- package/lib-es/chains.js +95 -0
- package/lib-es/chains.js.map +1 -0
- package/lib-es/config.d.ts +4 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js +1 -0
- package/lib-es/config.js.map +1 -1
- package/lib-es/internalTxSources.d.ts.map +1 -1
- package/lib-es/internalTxSources.js +21 -3
- package/lib-es/internalTxSources.js.map +1 -1
- package/lib-es/logic/broadcast.js +2 -2
- package/lib-es/logic/broadcast.js.map +1 -1
- package/lib-es/logic/common.d.ts +1 -1
- package/lib-es/logic/common.d.ts.map +1 -1
- package/lib-es/logic/common.js +22 -14
- package/lib-es/logic/common.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +7 -4
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js +11 -8
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +9 -9
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/getBlock.d.ts.map +1 -1
- package/lib-es/logic/getBlock.js +18 -18
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/getBlockInfo.js +2 -2
- package/lib-es/logic/getBlockInfo.js.map +1 -1
- package/lib-es/logic/getNextSequence.d.ts.map +1 -1
- package/lib-es/logic/getNextSequence.js +1 -1
- package/lib-es/logic/getNextSequence.js.map +1 -1
- package/lib-es/logic/getStakes.d.ts.map +1 -1
- package/lib-es/logic/getStakes.js +10 -10
- package/lib-es/logic/getStakes.js.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.d.ts +2 -2
- package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.js +9 -9
- package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib-es/logic/lastBlock.js +2 -2
- package/lib-es/logic/lastBlock.js.map +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +1 -1
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/predicates.d.ts +17 -0
- package/lib-es/logic/predicates.d.ts.map +1 -0
- package/lib-es/logic/predicates.js +114 -0
- package/lib-es/logic/predicates.js.map +1 -0
- package/lib-es/logic/validateIntent.d.ts.map +1 -1
- package/lib-es/logic/validateIntent.js +9 -9
- package/lib-es/logic/validateIntent.js.map +1 -1
- package/lib-es/logic.d.ts +1 -1
- package/lib-es/logic.d.ts.map +1 -1
- package/lib-es/logic.js +14 -13
- package/lib-es/logic.js.map +1 -1
- package/lib-es/network/explorer/etherscan.d.ts +2 -3
- package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
- package/lib-es/network/explorer/etherscan.js +6 -8
- package/lib-es/network/explorer/etherscan.js.map +1 -1
- package/lib-es/network/explorer/ledger.d.ts.map +1 -1
- package/lib-es/network/explorer/ledger.js +5 -5
- package/lib-es/network/explorer/ledger.js.map +1 -1
- package/lib-es/network/explorer/types.d.ts +2 -2
- package/lib-es/network/explorer/types.d.ts.map +1 -1
- package/lib-es/network/explorer/types.js +11 -1
- package/lib-es/network/explorer/types.js.map +1 -1
- package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib-es/network/gasTracker/ledger.js +1 -3
- package/lib-es/network/gasTracker/ledger.js.map +1 -1
- package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
- package/lib-es/network/node/explorerProxy.js +22 -17
- package/lib-es/network/node/explorerProxy.js.map +1 -1
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.js +4 -6
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
- package/lib-es/network/node/index.d.ts +1 -1
- package/lib-es/network/node/index.d.ts.map +1 -1
- package/lib-es/network/node/index.js +7 -7
- package/lib-es/network/node/index.js.map +1 -1
- package/lib-es/network/node/ledger.d.ts +3 -1
- package/lib-es/network/node/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js +38 -24
- package/lib-es/network/node/ledger.js.map +1 -1
- package/lib-es/network/node/rpc.common.d.ts +1 -1
- package/lib-es/network/node/rpc.common.d.ts.map +1 -1
- package/lib-es/network/node/rpc.common.js +102 -101
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +21 -22
- package/lib-es/network/node/types.d.ts.map +1 -1
- package/lib-es/network/node/types.js +0 -25
- package/lib-es/network/node/types.js.map +1 -1
- package/lib-es/network/node/withNodeSources.d.ts.map +1 -1
- package/lib-es/network/node/withNodeSources.js +15 -15
- package/lib-es/network/node/withNodeSources.js.map +1 -1
- package/lib-es/nodeSources.d.ts.map +1 -1
- package/lib-es/nodeSources.js +11 -3
- package/lib-es/nodeSources.js.map +1 -1
- package/lib-es/staking/abis.d.ts +3 -2
- package/lib-es/staking/abis.d.ts.map +1 -1
- package/lib-es/staking/abis.js +10 -9
- package/lib-es/staking/abis.js.map +1 -1
- package/lib-es/staking/contracts.d.ts +3 -2
- package/lib-es/staking/contracts.d.ts.map +1 -1
- package/lib-es/staking/contracts.js +12 -13
- package/lib-es/staking/contracts.js.map +1 -1
- package/lib-es/staking/detectOperationType.d.ts +2 -4
- package/lib-es/staking/detectOperationType.d.ts.map +1 -1
- package/lib-es/staking/detectOperationType.js +22 -21
- package/lib-es/staking/detectOperationType.js.map +1 -1
- package/lib-es/staking/encoder.d.ts +2 -1
- package/lib-es/staking/encoder.d.ts.map +1 -1
- package/lib-es/staking/encoder.js +8 -8
- package/lib-es/staking/encoder.js.map +1 -1
- package/lib-es/staking/fetchers.d.ts +2 -1
- package/lib-es/staking/fetchers.d.ts.map +1 -1
- package/lib-es/staking/fetchers.js +27 -27
- package/lib-es/staking/fetchers.js.map +1 -1
- package/lib-es/staking/logic.d.ts +6 -6
- package/lib-es/staking/logic.d.ts.map +1 -1
- package/lib-es/staking/logic.js +14 -13
- package/lib-es/staking/logic.js.map +1 -1
- package/lib-es/staking/operations/index.d.ts +2 -1
- package/lib-es/staking/operations/index.d.ts.map +1 -1
- package/lib-es/staking/operations/index.js +39 -20
- package/lib-es/staking/operations/index.js.map +1 -1
- package/lib-es/staking/prepareIntents.d.ts +1 -1
- package/lib-es/staking/prepareIntents.d.ts.map +1 -1
- package/lib-es/staking/prepareIntents.js +13 -11
- package/lib-es/staking/prepareIntents.js.map +1 -1
- package/lib-es/staking/redelegations.d.ts +4 -4
- package/lib-es/staking/redelegations.d.ts.map +1 -1
- package/lib-es/staking/redelegations.js +19 -24
- package/lib-es/staking/redelegations.js.map +1 -1
- package/lib-es/staking/rewards.d.ts +1 -1
- package/lib-es/staking/rewards.d.ts.map +1 -1
- package/lib-es/staking/rewards.js +2 -2
- package/lib-es/staking/rewards.js.map +1 -1
- package/lib-es/staking/rewardsFromReceipt.d.ts +2 -1
- package/lib-es/staking/rewardsFromReceipt.d.ts.map +1 -1
- package/lib-es/staking/rewardsFromReceipt.js +2 -2
- package/lib-es/staking/rewardsFromReceipt.js.map +1 -1
- package/lib-es/staking/transactionData.d.ts +2 -1
- package/lib-es/staking/transactionData.d.ts.map +1 -1
- package/lib-es/staking/transactionData.js +6 -6
- package/lib-es/staking/transactionData.js.map +1 -1
- package/lib-es/staking/unbondings.d.ts +1 -1
- package/lib-es/staking/unbondings.d.ts.map +1 -1
- package/lib-es/staking/unbondings.js +2 -2
- package/lib-es/staking/unbondings.js.map +1 -1
- package/lib-es/staking/utils.d.ts.map +1 -1
- package/lib-es/staking/utils.js +20 -25
- package/lib-es/staking/utils.js.map +1 -1
- package/lib-es/staking/validators/index.d.ts +14 -14
- package/lib-es/staking/validators/index.d.ts.map +1 -1
- package/lib-es/staking/validators/index.js +39 -38
- package/lib-es/staking/validators/index.js.map +1 -1
- package/lib-es/staking/validators/monad.d.ts +5 -5
- package/lib-es/staking/validators/monad.d.ts.map +1 -1
- package/lib-es/staking/validators/monad.js +43 -36
- package/lib-es/staking/validators/monad.js.map +1 -1
- package/lib-es/staking/validators/monadResolver.d.ts +1 -1
- package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib-es/staking/validators/monadResolver.js +6 -5
- package/lib-es/staking/validators/monadResolver.js.map +1 -1
- package/lib-es/staking/validators/sei.js +2 -2
- package/lib-es/staking/validators/sei.js.map +1 -1
- package/lib-es/staking/validators/somnia.d.ts +4 -4
- package/lib-es/staking/validators/somnia.d.ts.map +1 -1
- package/lib-es/staking/validators/somnia.js +24 -23
- package/lib-es/staking/validators/somnia.js.map +1 -1
- package/lib-es/staking/validators/types.d.ts +1 -1
- package/lib-es/staking/validators/types.d.ts.map +1 -1
- package/lib-es/staking/validators/zero_gravity.d.ts +1 -1
- package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib-es/staking/validators/zero_gravity.js +9 -8
- package/lib-es/staking/validators/zero_gravity.js.map +1 -1
- package/lib-es/types/staking.d.ts +5 -6
- package/lib-es/types/staking.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/abis/index.test.ts +36 -0
- package/src/abis/index.ts +30 -0
- package/src/adapters/blockOperations.ts +1 -1
- package/src/adapters/etherscan.test.ts +34 -38
- package/src/adapters/etherscan.ts +3 -2
- package/src/adapters/ledger.test.ts +49 -22
- package/src/adapters/ledger.ts +3 -2
- package/src/api/getBlock.integ.test.ts +2 -1
- package/src/api/index.monad_testnet.integ.test.ts +2 -2
- package/src/api/index.ts +4 -3
- package/src/chains.test.ts +12 -0
- package/src/chains.ts +97 -0
- package/src/config.ts +5 -1
- package/src/fixtures/staking.fixtures.ts +13 -0
- package/src/internalTxSources.ts +20 -3
- package/src/logic/broadcast.ts +2 -2
- package/src/logic/common.ts +23 -14
- package/src/logic/craftTransaction.ts +6 -5
- package/src/logic/estimateFees.ts +10 -25
- package/src/logic/getBalance.ts +7 -13
- package/src/logic/getBlock.ts +22 -19
- package/src/logic/getBlockInfo.ts +2 -2
- package/src/logic/getNextSequence.ts +1 -4
- package/src/logic/getStakes.ts +11 -12
- package/src/logic/internalTransactionsFetcher.ts +7 -9
- package/src/logic/lastBlock.ts +2 -2
- package/src/logic/listOperations.ts +0 -1
- package/src/logic/predicates.ts +124 -0
- package/src/logic/tests/broadcast.test.ts +4 -4
- package/src/logic/tests/broadcastSource.test.ts +0 -3
- package/src/logic/tests/common.test.ts +17 -33
- package/src/logic/tests/craftTransaction.test.ts +13 -6
- package/src/logic/tests/estimateFees.test.ts +16 -7
- package/src/logic/tests/getBalance.test.ts +17 -33
- package/src/logic/tests/getBlock.test.ts +69 -75
- package/src/logic/tests/getBlockInfo.test.ts +1 -1
- package/src/logic/tests/getNextSequence.test.ts +1 -1
- package/src/logic/tests/getStakes.test.ts +28 -16
- package/src/logic/tests/internalTransactionsFetcher.test.ts +5 -5
- package/src/logic/tests/lastBlock.test.ts +3 -6
- package/src/logic/tests/listOperations.test.ts +3 -4
- package/src/logic/tests/validateIntent.test.ts +16 -3
- package/src/logic/validateIntent.ts +8 -10
- package/src/logic.test.ts +12 -4
- package/src/logic.ts +13 -13
- package/src/network/explorer/etherscan.test.ts +9 -58
- package/src/network/explorer/etherscan.ts +8 -24
- package/src/network/explorer/index.test.ts +1 -1
- package/src/network/explorer/ledger.test.ts +44 -146
- package/src/network/explorer/ledger.ts +2 -5
- package/src/network/explorer/types.ts +12 -5
- package/src/network/gasTracker/ledger.ts +1 -4
- package/src/network/node/explorerProxy.test.ts +17 -22
- package/src/network/node/explorerProxy.ts +23 -20
- package/src/network/node/gethCallTracerToTraceBlockItems.test.ts +1 -1
- package/src/network/node/gethCallTracerToTraceBlockItems.ts +6 -9
- package/src/network/node/index.memoization.test.ts +29 -22
- package/src/network/node/index.test.ts +1 -3
- package/src/network/node/index.ts +11 -8
- package/src/network/node/ledger.test.ts +63 -69
- package/src/network/node/ledger.ts +39 -38
- package/src/network/node/rpc.common.ts +134 -158
- package/src/network/node/rpc.test.ts +201 -110
- package/src/network/node/types.ts +17 -64
- package/src/network/node/withNodeSources.test.ts +7 -9
- package/src/network/node/withNodeSources.ts +23 -26
- package/src/nodeSources.ts +11 -3
- package/src/staking/abis.test.ts +24 -28
- package/src/staking/abis.ts +12 -10
- package/src/staking/contracts.test.ts +20 -8
- package/src/staking/contracts.ts +13 -14
- package/src/staking/detectOperationType.test.ts +16 -13
- package/src/staking/detectOperationType.ts +24 -22
- package/src/staking/encoder.test.ts +38 -27
- package/src/staking/encoder.ts +9 -8
- package/src/staking/fetchers.ts +28 -39
- package/src/staking/logic.test.ts +34 -32
- package/src/staking/logic.ts +14 -14
- package/src/staking/operations/index.test.ts +48 -39
- package/src/staking/operations/index.ts +43 -21
- package/src/staking/prepareIntents.test.ts +14 -34
- package/src/staking/prepareIntents.ts +12 -14
- package/src/staking/redelegations.test.ts +73 -131
- package/src/staking/redelegations.ts +13 -31
- package/src/staking/rewards.test.ts +19 -21
- package/src/staking/rewards.ts +1 -2
- package/src/staking/rewardsFromReceipt.test.ts +9 -8
- package/src/staking/rewardsFromReceipt.ts +3 -2
- package/src/staking/transactionData.test.ts +35 -25
- package/src/staking/transactionData.ts +7 -6
- package/src/staking/unbondings.test.ts +26 -20
- package/src/staking/unbondings.ts +1 -2
- package/src/staking/utils.ts +19 -26
- package/src/staking/validators/index.ts +45 -51
- package/src/staking/validators/monad.test.ts +52 -54
- package/src/staking/validators/monad.ts +42 -40
- package/src/staking/validators/monadResolver.ts +4 -5
- package/src/staking/validators/sei.ts +2 -2
- package/src/staking/validators/somnia.test.ts +22 -19
- package/src/staking/validators/somnia.ts +23 -29
- package/src/staking/validators/types.ts +0 -1
- package/src/staking/validators/zero_gravity.test.ts +34 -49
- package/src/staking/validators/zero_gravity.ts +7 -12
- package/src/staking/validators.integ.test.ts +3 -5
- package/src/staking/validators.test.ts +56 -53
- package/src/types/staking.ts +3 -6
|
@@ -6,6 +6,7 @@ import type { PerformActionRequest } from 'ethers'
|
|
|
6
6
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
7
7
|
import BigNumber from 'bignumber.js'
|
|
8
8
|
import { FeeData, FetchRequest, JsonRpcProvider, Network, Transaction } from 'ethers'
|
|
9
|
+
import { CHAIN_ID } from '../../config'
|
|
9
10
|
import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../errors'
|
|
10
11
|
import {
|
|
11
12
|
createMockEvmConfigInfo,
|
|
@@ -28,8 +29,6 @@ import {
|
|
|
28
29
|
ERC20_MINT_TOPIC,
|
|
29
30
|
} from './rpc.common'
|
|
30
31
|
|
|
31
|
-
const currencyId = 'my_new_chain'
|
|
32
|
-
|
|
33
32
|
const evmConfig = createMockEvmConfigInfo({
|
|
34
33
|
chainId: 1,
|
|
35
34
|
name: 'My New Chain',
|
|
@@ -167,7 +166,7 @@ describe('EVM Family', () => {
|
|
|
167
166
|
return true
|
|
168
167
|
})
|
|
169
168
|
const nodeConfig = { type: 'external' as const, uri: 'my-rpc.com', retries: 2 }
|
|
170
|
-
const response = await withApi(evmConfig,
|
|
169
|
+
const response = await withApi(evmConfig, spy, nodeConfig)
|
|
171
170
|
|
|
172
171
|
expect(response).toBe(true)
|
|
173
172
|
// it should fail 2 times and succeed on the next try
|
|
@@ -192,70 +191,43 @@ describe('EVM Family', () => {
|
|
|
192
191
|
retries: DEFAULT_RETRIES_RPC_METHODS,
|
|
193
192
|
}
|
|
194
193
|
|
|
195
|
-
await expect(withApi(evmConfig,
|
|
194
|
+
await expect(withApi(evmConfig, spy, nodeConfig)).rejects.toThrow(SpyError)
|
|
196
195
|
})
|
|
197
196
|
|
|
198
|
-
it('provider cache should reuse the same JsonRpcProvider for the same
|
|
199
|
-
const testCurrencyId = 'provider_cache_by_currency'
|
|
197
|
+
it('provider cache should reuse the same JsonRpcProvider for the same chain and same uri', async () => {
|
|
200
198
|
const nodeConfig = { type: 'external' as const, uri: 'https://rpc-a.example', retries: 0 }
|
|
201
|
-
const first = await withApi(
|
|
202
|
-
|
|
203
|
-
testCurrencyId,
|
|
204
|
-
(api) => Promise.resolve(api),
|
|
205
|
-
nodeConfig
|
|
206
|
-
)
|
|
207
|
-
const second = await withApi(
|
|
208
|
-
evmConfig,
|
|
209
|
-
testCurrencyId,
|
|
210
|
-
(api) => Promise.resolve(api),
|
|
211
|
-
nodeConfig
|
|
212
|
-
)
|
|
199
|
+
const first = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig)
|
|
200
|
+
const second = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig)
|
|
213
201
|
|
|
214
202
|
expect(first).toBe(second)
|
|
215
203
|
expect(first).toBeInstanceOf(JsonRpcProvider)
|
|
216
204
|
})
|
|
217
205
|
|
|
218
|
-
it('provider cache should use distinct JsonRpcProviders for the same
|
|
219
|
-
const testCurrencyId = 'provider_cache_by_currency'
|
|
220
|
-
|
|
206
|
+
it('provider cache should use distinct JsonRpcProviders for the same chain but different uri', async () => {
|
|
221
207
|
const nodeConfig1 = { type: 'external' as const, uri: 'https://rpc-a.example', retries: 0 }
|
|
222
|
-
const first = await withApi(
|
|
223
|
-
evmConfig,
|
|
224
|
-
testCurrencyId,
|
|
225
|
-
(api) => Promise.resolve(api),
|
|
226
|
-
nodeConfig1
|
|
227
|
-
)
|
|
208
|
+
const first = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig1)
|
|
228
209
|
|
|
229
210
|
const nodeConfig2 = { ...nodeConfig1, uri: 'https://rpc-b.example' }
|
|
230
|
-
const second = await withApi(
|
|
231
|
-
evmConfig,
|
|
232
|
-
testCurrencyId,
|
|
233
|
-
(api) => Promise.resolve(api),
|
|
234
|
-
nodeConfig2
|
|
235
|
-
)
|
|
211
|
+
const second = await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig2)
|
|
236
212
|
|
|
237
213
|
expect(first).not.toBe(second)
|
|
238
214
|
expect(first).toBeInstanceOf(JsonRpcProvider)
|
|
239
215
|
expect(second).toBeInstanceOf(JsonRpcProvider)
|
|
240
216
|
})
|
|
241
217
|
|
|
242
|
-
it('provider cache should use distinct JsonRpcProviders for different
|
|
218
|
+
it('provider cache should use distinct JsonRpcProviders for different chain ids', async () => {
|
|
243
219
|
const nodeConfig = {
|
|
244
220
|
type: 'external' as const,
|
|
245
221
|
uri: 'https://shared-rpc.example',
|
|
246
222
|
retries: 0,
|
|
247
223
|
}
|
|
248
|
-
const currencyIdOne = 'provider_cache_currency_one'
|
|
249
|
-
const currencyIdTwo = 'provider_cache_currency_two'
|
|
250
224
|
const p1 = await withApi(
|
|
251
|
-
evmConfig,
|
|
252
|
-
currencyIdOne,
|
|
225
|
+
{ ...evmConfig, chainId: CHAIN_ID.ETHEREUM },
|
|
253
226
|
(api) => Promise.resolve(api),
|
|
254
227
|
nodeConfig
|
|
255
228
|
)
|
|
256
229
|
const p2 = await withApi(
|
|
257
|
-
evmConfig,
|
|
258
|
-
currencyIdTwo,
|
|
230
|
+
{ ...evmConfig, chainId: CHAIN_ID.BSC },
|
|
259
231
|
(api) => Promise.resolve(api),
|
|
260
232
|
nodeConfig
|
|
261
233
|
)
|
|
@@ -266,7 +238,6 @@ describe('EVM Family', () => {
|
|
|
266
238
|
})
|
|
267
239
|
|
|
268
240
|
it('should disable ethers built-in HTTP retries by setting maxAttempts: 1 on FetchRequest', async () => {
|
|
269
|
-
const testCurrencyId = 'provider_fetch_throttle_test'
|
|
270
241
|
const nodeConfig = {
|
|
271
242
|
type: 'external' as const,
|
|
272
243
|
uri: 'https://rpc-throttle-test.example',
|
|
@@ -275,7 +246,7 @@ describe('EVM Family', () => {
|
|
|
275
246
|
|
|
276
247
|
const setThrottleParamsSpy = jest.spyOn(FetchRequest.prototype, 'setThrottleParams')
|
|
277
248
|
|
|
278
|
-
await withApi(evmConfig,
|
|
249
|
+
await withApi(evmConfig, (api) => Promise.resolve(api), nodeConfig)
|
|
279
250
|
|
|
280
251
|
expect(setThrottleParamsSpy).toHaveBeenCalledWith({ maxAttempts: 1 })
|
|
281
252
|
})
|
|
@@ -310,7 +281,6 @@ describe('EVM Family', () => {
|
|
|
310
281
|
mockRawReceipt({ l1Fee: '0x56c2d5eea374' }) // 95394812830580
|
|
311
282
|
|
|
312
283
|
const tx = await nodeApi.getTransaction(
|
|
313
|
-
currencyId,
|
|
314
284
|
'0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
|
|
315
285
|
)
|
|
316
286
|
|
|
@@ -319,17 +289,55 @@ describe('EVM Family', () => {
|
|
|
319
289
|
|
|
320
290
|
it('should leave l1Fee undefined when the receipt has none (non OP-stack chains)', async () => {
|
|
321
291
|
const tx = await nodeApi.getTransaction(
|
|
322
|
-
currencyId,
|
|
323
292
|
'0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
|
|
324
293
|
)
|
|
325
294
|
|
|
326
295
|
expect(tx.l1Fee).toBeUndefined()
|
|
327
296
|
})
|
|
328
297
|
|
|
298
|
+
it('should preserve a null pre-Byzantium status', async () => {
|
|
299
|
+
mockRawReceipt({ status: null, type: null })
|
|
300
|
+
|
|
301
|
+
const tx = await nodeApi.getTransaction(
|
|
302
|
+
'0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
expect(tx.status).toBeNull()
|
|
306
|
+
expect(tx.type).toBe(0)
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
it.each([
|
|
310
|
+
['status', { status: 'success' }],
|
|
311
|
+
['gasUsed', { gasUsed: 'lots' }],
|
|
312
|
+
['gasPrice', { gasPrice: {} }],
|
|
313
|
+
['type', { type: 'eip1559' }],
|
|
314
|
+
['logs', { logs: [42] }],
|
|
315
|
+
[
|
|
316
|
+
'log data',
|
|
317
|
+
{
|
|
318
|
+
logs: [
|
|
319
|
+
{
|
|
320
|
+
address: '0x1111111111111111111111111111111111111111',
|
|
321
|
+
topics: [],
|
|
322
|
+
data: 'not-hex',
|
|
323
|
+
},
|
|
324
|
+
],
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
['l1Fee', { l1Fee: 'nope' }],
|
|
328
|
+
])('should reject a receipt with invalid %s', async (_field, overrides) => {
|
|
329
|
+
mockRawReceipt(overrides)
|
|
330
|
+
|
|
331
|
+
await expect(
|
|
332
|
+
nodeApi.getTransaction(
|
|
333
|
+
'0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
|
|
334
|
+
)
|
|
335
|
+
).rejects.toThrow('Transaction or receipt not found')
|
|
336
|
+
})
|
|
337
|
+
|
|
329
338
|
it('should return the expected payload', async () => {
|
|
330
339
|
expect(
|
|
331
340
|
await nodeApi.getTransaction(
|
|
332
|
-
currencyId,
|
|
333
341
|
'0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
|
|
334
342
|
)
|
|
335
343
|
).toEqual({
|
|
@@ -687,7 +695,7 @@ describe('EVM Family', () => {
|
|
|
687
695
|
.mockResolvedValueOnce('0x00000001')
|
|
688
696
|
|
|
689
697
|
await expect(
|
|
690
|
-
nodeApi.call(
|
|
698
|
+
nodeApi.call({
|
|
691
699
|
to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
692
700
|
data: '0x1234',
|
|
693
701
|
block: 42,
|
|
@@ -707,7 +715,6 @@ describe('EVM Family', () => {
|
|
|
707
715
|
it('should return the expected payload', async () => {
|
|
708
716
|
expect(
|
|
709
717
|
await nodeApi.getCoinBalance(
|
|
710
|
-
currencyId,
|
|
711
718
|
'0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
|
|
712
719
|
)
|
|
713
720
|
).toEqual(new BigNumber(420))
|
|
@@ -719,7 +726,6 @@ describe('EVM Family', () => {
|
|
|
719
726
|
it('should return the expected payload', async () => {
|
|
720
727
|
expect(
|
|
721
728
|
await nodeApi.getTokenBalance(
|
|
722
|
-
currencyId,
|
|
723
729
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
724
730
|
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
|
|
725
731
|
)
|
|
@@ -730,7 +736,7 @@ describe('EVM Family', () => {
|
|
|
730
736
|
describe('getTransactionCount', () => {
|
|
731
737
|
it('should return the expected payload', async () => {
|
|
732
738
|
expect(
|
|
733
|
-
await nodeApi.getTransactionCount(
|
|
739
|
+
await nodeApi.getTransactionCount('0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d')
|
|
734
740
|
).toEqual(5)
|
|
735
741
|
})
|
|
736
742
|
})
|
|
@@ -746,7 +752,7 @@ describe('EVM Family', () => {
|
|
|
746
752
|
return null
|
|
747
753
|
})
|
|
748
754
|
expect(
|
|
749
|
-
await nodeApi.getGasEstimation(
|
|
755
|
+
await nodeApi.getGasEstimation(address, {
|
|
750
756
|
recipient: '0x0000000000000000000000000000000000000000',
|
|
751
757
|
amount: new BigNumber(2),
|
|
752
758
|
data: Buffer.from(''),
|
|
@@ -765,7 +771,7 @@ describe('EVM Family', () => {
|
|
|
765
771
|
})
|
|
766
772
|
|
|
767
773
|
await expect(
|
|
768
|
-
nodeApi.getGasEstimation(
|
|
774
|
+
nodeApi.getGasEstimation(address, {
|
|
769
775
|
recipient: 'wrongAddress',
|
|
770
776
|
amount: new BigNumber(1),
|
|
771
777
|
data: Buffer.from(''),
|
|
@@ -805,7 +811,7 @@ describe('EVM Family', () => {
|
|
|
805
811
|
}
|
|
806
812
|
})
|
|
807
813
|
|
|
808
|
-
expect(await nodeApi.getFeeData(config,
|
|
814
|
+
expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
|
|
809
815
|
maxFeePerGas: new BigNumber('6000000014'),
|
|
810
816
|
maxPriorityFeePerGas: new BigNumber('5999999988'),
|
|
811
817
|
gasPrice: null,
|
|
@@ -823,7 +829,7 @@ describe('EVM Family', () => {
|
|
|
823
829
|
}
|
|
824
830
|
})
|
|
825
831
|
|
|
826
|
-
expect(await nodeApi.getFeeData(config,
|
|
832
|
+
expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
|
|
827
833
|
maxFeePerGas: new BigNumber('25000246'),
|
|
828
834
|
maxPriorityFeePerGas: new BigNumber('25000000'),
|
|
829
835
|
gasPrice: null,
|
|
@@ -846,9 +852,7 @@ describe('EVM Family', () => {
|
|
|
846
852
|
}
|
|
847
853
|
})
|
|
848
854
|
|
|
849
|
-
await expect(nodeApi.getFeeData(config,
|
|
850
|
-
feeHistoryError.message
|
|
851
|
-
)
|
|
855
|
+
await expect(nodeApi.getFeeData(config, eip1559Tx)).rejects.toThrow(feeHistoryError.message)
|
|
852
856
|
expect(sendSpy).not.toHaveBeenCalledWith('eth_maxPriorityFeePerGas', expect.anything())
|
|
853
857
|
})
|
|
854
858
|
|
|
@@ -867,7 +871,7 @@ describe('EVM Family', () => {
|
|
|
867
871
|
}
|
|
868
872
|
})
|
|
869
873
|
|
|
870
|
-
await expect(nodeApi.getFeeData(config,
|
|
874
|
+
await expect(nodeApi.getFeeData(config, eip1559Tx)).rejects.toThrow('timeout')
|
|
871
875
|
})
|
|
872
876
|
|
|
873
877
|
it('should return the expected payload for an EIP1559 tx when network returns 0 priority fee', async () => {
|
|
@@ -886,7 +890,7 @@ describe('EVM Family', () => {
|
|
|
886
890
|
}
|
|
887
891
|
})
|
|
888
892
|
|
|
889
|
-
expect(await nodeApi.getFeeData(config,
|
|
893
|
+
expect(await nodeApi.getFeeData(config, eip1559Tx)).toEqual({
|
|
890
894
|
maxFeePerGas: new BigNumber('1000000026'),
|
|
891
895
|
maxPriorityFeePerGas: new BigNumber(1e9),
|
|
892
896
|
gasPrice: null,
|
|
@@ -909,7 +913,7 @@ describe('EVM Family', () => {
|
|
|
909
913
|
it('defaults to 5 blocks (0x5) when not configured', async () => {
|
|
910
914
|
const sendSpy = stubFeeHistory()
|
|
911
915
|
|
|
912
|
-
await nodeApi.getFeeData(config,
|
|
916
|
+
await nodeApi.getFeeData(config, eip1559Tx)
|
|
913
917
|
|
|
914
918
|
expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [50]])
|
|
915
919
|
})
|
|
@@ -917,7 +921,7 @@ describe('EVM Family', () => {
|
|
|
917
921
|
it('defaults to the 50th percentile when feeHistoryRewardPercentile is not configured', async () => {
|
|
918
922
|
const sendSpy = stubFeeHistory()
|
|
919
923
|
|
|
920
|
-
await nodeApi.getFeeData(config,
|
|
924
|
+
await nodeApi.getFeeData(config, eip1559Tx)
|
|
921
925
|
|
|
922
926
|
expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [50]])
|
|
923
927
|
})
|
|
@@ -938,7 +942,7 @@ describe('EVM Family', () => {
|
|
|
938
942
|
})
|
|
939
943
|
const sendSpy = stubFeeHistory()
|
|
940
944
|
|
|
941
|
-
await nodeApi.getFeeData(config,
|
|
945
|
+
await nodeApi.getFeeData(config, eip1559Tx)
|
|
942
946
|
|
|
943
947
|
expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x5', 'latest', [expected]])
|
|
944
948
|
}
|
|
@@ -953,7 +957,7 @@ describe('EVM Family', () => {
|
|
|
953
957
|
})
|
|
954
958
|
const sendSpy = stubFeeHistory()
|
|
955
959
|
|
|
956
|
-
await nodeApi.getFeeData(config,
|
|
960
|
+
await nodeApi.getFeeData(config, eip1559Tx)
|
|
957
961
|
|
|
958
962
|
expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x14', 'latest', [75]])
|
|
959
963
|
})
|
|
@@ -974,7 +978,7 @@ describe('EVM Family', () => {
|
|
|
974
978
|
})
|
|
975
979
|
const sendSpy = stubFeeHistory()
|
|
976
980
|
|
|
977
|
-
await nodeApi.getFeeData(config,
|
|
981
|
+
await nodeApi.getFeeData(config, eip1559Tx)
|
|
978
982
|
|
|
979
983
|
expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', [expectedHex, 'latest', [50]])
|
|
980
984
|
}
|
|
@@ -1002,7 +1006,7 @@ describe('EVM Family', () => {
|
|
|
1002
1006
|
}
|
|
1003
1007
|
})
|
|
1004
1008
|
|
|
1005
|
-
await nodeApi.getFeeData(config,
|
|
1009
|
+
await nodeApi.getFeeData(config, legacyTx)
|
|
1006
1010
|
|
|
1007
1011
|
expect(sendSpy).not.toHaveBeenCalledWith('eth_feeHistory', expect.anything())
|
|
1008
1012
|
})
|
|
@@ -1027,7 +1031,7 @@ describe('EVM Family', () => {
|
|
|
1027
1031
|
}
|
|
1028
1032
|
})
|
|
1029
1033
|
|
|
1030
|
-
const result = await nodeApi.getFeeData(config,
|
|
1034
|
+
const result = await nodeApi.getFeeData(config, eip1559Tx)
|
|
1031
1035
|
|
|
1032
1036
|
expect(sendSpy).toHaveBeenCalledWith('eth_feeHistory', ['0x14', 'latest', [50]])
|
|
1033
1037
|
expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('20000000000'))
|
|
@@ -1052,7 +1056,7 @@ describe('EVM Family', () => {
|
|
|
1052
1056
|
}
|
|
1053
1057
|
})
|
|
1054
1058
|
|
|
1055
|
-
const result = await nodeApi.getFeeData(config,
|
|
1059
|
+
const result = await nodeApi.getFeeData(config, eip1559Tx)
|
|
1056
1060
|
|
|
1057
1061
|
expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('20000000000'))
|
|
1058
1062
|
// maxFeePerGas = nextBaseFee * 2 + floored priority = 13*2 + 20e9
|
|
@@ -1077,7 +1081,7 @@ describe('EVM Family', () => {
|
|
|
1077
1081
|
}
|
|
1078
1082
|
})
|
|
1079
1083
|
|
|
1080
|
-
const result = await nodeApi.getFeeData(config,
|
|
1084
|
+
const result = await nodeApi.getFeeData(config, eip1559Tx)
|
|
1081
1085
|
|
|
1082
1086
|
expect(result.maxPriorityFeePerGas).toEqual(new BigNumber('5000000000'))
|
|
1083
1087
|
})
|
|
@@ -1108,7 +1112,7 @@ describe('EVM Family', () => {
|
|
|
1108
1112
|
new FeeData(BigInt('1000000000'), 0n, 0n) // 1 Gwei
|
|
1109
1113
|
)
|
|
1110
1114
|
|
|
1111
|
-
const result = await nodeApi.getFeeData(config,
|
|
1115
|
+
const result = await nodeApi.getFeeData(config, legacyTx)
|
|
1112
1116
|
|
|
1113
1117
|
expect(result.gasPrice).toEqual(new BigNumber('20000000000'))
|
|
1114
1118
|
})
|
|
@@ -1129,7 +1133,12 @@ describe('EVM Family', () => {
|
|
|
1129
1133
|
}
|
|
1130
1134
|
})
|
|
1131
1135
|
|
|
1132
|
-
|
|
1136
|
+
const zeroGravityConfig = createMockEvmConfigInfo({
|
|
1137
|
+
chainId: CHAIN_ID.ZERO_GRAVITY,
|
|
1138
|
+
node: mkExternalNode({ uri: 'my-rpc.com' }),
|
|
1139
|
+
})
|
|
1140
|
+
|
|
1141
|
+
expect(await nodeApi.getFeeData(zeroGravityConfig, eip1559Tx)).toEqual({
|
|
1133
1142
|
maxFeePerGas: new BigNumber('2000000026'),
|
|
1134
1143
|
maxPriorityFeePerGas: new BigNumber(2e9),
|
|
1135
1144
|
gasPrice: null,
|
|
@@ -1168,7 +1177,7 @@ describe('EVM Family', () => {
|
|
|
1168
1177
|
}
|
|
1169
1178
|
})
|
|
1170
1179
|
|
|
1171
|
-
expect(await nodeApi.getFeeData(config,
|
|
1180
|
+
expect(await nodeApi.getFeeData(config, legacyTx)).toEqual({
|
|
1172
1181
|
maxFeePerGas: null,
|
|
1173
1182
|
maxPriorityFeePerGas: null,
|
|
1174
1183
|
gasPrice: new BigNumber('666'),
|
|
@@ -1181,7 +1190,7 @@ describe('EVM Family', () => {
|
|
|
1181
1190
|
it('should return the expected payload', async () => {
|
|
1182
1191
|
const serializedTransaction =
|
|
1183
1192
|
'0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41629'
|
|
1184
|
-
expect(await nodeApi.broadcastTransaction(
|
|
1193
|
+
expect(await nodeApi.broadcastTransaction(serializedTransaction)).toEqual(
|
|
1185
1194
|
'0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59'
|
|
1186
1195
|
)
|
|
1187
1196
|
})
|
|
@@ -1190,7 +1199,7 @@ describe('EVM Family', () => {
|
|
|
1190
1199
|
const serializedTransaction =
|
|
1191
1200
|
'0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41628'
|
|
1192
1201
|
|
|
1193
|
-
await expect(nodeApi.broadcastTransaction(
|
|
1202
|
+
await expect(nodeApi.broadcastTransaction(serializedTransaction)).rejects.toThrow(
|
|
1194
1203
|
InsufficientFunds
|
|
1195
1204
|
)
|
|
1196
1205
|
})
|
|
@@ -1199,15 +1208,13 @@ describe('EVM Family', () => {
|
|
|
1199
1208
|
const serializedTransaction =
|
|
1200
1209
|
'0x02f873012d85010c388d0085077715912682520894c2907efcce4011c491bbeda8a0fa63ba7aab596c87038d7ea4c6800080c001a0bbffe7ba303ab03f697d64672c4a288ae863df8a62ffc67ba72872ce8c227f6fa01261e7c9f06af13631f03fad9b88d3c48931d353b6b41b4072fddcca5ec41625'
|
|
1201
1210
|
|
|
1202
|
-
await expect(nodeApi.broadcastTransaction(
|
|
1203
|
-
'any error'
|
|
1204
|
-
)
|
|
1211
|
+
await expect(nodeApi.broadcastTransaction(serializedTransaction)).rejects.toThrow('any error')
|
|
1205
1212
|
})
|
|
1206
1213
|
})
|
|
1207
1214
|
|
|
1208
1215
|
describe('getBlock', () => {
|
|
1209
1216
|
it('should return the expected payload', async () => {
|
|
1210
|
-
expect(await nodeApi.getBlockByHeight(
|
|
1217
|
+
expect(await nodeApi.getBlockByHeight(0)).toEqual({
|
|
1211
1218
|
hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
|
|
1212
1219
|
// for this specific assertion we can't use Date.now() directly because
|
|
1213
1220
|
// the timestamp returned by ethers (and mocked at the beginning of
|
|
@@ -1229,7 +1236,7 @@ describe('EVM Family', () => {
|
|
|
1229
1236
|
})
|
|
1230
1237
|
)
|
|
1231
1238
|
|
|
1232
|
-
await expect(nodeApi.getBlockByHeight(
|
|
1239
|
+
await expect(nodeApi.getBlockByHeight(956855)).rejects.toThrow(
|
|
1233
1240
|
'Block 956855 not found (the node returned an empty stub block)'
|
|
1234
1241
|
)
|
|
1235
1242
|
})
|
|
@@ -1244,7 +1251,7 @@ describe('EVM Family', () => {
|
|
|
1244
1251
|
})
|
|
1245
1252
|
)
|
|
1246
1253
|
|
|
1247
|
-
await expect(nodeApi.getBlockByHeight(
|
|
1254
|
+
await expect(nodeApi.getBlockByHeight(0)).resolves.toMatchObject({
|
|
1248
1255
|
height: 0,
|
|
1249
1256
|
timestamp: 0,
|
|
1250
1257
|
})
|
|
@@ -1270,7 +1277,7 @@ describe('EVM Family', () => {
|
|
|
1270
1277
|
})
|
|
1271
1278
|
)
|
|
1272
1279
|
|
|
1273
|
-
expect(await nodeApi.getBlockByHeight(
|
|
1280
|
+
expect(await nodeApi.getBlockByHeight(1, true)).toEqual({
|
|
1274
1281
|
hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
|
|
1275
1282
|
timestamp: now * 1000,
|
|
1276
1283
|
height: 1,
|
|
@@ -1307,7 +1314,7 @@ describe('EVM Family', () => {
|
|
|
1307
1314
|
.spyOn(JsonRpcProvider.prototype, 'getBlock')
|
|
1308
1315
|
.mockResolvedValueOnce(blockWithThrowingGetter)
|
|
1309
1316
|
|
|
1310
|
-
expect(await nodeApi.getBlockByHeight(
|
|
1317
|
+
expect(await nodeApi.getBlockByHeight(1, true)).toEqual({
|
|
1311
1318
|
hash: '0x474dee0136108e9412e9d84197b468bb057a8dad0f2024fc55adebc4a28fa8c5',
|
|
1312
1319
|
timestamp: now * 1000,
|
|
1313
1320
|
height: 1,
|
|
@@ -1346,7 +1353,7 @@ describe('EVM Family', () => {
|
|
|
1346
1353
|
}
|
|
1347
1354
|
})
|
|
1348
1355
|
|
|
1349
|
-
expect(await nodeApi.getBlockByHeight(
|
|
1356
|
+
expect(await nodeApi.getBlockByHeight(69174056, true)).toEqual({
|
|
1350
1357
|
hash: '0x9e5af7a45cf98e8f32d1233092d1714f21ab15e2d24263c3fd5bef091d4736af',
|
|
1351
1358
|
timestamp: 1742556350000,
|
|
1352
1359
|
height: 69174056,
|
|
@@ -1382,7 +1389,7 @@ describe('EVM Family', () => {
|
|
|
1382
1389
|
throw new Error(`Method not mocked: ${method}`)
|
|
1383
1390
|
})
|
|
1384
1391
|
|
|
1385
|
-
expect(await nodeApi.getBlockReceipts!(
|
|
1392
|
+
expect(await nodeApi.getBlockReceipts!(1)).toEqual([
|
|
1386
1393
|
{
|
|
1387
1394
|
hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
|
|
1388
1395
|
gasUsed: '500000',
|
|
@@ -1408,7 +1415,7 @@ describe('EVM Family', () => {
|
|
|
1408
1415
|
}
|
|
1409
1416
|
throw new Error(`Method not mocked: ${method}`)
|
|
1410
1417
|
})
|
|
1411
|
-
expect(await nodeApi.getBlockReceipts!(
|
|
1418
|
+
expect(await nodeApi.getBlockReceipts!(1)).toEqual([
|
|
1412
1419
|
{
|
|
1413
1420
|
hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
|
|
1414
1421
|
gasUsed: '21000',
|
|
@@ -1436,7 +1443,7 @@ describe('EVM Family', () => {
|
|
|
1436
1443
|
throw new Error(`Method not mocked: ${method}`)
|
|
1437
1444
|
})
|
|
1438
1445
|
|
|
1439
|
-
expect(await nodeApi.getBlockReceipts!(
|
|
1446
|
+
expect(await nodeApi.getBlockReceipts!(1)).toEqual([
|
|
1440
1447
|
{
|
|
1441
1448
|
hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
|
|
1442
1449
|
gasUsed: '21000',
|
|
@@ -1448,6 +1455,83 @@ describe('EVM Family', () => {
|
|
|
1448
1455
|
])
|
|
1449
1456
|
})
|
|
1450
1457
|
|
|
1458
|
+
it('should map a validated receipt, including log data later passed to BigInt', async () => {
|
|
1459
|
+
jest.spyOn(JsonRpcProvider.prototype, 'send').mockImplementationOnce(async (method) => {
|
|
1460
|
+
if (method === 'eth_getBlockReceipts') {
|
|
1461
|
+
return [
|
|
1462
|
+
{
|
|
1463
|
+
transactionHash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
|
|
1464
|
+
gasUsed: '0x5208',
|
|
1465
|
+
effectiveGasPrice: null,
|
|
1466
|
+
gasPrice: '0x3b9aca00',
|
|
1467
|
+
status: 1,
|
|
1468
|
+
type: '0x2',
|
|
1469
|
+
logs: [
|
|
1470
|
+
{
|
|
1471
|
+
address: '0xabf26902fd7b624e0db40d31171ea9dddf078351',
|
|
1472
|
+
topics: [
|
|
1473
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
1474
|
+
'0x000000000000000000000000534eef6db44fbeb71047ee3eb4cb16e572862af6',
|
|
1475
|
+
'0x000000000000000000000000970402b253733a1f6f4f3cd1d07420006be2882d',
|
|
1476
|
+
],
|
|
1477
|
+
data: '0x01',
|
|
1478
|
+
},
|
|
1479
|
+
],
|
|
1480
|
+
},
|
|
1481
|
+
]
|
|
1482
|
+
}
|
|
1483
|
+
throw new Error(`Method not mocked: ${method}`)
|
|
1484
|
+
})
|
|
1485
|
+
|
|
1486
|
+
expect(await nodeApi.getBlockReceipts!(1)).toEqual([
|
|
1487
|
+
{
|
|
1488
|
+
hash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
|
|
1489
|
+
gasUsed: '21000',
|
|
1490
|
+
gasPrice: '1000000000',
|
|
1491
|
+
status: 1,
|
|
1492
|
+
type: 2,
|
|
1493
|
+
erc20Transfers: [
|
|
1494
|
+
{
|
|
1495
|
+
asset: {
|
|
1496
|
+
type: 'erc20',
|
|
1497
|
+
assetReference: '0xaBf26902Fd7B624e0db40D31171eA9ddDf078351',
|
|
1498
|
+
},
|
|
1499
|
+
from: '0x534eeF6Db44FBeB71047EE3eb4CB16E572862aF6',
|
|
1500
|
+
to: '0x970402B253733A1f6F4f3cd1d07420006be2882D',
|
|
1501
|
+
value: '1',
|
|
1502
|
+
},
|
|
1503
|
+
],
|
|
1504
|
+
},
|
|
1505
|
+
])
|
|
1506
|
+
})
|
|
1507
|
+
|
|
1508
|
+
it.each([
|
|
1509
|
+
['status', { status: 'success' }],
|
|
1510
|
+
['gasUsed', { gasUsed: '0x' }],
|
|
1511
|
+
['effectiveGasPrice', { effectiveGasPrice: 'nope' }],
|
|
1512
|
+
['type', { type: {} }],
|
|
1513
|
+
['logs', { logs: [null] }],
|
|
1514
|
+
])('should reject a receipt with invalid %s', async (_field, overrides) => {
|
|
1515
|
+
jest.spyOn(JsonRpcProvider.prototype, 'send').mockImplementation(async (method) => {
|
|
1516
|
+
if (method === 'eth_getBlockReceipts') {
|
|
1517
|
+
return [
|
|
1518
|
+
{
|
|
1519
|
+
transactionHash: '0x435b00d28a10febbcfefbdea080134d08ef843df122d5bc9174b09de7fce6a59',
|
|
1520
|
+
gasUsed: '0x5208',
|
|
1521
|
+
status: '0x1',
|
|
1522
|
+
logs: [],
|
|
1523
|
+
...overrides,
|
|
1524
|
+
},
|
|
1525
|
+
]
|
|
1526
|
+
}
|
|
1527
|
+
throw new Error(`Method not mocked: ${method}`)
|
|
1528
|
+
})
|
|
1529
|
+
|
|
1530
|
+
await expect(nodeApi.getBlockReceipts!(1)).rejects.toThrow(
|
|
1531
|
+
'Malformed eth_getBlockReceipts response at index 0'
|
|
1532
|
+
)
|
|
1533
|
+
})
|
|
1534
|
+
|
|
1451
1535
|
it('should throw UnsupportedRpcMethodError for RPC -32601', async () => {
|
|
1452
1536
|
jest.spyOn(JsonRpcProvider.prototype, 'send').mockImplementation(async (method) => {
|
|
1453
1537
|
if (method === 'eth_chainId') {
|
|
@@ -1459,9 +1543,7 @@ describe('EVM Family', () => {
|
|
|
1459
1543
|
throw new Error(`Method not mocked: ${method}`)
|
|
1460
1544
|
})
|
|
1461
1545
|
|
|
1462
|
-
await expect(nodeApi.getBlockReceipts!(
|
|
1463
|
-
UnsupportedRpcMethodError
|
|
1464
|
-
)
|
|
1546
|
+
await expect(nodeApi.getBlockReceipts!(1)).rejects.toBeInstanceOf(UnsupportedRpcMethodError)
|
|
1465
1547
|
})
|
|
1466
1548
|
|
|
1467
1549
|
it('should throw UnsupportedRpcMethodError for nested responseBody code', async () => {
|
|
@@ -1481,9 +1563,7 @@ describe('EVM Family', () => {
|
|
|
1481
1563
|
throw new Error(`Method not mocked: ${method}`)
|
|
1482
1564
|
})
|
|
1483
1565
|
|
|
1484
|
-
await expect(nodeApi.getBlockReceipts!(
|
|
1485
|
-
UnsupportedRpcMethodError
|
|
1486
|
-
)
|
|
1566
|
+
await expect(nodeApi.getBlockReceipts!(1)).rejects.toBeInstanceOf(UnsupportedRpcMethodError)
|
|
1487
1567
|
})
|
|
1488
1568
|
})
|
|
1489
1569
|
|
|
@@ -1514,7 +1594,7 @@ describe('EVM Family', () => {
|
|
|
1514
1594
|
throw new Error(`Method not mocked: ${method}`)
|
|
1515
1595
|
})
|
|
1516
1596
|
|
|
1517
|
-
const result = await nodeApi.traceBlockErigon!(
|
|
1597
|
+
const result = await nodeApi.traceBlockErigon!(120647648)
|
|
1518
1598
|
expect(result).toEqual([traceItem])
|
|
1519
1599
|
})
|
|
1520
1600
|
|
|
@@ -1547,7 +1627,7 @@ describe('EVM Family', () => {
|
|
|
1547
1627
|
throw new Error(`Method not mocked: ${method}`)
|
|
1548
1628
|
})
|
|
1549
1629
|
|
|
1550
|
-
const err = await nodeApi.traceBlockErigon!(
|
|
1630
|
+
const err = await nodeApi.traceBlockErigon!(1).then(
|
|
1551
1631
|
() => null,
|
|
1552
1632
|
(e: unknown) => e
|
|
1553
1633
|
)
|
|
@@ -1579,7 +1659,7 @@ describe('EVM Family', () => {
|
|
|
1579
1659
|
throw new Error(`Method not mocked: ${method}`)
|
|
1580
1660
|
})
|
|
1581
1661
|
|
|
1582
|
-
const result = await nodeApi.traceBlockGeth!(
|
|
1662
|
+
const result = await nodeApi.traceBlockGeth!(42)
|
|
1583
1663
|
expect(result).toEqual([
|
|
1584
1664
|
{
|
|
1585
1665
|
action: {
|
|
@@ -1617,7 +1697,7 @@ describe('EVM Family', () => {
|
|
|
1617
1697
|
throw new Error(`Method not mocked: ${method}`)
|
|
1618
1698
|
})
|
|
1619
1699
|
|
|
1620
|
-
const err = await nodeApi.traceBlockGeth!(
|
|
1700
|
+
const err = await nodeApi.traceBlockGeth!(1).then(
|
|
1621
1701
|
() => null,
|
|
1622
1702
|
(e: unknown) => e
|
|
1623
1703
|
)
|
|
@@ -1643,7 +1723,7 @@ describe('EVM Family', () => {
|
|
|
1643
1723
|
throw new Error(`Method not mocked: ${method}`)
|
|
1644
1724
|
})
|
|
1645
1725
|
|
|
1646
|
-
const err = await nodeApi.traceBlockGeth!(
|
|
1726
|
+
const err = await nodeApi.traceBlockGeth!(1).then(
|
|
1647
1727
|
() => null,
|
|
1648
1728
|
(e: unknown) => e
|
|
1649
1729
|
)
|
|
@@ -1655,9 +1735,17 @@ describe('EVM Family', () => {
|
|
|
1655
1735
|
|
|
1656
1736
|
describe('getOptimismAdditionalFees', () => {
|
|
1657
1737
|
it('should return the expected payload', async () => {
|
|
1738
|
+
const optimismNodeApi = createNodeApi(
|
|
1739
|
+
createMockEvmConfigInfo({
|
|
1740
|
+
chainId: CHAIN_ID.OPTIMISM,
|
|
1741
|
+
name: 'Optimism',
|
|
1742
|
+
node: mkExternalNode({ uri: 'http://test' }),
|
|
1743
|
+
}),
|
|
1744
|
+
{ type: 'external', uri: 'http://test', retries: DEFAULT_RETRIES_RPC_METHODS },
|
|
1745
|
+
testLogger
|
|
1746
|
+
)
|
|
1658
1747
|
expect(
|
|
1659
|
-
await
|
|
1660
|
-
'optimism',
|
|
1748
|
+
await optimismNodeApi.getOptimismAdditionalFees(
|
|
1661
1749
|
// Build a serialized transaction, the exact same way we do in `estimateFees`
|
|
1662
1750
|
Transaction.from({
|
|
1663
1751
|
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
@@ -1681,8 +1769,8 @@ describe('EVM Family', () => {
|
|
|
1681
1769
|
it("should return 0 if the currency isn't optimism", async () => {
|
|
1682
1770
|
expect(
|
|
1683
1771
|
await nodeApi.getOptimismAdditionalFees(
|
|
1684
|
-
currencyId,
|
|
1685
1772
|
// Build a serialized transaction, the exact same way we do in `estimateFees`
|
|
1773
|
+
// (a distinct nonce: the cache is keyed by chain id and transaction)
|
|
1686
1774
|
Transaction.from({
|
|
1687
1775
|
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
1688
1776
|
maxFeePerGas: BigInt(new BigNumber('0x777159126').toFixed()),
|
|
@@ -1691,7 +1779,7 @@ describe('EVM Family', () => {
|
|
|
1691
1779
|
gasLimit: 0n,
|
|
1692
1780
|
type: 2,
|
|
1693
1781
|
chainId: 1,
|
|
1694
|
-
nonce:
|
|
1782
|
+
nonce: 53,
|
|
1695
1783
|
signature: {
|
|
1696
1784
|
r: '0xffffffffffffffffffffffffffffffffffffffff',
|
|
1697
1785
|
s: '0xffffffffffffffffffffffffffffffffffffffff',
|
|
@@ -1705,9 +1793,17 @@ describe('EVM Family', () => {
|
|
|
1705
1793
|
|
|
1706
1794
|
describe('getScrollAdditionalFees', () => {
|
|
1707
1795
|
it('should return the expected payload', async () => {
|
|
1796
|
+
const scrollNodeApi = createNodeApi(
|
|
1797
|
+
createMockEvmConfigInfo({
|
|
1798
|
+
chainId: CHAIN_ID.SCROLL,
|
|
1799
|
+
name: 'Scroll',
|
|
1800
|
+
node: mkExternalNode({ uri: 'http://test' }),
|
|
1801
|
+
}),
|
|
1802
|
+
{ type: 'external', uri: 'http://test', retries: DEFAULT_RETRIES_RPC_METHODS },
|
|
1803
|
+
testLogger
|
|
1804
|
+
)
|
|
1708
1805
|
expect(
|
|
1709
|
-
await
|
|
1710
|
-
'scroll',
|
|
1806
|
+
await scrollNodeApi.getScrollAdditionalFees(
|
|
1711
1807
|
// Build a serialized transaction, the exact same way we do in `estimateFees`
|
|
1712
1808
|
Transaction.from({
|
|
1713
1809
|
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
@@ -1731,7 +1827,6 @@ describe('EVM Family', () => {
|
|
|
1731
1827
|
it("should return 0 if the currency isn't optimism", async () => {
|
|
1732
1828
|
expect(
|
|
1733
1829
|
await nodeApi.getScrollAdditionalFees(
|
|
1734
|
-
currencyId,
|
|
1735
1830
|
// Build a serialized transaction, the exact same way we do in `estimateFees`
|
|
1736
1831
|
Transaction.from({
|
|
1737
1832
|
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
@@ -1775,7 +1870,7 @@ describe('EVM Family', () => {
|
|
|
1775
1870
|
.spyOn(JsonRpcProvider.prototype, 'getBalance')
|
|
1776
1871
|
.mockResolvedValue(BigInt(100))
|
|
1777
1872
|
|
|
1778
|
-
await nodeApi.getCoinBalance(
|
|
1873
|
+
await nodeApi.getCoinBalance(EIP1191_CHECKSUMMED_ADDRESS)
|
|
1779
1874
|
|
|
1780
1875
|
expect(getBalanceSpy).toHaveBeenCalledWith(NORMALIZED_ADDRESS)
|
|
1781
1876
|
})
|
|
@@ -1792,11 +1887,7 @@ describe('EVM Family', () => {
|
|
|
1792
1887
|
.spyOn(JsonRpcProvider.prototype, 'call')
|
|
1793
1888
|
.mockResolvedValue('0x0000000000000000000000000000000000000000000000000000000000000064')
|
|
1794
1889
|
|
|
1795
|
-
await nodeApi.getTokenBalance(
|
|
1796
|
-
currencyId,
|
|
1797
|
-
EIP1191_CHECKSUMMED_ADDRESS,
|
|
1798
|
-
EIP1191_TOKEN_ADDRESS
|
|
1799
|
-
)
|
|
1890
|
+
await nodeApi.getTokenBalance(EIP1191_CHECKSUMMED_ADDRESS, EIP1191_TOKEN_ADDRESS)
|
|
1800
1891
|
|
|
1801
1892
|
// The call should be made to the normalized contract address
|
|
1802
1893
|
// and the data should contain the normalized account address
|
|
@@ -1816,7 +1907,7 @@ describe('EVM Family', () => {
|
|
|
1816
1907
|
.spyOn(JsonRpcProvider.prototype, 'getTransactionCount')
|
|
1817
1908
|
.mockResolvedValue(10)
|
|
1818
1909
|
|
|
1819
|
-
await nodeApi.getTransactionCount(
|
|
1910
|
+
await nodeApi.getTransactionCount(EIP1191_CHECKSUMMED_ADDRESS)
|
|
1820
1911
|
|
|
1821
1912
|
expect(getTransactionCountSpy).toHaveBeenCalledWith(NORMALIZED_ADDRESS, 'pending')
|
|
1822
1913
|
})
|
|
@@ -1836,7 +1927,7 @@ describe('EVM Family', () => {
|
|
|
1836
1927
|
return null
|
|
1837
1928
|
})
|
|
1838
1929
|
|
|
1839
|
-
await nodeApi.getGasEstimation(
|
|
1930
|
+
await nodeApi.getGasEstimation(address, {
|
|
1840
1931
|
recipient: EIP1191_RECIPIENT,
|
|
1841
1932
|
amount: new BigNumber(1000),
|
|
1842
1933
|
data: Buffer.from(''),
|