@mainsail/evm 0.0.1-evm.4 → 0.0.1-evm.40

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 +264 -60
  2. package/index.js +457 -258
  3. package/package.json +18 -20
package/index.d.ts CHANGED
@@ -1,101 +1,305 @@
1
- /* tslint:disable */
1
+ /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ export declare class Evm {
4
+ constructor(opts: JsEvmOptions)
5
+ preverifyTransaction(txCtx: JsPreverifyTransactionContext): Promise<JsPreverifyTransactionResult>
6
+ view(viewCtx: JsTransactionViewContext): Promise<JsViewResult>
7
+ process(txCtx: JsTransactionContext): Promise<JsProcessResult>
8
+ simulate(txCtx: JsTransactionSimulateContext): Promise<JsSimulateResult>
9
+ initializeGenesis(genesisCtx: JsGenesisContext): Promise<undefined>
10
+ prepareNextCommit(ctx: JsPrepareNextCommitContext): Promise<undefined>
11
+ calculateRoundValidators(ctx: JsCalculateRoundValidatorsContext): Promise<undefined>
12
+ updateRewardsAndVotes(ctx: JsUpdateRewardsAndVotesContext): Promise<undefined>
13
+ getAccountInfo(address: string, blockNumber?: bigint | undefined | null): Promise<JsAccountInfo>
14
+ getAccountInfoExtended(address: string, legacyAddress?: string | undefined | null): Promise<JsAccountInfoExtended>
15
+ importAccountInfos(infos: Array<JsAccountInfoExtended>): Promise<undefined>
16
+ importLegacyColdWallets(infos: Array<JsLegacyColdWallet>): Promise<undefined>
17
+ getAccounts(offset: bigint, limit: bigint): Promise<JsGetAccounts>
18
+ getLegacyAttributes(address: string, legacyAddress?: string | undefined | null): Promise<JsLegacyAttributes | undefined | null>
19
+ getLegacyColdWallets(offset: bigint, limit: bigint): Promise<JsGetLegacyColdWallets>
20
+ getReceipts(offset: bigint, limit: bigint): Promise<JsGetReceipts>
21
+ getReceiptsByBlockNumber(blockNumber: bigint): Promise<Record<string, JsTransactionReceipt>>
22
+ getReceipt(blockNumber: bigint, txHash: string): Promise<JsGetReceipt>
23
+ codeAt(address: string, blockNumber?: bigint | undefined | null): Promise<string>
24
+ storageAt(address: string, slot: bigint): Promise<string>
25
+ commit(commitKey: JsCommitKey, commitData?: JsCommitData | undefined | null): Promise<JsCommitResult>
26
+ stateRoot(commitKey: JsCommitKey, currentHash: string): Promise<string>
27
+ logsBloom(commitKey: JsCommitKey): Promise<string>
28
+ isEmpty(): Promise<boolean>
29
+ getState(): Promise<JsGetState>
30
+ getBlockHeaderData(blockNumber: bigint): Promise<JsBlockHeaderData | undefined | null>
31
+ getBlockNumberByHash(blockHash: string): Promise<bigint | undefined | null>
32
+ getCommitData(blockNumber: bigint): Promise<JsCommitData | undefined | null>
33
+ getTransactionData(key: string): Promise<JsTransactionData | undefined | null>
34
+ getTransactionKeyByHash(txHash: string): Promise<string | undefined | null>
35
+ snapshot(commitKey: JsCommitKey): Promise<undefined>
36
+ rollback(commitKey: JsCommitKey): Promise<undefined>
37
+ dispose(): Promise<undefined>
38
+ }
39
+ export type JsEvmWrapper = Evm
3
40
 
4
- /* auto-generated by NAPI-RS */
41
+ export interface JsAccountInfo {
42
+ balance: bigint
43
+ nonce: bigint
44
+ }
5
45
 
