@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
package/index.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* prettier-ignore */
|
|
4
|
+
|
|
5
|
+
/* auto-generated by NAPI-RS */
|
|
6
|
+
|
|
7
|
+
const { existsSync, readFileSync } = require('fs')
|
|
8
|
+
const { join } = require('path')
|
|
9
|
+
|
|
10
|
+
const { platform, arch } = process
|
|
11
|
+
|
|
12
|
+
let nativeBinding = null
|
|
13
|
+
let localFileExisted = false
|
|
14
|
+
let loadError = null
|
|
15
|
+
|
|
16
|
+
function isMusl() {
|
|
17
|
+
// For Node 10
|
|
18
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
19
|
+
try {
|
|
20
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
21
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
+
return !glibcVersionRuntime
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
switch (platform) {
|
|
32
|
+
case 'android':
|
|
33
|
+
switch (arch) {
|
|
34
|
+
case 'arm64':
|
|
35
|
+
localFileExisted = existsSync(join(__dirname, 'edr.android-arm64.node'))
|
|
36
|
+
try {
|
|
37
|
+
if (localFileExisted) {
|
|
38
|
+
nativeBinding = require('./edr.android-arm64.node')
|
|
39
|
+
} else {
|
|
40
|
+
nativeBinding = require('@nomicfoundation/edr-android-arm64')
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
loadError = e
|
|
44
|
+
}
|
|
45
|
+
break
|
|
46
|
+
case 'arm':
|
|
47
|
+
localFileExisted = existsSync(join(__dirname, 'edr.android-arm-eabi.node'))
|
|
48
|
+
try {
|
|
49
|
+
if (localFileExisted) {
|
|
50
|
+
nativeBinding = require('./edr.android-arm-eabi.node')
|
|
51
|
+
} else {
|
|
52
|
+
nativeBinding = require('@nomicfoundation/edr-android-arm-eabi')
|
|
53
|
+
}
|
|
54
|
+
} catch (e) {
|
|
55
|
+
loadError = e
|
|
56
|
+
}
|
|
57
|
+
break
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
60
|
+
}
|
|
61
|
+
break
|
|
62
|
+
case 'win32':
|
|
63
|
+
switch (arch) {
|
|
64
|
+
case 'x64':
|
|
65
|
+
localFileExisted = existsSync(
|
|
66
|
+
join(__dirname, 'edr.win32-x64-msvc.node')
|
|
67
|
+
)
|
|
68
|
+
try {
|
|
69
|
+
if (localFileExisted) {
|
|
70
|
+
nativeBinding = require('./edr.win32-x64-msvc.node')
|
|
71
|
+
} else {
|
|
72
|
+
nativeBinding = require('@nomicfoundation/edr-win32-x64-msvc')
|
|
73
|
+
}
|
|
74
|
+
} catch (e) {
|
|
75
|
+
loadError = e
|
|
76
|
+
}
|
|
77
|
+
break
|
|
78
|
+
case 'ia32':
|
|
79
|
+
localFileExisted = existsSync(
|
|
80
|
+
join(__dirname, 'edr.win32-ia32-msvc.node')
|
|
81
|
+
)
|
|
82
|
+
try {
|
|
83
|
+
if (localFileExisted) {
|
|
84
|
+
nativeBinding = require('./edr.win32-ia32-msvc.node')
|
|
85
|
+
} else {
|
|
86
|
+
nativeBinding = require('@nomicfoundation/edr-win32-ia32-msvc')
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
loadError = e
|
|
90
|
+
}
|
|
91
|
+
break
|
|
92
|
+
case 'arm64':
|
|
93
|
+
localFileExisted = existsSync(
|
|
94
|
+
join(__dirname, 'edr.win32-arm64-msvc.node')
|
|
95
|
+
)
|
|
96
|
+
try {
|
|
97
|
+
if (localFileExisted) {
|
|
98
|
+
nativeBinding = require('./edr.win32-arm64-msvc.node')
|
|
99
|
+
} else {
|
|
100
|
+
nativeBinding = require('@nomicfoundation/edr-win32-arm64-msvc')
|
|
101
|
+
}
|
|
102
|
+
} catch (e) {
|
|
103
|
+
loadError = e
|
|
104
|
+
}
|
|
105
|
+
break
|
|
106
|
+
default:
|
|
107
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
108
|
+
}
|
|
109
|
+
break
|
|
110
|
+
case 'darwin':
|
|
111
|
+
localFileExisted = existsSync(join(__dirname, 'edr.darwin-universal.node'))
|
|
112
|
+
try {
|
|
113
|
+
if (localFileExisted) {
|
|
114
|
+
nativeBinding = require('./edr.darwin-universal.node')
|
|
115
|
+
} else {
|
|
116
|
+
nativeBinding = require('@nomicfoundation/edr-darwin-universal')
|
|
117
|
+
}
|
|
118
|
+
break
|
|
119
|
+
} catch {}
|
|
120
|
+
switch (arch) {
|
|
121
|
+
case 'x64':
|
|
122
|
+
localFileExisted = existsSync(join(__dirname, 'edr.darwin-x64.node'))
|
|
123
|
+
try {
|
|
124
|
+
if (localFileExisted) {
|
|
125
|
+
nativeBinding = require('./edr.darwin-x64.node')
|
|
126
|
+
} else {
|
|
127
|
+
nativeBinding = require('@nomicfoundation/edr-darwin-x64')
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadError = e
|
|
131
|
+
}
|
|
132
|
+
break
|
|
133
|
+
case 'arm64':
|
|
134
|
+
localFileExisted = existsSync(
|
|
135
|
+
join(__dirname, 'edr.darwin-arm64.node')
|
|
136
|
+
)
|
|
137
|
+
try {
|
|
138
|
+
if (localFileExisted) {
|
|
139
|
+
nativeBinding = require('./edr.darwin-arm64.node')
|
|
140
|
+
} else {
|
|
141
|
+
nativeBinding = require('@nomicfoundation/edr-darwin-arm64')
|
|
142
|
+
}
|
|
143
|
+
} catch (e) {
|
|
144
|
+
loadError = e
|
|
145
|
+
}
|
|
146
|
+
break
|
|
147
|
+
default:
|
|
148
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
149
|
+
}
|
|
150
|
+
break
|
|
151
|
+
case 'freebsd':
|
|
152
|
+
if (arch !== 'x64') {
|
|
153
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
154
|
+
}
|
|
155
|
+
localFileExisted = existsSync(join(__dirname, 'edr.freebsd-x64.node'))
|
|
156
|
+
try {
|
|
157
|
+
if (localFileExisted) {
|
|
158
|
+
nativeBinding = require('./edr.freebsd-x64.node')
|
|
159
|
+
} else {
|
|
160
|
+
nativeBinding = require('@nomicfoundation/edr-freebsd-x64')
|
|
161
|
+
}
|
|
162
|
+
} catch (e) {
|
|
163
|
+
loadError = e
|
|
164
|
+
}
|
|
165
|
+
break
|
|
166
|
+
case 'linux':
|
|
167
|
+
switch (arch) {
|
|
168
|
+
case 'x64':
|
|
169
|
+
if (isMusl()) {
|
|
170
|
+
localFileExisted = existsSync(
|
|
171
|
+
join(__dirname, 'edr.linux-x64-musl.node')
|
|
172
|
+
)
|
|
173
|
+
try {
|
|
174
|
+
if (localFileExisted) {
|
|
175
|
+
nativeBinding = require('./edr.linux-x64-musl.node')
|
|
176
|
+
} else {
|
|
177
|
+
nativeBinding = require('@nomicfoundation/edr-linux-x64-musl')
|
|
178
|
+
}
|
|
179
|
+
} catch (e) {
|
|
180
|
+
loadError = e
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
localFileExisted = existsSync(
|
|
184
|
+
join(__dirname, 'edr.linux-x64-gnu.node')
|
|
185
|
+
)
|
|
186
|
+
try {
|
|
187
|
+
if (localFileExisted) {
|
|
188
|
+
nativeBinding = require('./edr.linux-x64-gnu.node')
|
|
189
|
+
} else {
|
|
190
|
+
nativeBinding = require('@nomicfoundation/edr-linux-x64-gnu')
|
|
191
|
+
}
|
|
192
|
+
} catch (e) {
|
|
193
|
+
loadError = e
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
break
|
|
197
|
+
case 'arm64':
|
|
198
|
+
if (isMusl()) {
|
|
199
|
+
localFileExisted = existsSync(
|
|
200
|
+
join(__dirname, 'edr.linux-arm64-musl.node')
|
|
201
|
+
)
|
|
202
|
+
try {
|
|
203
|
+
if (localFileExisted) {
|
|
204
|
+
nativeBinding = require('./edr.linux-arm64-musl.node')
|
|
205
|
+
} else {
|
|
206
|
+
nativeBinding = require('@nomicfoundation/edr-linux-arm64-musl')
|
|
207
|
+
}
|
|
208
|
+
} catch (e) {
|
|
209
|
+
loadError = e
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
localFileExisted = existsSync(
|
|
213
|
+
join(__dirname, 'edr.linux-arm64-gnu.node')
|
|
214
|
+
)
|
|
215
|
+
try {
|
|
216
|
+
if (localFileExisted) {
|
|
217
|
+
nativeBinding = require('./edr.linux-arm64-gnu.node')
|
|
218
|
+
} else {
|
|
219
|
+
nativeBinding = require('@nomicfoundation/edr-linux-arm64-gnu')
|
|
220
|
+
}
|
|
221
|
+
} catch (e) {
|
|
222
|
+
loadError = e
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
break
|
|
226
|
+
case 'arm':
|
|
227
|
+
localFileExisted = existsSync(
|
|
228
|
+
join(__dirname, 'edr.linux-arm-gnueabihf.node')
|
|
229
|
+
)
|
|
230
|
+
try {
|
|
231
|
+
if (localFileExisted) {
|
|
232
|
+
nativeBinding = require('./edr.linux-arm-gnueabihf.node')
|
|
233
|
+
} else {
|
|
234
|
+
nativeBinding = require('@nomicfoundation/edr-linux-arm-gnueabihf')
|
|
235
|
+
}
|
|
236
|
+
} catch (e) {
|
|
237
|
+
loadError = e
|
|
238
|
+
}
|
|
239
|
+
break
|
|
240
|
+
default:
|
|
241
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
242
|
+
}
|
|
243
|
+
break
|
|
244
|
+
default:
|
|
245
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (!nativeBinding) {
|
|
249
|
+
if (loadError) {
|
|
250
|
+
throw loadError
|
|
251
|
+
}
|
|
252
|
+
throw new Error(`Failed to load native binding`)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const { SpecId, EdrContext, MineOrdering, Provider, Response, SuccessReason, ExceptionalHalt, RawTrace } = nativeBinding
|
|
256
|
+
|
|
257
|
+
module.exports.SpecId = SpecId
|
|
258
|
+
module.exports.EdrContext = EdrContext
|
|
259
|
+
module.exports.MineOrdering = MineOrdering
|
|
260
|
+
module.exports.Provider = Provider
|
|
261
|
+
module.exports.Response = Response
|
|
262
|
+
module.exports.SuccessReason = SuccessReason
|
|
263
|
+
module.exports.ExceptionalHalt = ExceptionalHalt
|
|
264
|
+
module.exports.RawTrace = RawTrace
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-darwin-arm64",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"darwin"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"arm64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.darwin-arm64.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.darwin-arm64.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-darwin-x64",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"darwin"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"x64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.darwin-x64.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.darwin-x64.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-linux-arm64-gnu",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"linux"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"arm64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.linux-arm64-gnu.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.linux-arm64-gnu.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
},
|
|
22
|
+
"libc": [
|
|
23
|
+
"glibc"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-linux-arm64-musl",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"linux"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"arm64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.linux-arm64-musl.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.linux-arm64-musl.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
},
|
|
22
|
+
"libc": [
|
|
23
|
+
"musl"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-linux-x64-gnu",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"linux"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"x64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.linux-x64-gnu.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.linux-x64-gnu.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
},
|
|
22
|
+
"libc": [
|
|
23
|
+
"glibc"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-linux-x64-musl",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"linux"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"x64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.linux-x64-musl.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.linux-x64-musl.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
},
|
|
22
|
+
"libc": [
|
|
23
|
+
"musl"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-win32-arm64-msvc",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"win32"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"arm64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.win32-arm64-msvc.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.win32-arm64-msvc.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 10"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-win32-ia32-msvc",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"win32"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"ia32"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.win32-ia32-msvc.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.win32-ia32-msvc.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr-win32-x64-msvc",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
5
|
+
"type": "git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.2.0-alpha.2",
|
|
8
|
+
"os": [
|
|
9
|
+
"win32"
|
|
10
|
+
],
|
|
11
|
+
"cpu": [
|
|
12
|
+
"x64"
|
|
13
|
+
],
|
|
14
|
+
"main": "edr.win32-x64-msvc.node",
|
|
15
|
+
"files": [
|
|
16
|
+
"edr.win32-x64-msvc.node"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 18"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomicfoundation/edr",
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/NomicFoundation/hardhat.git",
|
|
8
|
+
"type": "git"
|
|
9
|
+
},
|
|
10
|
+
"napi": {
|
|
11
|
+
"name": "edr",
|
|
12
|
+
"triples": {
|
|
13
|
+
"additional": [
|
|
14
|
+
"aarch64-apple-darwin",
|
|
15
|
+
"aarch64-pc-windows-msvc",
|
|
16
|
+
"aarch64-unknown-linux-gnu",
|
|
17
|
+
"aarch64-unknown-linux-musl",
|
|
18
|
+
"x86_64-unknown-linux-musl",
|
|
19
|
+
"i686-pc-windows-msvc"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@napi-rs/cli": "^2.16.3",
|
|
26
|
+
"@types/chai": "^4.2.0",
|
|
27
|
+
"@types/chai-as-promised": "^7.1.8",
|
|
28
|
+
"@types/mocha": ">=9.1.0",
|
|
29
|
+
"@types/node": "^16.0.0",
|
|
30
|
+
"chai": "^4.3.6",
|
|
31
|
+
"chai-as-promised": "^7.1.1",
|
|
32
|
+
"mocha": "^10.0.0",
|
|
33
|
+
"typescript": "~4.5.2"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">= 18"
|
|
37
|
+
},
|
|
38
|
+
"optionalDependencies": {
|
|
39
|
+
"@nomicfoundation/edr-win32-x64-msvc": "0.2.0-alpha.2",
|
|
40
|
+
"@nomicfoundation/edr-darwin-x64": "0.2.0-alpha.2",
|
|
41
|
+
"@nomicfoundation/edr-linux-x64-gnu": "0.2.0-alpha.2",
|
|
42
|
+
"@nomicfoundation/edr-darwin-arm64": "0.2.0-alpha.2",
|
|
43
|
+
"@nomicfoundation/edr-win32-arm64-msvc": "0.2.0-alpha.2",
|
|
44
|
+
"@nomicfoundation/edr-linux-arm64-gnu": "0.2.0-alpha.2",
|
|
45
|
+
"@nomicfoundation/edr-linux-arm64-musl": "0.2.0-alpha.2",
|
|
46
|
+
"@nomicfoundation/edr-linux-x64-musl": "0.2.0-alpha.2",
|
|
47
|
+
"@nomicfoundation/edr-win32-ia32-msvc": "0.2.0-alpha.2"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"artifacts": "napi artifacts",
|
|
51
|
+
"build": "napi build --platform --release",
|
|
52
|
+
"build:debug": "napi build --platform",
|
|
53
|
+
"build:tracing": "napi build --release --features tracing",
|
|
54
|
+
"universal": "napi universal",
|
|
55
|
+
"version": "napi version",
|
|
56
|
+
"pretest": "pnpm build",
|
|
57
|
+
"test": "pnpm tsc && mocha --recursive \"test/**/*.ts\" --exit",
|
|
58
|
+
"testNoBuild": "pnpm tsc && mocha --recursive \"test/**/*.ts\" --exit",
|
|
59
|
+
"clean": "rm -rf @nomicfoundation/edr.node"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/account.rs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
use edr_eth::signature::secret_key_from_str;
|
|
2
|
+
use napi::{bindgen_prelude::BigInt, Status};
|
|
3
|
+
use napi_derive::napi;
|
|
4
|
+
|
|
5
|
+
use crate::cast::TryCast;
|
|
6
|
+
|
|
7
|
+
/// An account that needs to be created during the genesis block.
|
|
8
|
+
#[napi(object)]
|
|
9
|
+
pub struct GenesisAccount {
|
|
10
|
+
/// Account secret key
|
|
11
|
+
pub secret_key: String,
|
|
12
|
+
/// Account balance
|
|
13
|
+
pub balance: BigInt,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
impl TryFrom<GenesisAccount> for edr_provider::AccountConfig {
|
|
17
|
+
type Error = napi::Error;
|
|
18
|
+
|
|
19
|
+
fn try_from(value: GenesisAccount) -> Result<Self, Self::Error> {
|
|
20
|
+
let secret_key = secret_key_from_str(&value.secret_key)
|
|
21
|
+
.map_err(|e| napi::Error::new(Status::InvalidArg, e.to_string()))?;
|
|
22
|
+
|
|
23
|
+
Ok(Self {
|
|
24
|
+
secret_key,
|
|
25
|
+
balance: value.balance.try_cast()?,
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|