@nomicfoundation/edr 0.2.0-alpha.2
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/.cargo/config.toml +8 -0
- package/.mocharc.json +4 -0
- package/Cargo.toml +50 -0
- package/LICENSE +1 -0
- package/artifacts/bindings-aarch64-apple-darwin/edr.darwin-arm64.node +0 -0
- package/artifacts/bindings-aarch64-pc-windows-msvc/edr.win32-arm64-msvc.node +0 -0
- package/artifacts/bindings-aarch64-unknown-linux-gnu/edr.linux-arm64-gnu.node +0 -0
- package/artifacts/bindings-aarch64-unknown-linux-musl/edr.linux-arm64-musl.node +0 -0
- package/artifacts/bindings-i686-pc-windows-msvc/edr.win32-ia32-msvc.node +0 -0
- package/artifacts/bindings-x86_64-apple-darwin/edr.darwin-x64.node +0 -0
- package/artifacts/bindings-x86_64-pc-windows-msvc/edr.win32-x64-msvc.node +0 -0
- package/artifacts/bindings-x86_64-unknown-linux-gnu/edr.linux-x64-gnu.node +0 -0
- package/artifacts/bindings-x86_64-unknown-linux-musl/edr.linux-x64-musl.node +0 -0
- package/build.rs +3 -0
- package/index.d.ts +383 -0
- package/index.js +264 -0
- package/npm/darwin-arm64/README.md +3 -0
- package/npm/darwin-arm64/edr.darwin-arm64.node +0 -0
- package/npm/darwin-arm64/package.json +22 -0
- package/npm/darwin-x64/README.md +3 -0
- package/npm/darwin-x64/edr.darwin-x64.node +0 -0
- package/npm/darwin-x64/package.json +22 -0
- package/npm/linux-arm64-gnu/README.md +3 -0
- package/npm/linux-arm64-gnu/edr.linux-arm64-gnu.node +0 -0
- package/npm/linux-arm64-gnu/package.json +25 -0
- package/npm/linux-arm64-musl/README.md +3 -0
- package/npm/linux-arm64-musl/edr.linux-arm64-musl.node +0 -0
- package/npm/linux-arm64-musl/package.json +25 -0
- package/npm/linux-x64-gnu/README.md +3 -0
- package/npm/linux-x64-gnu/edr.linux-x64-gnu.node +0 -0
- package/npm/linux-x64-gnu/package.json +25 -0
- package/npm/linux-x64-musl/README.md +3 -0
- package/npm/linux-x64-musl/edr.linux-x64-musl.node +0 -0
- package/npm/linux-x64-musl/package.json +25 -0
- package/npm/win32-arm64-msvc/README.md +3 -0
- package/npm/win32-arm64-msvc/edr.win32-arm64-msvc.node +0 -0
- package/npm/win32-arm64-msvc/package.json +22 -0
- package/npm/win32-ia32-msvc/README.md +3 -0
- package/npm/win32-ia32-msvc/edr.win32-ia32-msvc.node +0 -0
- package/npm/win32-ia32-msvc/package.json +22 -0
- package/npm/win32-x64-msvc/README.md +3 -0
- package/npm/win32-x64-msvc/edr.win32-x64-msvc.node +0 -0
- package/npm/win32-x64-msvc/package.json +22 -0
- package/package.json +61 -0
- package/src/account.rs +28 -0
- package/src/block.rs +110 -0
- package/src/cast.rs +119 -0
- package/src/config.rs +70 -0
- package/src/context.rs +74 -0
- package/src/debug_trace.rs +38 -0
- package/src/lib.rs +18 -0
- package/src/log.rs +41 -0
- package/src/logger.rs +1277 -0
- package/src/provider/config.rs +271 -0
- package/src/provider.rs +185 -0
- package/src/result.rs +254 -0
- package/src/subscribe.rs +60 -0
- package/src/sync.rs +85 -0
- package/src/threadsafe_function.rs +305 -0
- package/src/trace.rs +168 -0
- package/test/provider.ts +104 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# The monorepo Cargo workspace builds to `$REPO_ROOT/target` by default.
|
|
2
|
+
# However, it uses different settings than the one NAPI sets during the build for this crate.
|
|
3
|
+
# Let's use a separate target-dir "$THIS_CRATE/target" to avoid invalidating the workspace-level cache.
|
|
4
|
+
target-dir = "./target"
|
|
5
|
+
|
|
6
|
+
[target.aarch64-unknown-linux-musl]
|
|
7
|
+
linker = "aarch64-linux-musl-gcc"
|
|
8
|
+
rustflags = ["-C", "target-feature=-crt-static"]
|
package/.mocharc.json
ADDED
package/Cargo.toml
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "edr_napi"
|
|
3
|
+
version = "0.2.0-dev"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[lib]
|
|
7
|
+
crate-type = ["cdylib"]
|
|
8
|
+
|
|
9
|
+
[dependencies]
|
|
10
|
+
ansi_term = { version = "0.12.1", default-features = false }
|
|
11
|
+
crossbeam-channel = { version = "0.5.6", default-features = false }
|
|
12
|
+
itertools = { version = "0.12.0", default-features = false }
|
|
13
|
+
k256 = { version = "0.13.1", default-features = false, features = ["arithmetic", "ecdsa", "pkcs8", "precomputed-tables", "std"] }
|
|
14
|
+
log = { version = "0.4.20", default-features = false }
|
|
15
|
+
# when napi is pinned, be sure to pin napi-derive to the same version
|
|
16
|
+
# The `async` feature ensures that a tokio runtime is available
|
|
17
|
+
napi = { version = "2.12.4", default-features = false, features = ["async", "error_anyhow", "napi8", "serde-json"] }
|
|
18
|
+
napi-derive = "2.12.3"
|
|
19
|
+
edr_defaults = { version = "0.2.0-dev", path = "../edr_defaults" }
|
|
20
|
+
edr_evm = { version = "0.2.0-dev", path = "../edr_evm", features = ["tracing"]}
|
|
21
|
+
edr_eth = { version = "0.2.0-dev", path = "../edr_eth" }
|
|
22
|
+
edr_provider = { version = "0.2.0-dev", path = "../edr_provider" }
|
|
23
|
+
serde_json = { version = "1.0.85", default-features = false, features = ["alloc"] }
|
|
24
|
+
thiserror = { version = "1.0.37", default-features = false }
|
|
25
|
+
tracing = { version = "0.1.37", default-features = false, features = ["std"] }
|
|
26
|
+
tracing-flame = { version = "0.2.0", default-features = false, features = ["smallvec"] }
|
|
27
|
+
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["ansi", "env-filter", "fmt", "parking_lot", "smallvec", "std"] }
|
|
28
|
+
parking_lot = { version = "0.12.1", default-features = false }
|
|
29
|
+
lazy_static = { version = "1.4.0", features = [] }
|
|
30
|
+
|
|
31
|
+
[target.x86_64-unknown-linux-gnu.dependencies]
|
|
32
|
+
openssl-sys = { version = "0.9.93", features = ["vendored"] }
|
|
33
|
+
|
|
34
|
+
[target.x86_64-unknown-linux-musl.dependencies]
|
|
35
|
+
openssl-sys = { version = "0.9.93", features = ["vendored"] }
|
|
36
|
+
|
|
37
|
+
[target.aarch64-unknown-linux-gnu.dependencies]
|
|
38
|
+
openssl-sys = { version = "0.9.93", features = ["vendored"] }
|
|
39
|
+
|
|
40
|
+
[target.aarch64-unknown-linux-musl.dependencies]
|
|
41
|
+
openssl-sys = { version = "0.9.93", features = ["vendored"] }
|
|
42
|
+
|
|
43
|
+
[build-dependencies]
|
|
44
|
+
napi-build = "2.0.1"
|
|
45
|
+
|
|
46
|
+
[features]
|
|
47
|
+
tracing = ["edr_evm/tracing"]
|
|
48
|
+
|
|
49
|
+
[profile.release]
|
|
50
|
+
lto = true
|
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
SEE LICENSE IN EACH PACKAGE'S LICENSE FILE
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build.rs
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
/** An account that needs to be created during the genesis block. */
|
|
7
|
+
export interface GenesisAccount {
|
|
8
|
+
/** Account secret key */
|
|
9
|
+
secretKey: string
|
|
10
|
+
/** Account balance */
|
|
11
|
+
balance: bigint
|
|
12
|
+
}
|
|
13
|
+
export interface BlockOptions {
|
|
14
|
+
/** The parent block's hash */
|
|
15
|
+
parentHash?: Buffer
|
|
16
|
+
/** The block's beneficiary */
|
|
17
|
+
beneficiary?: Buffer
|
|
18
|
+
/** The state's root hash */
|
|
19
|
+
stateRoot?: Buffer
|
|
20
|
+
/** The block's difficulty */
|
|
21
|
+
difficulty?: bigint
|
|
22
|
+
/** The block's number */
|
|
23
|
+
number?: bigint
|
|
24
|
+
/** The block's gas limit */
|
|
25
|
+
gasLimit?: bigint
|
|
26
|
+
/** The block's timestamp */
|
|
27
|
+
timestamp?: bigint
|
|
28
|
+
/** The block's extra data */
|
|
29
|
+
extraData?: Buffer
|
|
30
|
+
/** The block's mix hash (or prevrandao) */
|
|
31
|
+
mixHash?: Buffer
|
|
32
|
+
/** The block's nonce */
|
|
33
|
+
nonce?: Buffer
|
|
34
|
+
/** The block's base gas fee */
|
|
35
|
+
baseFee?: bigint
|
|
36
|
+
/** The block's withdrawals root */
|
|
37
|
+
withdrawalsRoot?: Buffer
|
|
38
|
+
/**
|
|
39
|
+
* The hash tree root of the parent beacon block for the given execution
|
|
40
|
+
* block (EIP-4788).
|
|
41
|
+
*/
|
|
42
|
+
parentBeaconBlockRoot?: Buffer
|
|
43
|
+
}
|
|
44
|
+
/** Information about the blob gas used in a block. */
|
|
45
|
+
export interface BlobGas {
|
|
46
|
+
/**
|
|
47
|
+
* The total amount of blob gas consumed by the transactions within the
|
|
48
|
+
* block.
|
|
49
|
+
*/
|
|
50
|
+
gasUsed: bigint
|
|
51
|
+
/**
|
|
52
|
+
* The running total of blob gas consumed in excess of the target, prior to
|
|
53
|
+
* the block. Blocks with above-target blob gas consumption increase this
|
|
54
|
+
* value, blocks with below-target blob gas consumption decrease it
|
|
55
|
+
* (bounded at 0).
|
|
56
|
+
*/
|
|
57
|
+
excessGas: bigint
|
|
58
|
+
}
|
|
59
|
+
/** Identifier for the Ethereum spec. */
|
|
60
|
+
export const enum SpecId {
|
|
61
|
+
/** Frontier */
|
|
62
|
+
Frontier = 0,
|
|
63
|
+
/** Frontier Thawing */
|
|
64
|
+
FrontierThawing = 1,
|
|
65
|
+
/** Homestead */
|
|
66
|
+
Homestead = 2,
|
|
67
|
+
/** DAO Fork */
|
|
68
|
+
DaoFork = 3,
|
|
69
|
+
/** Tangerine */
|
|
70
|
+
Tangerine = 4,
|
|
71
|
+
/** Spurious Dragon */
|
|
72
|
+
SpuriousDragon = 5,
|
|
73
|
+
/** Byzantium */
|
|
74
|
+
Byzantium = 6,
|
|
75
|
+
/** Constantinople */
|
|
76
|
+
Constantinople = 7,
|
|
77
|
+
/** Petersburg */
|
|
78
|
+
Petersburg = 8,
|
|
79
|
+
/** Istanbul */
|
|
80
|
+
Istanbul = 9,
|
|
81
|
+
/** Muir Glacier */
|
|
82
|
+
MuirGlacier = 10,
|
|
83
|
+
/** Berlin */
|
|
84
|
+
Berlin = 11,
|
|
85
|
+
/** London */
|
|
86
|
+
London = 12,
|
|
87
|
+
/** Arrow Glacier */
|
|
88
|
+
ArrowGlacier = 13,
|
|
89
|
+
/** Gray Glacier */
|
|
90
|
+
GrayGlacier = 14,
|
|
91
|
+
/** Merge */
|
|
92
|
+
Merge = 15,
|
|
93
|
+
/** Shanghai */
|
|
94
|
+
Shanghai = 16,
|
|
95
|
+
/** Cancun */
|
|
96
|
+
Cancun = 17,
|
|
97
|
+
/** Latest */
|
|
98
|
+
Latest = 18
|
|
99
|
+
}
|
|
100
|
+
export interface DebugTraceResult {
|
|
101
|
+
pass: boolean
|
|
102
|
+
gasUsed: bigint
|
|
103
|
+
output?: Buffer
|
|
104
|
+
structLogs: Array<DebugTraceLogItem>
|
|
105
|
+
}
|
|
106
|
+
export interface DebugTraceLogItem {
|
|
107
|
+
/** Program Counter */
|
|
108
|
+
pc: bigint
|
|
109
|
+
op: number
|
|
110
|
+
/** Gas left before executing this operation as hex number. */
|
|
111
|
+
gas: string
|
|
112
|
+
/** Gas cost of this operation as hex number. */
|
|
113
|
+
gasCost: string
|
|
114
|
+
/** Array of all values (hex numbers) on the stack */
|
|
115
|
+
stack?: Array<string>
|
|
116
|
+
/** Depth of the call stack */
|
|
117
|
+
depth: bigint
|
|
118
|
+
/** Size of memory array */
|
|
119
|
+
memSize: bigint
|
|
120
|
+
/** Name of the operation */
|
|
121
|
+
opName: string
|
|
122
|
+
/** Description of an error as a hex string. */
|
|
123
|
+
error?: string
|
|
124
|
+
/** Array of all allocated values as hex strings. */
|
|
125
|
+
memory?: Array<string>
|
|
126
|
+
/** Map of all stored values with keys and values encoded as hex strings. */
|
|
127
|
+
storage?: Record<string, string>
|
|
128
|
+
}
|
|
129
|
+
/** Ethereum execution log. */
|
|
130
|
+
export interface ExecutionLog {
|
|
131
|
+
address: Buffer
|
|
132
|
+
topics: Array<Buffer>
|
|
133
|
+
data: Buffer
|
|
134
|
+
}
|
|
135
|
+
export interface ContractAndFunctionName {
|
|
136
|
+
/** The contract name. */
|
|
137
|
+
contractName: string
|
|
138
|
+
/** The function name. Only present for calls. */
|
|
139
|
+
functionName?: string
|
|
140
|
+
}
|
|
141
|
+
export interface LoggerConfig {
|
|
142
|
+
/** Whether to enable the logger. */
|
|
143
|
+
enable: boolean
|
|
144
|
+
decodeConsoleLogInputsCallback: (inputs: Buffer[]) => string[]
|
|
145
|
+
getContractAndFunctionNameCallback: (code: Buffer, calldata?: Buffer) => ContractAndFunctionName
|
|
146
|
+
printLineCallback: (message: string, replace: boolean) => void
|
|
147
|
+
}
|
|
148
|
+
/** Configuration for a chain */
|
|
149
|
+
export interface ChainConfig {
|
|
150
|
+
/** The chain ID */
|
|
151
|
+
chainId: bigint
|
|
152
|
+
/** The chain's supported hardforks */
|
|
153
|
+
hardforks: Array<HardforkActivation>
|
|
154
|
+
}
|
|
155
|
+
/** Configuration for forking a blockchain */
|
|
156
|
+
export interface ForkConfig {
|
|
157
|
+
/** The URL of the JSON-RPC endpoint to fork from */
|
|
158
|
+
jsonRpcUrl: string
|
|
159
|
+
/**
|
|
160
|
+
* The block number to fork from. If not provided, the latest safe block is
|
|
161
|
+
* used.
|
|
162
|
+
*/
|
|
163
|
+
blockNumber?: bigint
|
|
164
|
+
/** The HTTP headers to use when making requests to the JSON-RPC endpoint */
|
|
165
|
+
httpHeaders?: Array<HttpHeader>
|
|
166
|
+
}
|
|
167
|
+
export interface HttpHeader {
|
|
168
|
+
name: string
|
|
169
|
+
value: string
|
|
170
|
+
}
|
|
171
|
+
/** Configuration for a hardfork activation */
|
|
172
|
+
export interface HardforkActivation {
|
|
173
|
+
/** The block number at which the hardfork is activated */
|
|
174
|
+
blockNumber: bigint
|
|
175
|
+
/** The activated hardfork */
|
|
176
|
+
specId: SpecId
|
|
177
|
+
}
|
|
178
|
+
/**The type of ordering to use when selecting blocks to mine. */
|
|
179
|
+
export const enum MineOrdering {
|
|
180
|
+
/**Insertion order */
|
|
181
|
+
Fifo = 'Fifo',
|
|
182
|
+
/**Effective miner fee */
|
|
183
|
+
Priority = 'Priority'
|
|
184
|
+
}
|
|
185
|
+
/** Configuration for the provider's mempool. */
|
|
186
|
+
export interface MemPoolConfig {
|
|
187
|
+
order: MineOrdering
|
|
188
|
+
}
|
|
189
|
+
export interface IntervalRange {
|
|
190
|
+
min: bigint
|
|
191
|
+
max: bigint
|
|
192
|
+
}
|
|
193
|
+
/** Configuration for the provider's miner. */
|
|
194
|
+
export interface MiningConfig {
|
|
195
|
+
autoMine: boolean
|
|
196
|
+
interval?: bigint | IntervalRange
|
|
197
|
+
memPool: MemPoolConfig
|
|
198
|
+
}
|
|
199
|
+
/** Configuration for a provider */
|
|
200
|
+
export interface ProviderConfig {
|
|
201
|
+
/** Whether to allow blocks with the same timestamp */
|
|
202
|
+
allowBlocksWithSameTimestamp: boolean
|
|
203
|
+
/** Whether to allow unlimited contract size */
|
|
204
|
+
allowUnlimitedContractSize: boolean
|
|
205
|
+
/** Whether to return an `Err` when `eth_call` fails */
|
|
206
|
+
bailOnCallFailure: boolean
|
|
207
|
+
/** Whether to return an `Err` when a `eth_sendTransaction` fails */
|
|
208
|
+
bailOnTransactionFailure: boolean
|
|
209
|
+
/** The gas limit of each block */
|
|
210
|
+
blockGasLimit: bigint
|
|
211
|
+
/** The directory to cache remote JSON-RPC responses */
|
|
212
|
+
cacheDir?: string
|
|
213
|
+
/** The chain ID of the blockchain */
|
|
214
|
+
chainId: bigint
|
|
215
|
+
/** The configuration for chains */
|
|
216
|
+
chains: Array<ChainConfig>
|
|
217
|
+
/** The address of the coinbase */
|
|
218
|
+
coinbase: Buffer
|
|
219
|
+
/**
|
|
220
|
+
* The configuration for forking a blockchain. If not provided, a local
|
|
221
|
+
* blockchain will be created
|
|
222
|
+
*/
|
|
223
|
+
fork?: ForkConfig
|
|
224
|
+
/** The genesis accounts of the blockchain */
|
|
225
|
+
genesisAccounts: Array<GenesisAccount>
|
|
226
|
+
/** The hardfork of the blockchain */
|
|
227
|
+
hardfork: SpecId
|
|
228
|
+
/**
|
|
229
|
+
* The initial base fee per gas of the blockchain. Required for EIP-1559
|
|
230
|
+
* transactions and later
|
|
231
|
+
*/
|
|
232
|
+
initialBaseFeePerGas?: bigint
|
|
233
|
+
/** The initial blob gas of the blockchain. Required for EIP-4844 */
|
|
234
|
+
initialBlobGas?: BlobGas
|
|
235
|
+
/** The initial date of the blockchain, in seconds since the Unix epoch */
|
|
236
|
+
initialDate?: bigint
|
|
237
|
+
/**
|
|
238
|
+
* The initial parent beacon block root of the blockchain. Required for
|
|
239
|
+
* EIP-4788
|
|
240
|
+
*/
|
|
241
|
+
initialParentBeaconBlockRoot?: Buffer
|
|
242
|
+
/** The minimum gas price of the next block. */
|
|
243
|
+
minGasPrice: bigint
|
|
244
|
+
/** The configuration for the miner */
|
|
245
|
+
mining: MiningConfig
|
|
246
|
+
/** The network ID of the blockchain */
|
|
247
|
+
networkId: bigint
|
|
248
|
+
}
|
|
249
|
+
/** The possible reasons for successful termination of the EVM. */
|
|
250
|
+
export const enum SuccessReason {
|
|
251
|
+
/** The opcode `STOP` was called */
|
|
252
|
+
Stop = 0,
|
|
253
|
+
/** The opcode `RETURN` was called */
|
|
254
|
+
Return = 1,
|
|
255
|
+
/** The opcode `SELFDESTRUCT` was called */
|
|
256
|
+
SelfDestruct = 2
|
|
257
|
+
}
|
|
258
|
+
export interface CallOutput {
|
|
259
|
+
/** Return value */
|
|
260
|
+
returnValue: Buffer
|
|
261
|
+
}
|
|
262
|
+
export interface CreateOutput {
|
|
263
|
+
/** Return value */
|
|
264
|
+
returnValue: Buffer
|
|
265
|
+
/** Optionally, a 160-bit address */
|
|
266
|
+
address?: Buffer
|
|
267
|
+
}
|
|
268
|
+
/** The result when the EVM terminates successfully. */
|
|
269
|
+
export interface SuccessResult {
|
|
270
|
+
/** The reason for termination */
|
|
271
|
+
reason: SuccessReason
|
|
272
|
+
/** The amount of gas used */
|
|
273
|
+
gasUsed: bigint
|
|
274
|
+
/** The amount of gas refunded */
|
|
275
|
+
gasRefunded: bigint
|
|
276
|
+
/** The logs */
|
|
277
|
+
logs: Array<ExecutionLog>
|
|
278
|
+
/** The transaction output */
|
|
279
|
+
output: CallOutput | CreateOutput
|
|
280
|
+
}
|
|
281
|
+
/** The result when the EVM terminates due to a revert. */
|
|
282
|
+
export interface RevertResult {
|
|
283
|
+
/** The amount of gas used */
|
|
284
|
+
gasUsed: bigint
|
|
285
|
+
/** The transaction output */
|
|
286
|
+
output: Buffer
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Indicates that the EVM has experienced an exceptional halt. This causes
|
|
290
|
+
* execution to immediately end with all gas being consumed.
|
|
291
|
+
*/
|
|
292
|
+
export const enum ExceptionalHalt {
|
|
293
|
+
OutOfGas = 0,
|
|
294
|
+
OpcodeNotFound = 1,
|
|
295
|
+
InvalidFEOpcode = 2,
|
|
296
|
+
InvalidJump = 3,
|
|
297
|
+
NotActivated = 4,
|
|
298
|
+
StackUnderflow = 5,
|
|
299
|
+
StackOverflow = 6,
|
|
300
|
+
OutOfOffset = 7,
|
|
301
|
+
CreateCollision = 8,
|
|
302
|
+
PrecompileError = 9,
|
|
303
|
+
NonceOverflow = 10,
|
|
304
|
+
/** Create init code size exceeds limit (runtime). */
|
|
305
|
+
CreateContractSizeLimit = 11,
|
|
306
|
+
/** Error on created contract that begins with EF */
|
|
307
|
+
CreateContractStartingWithEF = 12,
|
|
308
|
+
/** EIP-3860: Limit and meter initcode. Initcode size limit exceeded. */
|
|
309
|
+
CreateInitcodeSizeLimit = 13
|
|
310
|
+
}
|
|
311
|
+
/** The result when the EVM terminates due to an exceptional halt. */
|
|
312
|
+
export interface HaltResult {
|
|
313
|
+
/** The exceptional halt that occurred */
|
|
314
|
+
reason: ExceptionalHalt
|
|
315
|
+
/**
|
|
316
|
+
* Halting will spend all the gas and will thus be equal to the specified
|
|
317
|
+
* gas limit
|
|
318
|
+
*/
|
|
319
|
+
gasUsed: bigint
|
|
320
|
+
}
|
|
321
|
+
/** The result of executing a transaction. */
|
|
322
|
+
export interface ExecutionResult {
|
|
323
|
+
/** The transaction result */
|
|
324
|
+
result: SuccessResult | RevertResult | HaltResult
|
|
325
|
+
}
|
|
326
|
+
export interface SubscriptionEvent {
|
|
327
|
+
filterId: bigint
|
|
328
|
+
result: any
|
|
329
|
+
}
|
|
330
|
+
export interface TracingMessage {
|
|
331
|
+
/** Sender address */
|
|
332
|
+
readonly caller: Buffer
|
|
333
|
+
/** Recipient address. None if it is a Create message. */
|
|
334
|
+
readonly to?: Buffer
|
|
335
|
+
/** Transaction gas limit */
|
|
336
|
+
readonly gasLimit: bigint
|
|
337
|
+
/** Depth of the message */
|
|
338
|
+
readonly depth: number
|
|
339
|
+
/** Input data of the message */
|
|
340
|
+
readonly data: Buffer
|
|
341
|
+
/** Value sent in the message */
|
|
342
|
+
readonly value: bigint
|
|
343
|
+
/**
|
|
344
|
+
* Address of the code that is being executed. Can be different from `to`
|
|
345
|
+
* if a delegate call is being done.
|
|
346
|
+
*/
|
|
347
|
+
readonly codeAddress?: Buffer
|
|
348
|
+
/** Code of the contract that is being executed. */
|
|
349
|
+
readonly code?: Buffer
|
|
350
|
+
}
|
|
351
|
+
export interface TracingStep {
|
|
352
|
+
/** Call depth */
|
|
353
|
+
readonly depth: number
|
|
354
|
+
/** The program counter */
|
|
355
|
+
readonly pc: bigint
|
|
356
|
+
/** The executed op code */
|
|
357
|
+
readonly opcode: string
|
|
358
|
+
/** The top entry on the stack. None if the stack is empty. */
|
|
359
|
+
readonly stackTop?: bigint
|
|
360
|
+
}
|
|
361
|
+
export interface TracingMessageResult {
|
|
362
|
+
/** Execution result */
|
|
363
|
+
readonly executionResult: ExecutionResult
|
|
364
|
+
}
|
|
365
|
+
export class EdrContext {
|
|
366
|
+
/**Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
367
|
+
constructor()
|
|
368
|
+
}
|
|
369
|
+
/** A JSON-RPC provider for Ethereum. */
|
|
370
|
+
export class Provider {
|
|
371
|
+
/**Constructs a new provider with the provided configuration. */
|
|
372
|
+
static withConfig(context: EdrContext, config: ProviderConfig, loggerConfig: LoggerConfig, subscriberCallback: (event: SubscriptionEvent) => void): Promise<Provider>
|
|
373
|
+
/**Handles a JSON-RPC request and returns a JSON-RPC response. */
|
|
374
|
+
handleRequest(jsonRequest: string): Promise<Response>
|
|
375
|
+
}
|
|
376
|
+
export class Response {
|
|
377
|
+
get json(): string
|
|
378
|
+
get solidityTrace(): RawTrace | null
|
|
379
|
+
get traces(): Array<RawTrace>
|
|
380
|
+
}
|
|
381
|
+
export class RawTrace {
|
|
382
|
+
trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
|
|
383
|
+
}
|