6
- export interface JsTransactionContext {
7
- caller: string
8
- /** Omit recipient when deploying a contract */
9
- recipient?: string
10
- gasLimit: bigint
11
- gasPrice?: bigint
12
- value: bigint
46
+ export interface JsAccountInfoExtended {
47
+ address: string
48
+ balance: bigint
13
49
  nonce: bigint
14
- data: Buffer
50
+ legacyAttributes: JsLegacyAttributes
51
+ }
52
+
53
+ export interface JsAccountMergeInfo {
54
+ address: string
15
55
  txHash: string
16
- blockContext: JsBlockContext
17
- specId: string
18
56
  }
19
- export interface JsTransactionViewContext {
20
- caller: string
21
- recipient: string
22
- data: Buffer
23
- specId: string
57
+
58
+ export interface JsAccountUpdate {
59
+ address: string
60
+ balance: bigint
61
+ nonce: bigint
62
+ vote?: string
63
+ unvote?: string
64
+ username?: string
65
+ usernameResigned: boolean
66
+ legacyMergeInfo?: JsAccountMergeInfo
24
67
  }
68
+
25
69
  export interface JsBlockContext {
26
70
  commitKey: JsCommitKey
27
71
  gasLimit: bigint
28
72
  timestamp: bigint
29
73
  validatorAddress: string
30
74
  }
31
- export interface JsGenesisContext {
32
- account: string
33
- deployerAccount: string
34
- validatorContract: string
35
- initialSupply: bigint
36
- }
37
- export interface JsCalculateTopValidatorsContext {
38
- commitKey: JsCommitKey
75
+
76
+ export interface JsBlockHeaderData {
77
+ version: number
39
78
  timestamp: bigint
40
- activeValidators: bigint
41
- validatorAddress: string
42
- specId: string
79
+ number: number
80
+ round: number
81
+ hash: string
82
+ parentHash: string
83
+ stateRoot: string
84
+ logsBloom: string
85
+ transactionsRoot: string
86
+ transactionsCount: number
87
+ gasUsed: number
88
+ fee: bigint
89
+ reward: bigint
90
+ payloadSize: number
91
+ proposer: string
43
92
  }
44
- export interface JsUpdateRewardsAndVotesContext {
93
+
94
+ export interface JsCalculateRoundValidatorsContext {
45
95
  commitKey: JsCommitKey
46
96
  timestamp: bigint
47
- blockReward: bigint
97
+ roundValidators: bigint
48
98
  validatorAddress: string
49
99
  specId: string
50
100
  }
101
+
102
+ export interface JsCommitData {
103
+ proof: JsProofData
104
+ header: JsBlockHeaderData
105
+ transactions: Array<JsTransactionData>
106
+ }
107
+
51
108
  export interface JsCommitKey {
52
- height: bigint
109
+ blockNumber: bigint
53
110
  round: bigint
111
+ blockHash?: string
112
+ }
113
+
114
+ export interface JsCommitResult {
115
+ dirtyAccounts: Array<JsAccountUpdate>
116
+ }
117
+
118
+ export interface JsEvmOptions {
119
+ path: string
120
+ logger?: (arg: JsLogMessage) => void
121
+ historySize?: bigint
122
+ }
123
+
124
+ export interface JsGenesisContext {
125
+ account: string
126
+ deployerAccount: string
127
+ validatorContract: string
128
+ usernameContract: string
129
+ initialBlockNumber: bigint
130
+ initialSupply: bigint
131
+ }
132
+
133
+ export interface JsGetAccounts {
134
+ nextOffset?: bigint
135
+ accounts: Array<JsAccountInfoExtended>
136
+ }
137
+
138
+ export interface JsGetLegacyColdWallets {
139
+ nextOffset?: bigint
140
+ wallets: Array<JsLegacyColdWallet>
141
+ }
142
+
143
+ export interface JsGetReceipt {
144
+ receipt?: JsTransactionReceipt
145
+ }
146
+
147
+ export interface JsGetReceipts {
148
+ nextOffset?: bigint
149
+ receipts: Array<JsTransactionReceipt>
150
+ }
151
+
152
+ export interface JsGetState {
153
+ blockNumber: bigint
154
+ totalRound: bigint
155
+ }
156
+
157
+ export interface JsLegacyAttributes {
158
+ legacyNonce?: bigint
159
+ secondPublicKey?: string
160
+ multiSignature?: JsLegacyMultiSignatureAttribute
161
+ }
162
+
163
+ export interface JsLegacyColdWallet {
164
+ address: string
165
+ balance: bigint
166
+ legacyAttributes: JsLegacyAttributes
167
+ mergeInfo?: JsAccountMergeInfo
168
+ }
169
+
170
+ export interface JsLegacyMultiSignatureAttribute {
171
+ min: number
172
+ publicKeys: Array<string>
54
173
  }
174
+
175
+ export interface JsLogMessage {
176
+ level: LogLevel
177
+ message: string
178
+ }
179
+
55
180
  export interface JsPrepareNextCommitContext {
56
181
  commitKey: JsCommitKey
57
182
  }
183
+
184
+ export interface JsPreverifyTransactionContext {
185
+ from: string
186
+ legacyAddress?: string
187
+ /** Omit recipient when deploying a contract */
188
+ to?: string
189
+ gasLimit: bigint
190
+ gasPrice: bigint
191
+ value: bigint
192
+ nonce: bigint
193
+ data: Buffer
194
+ txHash: string
195
+ specId: string
196
+ blockGasLimit: bigint
197
+ }
198
+
199
+ export interface JsPreverifyTransactionResult {
200
+ success: boolean
201
+ initialGasUsed: bigint
202
+ error?: string
203
+ }
204
+
58
205
  export interface JsProcessResult {
59
206
  receipt: JsTransactionReceipt
60
207
  }
61
- export interface JsCommitResult {
62
- dirtyAccounts: Array<JsAccountUpdate>
208
+
209
+ export interface JsProofData {
210
+ round: number
211
+ signature: string
212
+ validatorSet: bigint
63
213
  }
64
- export interface JsViewResult {
65
- success: boolean
66
- output?: Buffer
214
+
215
+ export interface JsSimulateResult {
216
+ receipt: JsTransactionReceipt
217
+ }
218
+
219
+ export interface JsTransactionContext {
220
+ from: string
221
+ legacyAddress?: string
222
+ /** Omit recipient when deploying a contract */
223
+ to?: string
224
+ gasLimit: bigint
225
+ gasPrice: bigint
226
+ value: bigint
227
+ nonce: bigint
228
+ data: Buffer
229
+ txHash: string
230
+ index?: number
231
+ blockContext: JsBlockContext
232
+ specId: string
233
+ }
234
+
235
+ export interface JsTransactionData {
236
+ from: string
237
+ senderPublicKey: string
238
+ legacyAddress?: string
239
+ to?: string
240
+ gasLimit: bigint
241
+ gasPrice: bigint
242
+ value: bigint
243
+ nonce: bigint
244
+ data: Buffer
245
+ v: number
246
+ r: string
247
+ s: string
248
+ legacySecondSignature?: string
249
+ txHash: string
250
+ blockNumber: number
251
+ index: number
67
252
  }
253
+
68
254
  export interface JsTransactionReceipt {
255
+ blockNumber?: bigint
256
+ txHash?: string
69
257
  gasUsed: bigint
70
258
  gasRefunded: bigint
71
- success: boolean
72
- deployedContractAddress?: string
259
+ status: number
260
+ contractAddress?: string
73
261
  logs: any
74
262
  output?: Buffer
75
263
  }
76
- export interface JsAccountInfo {
77
- balance: bigint
264
+
265
+ export interface JsTransactionSimulateContext {
266
+ from: string
267
+ /** Omit recipient when deploying a contract */
268
+ to?: string
269
+ gasLimit: bigint
270
+ gasPrice: bigint
271
+ value: bigint
78
272
  nonce: bigint
273
+ data: Buffer
274
+ blockContext: JsBlockContext
275
+ specId: string
79
276
  }
80
- export interface JsAccountUpdate {
81
- address: string
82
- balance: bigint
83
- nonce: bigint
84
- vote?: string
85
- unvote?: string
277
+
278
+ export interface JsTransactionViewContext {
279
+ from: string
280
+ to: string
281
+ data: Buffer
282
+ specId: string
283
+ gasLimit?: bigint
86
284
  }
87
- export type JsEvmWrapper = Evm
88
- export declare class Evm {
89
- constructor(path: string)
90
- view(viewCtx: JsTransactionViewContext): Promise<JsViewResult>
91
- process(txCtx: JsTransactionContext): Promise<JsProcessResult>
92
- initializeGenesis(genesisCtx: JsGenesisContext): Promise<void>
93
- prepareNextCommit(ctx: JsPrepareNextCommitContext): Promise<void>
94
- calculateTopValidators(ctx: JsCalculateTopValidatorsContext): Promise<void>
95
- updateRewardsAndVotes(ctx: JsUpdateRewardsAndVotesContext): Promise<void>
96
- getAccountInfo(address: string): Promise<JsAccountInfo>
97
- codeAt(address: string): Promise<string>
98
- storageAt(address: string, slot: bigint): Promise<string>
99
- commit(commitKey: JsCommitKey): Promise<JsCommitResult>
100
- stateHash(commitKey: JsCommitKey, currentHash: string): Promise<string>
285
+
286
+ export interface JsUpdateRewardsAndVotesContext {
287
+ commitKey: JsCommitKey
288
+ timestamp: bigint
289
+ blockReward: bigint
290
+ validatorAddress: string
291
+ specId: string
292
+ }
293
+
294
+ export interface JsViewResult {
295
+ success: boolean
296
+ output?: Buffer
297
+ }
298
+
299
+ export declare const enum LogLevel {
300
+ Info = 0,
301
+ Debug = 1,
302
+ Notice = 2,
303
+ Alert = 3,
304
+ Warn = 4
101
305
  }
package/index.js CHANGED
@@ -1,315 +1,514 @@
1
- /* tslint:disable */
1
+ // prettier-ignore
2
2
  /* eslint-disable */
3
- /* prettier-ignore */
4
-
3
+ // @ts-nocheck
5
4
  /* auto-generated by NAPI-RS */
6
5
 
7
- const { existsSync, readFileSync } = require('fs')
8
- const { join } = require('path')
9
-
10
- const { platform, arch } = process
6
+ const { createRequire } = require('node:module')
7
+ require = createRequire(__filename)
11
8
 
9
+ const { readFileSync } = require('node:fs')
12
10
  let nativeBinding = null
13
- let localFileExisted = false
14
- let loadError = null
11
+ const loadErrors = []
15
12
 
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) {
13
+ const isMusl = () => {
14
+ let musl = false
15
+ if (process.platform === 'linux') {
16
+ musl = isMuslFromFilesystem()
17
+ if (musl === null) {
18
+ musl = isMuslFromReport()
19
+ }
20
+ if (musl === null) {
21
+ musl = isMuslFromChildProcess()
22
+ }
23
+ }
24
+ return musl
25
+ }
26
+
27
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
28
+
29
+ const isMuslFromFilesystem = () => {
30
+ try {
31
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
32
+ } catch {
33
+ return null
34
+ }
35
+ }
36
+
37
+ const isMuslFromReport = () => {
38
+ let report = null
39
+ if (typeof process.report?.getReport === 'function') {
40
+ process.report.excludeNetwork = true
41
+ report = process.report.getReport()
42
+ }
43
+ if (!report) {
44
+ return null
45
+ }
46
+ if (report.header && report.header.glibcVersionRuntime) {
47
+ return false
48
+ }
49
+ if (Array.isArray(report.sharedObjects)) {
50
+ if (report.sharedObjects.some(isFileMusl)) {
23
51
  return true
24
52
  }
25
- } else {
26
- const { glibcVersionRuntime } = process.report.getReport().header
27
- return !glibcVersionRuntime
28
53
  }
54
+ return false
29
55
  }
30
56
 
31
- switch (platform) {
32
- case 'android':
33
- switch (arch) {
34
- case 'arm64':
35
- localFileExisted = existsSync(join(__dirname, 'evm.android-arm64.node'))
57
+ const isMuslFromChildProcess = () => {
58
+ try {
59
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
60
+ } catch (e) {
61
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
62
+ return false
63
+ }
64
+ }
65
+
66
+ function requireNative() {
67
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68
+ try {
69
+ nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
70
+ } catch (err) {
71
+ loadErrors.push(err)
72
+ }
73
+ } else if (process.platform === 'android') {
74
+ if (process.arch === 'arm64') {
75
+ try {
76
+ return require('./evm.android-arm64.node')
77
+ } catch (e) {
78
+ loadErrors.push(e)
79
+ }
80
+ try {
81
+ const binding = require('@mainsail/evm-android-arm64')
82
+ const bindingPackageVersion = require('@mainsail/evm-android-arm64/package.json').version
83
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
+ }
86
+ return binding
87
+ } catch (e) {
88
+ loadErrors.push(e)
89
+ }
90
+ } else if (process.arch === 'arm') {
91
+ try {
92
+ return require('./evm.android-arm-eabi.node')
93
+ } catch (e) {
94
+ loadErrors.push(e)
95
+ }
96
+ try {
97
+ const binding = require('@mainsail/evm-android-arm-eabi')
98
+ const bindingPackageVersion = require('@mainsail/evm-android-arm-eabi/package.json').version
99
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
+ }
102
+ return binding
103
+ } catch (e) {
104
+ loadErrors.push(e)
105
+ }
106
+ } else {
107
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
108
+ }
109
+ } else if (process.platform === 'win32') {
110
+ if (process.arch === 'x64') {
111
+ try {
112
+ return require('./evm.win32-x64-msvc.node')
113
+ } catch (e) {
114
+ loadErrors.push(e)
115
+ }
116
+ try {
117
+ const binding = require('@mainsail/evm-win32-x64-msvc')
118
+ const bindingPackageVersion = require('@mainsail/evm-win32-x64-msvc/package.json').version
119
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
+ }
122
+ return binding
123
+ } catch (e) {
124
+ loadErrors.push(e)
125
+ }
126
+ } else if (process.arch === 'ia32') {
127
+ try {
128
+ return require('./evm.win32-ia32-msvc.node')
129
+ } catch (e) {
130
+ loadErrors.push(e)
131
+ }
132
+ try {
133
+ const binding = require('@mainsail/evm-win32-ia32-msvc')
134
+ const bindingPackageVersion = require('@mainsail/evm-win32-ia32-msvc/package.json').version
135
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
+ }
138
+ return binding
139
+ } catch (e) {
140
+ loadErrors.push(e)
141
+ }
142
+ } else if (process.arch === 'arm64') {
143
+ try {
144
+ return require('./evm.win32-arm64-msvc.node')
145
+ } catch (e) {
146
+ loadErrors.push(e)
147
+ }
148
+ try {
149
+ const binding = require('@mainsail/evm-win32-arm64-msvc')
150
+ const bindingPackageVersion = require('@mainsail/evm-win32-arm64-msvc/package.json').version
151
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
+ }
154
+ return binding
155
+ } catch (e) {
156
+ loadErrors.push(e)
157
+ }
158
+ } else {
159
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
160
+ }
161
+ } else if (process.platform === 'darwin') {
162
+ try {
163
+ return require('./evm.darwin-universal.node')
164
+ } catch (e) {
165
+ loadErrors.push(e)
166
+ }
167
+ try {
168
+ const binding = require('@mainsail/evm-darwin-universal')
169
+ const bindingPackageVersion = require('@mainsail/evm-darwin-universal/package.json').version
170
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
+ }
173
+ return binding
174
+ } catch (e) {
175
+ loadErrors.push(e)
176
+ }
177
+ if (process.arch === 'x64') {
178
+ try {
179
+ return require('./evm.darwin-x64.node')
180
+ } catch (e) {
181
+ loadErrors.push(e)
182
+ }
183
+ try {
184
+ const binding = require('@mainsail/evm-darwin-x64')
185
+ const bindingPackageVersion = require('@mainsail/evm-darwin-x64/package.json').version
186
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
+ }
189
+ return binding
190
+ } catch (e) {
191
+ loadErrors.push(e)
192
+ }
193
+ } else if (process.arch === 'arm64') {
194
+ try {
195
+ return require('./evm.darwin-arm64.node')
196
+ } catch (e) {
197
+ loadErrors.push(e)
198
+ }
199
+ try {
200
+ const binding = require('@mainsail/evm-darwin-arm64')
201
+ const bindingPackageVersion = require('@mainsail/evm-darwin-arm64/package.json').version
202
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
+ }
205
+ return binding
206
+ } catch (e) {
207
+ loadErrors.push(e)
208
+ }
209
+ } else {
210
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
211
+ }
212
+ } else if (process.platform === 'freebsd') {
213
+ if (process.arch === 'x64') {
214
+ try {
215
+ return require('./evm.freebsd-x64.node')
216
+ } catch (e) {
217
+ loadErrors.push(e)
218
+ }
219
+ try {
220
+ const binding = require('@mainsail/evm-freebsd-x64')
221
+ const bindingPackageVersion = require('@mainsail/evm-freebsd-x64/package.json').version
222
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
+ }
225
+ return binding
226
+ } catch (e) {
227
+ loadErrors.push(e)
228
+ }
229
+ } else if (process.arch === 'arm64') {
230
+ try {
231
+ return require('./evm.freebsd-arm64.node')
232
+ } catch (e) {
233
+ loadErrors.push(e)
234
+ }
235
+ try {
236
+ const binding = require('@mainsail/evm-freebsd-arm64')
237
+ const bindingPackageVersion = require('@mainsail/evm-freebsd-arm64/package.json').version
238
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
+ }
241
+ return binding
242
+ } catch (e) {
243
+ loadErrors.push(e)
244
+ }
245
+ } else {
246
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
247
+ }
248
+ } else if (process.platform === 'linux') {
249
+ if (process.arch === 'x64') {
250
+ if (isMusl()) {
36
251
  try {
37
- if (localFileExisted) {
38
- nativeBinding = require('./evm.android-arm64.node')
39
- } else {
40
- nativeBinding = require('@mainsail/evm-android-arm64')
41
- }
252
+ return require('./evm.linux-x64-musl.node')
42
253
  } catch (e) {
43
- loadError = e
254
+ loadErrors.push(e)
44
255
  }
45
- break
46
- case 'arm':
47
- localFileExisted = existsSync(join(__dirname, 'evm.android-arm-eabi.node'))
48
256
  try {
49
- if (localFileExisted) {
50
- nativeBinding = require('./evm.android-arm-eabi.node')
51
- } else {
52
- nativeBinding = require('@mainsail/evm-android-arm-eabi')
257
+ const binding = require('@mainsail/evm-linux-x64-musl')
258
+ const bindingPackageVersion = require('@mainsail/evm-linux-x64-musl/package.json').version
259
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
53
261
  }
262
+ return binding
54
263
  } catch (e) {
55
- loadError = e
264
+ loadErrors.push(e)
56
265
  }
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, 'evm.win32-x64-msvc.node')
67
- )
266
+ } else {
68
267
  try {
69
- if (localFileExisted) {
70
- nativeBinding = require('./evm.win32-x64-msvc.node')
71
- } else {
72
- nativeBinding = require('@mainsail/evm-win32-x64-msvc')
73
- }
268
+ return require('./evm.linux-x64-gnu.node')
74
269
  } catch (e) {
75
- loadError = e
270
+ loadErrors.push(e)
76
271
  }
77
- break
78
- case 'ia32':
79
- localFileExisted = existsSync(
80
- join(__dirname, 'evm.win32-ia32-msvc.node')
81
- )
82
272
  try {
83
- if (localFileExisted) {
84
- nativeBinding = require('./evm.win32-ia32-msvc.node')
85
- } else {
86
- nativeBinding = require('@mainsail/evm-win32-ia32-msvc')
273
+ const binding = require('@mainsail/evm-linux-x64-gnu')
274
+ const bindingPackageVersion = require('@mainsail/evm-linux-x64-gnu/package.json').version
275
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
87
277
  }
278
+ return binding
279
+ } catch (e) {
280
+ loadErrors.push(e)
281
+ }
282
+ }
283
+ } else if (process.arch === 'arm64') {
284
+ if (isMusl()) {
285
+ try {
286
+ return require('./evm.linux-arm64-musl.node')
88
287
  } catch (e) {
89
- loadError = e
288
+ loadErrors.push(e)
90
289
  }
91
- break
92
- case 'arm64':
93
- localFileExisted = existsSync(
94
- join(__dirname, 'evm.win32-arm64-msvc.node')
95
- )
96
290
  try {
97
- if (localFileExisted) {
98
- nativeBinding = require('./evm.win32-arm64-msvc.node')
99
- } else {
100
- nativeBinding = require('@mainsail/evm-win32-arm64-msvc')
291
+ const binding = require('@mainsail/evm-linux-arm64-musl')
292
+ const bindingPackageVersion = require('@mainsail/evm-linux-arm64-musl/package.json').version
293
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
295
  }
296
+ return binding
102
297
  } catch (e) {
103
- loadError = e
298
+ loadErrors.push(e)
104
299
  }
105
- break
106
- default:
107
- throw new Error(`Unsupported architecture on Windows: ${arch}`)
108
- }
109
- break
110
- case 'darwin':
111
- localFileExisted = existsSync(join(__dirname, 'evm.darwin-universal.node'))
112
- try {
113
- if (localFileExisted) {
114
- nativeBinding = require('./evm.darwin-universal.node')
115
300
  } else {
116
- nativeBinding = require('@mainsail/evm-darwin-universal')
117
- }
118
- break
119
- } catch {}
120
- switch (arch) {
121
- case 'x64':
122
- localFileExisted = existsSync(join(__dirname, 'evm.darwin-x64.node'))
123
301
  try {
124
- if (localFileExisted) {
125
- nativeBinding = require('./evm.darwin-x64.node')
126
- } else {
127
- nativeBinding = require('@mainsail/evm-darwin-x64')
128
- }
302
+ return require('./evm.linux-arm64-gnu.node')
129
303
  } catch (e) {
130
- loadError = e
304
+ loadErrors.push(e)
131
305
  }
132
- break
133
- case 'arm64':
134
- localFileExisted = existsSync(
135
- join(__dirname, 'evm.darwin-arm64.node')
136
- )
137
306
  try {
138
- if (localFileExisted) {
139
- nativeBinding = require('./evm.darwin-arm64.node')
140
- } else {
141
- nativeBinding = require('@mainsail/evm-darwin-arm64')
307
+ const binding = require('@mainsail/evm-linux-arm64-gnu')
308
+ const bindingPackageVersion = require('@mainsail/evm-linux-arm64-gnu/package.json').version
309
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
142
311
  }
312
+ return binding
143
313
  } catch (e) {
144
- loadError = e
314
+ loadErrors.push(e)
145
315
  }
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, 'evm.freebsd-x64.node'))
156
- try {
157
- if (localFileExisted) {
158
- nativeBinding = require('./evm.freebsd-x64.node')
159
- } else {
160
- nativeBinding = require('@mainsail/evm-freebsd-x64')
161
316
  }
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, 'evm.linux-x64-musl.node')
172
- )
173
- try {
174
- if (localFileExisted) {
175
- nativeBinding = require('./evm.linux-x64-musl.node')
176
- } else {
177
- nativeBinding = require('@mainsail/evm-linux-x64-musl')
178
- }
179
- } catch (e) {
180
- loadError = e
181
- }
182
- } else {
183
- localFileExisted = existsSync(
184
- join(__dirname, 'evm.linux-x64-gnu.node')
185
- )
186
- try {
187
- if (localFileExisted) {
188
- nativeBinding = require('./evm.linux-x64-gnu.node')
189
- } else {
190
- nativeBinding = require('@mainsail/evm-linux-x64-gnu')
191
- }
192
- } catch (e) {
193
- loadError = e
194
- }
317
+ } else if (process.arch === 'arm') {
318
+ if (isMusl()) {
319
+ try {
320
+ return require('./evm.linux-arm-musleabihf.node')
321
+ } catch (e) {
322
+ loadErrors.push(e)
195
323
  }
196
- break
197
- case 'arm64':
198
- if (isMusl()) {
199
- localFileExisted = existsSync(
200
- join(__dirname, 'evm.linux-arm64-musl.node')
201
- )
202
- try {
203
- if (localFileExisted) {
204
- nativeBinding = require('./evm.linux-arm64-musl.node')
205
- } else {
206
- nativeBinding = require('@mainsail/evm-linux-arm64-musl')
207
- }
208
- } catch (e) {
209
- loadError = e
210
- }
211
- } else {
212
- localFileExisted = existsSync(
213
- join(__dirname, 'evm.linux-arm64-gnu.node')
214
- )
215
- try {
216
- if (localFileExisted) {
217
- nativeBinding = require('./evm.linux-arm64-gnu.node')
218
- } else {
219
- nativeBinding = require('@mainsail/evm-linux-arm64-gnu')
220
- }
221
- } catch (e) {
222
- loadError = e
324
+ try {
325
+ const binding = require('@mainsail/evm-linux-arm-musleabihf')
326
+ const bindingPackageVersion = require('@mainsail/evm-linux-arm-musleabihf/package.json').version
327
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
329
  }
330
+ return binding
331
+ } catch (e) {
332
+ loadErrors.push(e)
224
333
  }
225
- break
226
- case 'arm':
227
- if (isMusl()) {
228
- localFileExisted = existsSync(
229
- join(__dirname, 'evm.linux-arm-musleabihf.node')
230
- )
231
- try {
232
- if (localFileExisted) {
233
- nativeBinding = require('./evm.linux-arm-musleabihf.node')
234
- } else {
235
- nativeBinding = require('@mainsail/evm-linux-arm-musleabihf')
236
- }
237
- } catch (e) {
238
- loadError = e
239
- }
240
- } else {
241
- localFileExisted = existsSync(
242
- join(__dirname, 'evm.linux-arm-gnueabihf.node')
243
- )
244
- try {
245
- if (localFileExisted) {
246
- nativeBinding = require('./evm.linux-arm-gnueabihf.node')
247
- } else {
248
- nativeBinding = require('@mainsail/evm-linux-arm-gnueabihf')
249
- }
250
- } catch (e) {
251
- loadError = e
252
- }
334
+ } else {
335
+ try {
336
+ return require('./evm.linux-arm-gnueabihf.node')
337
+ } catch (e) {
338
+ loadErrors.push(e)
253
339
  }
254
- break
255
- case 'riscv64':
256
- if (isMusl()) {
257
- localFileExisted = existsSync(
258
- join(__dirname, 'evm.linux-riscv64-musl.node')
259
- )
260
- try {
261
- if (localFileExisted) {
262
- nativeBinding = require('./evm.linux-riscv64-musl.node')
263
- } else {
264
- nativeBinding = require('@mainsail/evm-linux-riscv64-musl')
265
- }
266
- } catch (e) {
267
- loadError = e
340
+ try {
341
+ const binding = require('@mainsail/evm-linux-arm-gnueabihf')
342
+ const bindingPackageVersion = require('@mainsail/evm-linux-arm-gnueabihf/package.json').version
343
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
268
345
  }
269
- } else {
270
- localFileExisted = existsSync(
271
- join(__dirname, 'evm.linux-riscv64-gnu.node')
272
- )
273
- try {
274
- if (localFileExisted) {
275
- nativeBinding = require('./evm.linux-riscv64-gnu.node')
276
- } else {
277
- nativeBinding = require('@mainsail/evm-linux-riscv64-gnu')
278
- }
279
- } catch (e) {
280
- loadError = e
346
+ return binding
347
+ } catch (e) {
348
+ loadErrors.push(e)
349
+ }
350
+ }
351
+ } else if (process.arch === 'riscv64') {
352
+ if (isMusl()) {
353
+ try {
354
+ return require('./evm.linux-riscv64-musl.node')
355
+ } catch (e) {
356
+ loadErrors.push(e)
357
+ }
358
+ try {
359
+ const binding = require('@mainsail/evm-linux-riscv64-musl')
360
+ const bindingPackageVersion = require('@mainsail/evm-linux-riscv64-musl/package.json').version
361
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
281
363
  }
364
+ return binding
365
+ } catch (e) {
366
+ loadErrors.push(e)
282
367
  }
283
- break
284
- case 's390x':
285
- localFileExisted = existsSync(
286
- join(__dirname, 'evm.linux-s390x-gnu.node')
287
- )
368
+ } else {
288
369
  try {
289
- if (localFileExisted) {
290
- nativeBinding = require('./evm.linux-s390x-gnu.node')
291
- } else {
292
- nativeBinding = require('@mainsail/evm-linux-s390x-gnu')
370
+ return require('./evm.linux-riscv64-gnu.node')
371
+ } catch (e) {
372
+ loadErrors.push(e)
373
+ }
374
+ try {
375
+ const binding = require('@mainsail/evm-linux-riscv64-gnu')
376
+ const bindingPackageVersion = require('@mainsail/evm-linux-riscv64-gnu/package.json').version
377
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
293
379
  }
380
+ return binding
294
381
  } catch (e) {
295
- loadError = e
382
+ loadErrors.push(e)
296
383
  }
297
- break
298
- default:
299
- throw new Error(`Unsupported architecture on Linux: ${arch}`)
384
+ }
385
+ } else if (process.arch === 'ppc64') {
386
+ try {
387
+ return require('./evm.linux-ppc64-gnu.node')
388
+ } catch (e) {
389
+ loadErrors.push(e)
390
+ }
391
+ try {
392
+ const binding = require('@mainsail/evm-linux-ppc64-gnu')
393
+ const bindingPackageVersion = require('@mainsail/evm-linux-ppc64-gnu/package.json').version
394
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ }
397
+ return binding
398
+ } catch (e) {
399
+ loadErrors.push(e)
400
+ }
401
+ } else if (process.arch === 's390x') {
402
+ try {
403
+ return require('./evm.linux-s390x-gnu.node')
404
+ } catch (e) {
405
+ loadErrors.push(e)
406
+ }
407
+ try {
408
+ const binding = require('@mainsail/evm-linux-s390x-gnu')
409
+ const bindingPackageVersion = require('@mainsail/evm-linux-s390x-gnu/package.json').version
410
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
+ }
413
+ return binding
414
+ } catch (e) {
415
+ loadErrors.push(e)
416
+ }
417
+ } else {
418
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
300
419
  }
301
- break
302
- default:
303
- throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
420
+ } else if (process.platform === 'openharmony') {
421
+ if (process.arch === 'arm64') {
422
+ try {
423
+ return require('./evm.openharmony-arm64.node')
424
+ } catch (e) {
425
+ loadErrors.push(e)
426
+ }
427
+ try {
428
+ const binding = require('@mainsail/evm-openharmony-arm64')
429
+ const bindingPackageVersion = require('@mainsail/evm-openharmony-arm64/package.json').version
430
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
+ }
433
+ return binding
434
+ } catch (e) {
435
+ loadErrors.push(e)
436
+ }
437
+ } else if (process.arch === 'x64') {
438
+ try {
439
+ return require('./evm.openharmony-x64.node')
440
+ } catch (e) {
441
+ loadErrors.push(e)
442
+ }
443
+ try {
444
+ const binding = require('@mainsail/evm-openharmony-x64')
445
+ const bindingPackageVersion = require('@mainsail/evm-openharmony-x64/package.json').version
446
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
448
+ }
449
+ return binding
450
+ } catch (e) {
451
+ loadErrors.push(e)
452
+ }
453
+ } else if (process.arch === 'arm') {
454
+ try {
455
+ return require('./evm.openharmony-arm.node')
456
+ } catch (e) {
457
+ loadErrors.push(e)
458
+ }
459
+ try {
460
+ const binding = require('@mainsail/evm-openharmony-arm')
461
+ const bindingPackageVersion = require('@mainsail/evm-openharmony-arm/package.json').version
462
+ if (bindingPackageVersion !== '0.0.1-evm.40' && 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-evm.40 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
+ }
465
+ return binding
466
+ } catch (e) {
467
+ loadErrors.push(e)
468
+ }
469
+ } else {
470
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
471
+ }
472
+ } else {
473
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
474
+ }
475
+ }
476
+
477
+ nativeBinding = requireNative()
478
+
479
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
480
+ try {
481
+ nativeBinding = require('./evm.wasi.cjs')
482
+ } catch (err) {
483
+ if (process.env.NAPI_RS_FORCE_WASI) {
484
+ loadErrors.push(err)
485
+ }
486
+ }
487
+ if (!nativeBinding) {
488
+ try {
489
+ nativeBinding = require('@mainsail/evm-wasm32-wasi')
490
+ } catch (err) {
491
+ if (process.env.NAPI_RS_FORCE_WASI) {
492
+ loadErrors.push(err)
493
+ }
494
+ }
495
+ }
304
496
  }
