hardhat 2.20.0 → 2.21.0-dev.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/internal/core/jsonrpc/types/input/blockTag.d.ts +3 -3
- package/internal/core/jsonrpc/types/input/filterRequest.d.ts +6 -6
- package/internal/core/providers/construction.d.ts.map +1 -1
- package/internal/core/providers/construction.js +28 -4
- package/internal/core/providers/construction.js.map +1 -1
- package/internal/core/providers/http.d.ts +2 -0
- package/internal/core/providers/http.d.ts.map +1 -1
- package/internal/core/providers/http.js +2 -1
- package/internal/core/providers/http.js.map +1 -1
- package/internal/core/runtime-environment.d.ts.map +1 -1
- package/internal/core/runtime-environment.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/client.d.ts +0 -2
- package/internal/hardhat-network/jsonrpc/client.d.ts.map +1 -1
- package/internal/hardhat-network/jsonrpc/client.js +0 -16
- package/internal/hardhat-network/jsonrpc/client.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/handler.js +9 -1
- package/internal/hardhat-network/jsonrpc/handler.js.map +1 -1
- package/internal/hardhat-network/provider/BlockchainData.d.ts +5 -5
- package/internal/hardhat-network/provider/BlockchainData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/BlockchainData.js +10 -10
- package/internal/hardhat-network/provider/BlockchainData.js.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts +0 -7
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.js +2 -14
- package/internal/hardhat-network/provider/HardhatBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/TxPool.d.ts +3 -2
- package/internal/hardhat-network/provider/TxPool.d.ts.map +1 -1
- package/internal/hardhat-network/provider/TxPool.js +16 -16
- package/internal/hardhat-network/provider/TxPool.js.map +1 -1
- package/internal/hardhat-network/provider/ethereumjs-workarounds.js +1 -1
- package/internal/hardhat-network/provider/ethereumjs-workarounds.js.map +1 -1
- package/internal/hardhat-network/provider/filter.d.ts +6 -5
- package/internal/hardhat-network/provider/filter.d.ts.map +1 -1
- package/internal/hardhat-network/provider/filter.js +2 -2
- package/internal/hardhat-network/provider/filter.js.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts +0 -7
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js +4 -21
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts +13 -19
- package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkStateManager.js +61 -59
- package/internal/hardhat-network/provider/fork/ForkStateManager.js.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToBlockData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToBlockData.js +0 -3
- package/internal/hardhat-network/provider/fork/rpcToBlockData.js.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts +2 -2
- package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToTxData.js +1 -1
- package/internal/hardhat-network/provider/fork/rpcToTxData.js.map +1 -1
- package/internal/hardhat-network/provider/modules/base.js +4 -4
- package/internal/hardhat-network/provider/modules/base.js.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.js +9 -16
- package/internal/hardhat-network/provider/modules/eth.js.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.d.ts +6 -84
- package/internal/hardhat-network/provider/modules/logger.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.js +3 -530
- package/internal/hardhat-network/provider/modules/logger.js.map +1 -1
- package/internal/hardhat-network/provider/node-types.d.ts +2 -65
- package/internal/hardhat-network/provider/node-types.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node-types.js +0 -5
- package/internal/hardhat-network/provider/node-types.js.map +1 -1
- package/internal/hardhat-network/provider/node.d.ts +2 -6
- package/internal/hardhat-network/provider/node.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.js +79 -148
- package/internal/hardhat-network/provider/node.js.map +1 -1
- package/internal/hardhat-network/provider/output.d.ts +0 -14
- package/internal/hardhat-network/provider/output.d.ts.map +1 -1
- package/internal/hardhat-network/provider/output.js +0 -264
- package/internal/hardhat-network/provider/output.js.map +1 -1
- package/internal/hardhat-network/provider/provider.d.ts +26 -25
- package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
- package/internal/hardhat-network/provider/provider.js +342 -186
- package/internal/hardhat-network/provider/provider.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts +10 -8
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js +9 -9
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts +10 -8
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js +9 -9
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts +10 -9
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js +7 -6
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts +6 -5
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts +5 -4
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts +8 -7
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js +2 -2
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.d.ts +8 -7
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.js +2 -2
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.js.map +1 -1
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts +5 -4
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/convertToEdr.d.ts +14 -0
- package/internal/hardhat-network/provider/utils/convertToEdr.d.ts.map +1 -0
- package/internal/hardhat-network/provider/utils/convertToEdr.js +191 -0
- package/internal/hardhat-network/provider/utils/convertToEdr.js.map +1 -0
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.d.ts +0 -1
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.js +1 -5
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeCommon.d.ts +1 -1
- package/internal/hardhat-network/provider/utils/makeCommon.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeCommon.js +1 -3
- package/internal/hardhat-network/provider/utils/makeCommon.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeFakeSignature.d.ts +2 -2
- package/internal/hardhat-network/provider/utils/makeFakeSignature.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeFakeSignature.js +1 -15
- package/internal/hardhat-network/provider/utils/makeFakeSignature.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.d.ts +10 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.js +38 -18
- package/internal/hardhat-network/provider/utils/makeForkClient.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeStateTrie.js +2 -2
- package/internal/hardhat-network/provider/utils/makeStateTrie.js.map +1 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts +3 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.js +2 -6
- package/internal/hardhat-network/provider/utils/putGenesisBlock.js.map +1 -1
- package/internal/hardhat-network/provider/utils/random.d.ts +1 -0
- package/internal/hardhat-network/provider/utils/random.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/random.js +7 -1
- package/internal/hardhat-network/provider/utils/random.js.map +1 -1
- package/internal/hardhat-network/provider/utils/reorgs-protection.d.ts +1 -1
- package/internal/hardhat-network/provider/utils/reorgs-protection.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/reorgs-protection.js +5 -5
- package/internal/hardhat-network/provider/utils/reorgs-protection.js.map +1 -1
- package/internal/hardhat-network/provider/vm/exit.d.ts +22 -0
- package/internal/hardhat-network/provider/vm/exit.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/exit.js +93 -0
- package/internal/hardhat-network/provider/vm/exit.js.map +1 -0
- package/internal/hardhat-network/provider/vm/minimal-vm.d.ts +29 -0
- package/internal/hardhat-network/provider/vm/minimal-vm.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/minimal-vm.js +46 -0
- package/internal/hardhat-network/provider/vm/minimal-vm.js.map +1 -0
- package/internal/hardhat-network/provider/vm/proxy-vm.d.ts +36 -0
- package/internal/hardhat-network/provider/vm/proxy-vm.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/proxy-vm.js +73 -0
- package/internal/hardhat-network/provider/vm/proxy-vm.js.map +1 -0
- package/internal/hardhat-network/provider/vm/types.d.ts +27 -0
- package/internal/hardhat-network/provider/vm/types.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/types.js +3 -0
- package/internal/hardhat-network/provider/vm/types.js.map +1 -0
- package/internal/hardhat-network/stack-traces/consoleLogger.d.ts +6 -0
- package/internal/hardhat-network/stack-traces/consoleLogger.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/consoleLogger.js +33 -16
- package/internal/hardhat-network/stack-traces/consoleLogger.js.map +1 -1
- package/internal/hardhat-network/stack-traces/contracts-identifier.d.ts +1 -2
- package/internal/hardhat-network/stack-traces/contracts-identifier.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/contracts-identifier.js +6 -7
- package/internal/hardhat-network/stack-traces/contracts-identifier.js.map +1 -1
- package/internal/hardhat-network/stack-traces/debug.js +6 -6
- package/internal/hardhat-network/stack-traces/debug.js.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.js +13 -7
- package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/message-trace.d.ts +8 -3
- package/internal/hardhat-network/stack-traces/message-trace.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/message-trace.js +22 -1
- package/internal/hardhat-network/stack-traces/message-trace.js.map +1 -1
- package/internal/hardhat-network/stack-traces/model.d.ts +8 -0
- package/internal/hardhat-network/stack-traces/model.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/model.js +52 -0
- package/internal/hardhat-network/stack-traces/model.js.map +1 -1
- package/internal/hardhat-network/stack-traces/opcodes.d.ts +1 -0
- package/internal/hardhat-network/stack-traces/opcodes.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/opcodes.js +5 -1
- package/internal/hardhat-network/stack-traces/opcodes.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.js +2 -2
- package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.js +5 -5
- package/internal/hardhat-network/stack-traces/solidityTracer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.js +28 -34
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-trace-decoder.d.ts +7 -0
- package/internal/hardhat-network/stack-traces/vm-trace-decoder.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-trace-decoder.js +69 -2
- package/internal/hardhat-network/stack-traces/vm-trace-decoder.js.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-tracer.d.ts +7 -12
- package/internal/hardhat-network/stack-traces/vm-tracer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-tracer.js +46 -65
- package/internal/hardhat-network/stack-traces/vm-tracer.js.map +1 -1
- package/internal/util/date.d.ts +1 -0
- package/internal/util/date.d.ts.map +1 -1
- package/internal/util/date.js +5 -1
- package/internal/util/date.js.map +1 -1
- package/internal/util/hardforks.d.ts +2 -0
- package/internal/util/hardforks.d.ts.map +1 -1
- package/internal/util/hardforks.js +27 -1
- package/internal/util/hardforks.js.map +1 -1
- package/package.json +18 -16
- package/src/internal/core/providers/construction.ts +7 -9
- package/src/internal/core/providers/http.ts +3 -1
- package/src/internal/core/runtime-environment.ts +2 -1
- package/src/internal/hardhat-network/jsonrpc/client.ts +1 -28
- package/src/internal/hardhat-network/jsonrpc/handler.ts +9 -1
- package/src/internal/hardhat-network/provider/modules/logger.ts +6 -801
- package/src/internal/hardhat-network/provider/node-types.ts +2 -89
- package/src/internal/hardhat-network/provider/output.ts +0 -352
- package/src/internal/hardhat-network/provider/provider.ts +482 -263
- package/src/internal/hardhat-network/provider/utils/convertToEdr.ts +228 -0
- package/src/internal/hardhat-network/provider/utils/getCurrentTimestamp.ts +0 -4
- package/src/internal/hardhat-network/provider/utils/makeCommon.ts +1 -12
- package/src/internal/hardhat-network/provider/utils/makeForkClient.ts +63 -24
- package/src/internal/hardhat-network/provider/utils/random.ts +8 -1
- package/src/internal/hardhat-network/provider/utils/reorgs-protection.ts +5 -5
- package/src/internal/hardhat-network/provider/vm/exit.ts +101 -0
- package/src/internal/hardhat-network/provider/vm/minimal-vm.ts +101 -0
- package/src/internal/hardhat-network/provider/vm/types.ts +31 -0
- package/src/internal/hardhat-network/stack-traces/consoleLogger.ts +40 -21
- package/src/internal/hardhat-network/stack-traces/contracts-identifier.ts +10 -12
- package/src/internal/hardhat-network/stack-traces/debug.ts +6 -6
- package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +15 -8
- package/src/internal/hardhat-network/stack-traces/message-trace.ts +40 -4
- package/src/internal/hardhat-network/stack-traces/model.ts +61 -0
- package/src/internal/hardhat-network/stack-traces/opcodes.ts +4 -0
- package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +2 -2
- package/src/internal/hardhat-network/stack-traces/solidityTracer.ts +6 -5
- package/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts +113 -4
- package/src/internal/hardhat-network/stack-traces/vm-tracer.ts +67 -95
- package/src/internal/util/date.ts +4 -0
- package/src/internal/util/hardforks.ts +52 -0
- package/src/internal/hardhat-network/provider/BlockchainBase.ts +0 -185
- package/src/internal/hardhat-network/provider/BlockchainData.ts +0 -261
- package/src/internal/hardhat-network/provider/HardhatBlockchain.ts +0 -140
- package/src/internal/hardhat-network/provider/PoolState.ts +0 -48
- package/src/internal/hardhat-network/provider/TransactionQueue.ts +0 -158
- package/src/internal/hardhat-network/provider/TxPool.ts +0 -715
- package/src/internal/hardhat-network/provider/ethereumjs-workarounds.ts +0 -21
- package/src/internal/hardhat-network/provider/filter.ts +0 -142
- package/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts +0 -433
- package/src/internal/hardhat-network/provider/fork/ForkStateManager.ts +0 -480
- package/src/internal/hardhat-network/provider/fork/rpcToBlockData.ts +0 -35
- package/src/internal/hardhat-network/provider/fork/rpcToTxData.ts +0 -44
- package/src/internal/hardhat-network/provider/modules/base.ts +0 -156
- package/src/internal/hardhat-network/provider/modules/debug.ts +0 -104
- package/src/internal/hardhat-network/provider/modules/eth.ts +0 -1781
- package/src/internal/hardhat-network/provider/modules/evm.ts +0 -249
- package/src/internal/hardhat-network/provider/modules/hardhat.ts +0 -481
- package/src/internal/hardhat-network/provider/modules/net.ts +0 -60
- package/src/internal/hardhat-network/provider/modules/personal.ts +0 -40
- package/src/internal/hardhat-network/provider/modules/web3.ts +0 -49
- package/src/internal/hardhat-network/provider/node.ts +0 -2993
- package/src/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.ts +0 -226
- package/src/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.ts +0 -224
- package/src/internal/hardhat-network/provider/transactions/FakeSenderTransaction.ts +0 -216
- package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.ts +0 -143
- package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.ts +0 -144
- package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.ts +0 -171
- package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidUnknownTypeTransaction.ts +0 -169
- package/src/internal/hardhat-network/provider/types/HardhatBlockchainInterface.ts +0 -25
- package/src/internal/hardhat-network/provider/utils/makeFakeSignature.ts +0 -60
- package/src/internal/hardhat-network/provider/utils/makeStateTrie.ts +0 -29
- package/src/internal/hardhat-network/provider/utils/putGenesisBlock.ts +0 -61
- package/src/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.ts +0 -45
- package/src/internal/hardhat-network/provider/utils/txMapToArray.ts +0 -7
- package/src/internal/hardhat-network/stack-traces/vm-debug-tracer.ts +0 -630
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import type { ReturnData } from "./return-data";
|
|
2
|
-
|
|
3
|
-
import { Block } from "@nomicfoundation/ethereumjs-block";
|
|
4
|
-
import { RunBlockResult } from "@nomicfoundation/ethereumjs-vm";
|
|
5
|
-
|
|
6
1
|
import { HARDHAT_MEMPOOL_SUPPORTED_ORDERS } from "../../constants";
|
|
7
2
|
import { BuildInfo, HardhatNetworkChainsConfig } from "../../../types";
|
|
8
|
-
import { MessageTrace } from "../stack-traces/message-trace";
|
|
9
|
-
import { RandomBufferGenerator } from "./utils/random";
|
|
10
3
|
|
|
11
4
|
export type NodeConfig = LocalNodeConfig | ForkedNodeConfig;
|
|
12
5
|
|
|
13
|
-
export function isForkedNodeConfig(
|
|
14
|
-
config: NodeConfig
|
|
15
|
-
): config is ForkedNodeConfig {
|
|
16
|
-
return "forkConfig" in config && config.forkConfig !== undefined;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
6
|
interface CommonConfig {
|
|
20
7
|
automine: boolean;
|
|
21
8
|
blockGasLimit: number;
|
|
@@ -50,6 +37,7 @@ export interface ForkedNodeConfig extends CommonConfig {
|
|
|
50
37
|
|
|
51
38
|
export interface TracingConfig {
|
|
52
39
|
buildInfos?: BuildInfo[];
|
|
40
|
+
ignoreContracts?: boolean;
|
|
53
41
|
}
|
|
54
42
|
|
|
55
43
|
export type IntervalMiningConfig = number | [number, number];
|
|
@@ -63,26 +51,10 @@ export interface GenesisAccount {
|
|
|
63
51
|
|
|
64
52
|
export type AccessListBufferItem = [Uint8Array, Uint8Array[]];
|
|
65
53
|
|
|
66
|
-
export interface CallParams {
|
|
67
|
-
to?: Uint8Array;
|
|
68
|
-
from: Uint8Array;
|
|
69
|
-
gasLimit: bigint;
|
|
70
|
-
value: bigint;
|
|
71
|
-
data: Uint8Array;
|
|
72
|
-
// We use this access list format because @nomicfoundation/ethereumjs-tx access list data
|
|
73
|
-
// forces us to use it or stringify them
|
|
74
|
-
accessList?: AccessListBufferItem[];
|
|
75
|
-
// Fee params
|
|
76
|
-
gasPrice?: bigint;
|
|
77
|
-
maxFeePerGas?: bigint;
|
|
78
|
-
maxPriorityFeePerGas?: bigint;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
54
|
export type TransactionParams =
|
|
82
55
|
| LegacyTransactionParams
|
|
83
56
|
| AccessListTransactionParams
|
|
84
|
-
| EIP1559TransactionParams
|
|
85
|
-
| BlobTransactionParams;
|
|
57
|
+
| EIP1559TransactionParams;
|
|
86
58
|
|
|
87
59
|
interface BaseTransactionParams {
|
|
88
60
|
// `to` should be undefined for contract creation
|
|
@@ -112,62 +84,3 @@ export interface EIP1559TransactionParams extends BaseTransactionParams {
|
|
|
112
84
|
maxFeePerGas: bigint;
|
|
113
85
|
maxPriorityFeePerGas: bigint;
|
|
114
86
|
}
|
|
115
|
-
|
|
116
|
-
export interface BlobTransactionParams extends EIP1559TransactionParams {
|
|
117
|
-
blobs: Uint8Array[];
|
|
118
|
-
blobVersionedHashes: Uint8Array[];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface FilterParams {
|
|
122
|
-
fromBlock: bigint;
|
|
123
|
-
toBlock: bigint;
|
|
124
|
-
addresses: Uint8Array[];
|
|
125
|
-
normalizedTopics: Array<Array<Uint8Array | null> | null>;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface Snapshot {
|
|
129
|
-
id: number;
|
|
130
|
-
date: Date;
|
|
131
|
-
latestBlock: Block;
|
|
132
|
-
stateRoot: Uint8Array;
|
|
133
|
-
txPoolSnapshotId: number;
|
|
134
|
-
blockTimeOffsetSeconds: bigint;
|
|
135
|
-
nextBlockTimestamp: bigint;
|
|
136
|
-
irregularStatesByBlockNumber: Map<bigint, Uint8Array>;
|
|
137
|
-
userProvidedNextBlockBaseFeePerGas: bigint | undefined;
|
|
138
|
-
coinbase: string;
|
|
139
|
-
mixHashGenerator: RandomBufferGenerator;
|
|
140
|
-
parentBeaconBlockRootGenerator: RandomBufferGenerator;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export type SendTransactionResult =
|
|
144
|
-
| string
|
|
145
|
-
| MineBlockResult
|
|
146
|
-
| MineBlockResult[];
|
|
147
|
-
|
|
148
|
-
export interface MineBlockResult {
|
|
149
|
-
block: Block;
|
|
150
|
-
blockResult: RunBlockResult;
|
|
151
|
-
traces: GatherTracesResult[];
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface RunCallResult extends GatherTracesResult {
|
|
155
|
-
result: ReturnData;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface EstimateGasResult extends GatherTracesResult {
|
|
159
|
-
estimation: bigint;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface GatherTracesResult {
|
|
163
|
-
trace: MessageTrace | undefined;
|
|
164
|
-
error?: Error;
|
|
165
|
-
consoleLogMessages: string[];
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface FeeHistory {
|
|
169
|
-
oldestBlock: bigint;
|
|
170
|
-
baseFeePerGas: bigint[];
|
|
171
|
-
gasUsedRatio: number[];
|
|
172
|
-
reward?: bigint[][];
|
|
173
|
-
}
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import { Block } from "@nomicfoundation/ethereumjs-block";
|
|
2
|
-
import { Common } from "@nomicfoundation/ethereumjs-common";
|
|
3
|
-
import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
|
|
4
|
-
import { bytesToHex as bufferToHex } from "@nomicfoundation/ethereumjs-util";
|
|
5
|
-
import { RunBlockResult } from "@nomicfoundation/ethereumjs-vm";
|
|
6
|
-
|
|
7
|
-
import * as BigIntUtils from "../../util/bigint";
|
|
8
|
-
import { assertHardhatInvariant } from "../../core/errors";
|
|
9
|
-
import {
|
|
10
|
-
bufferToRpcData,
|
|
11
|
-
numberToRpcQuantity,
|
|
12
|
-
} from "../../core/jsonrpc/types/base-types";
|
|
13
|
-
import { RpcLog } from "../../core/jsonrpc/types/output/log";
|
|
14
|
-
import { RpcTransactionReceipt } from "../../core/jsonrpc/types/output/receipt";
|
|
15
|
-
import { assertHardhatNetworkInvariant } from "./utils/assertions";
|
|
16
|
-
|
|
17
|
-
const FIRST_HARDFORK_WITH_TRANSACTION_TYPE = "berlin";
|
|
18
|
-
const FIRST_HARDFORK_WITH_EIP1559 = "london";
|
|
19
|
-
|
|
20
1
|
// TODO: These types should be moved to core, and probably inferred by io-ts
|
|
21
2
|
export interface RpcBlockOutput {
|
|
22
3
|
difficulty: string;
|
|
@@ -42,8 +23,6 @@ export interface RpcBlockOutput {
|
|
|
42
23
|
baseFeePerGas?: string;
|
|
43
24
|
withdrawals?: RpcWithdrawalItem[];
|
|
44
25
|
withdrawalsRoot?: string;
|
|
45
|
-
|
|
46
|
-
// Only present after Cancun hard-fork
|
|
47
26
|
parentBeaconBlockRoot?: string | null;
|
|
48
27
|
blobGasUsed?: string | null;
|
|
49
28
|
excessBlobGas?: string | null;
|
|
@@ -160,334 +139,3 @@ export interface RpcWithdrawalItem {
|
|
|
160
139
|
address: string;
|
|
161
140
|
amount: string;
|
|
162
141
|
}
|
|
163
|
-
|
|
164
|
-
/* eslint-disable @nomicfoundation/hardhat-internal-rules/only-hardhat-error */
|
|
165
|
-
|
|
166
|
-
export function getRpcBlock(
|
|
167
|
-
block: Block,
|
|
168
|
-
totalDifficulty: bigint,
|
|
169
|
-
showTransactionType: boolean,
|
|
170
|
-
includeTransactions = true,
|
|
171
|
-
pending = false
|
|
172
|
-
): RpcBlockOutput {
|
|
173
|
-
const transactions = includeTransactions
|
|
174
|
-
? block.transactions.map((tx, index) =>
|
|
175
|
-
getRpcTransaction(tx, showTransactionType, block, index)
|
|
176
|
-
)
|
|
177
|
-
: block.transactions.map((tx) => bufferToRpcData(tx.hash()));
|
|
178
|
-
|
|
179
|
-
const output: RpcBlockOutput = {
|
|
180
|
-
number: pending ? null : numberToRpcQuantity(block.header.number),
|
|
181
|
-
hash: pending ? null : bufferToRpcData(block.hash()),
|
|
182
|
-
parentHash: bufferToRpcData(block.header.parentHash),
|
|
183
|
-
// We pad this to 8 bytes because of a limitation in The Graph
|
|
184
|
-
// See: https://github.com/nomiclabs/hardhat/issues/491
|
|
185
|
-
nonce: pending ? null : bufferToRpcData(block.header.nonce, 8),
|
|
186
|
-
mixHash: pending ? null : bufferToRpcData(block.header.mixHash, 32),
|
|
187
|
-
sha3Uncles: bufferToRpcData(block.header.uncleHash),
|
|
188
|
-
logsBloom: bufferToRpcData(block.header.logsBloom),
|
|
189
|
-
transactionsRoot: bufferToRpcData(block.header.transactionsTrie),
|
|
190
|
-
stateRoot: bufferToRpcData(block.header.stateRoot),
|
|
191
|
-
receiptsRoot: bufferToRpcData(block.header.receiptTrie),
|
|
192
|
-
miner: bufferToRpcData(block.header.coinbase.toBytes()),
|
|
193
|
-
difficulty: numberToRpcQuantity(block.header.difficulty),
|
|
194
|
-
totalDifficulty: numberToRpcQuantity(totalDifficulty),
|
|
195
|
-
extraData: bufferToRpcData(block.header.extraData),
|
|
196
|
-
size: numberToRpcQuantity(block.serialize().length),
|
|
197
|
-
gasLimit: numberToRpcQuantity(block.header.gasLimit),
|
|
198
|
-
gasUsed: numberToRpcQuantity(block.header.gasUsed),
|
|
199
|
-
timestamp: numberToRpcQuantity(block.header.timestamp),
|
|
200
|
-
transactions,
|
|
201
|
-
uncles: block.uncleHeaders.map((uh: any) => bufferToRpcData(uh.hash())),
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
if (block.header.baseFeePerGas !== undefined) {
|
|
205
|
-
output.baseFeePerGas = numberToRpcQuantity(block.header.baseFeePerGas);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (block.header.withdrawalsRoot !== undefined) {
|
|
209
|
-
output.withdrawals = block.withdrawals?.map((withdrawal) => ({
|
|
210
|
-
index: numberToRpcQuantity(withdrawal.index),
|
|
211
|
-
validatorIndex: numberToRpcQuantity(withdrawal.validatorIndex),
|
|
212
|
-
address: bufferToRpcData(withdrawal.address.toBytes()),
|
|
213
|
-
amount: numberToRpcQuantity(withdrawal.amount),
|
|
214
|
-
}));
|
|
215
|
-
|
|
216
|
-
output.withdrawalsRoot = bufferToRpcData(block.header.withdrawalsRoot);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
addCancunPropertiesIfPresent(output, block, pending);
|
|
220
|
-
|
|
221
|
-
return output;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function addCancunPropertiesIfPresent(
|
|
225
|
-
output: RpcBlockOutput,
|
|
226
|
-
block: Block,
|
|
227
|
-
pending: boolean
|
|
228
|
-
) {
|
|
229
|
-
if (block.header.parentBeaconBlockRoot !== undefined) {
|
|
230
|
-
output.parentBeaconBlockRoot = pending
|
|
231
|
-
? null
|
|
232
|
-
: bufferToRpcData(block.header.parentBeaconBlockRoot, 32);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (block.header.blobGasUsed !== undefined) {
|
|
236
|
-
output.blobGasUsed = numberToRpcQuantity(block.header.blobGasUsed);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (block.header.excessBlobGas !== undefined) {
|
|
240
|
-
output.excessBlobGas = numberToRpcQuantity(block.header.excessBlobGas);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export function getRpcTransaction(
|
|
245
|
-
tx: TypedTransaction,
|
|
246
|
-
showTransactionType: boolean,
|
|
247
|
-
block: Block,
|
|
248
|
-
index: number
|
|
249
|
-
): RpcTransactionOutput;
|
|
250
|
-
|
|
251
|
-
export function getRpcTransaction(
|
|
252
|
-
tx: TypedTransaction,
|
|
253
|
-
showTransactionType: boolean,
|
|
254
|
-
block: "pending"
|
|
255
|
-
): RpcTransactionOutput;
|
|
256
|
-
|
|
257
|
-
export function getRpcTransaction(
|
|
258
|
-
tx: TypedTransaction,
|
|
259
|
-
showTransactionType: boolean,
|
|
260
|
-
block: Block | "pending",
|
|
261
|
-
index?: number
|
|
262
|
-
): RpcTransactionOutput {
|
|
263
|
-
// only already signed transactions should be used here,
|
|
264
|
-
// but there is no type in ethereumjs for that
|
|
265
|
-
assertHardhatInvariant(tx.v !== undefined, "tx should be signed");
|
|
266
|
-
assertHardhatInvariant(tx.r !== undefined, "tx should be signed");
|
|
267
|
-
assertHardhatInvariant(tx.s !== undefined, "tx should be signed");
|
|
268
|
-
|
|
269
|
-
const isTypedTransaction = tx.type !== 0;
|
|
270
|
-
|
|
271
|
-
const baseOutput = {
|
|
272
|
-
blockHash: block === "pending" ? null : bufferToRpcData(block.hash()),
|
|
273
|
-
blockNumber:
|
|
274
|
-
block === "pending" ? null : numberToRpcQuantity(block.header.number),
|
|
275
|
-
from: bufferToRpcData(tx.getSenderAddress().toBytes()),
|
|
276
|
-
gas: numberToRpcQuantity(tx.gasLimit),
|
|
277
|
-
hash: bufferToRpcData(tx.hash()),
|
|
278
|
-
input: bufferToRpcData(tx.data),
|
|
279
|
-
nonce: numberToRpcQuantity(tx.nonce),
|
|
280
|
-
to: tx.to === undefined ? null : bufferToRpcData(tx.to.toBytes()),
|
|
281
|
-
transactionIndex: index !== undefined ? numberToRpcQuantity(index) : null,
|
|
282
|
-
value: numberToRpcQuantity(tx.value),
|
|
283
|
-
v: numberToRpcQuantity(tx.v),
|
|
284
|
-
r: numberToRpcQuantity(tx.r),
|
|
285
|
-
s: numberToRpcQuantity(tx.s),
|
|
286
|
-
type:
|
|
287
|
-
showTransactionType || isTypedTransaction
|
|
288
|
-
? numberToRpcQuantity(tx.type)
|
|
289
|
-
: undefined,
|
|
290
|
-
accessList:
|
|
291
|
-
"accessList" in tx
|
|
292
|
-
? tx.accessList.map(([address, storageKeys]) => ({
|
|
293
|
-
address: bufferToHex(address),
|
|
294
|
-
storageKeys: storageKeys.map(bufferToHex),
|
|
295
|
-
}))
|
|
296
|
-
: undefined,
|
|
297
|
-
chainId: "chainId" in tx ? numberToRpcQuantity(tx.chainId) : undefined,
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
if ("maxFeePerGas" in tx) {
|
|
301
|
-
const effectiveGasPrice =
|
|
302
|
-
block === "pending"
|
|
303
|
-
? tx.maxFeePerGas
|
|
304
|
-
: getEffectiveGasPrice(tx, block.header.baseFeePerGas!);
|
|
305
|
-
|
|
306
|
-
// EIP-1559
|
|
307
|
-
return {
|
|
308
|
-
...baseOutput,
|
|
309
|
-
gasPrice: numberToRpcQuantity(effectiveGasPrice),
|
|
310
|
-
chainId: numberToRpcQuantity(tx.chainId),
|
|
311
|
-
maxFeePerGas: numberToRpcQuantity(tx.maxFeePerGas),
|
|
312
|
-
maxPriorityFeePerGas: numberToRpcQuantity(tx.maxPriorityFeePerGas),
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// Not EIP-1559
|
|
317
|
-
return {
|
|
318
|
-
...baseOutput,
|
|
319
|
-
gasPrice: numberToRpcQuantity(tx.gasPrice),
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function getEffectiveGasPrice(tx: TypedTransaction, baseFeePerGas: bigint) {
|
|
324
|
-
const maxFeePerGas = "maxFeePerGas" in tx ? tx.maxFeePerGas : tx.gasPrice;
|
|
325
|
-
const maxPriorityFeePerGas =
|
|
326
|
-
"maxPriorityFeePerGas" in tx ? tx.maxPriorityFeePerGas : tx.gasPrice;
|
|
327
|
-
|
|
328
|
-
return (
|
|
329
|
-
baseFeePerGas +
|
|
330
|
-
BigIntUtils.min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas)
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export function getRpcReceiptOutputsFromLocalBlockExecution(
|
|
335
|
-
block: Block,
|
|
336
|
-
runBlockResult: RunBlockResult,
|
|
337
|
-
showTransactionType: boolean
|
|
338
|
-
): RpcReceiptOutput[] {
|
|
339
|
-
const receipts: RpcReceiptOutput[] = [];
|
|
340
|
-
|
|
341
|
-
let blockLogIndex = 0;
|
|
342
|
-
|
|
343
|
-
for (let i = 0; i < runBlockResult.results.length; i += 1) {
|
|
344
|
-
const tx = block.transactions[i];
|
|
345
|
-
const { createdAddress, totalGasSpent } = runBlockResult.results[i];
|
|
346
|
-
const receipt = runBlockResult.receipts[i];
|
|
347
|
-
|
|
348
|
-
const logs = receipt.logs.map((log) => {
|
|
349
|
-
const result = getRpcLogOutput(log, tx, block, i, blockLogIndex);
|
|
350
|
-
blockLogIndex += 1;
|
|
351
|
-
return result;
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
const rpcReceipt: RpcReceiptOutput = {
|
|
355
|
-
transactionHash: bufferToRpcData(tx.hash()),
|
|
356
|
-
transactionIndex: numberToRpcQuantity(i),
|
|
357
|
-
blockHash: bufferToRpcData(block.hash()),
|
|
358
|
-
blockNumber: numberToRpcQuantity(block.header.number),
|
|
359
|
-
from: bufferToRpcData(tx.getSenderAddress().toBytes()),
|
|
360
|
-
to: tx.to === undefined ? null : bufferToRpcData(tx.to.toBytes()),
|
|
361
|
-
cumulativeGasUsed: numberToRpcQuantity(receipt.cumulativeBlockGasUsed),
|
|
362
|
-
gasUsed: numberToRpcQuantity(totalGasSpent),
|
|
363
|
-
contractAddress:
|
|
364
|
-
createdAddress !== undefined
|
|
365
|
-
? bufferToRpcData(createdAddress.toBytes())
|
|
366
|
-
: null,
|
|
367
|
-
logs,
|
|
368
|
-
logsBloom: bufferToRpcData(receipt.bitvector),
|
|
369
|
-
// There's no way to execute an EIP-2718 tx locally if we aren't in
|
|
370
|
-
// an HF >= Berlin, so this check is enough
|
|
371
|
-
type: showTransactionType ? numberToRpcQuantity(tx.type) : undefined,
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
if ("stateRoot" in receipt) {
|
|
375
|
-
rpcReceipt.root = bufferToRpcData(receipt.stateRoot);
|
|
376
|
-
} else {
|
|
377
|
-
rpcReceipt.status = numberToRpcQuantity(receipt.status);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
if (block.header.baseFeePerGas !== undefined) {
|
|
381
|
-
const effectiveGasPrice = getEffectiveGasPrice(
|
|
382
|
-
tx,
|
|
383
|
-
block.header.baseFeePerGas
|
|
384
|
-
);
|
|
385
|
-
|
|
386
|
-
rpcReceipt.effectiveGasPrice = numberToRpcQuantity(effectiveGasPrice);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
receipts.push(rpcReceipt);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
return receipts;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
export function remoteReceiptToRpcReceiptOutput(
|
|
396
|
-
receipt: RpcTransactionReceipt,
|
|
397
|
-
tx: TypedTransaction,
|
|
398
|
-
showTransactionType: boolean,
|
|
399
|
-
showEffectiveGasPrice: boolean
|
|
400
|
-
): RpcReceiptOutput {
|
|
401
|
-
const isTypedTransaction = tx.type !== 0;
|
|
402
|
-
const effectiveGasPrice =
|
|
403
|
-
receipt.effectiveGasPrice ?? ("gasPrice" in tx ? tx.gasPrice : undefined);
|
|
404
|
-
|
|
405
|
-
assertHardhatNetworkInvariant(
|
|
406
|
-
effectiveGasPrice !== undefined,
|
|
407
|
-
"Receipt without effectiveGasPrice nor gasPrice in its tx"
|
|
408
|
-
);
|
|
409
|
-
|
|
410
|
-
return {
|
|
411
|
-
blockHash: bufferToRpcData(receipt.blockHash),
|
|
412
|
-
blockNumber: numberToRpcQuantity(receipt.blockNumber),
|
|
413
|
-
contractAddress:
|
|
414
|
-
receipt.contractAddress !== null
|
|
415
|
-
? bufferToRpcData(receipt.contractAddress)
|
|
416
|
-
: null,
|
|
417
|
-
cumulativeGasUsed: numberToRpcQuantity(receipt.cumulativeGasUsed),
|
|
418
|
-
from: bufferToRpcData(receipt.from),
|
|
419
|
-
gasUsed: numberToRpcQuantity(receipt.gasUsed),
|
|
420
|
-
logs: receipt.logs.map(toRpcLogOutput),
|
|
421
|
-
logsBloom: bufferToRpcData(receipt.logsBloom),
|
|
422
|
-
status:
|
|
423
|
-
receipt.status !== undefined && receipt.status !== null
|
|
424
|
-
? numberToRpcQuantity(receipt.status)
|
|
425
|
-
: undefined,
|
|
426
|
-
root:
|
|
427
|
-
receipt.root !== undefined ? bufferToRpcData(receipt.root) : undefined,
|
|
428
|
-
to: receipt.to !== null ? bufferToRpcData(receipt.to) : null,
|
|
429
|
-
transactionHash: bufferToRpcData(receipt.transactionHash),
|
|
430
|
-
transactionIndex: numberToRpcQuantity(receipt.transactionIndex),
|
|
431
|
-
type:
|
|
432
|
-
showTransactionType || isTypedTransaction
|
|
433
|
-
? numberToRpcQuantity(tx.type)
|
|
434
|
-
: undefined,
|
|
435
|
-
effectiveGasPrice:
|
|
436
|
-
showEffectiveGasPrice || tx.type === 2
|
|
437
|
-
? numberToRpcQuantity(effectiveGasPrice)
|
|
438
|
-
: undefined,
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
export function toRpcLogOutput(log: RpcLog): RpcLogOutput {
|
|
443
|
-
return {
|
|
444
|
-
removed: false,
|
|
445
|
-
address: bufferToRpcData(log.address),
|
|
446
|
-
blockHash: log.blockHash !== null ? bufferToRpcData(log.blockHash) : null,
|
|
447
|
-
blockNumber:
|
|
448
|
-
log.blockNumber !== null ? numberToRpcQuantity(log.blockNumber) : null,
|
|
449
|
-
data: bufferToRpcData(log.data),
|
|
450
|
-
logIndex: log.logIndex !== null ? numberToRpcQuantity(log.logIndex) : null,
|
|
451
|
-
transactionIndex:
|
|
452
|
-
log.transactionIndex !== null
|
|
453
|
-
? numberToRpcQuantity(log.transactionIndex)
|
|
454
|
-
: null,
|
|
455
|
-
transactionHash:
|
|
456
|
-
log.transactionHash !== null
|
|
457
|
-
? bufferToRpcData(log.transactionHash)
|
|
458
|
-
: null,
|
|
459
|
-
topics: log.topics.map((topic) => bufferToRpcData(topic)),
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function getRpcLogOutput(
|
|
464
|
-
log: any[],
|
|
465
|
-
tx: TypedTransaction,
|
|
466
|
-
block?: Block,
|
|
467
|
-
transactionIndex?: number,
|
|
468
|
-
logIndex?: number
|
|
469
|
-
): RpcLogOutput {
|
|
470
|
-
return {
|
|
471
|
-
removed: false,
|
|
472
|
-
logIndex: logIndex !== undefined ? numberToRpcQuantity(logIndex) : null,
|
|
473
|
-
transactionIndex:
|
|
474
|
-
transactionIndex !== undefined
|
|
475
|
-
? numberToRpcQuantity(transactionIndex)
|
|
476
|
-
: null,
|
|
477
|
-
transactionHash: block !== undefined ? bufferToRpcData(tx.hash()) : null,
|
|
478
|
-
blockHash: block !== undefined ? bufferToRpcData(block.hash()) : null,
|
|
479
|
-
blockNumber:
|
|
480
|
-
block !== undefined ? numberToRpcQuantity(block.header.number) : null,
|
|
481
|
-
address: bufferToRpcData(log[0]),
|
|
482
|
-
data: bufferToRpcData(log[2]),
|
|
483
|
-
topics: log[1].map((topic: Buffer) => bufferToRpcData(topic)),
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
export function shouldShowTransactionTypeForHardfork(common: Common) {
|
|
488
|
-
return common.gteHardfork(FIRST_HARDFORK_WITH_TRANSACTION_TYPE);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
export function shouldShowEffectiveGasPriceForHardfork(common: Common) {
|
|
492
|
-
return common.gteHardfork(FIRST_HARDFORK_WITH_EIP1559);
|
|
493
|
-
}
|