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