@mainsail/evm 0.0.1-rc.7 → 0.0.1-rc.9

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.
Files changed (3) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +118 -51
  3. package/package.json +8 -7
package/index.d.ts CHANGED
@@ -255,6 +255,7 @@ export interface JsTransactionReceipt {
255
255
  blockNumber?: bigint
256
256
  txHash?: string
257
257
  gasUsed: bigint
258
+ cumulativeGasUsed: bigint
258
259
  gasRefunded: bigint
259
260
  status: number
260
261
  contractAddress?: string
package/index.js CHANGED
@@ -66,7 +66,7 @@ const isMuslFromChildProcess = () => {
66
66
  function requireNative() {
67
67
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68
68
  try {
69
- nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
69
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
70
70
  } catch (err) {
71
71
  loadErrors.push(err)
72
72
  }
@@ -80,8 +80,8 @@ function requireNative() {
80
80
  try {
81
81
  const binding = require('@mainsail/evm-android-arm64')
82
82
  const bindingPackageVersion = require('@mainsail/evm-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
83
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
85
  }
86
86
  return binding
87
87
  } catch (e) {
@@ -96,8 +96,8 @@ function requireNative() {
96
96
  try {
97
97
  const binding = require('@mainsail/evm-android-arm-eabi')
98
98
  const bindingPackageVersion = require('@mainsail/evm-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
99
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
101
  }
102
102
  return binding
103
103
  } catch (e) {
@@ -108,7 +108,24 @@ function requireNative() {
108
108
  }
109
109
  } else if (process.platform === 'win32') {
110
110
  if (process.arch === 'x64') {
111
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
112
+ try {
113
+ return require('./evm.win32-x64-gnu.node')
114
+ } catch (e) {
115
+ loadErrors.push(e)
116
+ }
111
117
  try {
118
+ const binding = require('@mainsail/evm-win32-x64-gnu')
119
+ const bindingPackageVersion = require('@mainsail/evm-win32-x64-gnu/package.json').version
120
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
+ }
123
+ return binding
124
+ } catch (e) {
125
+ loadErrors.push(e)
126
+ }
127
+ } else {
128
+ try {
112
129
  return require('./evm.win32-x64-msvc.node')
113
130
  } catch (e) {
114
131
  loadErrors.push(e)
@@ -116,13 +133,14 @@ function requireNative() {
116
133
  try {
117
134
  const binding = require('@mainsail/evm-win32-x64-msvc')
118
135
  const bindingPackageVersion = require('@mainsail/evm-win32-x64-msvc/package.json').version
119
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
138
  }
122
139
  return binding
123
140
  } catch (e) {
124
141
  loadErrors.push(e)
125
142
  }
143
+ }
126
144
  } else if (process.arch === 'ia32') {
127
145
  try {
128
146
  return require('./evm.win32-ia32-msvc.node')
@@ -132,8 +150,8 @@ function requireNative() {
132
150
  try {
133
151
  const binding = require('@mainsail/evm-win32-ia32-msvc')
134
152
  const bindingPackageVersion = require('@mainsail/evm-win32-ia32-msvc/package.json').version
135
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
154
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
155
  }
138
156
  return binding
139
157
  } catch (e) {
@@ -148,8 +166,8 @@ function requireNative() {
148
166
  try {
149
167
  const binding = require('@mainsail/evm-win32-arm64-msvc')
150
168
  const bindingPackageVersion = require('@mainsail/evm-win32-arm64-msvc/package.json').version
151
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
169
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
170
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
171
  }
154
172
  return binding
155
173
  } catch (e) {
@@ -167,8 +185,8 @@ function requireNative() {
167
185
  try {
168
186
  const binding = require('@mainsail/evm-darwin-universal')
169
187
  const bindingPackageVersion = require('@mainsail/evm-darwin-universal/package.json').version
170
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
189
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
190
  }
173
191
  return binding
174
192
  } catch (e) {
@@ -183,8 +201,8 @@ function requireNative() {
183
201
  try {
184
202
  const binding = require('@mainsail/evm-darwin-x64')
185
203
  const bindingPackageVersion = require('@mainsail/evm-darwin-x64/package.json').version
186
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
205
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
206
  }
189
207
  return binding
190
208
  } catch (e) {
@@ -199,8 +217,8 @@ function requireNative() {
199
217
  try {
200
218
  const binding = require('@mainsail/evm-darwin-arm64')
201
219
  const bindingPackageVersion = require('@mainsail/evm-darwin-arm64/package.json').version
202
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
220
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
221
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
222
  }
205
223
  return binding
206
224
  } catch (e) {
@@ -219,8 +237,8 @@ function requireNative() {
219
237
  try {
220
238
  const binding = require('@mainsail/evm-freebsd-x64')
221
239
  const bindingPackageVersion = require('@mainsail/evm-freebsd-x64/package.json').version
222
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
241
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
242
  }
225
243
  return binding
226
244
  } catch (e) {
@@ -235,8 +253,8 @@ function requireNative() {
235
253
  try {
236
254
  const binding = require('@mainsail/evm-freebsd-arm64')
237
255
  const bindingPackageVersion = require('@mainsail/evm-freebsd-arm64/package.json').version
238
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
256
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
257
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
258
  }
241
259
  return binding
242
260
  } catch (e) {
@@ -256,8 +274,8 @@ function requireNative() {
256
274
  try {
257
275
  const binding = require('@mainsail/evm-linux-x64-musl')
258
276
  const bindingPackageVersion = require('@mainsail/evm-linux-x64-musl/package.json').version
259
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
278
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
279
  }
262
280
  return binding
263
281
  } catch (e) {
@@ -272,8 +290,8 @@ function requireNative() {
272
290
  try {
273
291
  const binding = require('@mainsail/evm-linux-x64-gnu')
274
292
  const bindingPackageVersion = require('@mainsail/evm-linux-x64-gnu/package.json').version
275
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
293
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
295
  }
278
296
  return binding
279
297
  } catch (e) {
@@ -290,8 +308,8 @@ function requireNative() {
290
308
  try {
291
309
  const binding = require('@mainsail/evm-linux-arm64-musl')
292
310
  const bindingPackageVersion = require('@mainsail/evm-linux-arm64-musl/package.json').version
293
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
312
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
313
  }
296
314
  return binding
297
315
  } catch (e) {
@@ -306,8 +324,8 @@ function requireNative() {
306
324
  try {
307
325
  const binding = require('@mainsail/evm-linux-arm64-gnu')
308
326
  const bindingPackageVersion = require('@mainsail/evm-linux-arm64-gnu/package.json').version
309
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
327
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
329
  }
312
330
  return binding
313
331
  } catch (e) {
@@ -324,8 +342,8 @@ function requireNative() {
324
342
  try {
325
343
  const binding = require('@mainsail/evm-linux-arm-musleabihf')
326
344
  const bindingPackageVersion = require('@mainsail/evm-linux-arm-musleabihf/package.json').version
327
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
346
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
347
  }
330
348
  return binding
331
349
  } catch (e) {
@@ -340,8 +358,42 @@ function requireNative() {
340
358
  try {
341
359
  const binding = require('@mainsail/evm-linux-arm-gnueabihf')
342
360
  const bindingPackageVersion = require('@mainsail/evm-linux-arm-gnueabihf/package.json').version
343
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
361
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
+ }
364
+ return binding
365
+ } catch (e) {
366
+ loadErrors.push(e)
367
+ }
368
+ }
369
+ } else if (process.arch === 'loong64') {
370
+ if (isMusl()) {
371
+ try {
372
+ return require('./evm.linux-loong64-musl.node')
373
+ } catch (e) {
374
+ loadErrors.push(e)
375
+ }
376
+ try {
377
+ const binding = require('@mainsail/evm-linux-loong64-musl')
378
+ const bindingPackageVersion = require('@mainsail/evm-linux-loong64-musl/package.json').version
379
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
380
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
381
+ }
382
+ return binding
383
+ } catch (e) {
384
+ loadErrors.push(e)
385
+ }
386
+ } else {
387
+ try {
388
+ return require('./evm.linux-loong64-gnu.node')
389
+ } catch (e) {
390
+ loadErrors.push(e)
391
+ }
392
+ try {
393
+ const binding = require('@mainsail/evm-linux-loong64-gnu')
394
+ const bindingPackageVersion = require('@mainsail/evm-linux-loong64-gnu/package.json').version
395
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
397
  }
346
398
  return binding
347
399
  } catch (e) {
@@ -358,8 +410,8 @@ function requireNative() {
358
410
  try {
359
411
  const binding = require('@mainsail/evm-linux-riscv64-musl')
360
412
  const bindingPackageVersion = require('@mainsail/evm-linux-riscv64-musl/package.json').version
361
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
414
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
415
  }
364
416
  return binding
365
417
  } catch (e) {
@@ -374,8 +426,8 @@ function requireNative() {
374
426
  try {
375
427
  const binding = require('@mainsail/evm-linux-riscv64-gnu')
376
428
  const bindingPackageVersion = require('@mainsail/evm-linux-riscv64-gnu/package.json').version
377
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
429
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
431
  }
380
432
  return binding
381
433
  } catch (e) {
@@ -391,8 +443,8 @@ function requireNative() {
391
443
  try {
392
444
  const binding = require('@mainsail/evm-linux-ppc64-gnu')
393
445
  const bindingPackageVersion = require('@mainsail/evm-linux-ppc64-gnu/package.json').version
394
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
395
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
446
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
447
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
448
  }
397
449
  return binding
398
450
  } catch (e) {
@@ -407,8 +459,8 @@ function requireNative() {
407
459
  try {
408
460
  const binding = require('@mainsail/evm-linux-s390x-gnu')
409
461
  const bindingPackageVersion = require('@mainsail/evm-linux-s390x-gnu/package.json').version
410
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
462
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
463
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
464
  }
413
465
  return binding
414
466
  } catch (e) {
@@ -427,8 +479,8 @@ function requireNative() {
427
479
  try {
428
480
  const binding = require('@mainsail/evm-openharmony-arm64')
429
481
  const bindingPackageVersion = require('@mainsail/evm-openharmony-arm64/package.json').version
430
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
482
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
483
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
484
  }
433
485
  return binding
434
486
  } catch (e) {
@@ -443,8 +495,8 @@ function requireNative() {
443
495
  try {
444
496
  const binding = require('@mainsail/evm-openharmony-x64')
445
497
  const bindingPackageVersion = require('@mainsail/evm-openharmony-x64/package.json').version
446
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
447
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
498
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
499
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
448
500
  }
449
501
  return binding
450
502
  } catch (e) {
@@ -459,8 +511,8 @@ function requireNative() {
459
511
  try {
460
512
  const binding = require('@mainsail/evm-openharmony-arm')
461
513
  const bindingPackageVersion = require('@mainsail/evm-openharmony-arm/package.json').version
462
- if (bindingPackageVersion !== '0.0.1-rc.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
463
- throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
514
+ if (bindingPackageVersion !== '0.0.1-rc.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
515
+ throw new Error(`Native binding package version mismatch, expected 0.0.1-rc.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
516
  }
465
517
  return binding
466
518
  } catch (e) {
@@ -477,22 +529,32 @@ function requireNative() {
477
529
  nativeBinding = requireNative()
478
530
 
479
531
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
532
+ let wasiBinding = null
533
+ let wasiBindingError = null
480
534
  try {
481
- nativeBinding = require('./evm.wasi.cjs')
535
+ wasiBinding = require('./evm.wasi.cjs')
536
+ nativeBinding = wasiBinding
482
537
  } catch (err) {
483
538
  if (process.env.NAPI_RS_FORCE_WASI) {
484
- loadErrors.push(err)
539
+ wasiBindingError = err
485
540
  }
486
541
  }
487
542
  if (!nativeBinding) {
488
543
  try {
489
- nativeBinding = require('@mainsail/evm-wasm32-wasi')
544
+ wasiBinding = require('@mainsail/evm-wasm32-wasi')
545
+ nativeBinding = wasiBinding
490
546
  } catch (err) {
491
547
  if (process.env.NAPI_RS_FORCE_WASI) {
548
+ wasiBindingError.cause = err
492
549
  loadErrors.push(err)
493
550
  }
494
551
  }
495
552
  }
553
+ if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
554
+ const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
555
+ error.cause = wasiBindingError
556
+ throw error
557
+ }
496
558
  }
497
559
 
498
560
  if (!nativeBinding) {
@@ -501,7 +563,12 @@ if (!nativeBinding) {
501
563
  `Cannot find native binding. ` +
502
564
  `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
503
565
  'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
504
- { cause: loadErrors }
566
+ {
567
+ cause: loadErrors.reduce((err, cur) => {
568
+ cur.cause = err
569
+ return cur
570
+ }),
571
+ },
505
572
  )
506
573
  }
507
574
  throw new Error(`Failed to load native binding`)
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@mainsail/evm",
3
- "version": "0.0.1-rc.7",
3
+ "version": "0.0.1-rc.9",
4
4
  "description": "EVM for the Mainsail blockchain",
5
5
  "license": "GPL-3.0-only",
6
6
  "contributors": [],
7
7
  "main": "index.js",
8
8
  "types": "index.d.ts",
9
9
  "devDependencies": {
10
- "@napi-rs/cli": "3.1.5"
10
+ "@napi-rs/cli": "3.4.0"
11
11
  },
12
12
  "engines": {
13
- "node": ">=20.x"
13
+ "node": ">=24"
14
14
  },
15
15
  "napi": {
16
16
  "binaryName": "evm",
@@ -22,10 +22,10 @@
22
22
  ]
23
23
  },
24
24
  "optionalDependencies": {
25
- "@mainsail/evm-linux-arm64-gnu": "0.0.1-rc.7",
26
- "@mainsail/evm-linux-arm64-musl": "0.0.1-rc.7",
27
- "@mainsail/evm-linux-x64-gnu": "0.0.1-rc.7",
28
- "@mainsail/evm-linux-x64-musl": "0.0.1-rc.7"
25
+ "@mainsail/evm-linux-arm64-gnu": "0.0.1-rc.9",
26
+ "@mainsail/evm-linux-arm64-musl": "0.0.1-rc.9",
27
+ "@mainsail/evm-linux-x64-gnu": "0.0.1-rc.9",
28
+ "@mainsail/evm-linux-x64-musl": "0.0.1-rc.9"
29
29
  },
30
30
  "scripts": {
31
31
  "artifacts": "napi artifacts",
@@ -36,6 +36,7 @@
36
36
  "release": "pnpm publish --access public",
37
37
  "test": "cargo test --release",
38
38
  "test:coverage": "mkdir -p coverage && cargo llvm-cov --lcov --output-path coverage/lcov.info --remap-path-prefix",
39
+ "test:coverage:html": "mkdir -p coverage && cargo llvm-cov --html --output-dir coverage/ --remap-path-prefix",
39
40
  "version": "napi version"
40
41
  }
41
42
  }