305
497
 
306
498
  if (!nativeBinding) {
307
- if (loadError) {
308
- throw loadError
499
+ if (loadErrors.length > 0) {
500
+ throw new Error(
501
+ `Cannot find native binding. ` +
502
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
503
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
504
+ { cause: loadErrors }
505
+ )
309
506
  }
310
507
  throw new Error(`Failed to load native binding`)
311
508
  }
312
509
 
313
- const { Evm } = nativeBinding
314
-
315
- module.exports.Evm = Evm
510
+ module.exports = nativeBinding
511
+ module.exports.Evm = nativeBinding.Evm
512
+ module.exports.JsEvmWrapper = nativeBinding.JsEvmWrapper
513
+ module.exports.LogLevel = nativeBinding.LogLevel
514
+ module.exports.JsLogLevel = nativeBinding.JsLogLevel
package/package.json CHANGED
@@ -1,43 +1,41 @@
1
1
  {
2
2
  "name": "@mainsail/evm",
3
- "version": "0.0.1-evm.4",
3
+ "version": "0.0.1-evm.40",
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": "^2.18.4"
10
+ "@napi-rs/cli": "3.1.5"
11
11
  },
12
12
  "engines": {
13
13
  "node": ">=20.x"
14
14
  },
15
15
  "napi": {
16
- "name": "evm",
17
- "triples": {
18
- "defaults": false,
19
- "additional": [
20
- "aarch64-unknown-linux-gnu",
21
- "aarch64-unknown-linux-musl",
22
- "x86_64-unknown-linux-gnu",
23
- "x86_64-unknown-linux-musl"
24
- ]
25
- }
16
+ "binaryName": "evm",
17
+ "targets": [
18
+ "aarch64-unknown-linux-gnu",
19
+ "aarch64-unknown-linux-musl",
20
+ "x86_64-unknown-linux-gnu",
21
+ "x86_64-unknown-linux-musl"
22
+ ]
26
23
  },
27
24
  "optionalDependencies": {
28
- "@mainsail/evm-linux-arm64-gnu": "0.0.1-evm.4",
29
- "@mainsail/evm-linux-arm64-musl": "0.0.1-evm.4",
30
- "@mainsail/evm-linux-x64-gnu": "0.0.1-evm.4",
31
- "@mainsail/evm-linux-x64-musl": "0.0.1-evm.4"
25
+ "@mainsail/evm-linux-arm64-gnu": "0.0.1-evm.40",
26
+ "@mainsail/evm-linux-arm64-musl": "0.0.1-evm.40",
27
+ "@mainsail/evm-linux-x64-gnu": "0.0.1-evm.40",
28
+ "@mainsail/evm-linux-x64-musl": "0.0.1-evm.40"
32
29
  },
33
30
  "scripts": {
34
31
  "artifacts": "napi artifacts",
35
32
  "build": "pnpm run clean && pnpm run build-napi",
36
- "build-napi": "napi build --platform --cargo-cwd bindings --release",
37
- "build-napi:debug": "napi build --platform --cargo-cwd bindings",
38
- "clean": "del index.js index.d.ts evm.*.node target",
33
+ "build-napi": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml --release",
34
+ "build-napi:debug": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml",
35
+ "clean": "rm -f index.js && rm -f index.d.ts && rm -f evm.*.node && rm -rf target",
39
36
  "release": "pnpm publish --access public",
40
37
  "test": "cargo test --release",
41
- "version": "napi version "
38
+ "test:coverage": "mkdir -p coverage && cargo llvm-cov --lcov --output-path coverage/lcov.info --remap-path-prefix",
39
+ "version": "napi version"
42
40
  }
43
41
  }