@mainsail/evm 0.0.1-evm.3 → 0.0.1-evm.31
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/index.d.ts +226 -61
- package/index.js +457 -258
- package/package.json +17 -19
package/index.d.ts
CHANGED
|
@@ -1,101 +1,266 @@
|
|
|
1
|
-
/*
|
|
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
|
+
getBlockHeaderBytes(blockNumber: bigint): Promise<Buffer | undefined>
|
|
31
|
+
getBlockNumberByHash(blockHash: string): Promise<bigint | undefined | null>
|
|
32
|
+
getProofBytes(blockNumber: bigint): Promise<Buffer | undefined | null>
|
|
33
|
+
getTransactionBytes(key: string): Promise<Buffer | 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
|
-
|
|
41
|
+
export interface JsAccountInfo {
|
|
42
|
+
balance: bigint
|
|
43
|
+
nonce: bigint
|
|
44
|
+
}
|
|
5
45
|
|
|
6
|
-
export interface
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
deployerAccount: string
|
|
34
|
-
validatorContract: string
|
|
35
|
-
initialSupply: bigint
|
|
36
|
-
}
|
|
37
|
-
export interface JsCalculateTopValidatorsContext {
|
|
75
|
+
|
|
76
|
+
export interface JsCalculateRoundValidatorsContext {
|
|
38
77
|
commitKey: JsCommitKey
|
|
39
78
|
timestamp: bigint
|
|
40
|
-
|
|
79
|
+
roundValidators: bigint
|
|
41
80
|
validatorAddress: string
|
|
42
81
|
specId: string
|
|
43
82
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
83
|
+
|
|
84
|
+
export interface JsCommitData {
|
|
85
|
+
commitRound: bigint
|
|
86
|
+
blockHash: string
|
|
87
|
+
block: Buffer
|
|
88
|
+
proof: Buffer
|
|
89
|
+
transactionHashes: Array<string>
|
|
90
|
+
transactions: Array<Buffer>
|
|
50
91
|
}
|
|
92
|
+
|
|
51
93
|
export interface JsCommitKey {
|
|
52
|
-
|
|
94
|
+
blockNumber: bigint
|
|
53
95
|
round: bigint
|
|
96
|
+
blockHash?: string
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface JsCommitResult {
|
|
100
|
+
dirtyAccounts: Array<JsAccountUpdate>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface JsEvmOptions {
|
|
104
|
+
path: string
|
|
105
|
+
logger?: (arg: JsLogMessage) => void
|
|
106
|
+
historySize?: bigint
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface JsGenesisContext {
|
|
110
|
+
account: string
|
|
111
|
+
deployerAccount: string
|
|
112
|
+
validatorContract: string
|
|
113
|
+
usernameContract: string
|
|
114
|
+
initialBlockNumber: bigint
|
|
115
|
+
initialSupply: bigint
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface JsGetAccounts {
|
|
119
|
+
nextOffset?: bigint
|
|
120
|
+
accounts: Array<JsAccountInfoExtended>
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface JsGetLegacyColdWallets {
|
|
124
|
+
nextOffset?: bigint
|
|
125
|
+
wallets: Array<JsLegacyColdWallet>
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface JsGetReceipt {
|
|
129
|
+
receipt?: JsTransactionReceipt
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface JsGetReceipts {
|
|
133
|
+
nextOffset?: bigint
|
|
134
|
+
receipts: Array<JsTransactionReceipt>
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface JsGetState {
|
|
138
|
+
blockNumber: bigint
|
|
139
|
+
totalRound: bigint
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface JsLegacyAttributes {
|
|
143
|
+
secondPublicKey?: string
|
|
144
|
+
multiSignature?: JsLegacyMultiSignatureAttribute
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface JsLegacyColdWallet {
|
|
148
|
+
address: string
|
|
149
|
+
balance: bigint
|
|
150
|
+
legacyAttributes: JsLegacyAttributes
|
|
151
|
+
mergeInfo?: JsAccountMergeInfo
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface JsLegacyMultiSignatureAttribute {
|
|
155
|
+
min: number
|
|
156
|
+
publicKeys: Array<string>
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface JsLogMessage {
|
|
160
|
+
level: LogLevel
|
|
161
|
+
message: string
|
|
54
162
|
}
|
|
163
|
+
|
|
55
164
|
export interface JsPrepareNextCommitContext {
|
|
56
165
|
commitKey: JsCommitKey
|
|
57
166
|
}
|
|
167
|
+
|
|
168
|
+
export interface JsPreverifyTransactionContext {
|
|
169
|
+
from: string
|
|
170
|
+
legacyAddress?: string
|
|
171
|
+
/** Omit recipient when deploying a contract */
|
|
172
|
+
to?: string
|
|
173
|
+
gasLimit: bigint
|
|
174
|
+
gasPrice: bigint
|
|
175
|
+
value: bigint
|
|
176
|
+
nonce: bigint
|
|
177
|
+
data: Buffer
|
|
178
|
+
txHash: string
|
|
179
|
+
specId: string
|
|
180
|
+
blockGasLimit: bigint
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface JsPreverifyTransactionResult {
|
|
184
|
+
success: boolean
|
|
185
|
+
initialGasUsed: bigint
|
|
186
|
+
error?: string
|
|
187
|
+
}
|
|
188
|
+
|
|
58
189
|
export interface JsProcessResult {
|
|
59
190
|
receipt: JsTransactionReceipt
|
|
60
191
|
}
|
|
61
|
-
|
|
62
|
-
|
|
192
|
+
|
|
193
|
+
export interface JsSimulateResult {
|
|
194
|
+
receipt: JsTransactionReceipt
|
|
63
195
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
196
|
+
|
|
197
|
+
export interface JsTransactionContext {
|
|
198
|
+
from: string
|
|
199
|
+
legacyAddress?: string
|
|
200
|
+
/** Omit recipient when deploying a contract */
|
|
201
|
+
to?: string
|
|
202
|
+
gasLimit: bigint
|
|
203
|
+
gasPrice: bigint
|
|
204
|
+
value: bigint
|
|
205
|
+
nonce: bigint
|
|
206
|
+
data: Buffer
|
|
207
|
+
txHash: string
|
|
208
|
+
index?: number
|
|
209
|
+
blockContext: JsBlockContext
|
|
210
|
+
specId: string
|
|
67
211
|
}
|
|
212
|
+
|
|
68
213
|
export interface JsTransactionReceipt {
|
|
214
|
+
blockNumber?: bigint
|
|
215
|
+
txHash?: string
|
|
69
216
|
gasUsed: bigint
|
|
70
217
|
gasRefunded: bigint
|
|
71
|
-
|
|
72
|
-
|
|
218
|
+
status: number
|
|
219
|
+
contractAddress?: string
|
|
73
220
|
logs: any
|
|
74
221
|
output?: Buffer
|
|
75
222
|
}
|
|
76
|
-
|
|
77
|
-
|
|
223
|
+
|
|
224
|
+
export interface JsTransactionSimulateContext {
|
|
225
|
+
from: string
|
|
226
|
+
/** Omit recipient when deploying a contract */
|
|
227
|
+
to?: string
|
|
228
|
+
gasLimit: bigint
|
|
229
|
+
gasPrice: bigint
|
|
230
|
+
value: bigint
|
|
78
231
|
nonce: bigint
|
|
232
|
+
data: Buffer
|
|
233
|
+
blockContext: JsBlockContext
|
|
234
|
+
specId: string
|
|
79
235
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
236
|
+
|
|
237
|
+
export interface JsTransactionViewContext {
|
|
238
|
+
from: string
|
|
239
|
+
to: string
|
|
240
|
+
data: Buffer
|
|
241
|
+
specId: string
|
|
242
|
+
gasLimit?: bigint
|
|
86
243
|
}
|
|
87
|
-
|
|
88
|
-
export
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
244
|
+
|
|
245
|
+
export interface JsUpdateRewardsAndVotesContext {
|
|
246
|
+
commitKey: JsCommitKey
|
|
247
|
+
timestamp: bigint
|
|
248
|
+
blockReward: bigint
|
|
249
|
+
validatorAddress: string
|
|
250
|
+
specId: string
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface JsViewResult {
|
|
254
|
+
success: boolean
|
|
255
|
+
output?: Buffer
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export declare const enum LogLevel {
|
|
259
|
+
Info = 0,
|
|
260
|
+
Debug = 1,
|
|
261
|
+
Notice = 2,
|
|
262
|
+
Emergency = 3,
|
|
263
|
+
Alert = 4,
|
|
264
|
+
Critical = 5,
|
|
265
|
+
Warning = 6
|
|
101
266
|
}
|
package/index.js
CHANGED
|
@@ -1,315 +1,514 @@
|
|
|
1
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// @ts-nocheck
|
|
5
4
|
/* auto-generated by NAPI-RS */
|
|
6
5
|
|
|
7
|
-
const {
|
|
8
|
-
|
|
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
|
-
|
|
14
|
-
let loadError = null
|
|
11
|
+
const loadErrors = []
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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.31' && 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.31 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
53
261
|
}
|
|
262
|
+
return binding
|
|
54
263
|
} catch (e) {
|
|
55
|
-
|
|
264
|
+
loadErrors.push(e)
|
|
56
265
|
}
|
|
57
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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.31' && 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.31 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
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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.31' && 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.31 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
295
|
}
|
|
296
|
+
return binding
|
|
102
297
|
} catch (e) {
|
|
103
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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.31' && 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.31 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
142
311
|
}
|
|
312
|
+
return binding
|
|
143
313
|
} catch (e) {
|
|
144
|
-
|
|
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
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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.31' && 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.31 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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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.31' && 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.31 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
268
345
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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.31' && 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.31 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
|
-
|
|
284
|
-
case 's390x':
|
|
285
|
-
localFileExisted = existsSync(
|
|
286
|
-
join(__dirname, 'evm.linux-s390x-gnu.node')
|
|
287
|
-
)
|
|
368
|
+
} else {
|
|
288
369
|
try {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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.31' && 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.31 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
293
379
|
}
|
|
380
|
+
return binding
|
|
294
381
|
} catch (e) {
|
|
295
|
-
|
|
382
|
+
loadErrors.push(e)
|
|
296
383
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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.31' && 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.31 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.31' && 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.31 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
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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.31' && 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.31 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.31' && 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.31 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.31' && 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.31 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 (
|
|
308
|
-
throw
|
|
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
|
-
|
|
314
|
-
|
|
315
|
-
module.exports.
|
|
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.
|
|
3
|
+
"version": "0.0.1-evm.31",
|
|
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": "
|
|
10
|
+
"@napi-rs/cli": "3.1.5"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=20.x"
|
|
14
14
|
},
|
|
15
15
|
"napi": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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.
|
|
29
|
-
"@mainsail/evm-linux-arm64-musl": "0.0.1-evm.
|
|
30
|
-
"@mainsail/evm-linux-x64-gnu": "0.0.1-evm.
|
|
31
|
-
"@mainsail/evm-linux-x64-musl": "0.0.1-evm.
|
|
25
|
+
"@mainsail/evm-linux-arm64-gnu": "0.0.1-evm.31",
|
|
26
|
+
"@mainsail/evm-linux-arm64-musl": "0.0.1-evm.31",
|
|
27
|
+
"@mainsail/evm-linux-x64-gnu": "0.0.1-evm.31",
|
|
28
|
+
"@mainsail/evm-linux-x64-musl": "0.0.1-evm.31"
|
|
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 --
|
|
37
|
-
"build-napi:debug": "napi build --platform --
|
|
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",
|
|
38
35
|
"clean": "del index.js index.d.ts evm.*.node target",
|
|
39
36
|
"release": "pnpm publish --access public",
|
|
40
37
|
"test": "cargo test --release",
|
|
41
|
-
"
|
|
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
|
}
|