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