@gitmyabi/minerpass 0.0.0-stage → 1.0.0
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/README.md +107 -2
- package/contracts/MinerPass.d.ts +867 -0
- package/contracts/MinerPass.js +941 -0
- package/contracts/MinerPass.ts +1137 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +40 -3
|
@@ -0,0 +1,941 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MinerPass = exports.MinerPassAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* MinerPass ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.MinerPassAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "owner_",
|
|
16
|
+
"type": "address"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"stateMutability": "nonpayable",
|
|
20
|
+
"type": "constructor"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"inputs": [
|
|
24
|
+
{
|
|
25
|
+
"internalType": "address",
|
|
26
|
+
"name": "sender",
|
|
27
|
+
"type": "address"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"internalType": "uint256",
|
|
31
|
+
"name": "balance",
|
|
32
|
+
"type": "uint256"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"internalType": "uint256",
|
|
36
|
+
"name": "needed",
|
|
37
|
+
"type": "uint256"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"internalType": "uint256",
|
|
41
|
+
"name": "tokenId",
|
|
42
|
+
"type": "uint256"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "ERC1155InsufficientBalance",
|
|
46
|
+
"type": "error"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"inputs": [
|
|
50
|
+
{
|
|
51
|
+
"internalType": "address",
|
|
52
|
+
"name": "approver",
|
|
53
|
+
"type": "address"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"name": "ERC1155InvalidApprover",
|
|
57
|
+
"type": "error"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"inputs": [
|
|
61
|
+
{
|
|
62
|
+
"internalType": "uint256",
|
|
63
|
+
"name": "idsLength",
|
|
64
|
+
"type": "uint256"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"internalType": "uint256",
|
|
68
|
+
"name": "valuesLength",
|
|
69
|
+
"type": "uint256"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "ERC1155InvalidArrayLength",
|
|
73
|
+
"type": "error"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"inputs": [
|
|
77
|
+
{
|
|
78
|
+
"internalType": "address",
|
|
79
|
+
"name": "operator",
|
|
80
|
+
"type": "address"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"name": "ERC1155InvalidOperator",
|
|
84
|
+
"type": "error"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"inputs": [
|
|
88
|
+
{
|
|
89
|
+
"internalType": "address",
|
|
90
|
+
"name": "receiver",
|
|
91
|
+
"type": "address"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"name": "ERC1155InvalidReceiver",
|
|
95
|
+
"type": "error"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"inputs": [
|
|
99
|
+
{
|
|
100
|
+
"internalType": "address",
|
|
101
|
+
"name": "sender",
|
|
102
|
+
"type": "address"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"name": "ERC1155InvalidSender",
|
|
106
|
+
"type": "error"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"inputs": [
|
|
110
|
+
{
|
|
111
|
+
"internalType": "address",
|
|
112
|
+
"name": "operator",
|
|
113
|
+
"type": "address"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"internalType": "address",
|
|
117
|
+
"name": "owner",
|
|
118
|
+
"type": "address"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"name": "ERC1155MissingApprovalForAll",
|
|
122
|
+
"type": "error"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"inputs": [
|
|
126
|
+
{
|
|
127
|
+
"internalType": "address",
|
|
128
|
+
"name": "owner",
|
|
129
|
+
"type": "address"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"name": "OwnableInvalidOwner",
|
|
133
|
+
"type": "error"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"inputs": [
|
|
137
|
+
{
|
|
138
|
+
"internalType": "address",
|
|
139
|
+
"name": "account",
|
|
140
|
+
"type": "address"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"name": "OwnableUnauthorizedAccount",
|
|
144
|
+
"type": "error"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"inputs": [],
|
|
148
|
+
"name": "Sealed",
|
|
149
|
+
"type": "error"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"inputs": [],
|
|
153
|
+
"name": "Soulbound",
|
|
154
|
+
"type": "error"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"anonymous": false,
|
|
158
|
+
"inputs": [
|
|
159
|
+
{
|
|
160
|
+
"indexed": true,
|
|
161
|
+
"internalType": "address",
|
|
162
|
+
"name": "account",
|
|
163
|
+
"type": "address"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"indexed": true,
|
|
167
|
+
"internalType": "address",
|
|
168
|
+
"name": "operator",
|
|
169
|
+
"type": "address"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"indexed": false,
|
|
173
|
+
"internalType": "bool",
|
|
174
|
+
"name": "approved",
|
|
175
|
+
"type": "bool"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"name": "ApprovalForAll",
|
|
179
|
+
"type": "event"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"anonymous": false,
|
|
183
|
+
"inputs": [
|
|
184
|
+
{
|
|
185
|
+
"indexed": true,
|
|
186
|
+
"internalType": "address",
|
|
187
|
+
"name": "previousOwner",
|
|
188
|
+
"type": "address"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"indexed": true,
|
|
192
|
+
"internalType": "address",
|
|
193
|
+
"name": "newOwner",
|
|
194
|
+
"type": "address"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"name": "OwnershipTransferred",
|
|
198
|
+
"type": "event"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"anonymous": false,
|
|
202
|
+
"inputs": [
|
|
203
|
+
{
|
|
204
|
+
"indexed": true,
|
|
205
|
+
"internalType": "address",
|
|
206
|
+
"name": "operator",
|
|
207
|
+
"type": "address"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"indexed": true,
|
|
211
|
+
"internalType": "address",
|
|
212
|
+
"name": "from",
|
|
213
|
+
"type": "address"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"indexed": true,
|
|
217
|
+
"internalType": "address",
|
|
218
|
+
"name": "to",
|
|
219
|
+
"type": "address"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"indexed": false,
|
|
223
|
+
"internalType": "uint256[]",
|
|
224
|
+
"name": "ids",
|
|
225
|
+
"type": "uint256[]"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"indexed": false,
|
|
229
|
+
"internalType": "uint256[]",
|
|
230
|
+
"name": "values",
|
|
231
|
+
"type": "uint256[]"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"name": "TransferBatch",
|
|
235
|
+
"type": "event"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"anonymous": false,
|
|
239
|
+
"inputs": [
|
|
240
|
+
{
|
|
241
|
+
"indexed": true,
|
|
242
|
+
"internalType": "address",
|
|
243
|
+
"name": "operator",
|
|
244
|
+
"type": "address"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"indexed": true,
|
|
248
|
+
"internalType": "address",
|
|
249
|
+
"name": "from",
|
|
250
|
+
"type": "address"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"indexed": true,
|
|
254
|
+
"internalType": "address",
|
|
255
|
+
"name": "to",
|
|
256
|
+
"type": "address"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"indexed": false,
|
|
260
|
+
"internalType": "uint256",
|
|
261
|
+
"name": "id",
|
|
262
|
+
"type": "uint256"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"indexed": false,
|
|
266
|
+
"internalType": "uint256",
|
|
267
|
+
"name": "value",
|
|
268
|
+
"type": "uint256"
|
|
269
|
+
}
|
|
270
|
+
],
|
|
271
|
+
"name": "TransferSingle",
|
|
272
|
+
"type": "event"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"anonymous": false,
|
|
276
|
+
"inputs": [
|
|
277
|
+
{
|
|
278
|
+
"indexed": false,
|
|
279
|
+
"internalType": "string",
|
|
280
|
+
"name": "value",
|
|
281
|
+
"type": "string"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"indexed": true,
|
|
285
|
+
"internalType": "uint256",
|
|
286
|
+
"name": "id",
|
|
287
|
+
"type": "uint256"
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"name": "URI",
|
|
291
|
+
"type": "event"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"inputs": [],
|
|
295
|
+
"name": "ID",
|
|
296
|
+
"outputs": [
|
|
297
|
+
{
|
|
298
|
+
"internalType": "uint256",
|
|
299
|
+
"name": "",
|
|
300
|
+
"type": "uint256"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"stateMutability": "view",
|
|
304
|
+
"type": "function"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"inputs": [
|
|
308
|
+
{
|
|
309
|
+
"internalType": "address",
|
|
310
|
+
"name": "account",
|
|
311
|
+
"type": "address"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"internalType": "uint256",
|
|
315
|
+
"name": "id",
|
|
316
|
+
"type": "uint256"
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
"name": "balanceOf",
|
|
320
|
+
"outputs": [
|
|
321
|
+
{
|
|
322
|
+
"internalType": "uint256",
|
|
323
|
+
"name": "",
|
|
324
|
+
"type": "uint256"
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
"stateMutability": "view",
|
|
328
|
+
"type": "function"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"inputs": [
|
|
332
|
+
{
|
|
333
|
+
"internalType": "address[]",
|
|
334
|
+
"name": "accounts",
|
|
335
|
+
"type": "address[]"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"internalType": "uint256[]",
|
|
339
|
+
"name": "ids",
|
|
340
|
+
"type": "uint256[]"
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
"name": "balanceOfBatch",
|
|
344
|
+
"outputs": [
|
|
345
|
+
{
|
|
346
|
+
"internalType": "uint256[]",
|
|
347
|
+
"name": "",
|
|
348
|
+
"type": "uint256[]"
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
"stateMutability": "view",
|
|
352
|
+
"type": "function"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"inputs": [],
|
|
356
|
+
"name": "closed",
|
|
357
|
+
"outputs": [
|
|
358
|
+
{
|
|
359
|
+
"internalType": "bool",
|
|
360
|
+
"name": "",
|
|
361
|
+
"type": "bool"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"stateMutability": "view",
|
|
365
|
+
"type": "function"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"inputs": [
|
|
369
|
+
{
|
|
370
|
+
"internalType": "address",
|
|
371
|
+
"name": "account",
|
|
372
|
+
"type": "address"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"internalType": "address",
|
|
376
|
+
"name": "operator",
|
|
377
|
+
"type": "address"
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
"name": "isApprovedForAll",
|
|
381
|
+
"outputs": [
|
|
382
|
+
{
|
|
383
|
+
"internalType": "bool",
|
|
384
|
+
"name": "",
|
|
385
|
+
"type": "bool"
|
|
386
|
+
}
|
|
387
|
+
],
|
|
388
|
+
"stateMutability": "view",
|
|
389
|
+
"type": "function"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"inputs": [
|
|
393
|
+
{
|
|
394
|
+
"internalType": "address[]",
|
|
395
|
+
"name": "wallets",
|
|
396
|
+
"type": "address[]"
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
"name": "mint",
|
|
400
|
+
"outputs": [],
|
|
401
|
+
"stateMutability": "nonpayable",
|
|
402
|
+
"type": "function"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"inputs": [],
|
|
406
|
+
"name": "owner",
|
|
407
|
+
"outputs": [
|
|
408
|
+
{
|
|
409
|
+
"internalType": "address",
|
|
410
|
+
"name": "",
|
|
411
|
+
"type": "address"
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
"stateMutability": "view",
|
|
415
|
+
"type": "function"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"inputs": [],
|
|
419
|
+
"name": "renounceOwnership",
|
|
420
|
+
"outputs": [],
|
|
421
|
+
"stateMutability": "nonpayable",
|
|
422
|
+
"type": "function"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"inputs": [
|
|
426
|
+
{
|
|
427
|
+
"internalType": "address",
|
|
428
|
+
"name": "from",
|
|
429
|
+
"type": "address"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"internalType": "address",
|
|
433
|
+
"name": "to",
|
|
434
|
+
"type": "address"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"internalType": "uint256[]",
|
|
438
|
+
"name": "ids",
|
|
439
|
+
"type": "uint256[]"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"internalType": "uint256[]",
|
|
443
|
+
"name": "values",
|
|
444
|
+
"type": "uint256[]"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"internalType": "bytes",
|
|
448
|
+
"name": "data",
|
|
449
|
+
"type": "bytes"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
"name": "safeBatchTransferFrom",
|
|
453
|
+
"outputs": [],
|
|
454
|
+
"stateMutability": "nonpayable",
|
|
455
|
+
"type": "function"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"inputs": [
|
|
459
|
+
{
|
|
460
|
+
"internalType": "address",
|
|
461
|
+
"name": "from",
|
|
462
|
+
"type": "address"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"internalType": "address",
|
|
466
|
+
"name": "to",
|
|
467
|
+
"type": "address"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"internalType": "uint256",
|
|
471
|
+
"name": "id",
|
|
472
|
+
"type": "uint256"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"internalType": "uint256",
|
|
476
|
+
"name": "value",
|
|
477
|
+
"type": "uint256"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"internalType": "bytes",
|
|
481
|
+
"name": "data",
|
|
482
|
+
"type": "bytes"
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
"name": "safeTransferFrom",
|
|
486
|
+
"outputs": [],
|
|
487
|
+
"stateMutability": "nonpayable",
|
|
488
|
+
"type": "function"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"inputs": [],
|
|
492
|
+
"name": "seal",
|
|
493
|
+
"outputs": [],
|
|
494
|
+
"stateMutability": "nonpayable",
|
|
495
|
+
"type": "function"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"inputs": [
|
|
499
|
+
{
|
|
500
|
+
"internalType": "address",
|
|
501
|
+
"name": "operator",
|
|
502
|
+
"type": "address"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"internalType": "bool",
|
|
506
|
+
"name": "approved",
|
|
507
|
+
"type": "bool"
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
"name": "setApprovalForAll",
|
|
511
|
+
"outputs": [],
|
|
512
|
+
"stateMutability": "nonpayable",
|
|
513
|
+
"type": "function"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"inputs": [
|
|
517
|
+
{
|
|
518
|
+
"internalType": "bytes4",
|
|
519
|
+
"name": "interfaceId",
|
|
520
|
+
"type": "bytes4"
|
|
521
|
+
}
|
|
522
|
+
],
|
|
523
|
+
"name": "supportsInterface",
|
|
524
|
+
"outputs": [
|
|
525
|
+
{
|
|
526
|
+
"internalType": "bool",
|
|
527
|
+
"name": "",
|
|
528
|
+
"type": "bool"
|
|
529
|
+
}
|
|
530
|
+
],
|
|
531
|
+
"stateMutability": "view",
|
|
532
|
+
"type": "function"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
"inputs": [
|
|
536
|
+
{
|
|
537
|
+
"internalType": "address",
|
|
538
|
+
"name": "newOwner",
|
|
539
|
+
"type": "address"
|
|
540
|
+
}
|
|
541
|
+
],
|
|
542
|
+
"name": "transferOwnership",
|
|
543
|
+
"outputs": [],
|
|
544
|
+
"stateMutability": "nonpayable",
|
|
545
|
+
"type": "function"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"inputs": [
|
|
549
|
+
{
|
|
550
|
+
"internalType": "uint256",
|
|
551
|
+
"name": "",
|
|
552
|
+
"type": "uint256"
|
|
553
|
+
}
|
|
554
|
+
],
|
|
555
|
+
"name": "uri",
|
|
556
|
+
"outputs": [
|
|
557
|
+
{
|
|
558
|
+
"internalType": "string",
|
|
559
|
+
"name": "",
|
|
560
|
+
"type": "string"
|
|
561
|
+
}
|
|
562
|
+
],
|
|
563
|
+
"stateMutability": "view",
|
|
564
|
+
"type": "function"
|
|
565
|
+
}
|
|
566
|
+
];
|
|
567
|
+
/**
|
|
568
|
+
* MinerPass Contract Class
|
|
569
|
+
*
|
|
570
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* ```typescript
|
|
574
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
575
|
+
* import { mainnet } from 'viem/chains';
|
|
576
|
+
* import { MinerPass } from 'MinerPass';
|
|
577
|
+
*
|
|
578
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
579
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
580
|
+
*
|
|
581
|
+
* const contract = new MinerPass('0x...', { publicClient, walletClient });
|
|
582
|
+
*
|
|
583
|
+
* // Read functions
|
|
584
|
+
* const result = await contract.balanceOf('0x...');
|
|
585
|
+
*
|
|
586
|
+
* // Write functions
|
|
587
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
588
|
+
*
|
|
589
|
+
* // Simulate transactions (dry-run)
|
|
590
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
591
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
592
|
+
*
|
|
593
|
+
* // Watch events
|
|
594
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
595
|
+
* console.log('Transfer event:', event);
|
|
596
|
+
* });
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
class MinerPass {
|
|
600
|
+
constructor(address, clients) {
|
|
601
|
+
this.contractAddress = address;
|
|
602
|
+
this.publicClient = clients.publicClient;
|
|
603
|
+
this.contract = (0, viem_1.getContract)({
|
|
604
|
+
address,
|
|
605
|
+
abi: exports.MinerPassAbi,
|
|
606
|
+
client: {
|
|
607
|
+
public: clients.publicClient,
|
|
608
|
+
wallet: clients.walletClient,
|
|
609
|
+
},
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Get the contract address
|
|
614
|
+
*/
|
|
615
|
+
get address() {
|
|
616
|
+
return this.contractAddress;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Get the underlying viem contract instance.
|
|
620
|
+
*/
|
|
621
|
+
getContract() {
|
|
622
|
+
return this.contract;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* ID
|
|
626
|
+
* view
|
|
627
|
+
*/
|
|
628
|
+
async ID() {
|
|
629
|
+
return this.contract.read.ID();
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* balanceOf
|
|
633
|
+
* view
|
|
634
|
+
*/
|
|
635
|
+
async balanceOf(account, id) {
|
|
636
|
+
return this.contract.read.balanceOf([account, id]);
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* balanceOfBatch
|
|
640
|
+
* view
|
|
641
|
+
*/
|
|
642
|
+
async balanceOfBatch(accounts, ids) {
|
|
643
|
+
return this.contract.read.balanceOfBatch([accounts, ids]);
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* closed
|
|
647
|
+
* view
|
|
648
|
+
*/
|
|
649
|
+
async closed() {
|
|
650
|
+
return this.contract.read.closed();
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* isApprovedForAll
|
|
654
|
+
* view
|
|
655
|
+
*/
|
|
656
|
+
async isApprovedForAll(account, operator) {
|
|
657
|
+
return this.contract.read.isApprovedForAll([account, operator]);
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* owner
|
|
661
|
+
* view
|
|
662
|
+
*/
|
|
663
|
+
async owner() {
|
|
664
|
+
return this.contract.read.owner();
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* supportsInterface
|
|
668
|
+
* view
|
|
669
|
+
*/
|
|
670
|
+
async supportsInterface(interfaceId) {
|
|
671
|
+
return this.contract.read.supportsInterface([interfaceId]);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* uri
|
|
675
|
+
* view
|
|
676
|
+
*/
|
|
677
|
+
async uri(arg0) {
|
|
678
|
+
return this.contract.read.uri([arg0]);
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* mint
|
|
682
|
+
* nonpayable
|
|
683
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
684
|
+
*/
|
|
685
|
+
async mint(wallets, options) {
|
|
686
|
+
if (!this.contract.write) {
|
|
687
|
+
throw new Error('Wallet client is required for write operations');
|
|
688
|
+
}
|
|
689
|
+
return this.contract.write.mint([wallets], options);
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* renounceOwnership
|
|
693
|
+
* nonpayable
|
|
694
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
695
|
+
*/
|
|
696
|
+
async renounceOwnership(options) {
|
|
697
|
+
if (!this.contract.write) {
|
|
698
|
+
throw new Error('Wallet client is required for write operations');
|
|
699
|
+
}
|
|
700
|
+
return this.contract.write.renounceOwnership(options);
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* safeBatchTransferFrom
|
|
704
|
+
* nonpayable
|
|
705
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
706
|
+
*/
|
|
707
|
+
async safeBatchTransferFrom(from, to, ids, values, data, options) {
|
|
708
|
+
if (!this.contract.write) {
|
|
709
|
+
throw new Error('Wallet client is required for write operations');
|
|
710
|
+
}
|
|
711
|
+
return this.contract.write.safeBatchTransferFrom([from, to, ids, values, data], options);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* safeTransferFrom
|
|
715
|
+
* nonpayable
|
|
716
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
717
|
+
*/
|
|
718
|
+
async safeTransferFrom(from, to, id, value, data, options) {
|
|
719
|
+
if (!this.contract.write) {
|
|
720
|
+
throw new Error('Wallet client is required for write operations');
|
|
721
|
+
}
|
|
722
|
+
return this.contract.write.safeTransferFrom([from, to, id, value, data], options);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* seal
|
|
726
|
+
* nonpayable
|
|
727
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
728
|
+
*/
|
|
729
|
+
async seal(options) {
|
|
730
|
+
if (!this.contract.write) {
|
|
731
|
+
throw new Error('Wallet client is required for write operations');
|
|
732
|
+
}
|
|
733
|
+
return this.contract.write.seal(options);
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* setApprovalForAll
|
|
737
|
+
* nonpayable
|
|
738
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
739
|
+
*/
|
|
740
|
+
async setApprovalForAll(operator, approved, options) {
|
|
741
|
+
if (!this.contract.write) {
|
|
742
|
+
throw new Error('Wallet client is required for write operations');
|
|
743
|
+
}
|
|
744
|
+
return this.contract.write.setApprovalForAll([operator, approved], options);
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* transferOwnership
|
|
748
|
+
* nonpayable
|
|
749
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
750
|
+
*/
|
|
751
|
+
async transferOwnership(newOwner, options) {
|
|
752
|
+
if (!this.contract.write) {
|
|
753
|
+
throw new Error('Wallet client is required for write operations');
|
|
754
|
+
}
|
|
755
|
+
return this.contract.write.transferOwnership([newOwner], options);
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
762
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
763
|
+
* console.log('Would succeed:', result.result);
|
|
764
|
+
*/
|
|
765
|
+
get simulate() {
|
|
766
|
+
const contract = this.contract;
|
|
767
|
+
if (!contract.simulate) {
|
|
768
|
+
throw new Error('Public client is required for simulation');
|
|
769
|
+
}
|
|
770
|
+
return {
|
|
771
|
+
/**
|
|
772
|
+
* Simulate mint
|
|
773
|
+
* Returns gas estimate and result without sending transaction
|
|
774
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
775
|
+
*/
|
|
776
|
+
async mint(wallets, options) {
|
|
777
|
+
return contract.simulate.mint([wallets], options);
|
|
778
|
+
},
|
|
779
|
+
/**
|
|
780
|
+
* Simulate renounceOwnership
|
|
781
|
+
* Returns gas estimate and result without sending transaction
|
|
782
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
783
|
+
*/
|
|
784
|
+
async renounceOwnership(options) {
|
|
785
|
+
return contract.simulate.renounceOwnership(options);
|
|
786
|
+
},
|
|
787
|
+
/**
|
|
788
|
+
* Simulate safeBatchTransferFrom
|
|
789
|
+
* Returns gas estimate and result without sending transaction
|
|
790
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
791
|
+
*/
|
|
792
|
+
async safeBatchTransferFrom(from, to, ids, values, data, options) {
|
|
793
|
+
return contract.simulate.safeBatchTransferFrom([from, to, ids, values, data], options);
|
|
794
|
+
},
|
|
795
|
+
/**
|
|
796
|
+
* Simulate safeTransferFrom
|
|
797
|
+
* Returns gas estimate and result without sending transaction
|
|
798
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
799
|
+
*/
|
|
800
|
+
async safeTransferFrom(from, to, id, value, data, options) {
|
|
801
|
+
return contract.simulate.safeTransferFrom([from, to, id, value, data], options);
|
|
802
|
+
},
|
|
803
|
+
/**
|
|
804
|
+
* Simulate seal
|
|
805
|
+
* Returns gas estimate and result without sending transaction
|
|
806
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
807
|
+
*/
|
|
808
|
+
async seal(options) {
|
|
809
|
+
return contract.simulate.seal(options);
|
|
810
|
+
},
|
|
811
|
+
/**
|
|
812
|
+
* Simulate setApprovalForAll
|
|
813
|
+
* Returns gas estimate and result without sending transaction
|
|
814
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
815
|
+
*/
|
|
816
|
+
async setApprovalForAll(operator, approved, options) {
|
|
817
|
+
return contract.simulate.setApprovalForAll([operator, approved], options);
|
|
818
|
+
},
|
|
819
|
+
/**
|
|
820
|
+
* Simulate transferOwnership
|
|
821
|
+
* Returns gas estimate and result without sending transaction
|
|
822
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
823
|
+
*/
|
|
824
|
+
async transferOwnership(newOwner, options) {
|
|
825
|
+
return contract.simulate.transferOwnership([newOwner], options);
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Watch contract events
|
|
831
|
+
*
|
|
832
|
+
* @example
|
|
833
|
+
* // Watch all Transfer events
|
|
834
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
835
|
+
* console.log('Transfer:', event);
|
|
836
|
+
* });
|
|
837
|
+
*
|
|
838
|
+
* // Stop watching
|
|
839
|
+
* unwatch();
|
|
840
|
+
*/
|
|
841
|
+
get watch() {
|
|
842
|
+
return {
|
|
843
|
+
/**
|
|
844
|
+
* Watch ApprovalForAll events
|
|
845
|
+
* @param callback Function to call when event is emitted
|
|
846
|
+
* @param filter Optional filter for indexed parameters
|
|
847
|
+
* @returns Unwatch function to stop listening
|
|
848
|
+
*/
|
|
849
|
+
ApprovalForAll: (callback, filter) => {
|
|
850
|
+
return this.publicClient.watchContractEvent({
|
|
851
|
+
address: this.contractAddress,
|
|
852
|
+
abi: exports.MinerPassAbi,
|
|
853
|
+
eventName: 'ApprovalForAll',
|
|
854
|
+
args: filter,
|
|
855
|
+
onLogs: (logs) => {
|
|
856
|
+
logs.forEach((log) => {
|
|
857
|
+
callback(log.args);
|
|
858
|
+
});
|
|
859
|
+
},
|
|
860
|
+
});
|
|
861
|
+
},
|
|
862
|
+
/**
|
|
863
|
+
* Watch OwnershipTransferred events
|
|
864
|
+
* @param callback Function to call when event is emitted
|
|
865
|
+
* @param filter Optional filter for indexed parameters
|
|
866
|
+
* @returns Unwatch function to stop listening
|
|
867
|
+
*/
|
|
868
|
+
OwnershipTransferred: (callback, filter) => {
|
|
869
|
+
return this.publicClient.watchContractEvent({
|
|
870
|
+
address: this.contractAddress,
|
|
871
|
+
abi: exports.MinerPassAbi,
|
|
872
|
+
eventName: 'OwnershipTransferred',
|
|
873
|
+
args: filter,
|
|
874
|
+
onLogs: (logs) => {
|
|
875
|
+
logs.forEach((log) => {
|
|
876
|
+
callback(log.args);
|
|
877
|
+
});
|
|
878
|
+
},
|
|
879
|
+
});
|
|
880
|
+
},
|
|
881
|
+
/**
|
|
882
|
+
* Watch TransferBatch events
|
|
883
|
+
* @param callback Function to call when event is emitted
|
|
884
|
+
* @param filter Optional filter for indexed parameters
|
|
885
|
+
* @returns Unwatch function to stop listening
|
|
886
|
+
*/
|
|
887
|
+
TransferBatch: (callback, filter) => {
|
|
888
|
+
return this.publicClient.watchContractEvent({
|
|
889
|
+
address: this.contractAddress,
|
|
890
|
+
abi: exports.MinerPassAbi,
|
|
891
|
+
eventName: 'TransferBatch',
|
|
892
|
+
args: filter,
|
|
893
|
+
onLogs: (logs) => {
|
|
894
|
+
logs.forEach((log) => {
|
|
895
|
+
callback(log.args);
|
|
896
|
+
});
|
|
897
|
+
},
|
|
898
|
+
});
|
|
899
|
+
},
|
|
900
|
+
/**
|
|
901
|
+
* Watch TransferSingle events
|
|
902
|
+
* @param callback Function to call when event is emitted
|
|
903
|
+
* @param filter Optional filter for indexed parameters
|
|
904
|
+
* @returns Unwatch function to stop listening
|
|
905
|
+
*/
|
|
906
|
+
TransferSingle: (callback, filter) => {
|
|
907
|
+
return this.publicClient.watchContractEvent({
|
|
908
|
+
address: this.contractAddress,
|
|
909
|
+
abi: exports.MinerPassAbi,
|
|
910
|
+
eventName: 'TransferSingle',
|
|
911
|
+
args: filter,
|
|
912
|
+
onLogs: (logs) => {
|
|
913
|
+
logs.forEach((log) => {
|
|
914
|
+
callback(log.args);
|
|
915
|
+
});
|
|
916
|
+
},
|
|
917
|
+
});
|
|
918
|
+
},
|
|
919
|
+
/**
|
|
920
|
+
* Watch URI events
|
|
921
|
+
* @param callback Function to call when event is emitted
|
|
922
|
+
* @param filter Optional filter for indexed parameters
|
|
923
|
+
* @returns Unwatch function to stop listening
|
|
924
|
+
*/
|
|
925
|
+
URI: (callback, filter) => {
|
|
926
|
+
return this.publicClient.watchContractEvent({
|
|
927
|
+
address: this.contractAddress,
|
|
928
|
+
abi: exports.MinerPassAbi,
|
|
929
|
+
eventName: 'URI',
|
|
930
|
+
args: filter,
|
|
931
|
+
onLogs: (logs) => {
|
|
932
|
+
logs.forEach((log) => {
|
|
933
|
+
callback(log.args);
|
|
934
|
+
});
|
|
935
|
+
},
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
exports.MinerPass = MinerPass;
|