@gitmyabi-stg/t 0.0.1
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/T.d.ts +1329 -0
- package/contracts/T.js +1368 -0
- package/contracts/T.ts +1744 -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
package/contracts/T.ts
ADDED
|
@@ -0,0 +1,1744 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checkpoints.Checkpoint struct type
|
|
7
|
+
*/
|
|
8
|
+
export type Checkpoints_Checkpoint = {
|
|
9
|
+
fromBlock: bigint;
|
|
10
|
+
votes: bigint;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* T ABI
|
|
14
|
+
*
|
|
15
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
16
|
+
*/
|
|
17
|
+
export const TAbi = [
|
|
18
|
+
{
|
|
19
|
+
"inputs": [],
|
|
20
|
+
"stateMutability": "nonpayable",
|
|
21
|
+
"type": "constructor"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"anonymous": false,
|
|
25
|
+
"inputs": [
|
|
26
|
+
{
|
|
27
|
+
"indexed": true,
|
|
28
|
+
"internalType": "address",
|
|
29
|
+
"name": "owner",
|
|
30
|
+
"type": "address"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"indexed": true,
|
|
34
|
+
"internalType": "address",
|
|
35
|
+
"name": "spender",
|
|
36
|
+
"type": "address"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"indexed": false,
|
|
40
|
+
"internalType": "uint256",
|
|
41
|
+
"name": "value",
|
|
42
|
+
"type": "uint256"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "Approval",
|
|
46
|
+
"type": "event"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"anonymous": false,
|
|
50
|
+
"inputs": [
|
|
51
|
+
{
|
|
52
|
+
"indexed": true,
|
|
53
|
+
"internalType": "address",
|
|
54
|
+
"name": "delegator",
|
|
55
|
+
"type": "address"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"indexed": true,
|
|
59
|
+
"internalType": "address",
|
|
60
|
+
"name": "fromDelegate",
|
|
61
|
+
"type": "address"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"indexed": true,
|
|
65
|
+
"internalType": "address",
|
|
66
|
+
"name": "toDelegate",
|
|
67
|
+
"type": "address"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"name": "DelegateChanged",
|
|
71
|
+
"type": "event"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"anonymous": false,
|
|
75
|
+
"inputs": [
|
|
76
|
+
{
|
|
77
|
+
"indexed": true,
|
|
78
|
+
"internalType": "address",
|
|
79
|
+
"name": "delegate",
|
|
80
|
+
"type": "address"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"indexed": false,
|
|
84
|
+
"internalType": "uint256",
|
|
85
|
+
"name": "previousBalance",
|
|
86
|
+
"type": "uint256"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"indexed": false,
|
|
90
|
+
"internalType": "uint256",
|
|
91
|
+
"name": "newBalance",
|
|
92
|
+
"type": "uint256"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"name": "DelegateVotesChanged",
|
|
96
|
+
"type": "event"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"anonymous": false,
|
|
100
|
+
"inputs": [
|
|
101
|
+
{
|
|
102
|
+
"indexed": true,
|
|
103
|
+
"internalType": "address",
|
|
104
|
+
"name": "previousOwner",
|
|
105
|
+
"type": "address"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"indexed": true,
|
|
109
|
+
"internalType": "address",
|
|
110
|
+
"name": "newOwner",
|
|
111
|
+
"type": "address"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"name": "OwnershipTransferred",
|
|
115
|
+
"type": "event"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"anonymous": false,
|
|
119
|
+
"inputs": [
|
|
120
|
+
{
|
|
121
|
+
"indexed": true,
|
|
122
|
+
"internalType": "address",
|
|
123
|
+
"name": "from",
|
|
124
|
+
"type": "address"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"indexed": true,
|
|
128
|
+
"internalType": "address",
|
|
129
|
+
"name": "to",
|
|
130
|
+
"type": "address"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"indexed": false,
|
|
134
|
+
"internalType": "uint256",
|
|
135
|
+
"name": "value",
|
|
136
|
+
"type": "uint256"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"name": "Transfer",
|
|
140
|
+
"type": "event"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"inputs": [],
|
|
144
|
+
"name": "DELEGATION_TYPEHASH",
|
|
145
|
+
"outputs": [
|
|
146
|
+
{
|
|
147
|
+
"internalType": "bytes32",
|
|
148
|
+
"name": "",
|
|
149
|
+
"type": "bytes32"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"stateMutability": "view",
|
|
153
|
+
"type": "function"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"inputs": [],
|
|
157
|
+
"name": "DOMAIN_SEPARATOR",
|
|
158
|
+
"outputs": [
|
|
159
|
+
{
|
|
160
|
+
"internalType": "bytes32",
|
|
161
|
+
"name": "",
|
|
162
|
+
"type": "bytes32"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"stateMutability": "view",
|
|
166
|
+
"type": "function"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"inputs": [],
|
|
170
|
+
"name": "PERMIT_TYPEHASH",
|
|
171
|
+
"outputs": [
|
|
172
|
+
{
|
|
173
|
+
"internalType": "bytes32",
|
|
174
|
+
"name": "",
|
|
175
|
+
"type": "bytes32"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"stateMutability": "view",
|
|
179
|
+
"type": "function"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"inputs": [
|
|
183
|
+
{
|
|
184
|
+
"internalType": "address",
|
|
185
|
+
"name": "",
|
|
186
|
+
"type": "address"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"internalType": "address",
|
|
190
|
+
"name": "",
|
|
191
|
+
"type": "address"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"name": "allowance",
|
|
195
|
+
"outputs": [
|
|
196
|
+
{
|
|
197
|
+
"internalType": "uint256",
|
|
198
|
+
"name": "",
|
|
199
|
+
"type": "uint256"
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
"stateMutability": "view",
|
|
203
|
+
"type": "function"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"inputs": [
|
|
207
|
+
{
|
|
208
|
+
"internalType": "address",
|
|
209
|
+
"name": "spender",
|
|
210
|
+
"type": "address"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"internalType": "uint256",
|
|
214
|
+
"name": "amount",
|
|
215
|
+
"type": "uint256"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"name": "approve",
|
|
219
|
+
"outputs": [
|
|
220
|
+
{
|
|
221
|
+
"internalType": "bool",
|
|
222
|
+
"name": "",
|
|
223
|
+
"type": "bool"
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"stateMutability": "nonpayable",
|
|
227
|
+
"type": "function"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"inputs": [
|
|
231
|
+
{
|
|
232
|
+
"internalType": "address",
|
|
233
|
+
"name": "spender",
|
|
234
|
+
"type": "address"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"internalType": "uint256",
|
|
238
|
+
"name": "amount",
|
|
239
|
+
"type": "uint256"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"internalType": "bytes",
|
|
243
|
+
"name": "extraData",
|
|
244
|
+
"type": "bytes"
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
"name": "approveAndCall",
|
|
248
|
+
"outputs": [
|
|
249
|
+
{
|
|
250
|
+
"internalType": "bool",
|
|
251
|
+
"name": "",
|
|
252
|
+
"type": "bool"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"stateMutability": "nonpayable",
|
|
256
|
+
"type": "function"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"inputs": [
|
|
260
|
+
{
|
|
261
|
+
"internalType": "address",
|
|
262
|
+
"name": "",
|
|
263
|
+
"type": "address"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
"name": "balanceOf",
|
|
267
|
+
"outputs": [
|
|
268
|
+
{
|
|
269
|
+
"internalType": "uint256",
|
|
270
|
+
"name": "",
|
|
271
|
+
"type": "uint256"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"stateMutability": "view",
|
|
275
|
+
"type": "function"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"inputs": [
|
|
279
|
+
{
|
|
280
|
+
"internalType": "uint256",
|
|
281
|
+
"name": "amount",
|
|
282
|
+
"type": "uint256"
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
"name": "burn",
|
|
286
|
+
"outputs": [],
|
|
287
|
+
"stateMutability": "nonpayable",
|
|
288
|
+
"type": "function"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"inputs": [
|
|
292
|
+
{
|
|
293
|
+
"internalType": "address",
|
|
294
|
+
"name": "account",
|
|
295
|
+
"type": "address"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"internalType": "uint256",
|
|
299
|
+
"name": "amount",
|
|
300
|
+
"type": "uint256"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"name": "burnFrom",
|
|
304
|
+
"outputs": [],
|
|
305
|
+
"stateMutability": "nonpayable",
|
|
306
|
+
"type": "function"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"inputs": [],
|
|
310
|
+
"name": "cachedChainId",
|
|
311
|
+
"outputs": [
|
|
312
|
+
{
|
|
313
|
+
"internalType": "uint256",
|
|
314
|
+
"name": "",
|
|
315
|
+
"type": "uint256"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"stateMutability": "view",
|
|
319
|
+
"type": "function"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"inputs": [],
|
|
323
|
+
"name": "cachedDomainSeparator",
|
|
324
|
+
"outputs": [
|
|
325
|
+
{
|
|
326
|
+
"internalType": "bytes32",
|
|
327
|
+
"name": "",
|
|
328
|
+
"type": "bytes32"
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"stateMutability": "view",
|
|
332
|
+
"type": "function"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"inputs": [
|
|
336
|
+
{
|
|
337
|
+
"internalType": "address",
|
|
338
|
+
"name": "account",
|
|
339
|
+
"type": "address"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"internalType": "uint32",
|
|
343
|
+
"name": "pos",
|
|
344
|
+
"type": "uint32"
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
"name": "checkpoints",
|
|
348
|
+
"outputs": [
|
|
349
|
+
{
|
|
350
|
+
"components": [
|
|
351
|
+
{
|
|
352
|
+
"internalType": "uint32",
|
|
353
|
+
"name": "fromBlock",
|
|
354
|
+
"type": "uint32"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"internalType": "uint96",
|
|
358
|
+
"name": "votes",
|
|
359
|
+
"type": "uint96"
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
"internalType": "struct Checkpoints.Checkpoint",
|
|
363
|
+
"name": "checkpoint",
|
|
364
|
+
"type": "tuple"
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
"stateMutability": "view",
|
|
368
|
+
"type": "function"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"inputs": [],
|
|
372
|
+
"name": "decimals",
|
|
373
|
+
"outputs": [
|
|
374
|
+
{
|
|
375
|
+
"internalType": "uint8",
|
|
376
|
+
"name": "",
|
|
377
|
+
"type": "uint8"
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
"stateMutability": "view",
|
|
381
|
+
"type": "function"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"inputs": [
|
|
385
|
+
{
|
|
386
|
+
"internalType": "address",
|
|
387
|
+
"name": "delegatee",
|
|
388
|
+
"type": "address"
|
|
389
|
+
}
|
|
390
|
+
],
|
|
391
|
+
"name": "delegate",
|
|
392
|
+
"outputs": [],
|
|
393
|
+
"stateMutability": "nonpayable",
|
|
394
|
+
"type": "function"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"inputs": [
|
|
398
|
+
{
|
|
399
|
+
"internalType": "address",
|
|
400
|
+
"name": "signatory",
|
|
401
|
+
"type": "address"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"internalType": "address",
|
|
405
|
+
"name": "delegatee",
|
|
406
|
+
"type": "address"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"internalType": "uint256",
|
|
410
|
+
"name": "deadline",
|
|
411
|
+
"type": "uint256"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"internalType": "uint8",
|
|
415
|
+
"name": "v",
|
|
416
|
+
"type": "uint8"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"internalType": "bytes32",
|
|
420
|
+
"name": "r",
|
|
421
|
+
"type": "bytes32"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"internalType": "bytes32",
|
|
425
|
+
"name": "s",
|
|
426
|
+
"type": "bytes32"
|
|
427
|
+
}
|
|
428
|
+
],
|
|
429
|
+
"name": "delegateBySig",
|
|
430
|
+
"outputs": [],
|
|
431
|
+
"stateMutability": "nonpayable",
|
|
432
|
+
"type": "function"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"inputs": [
|
|
436
|
+
{
|
|
437
|
+
"internalType": "address",
|
|
438
|
+
"name": "account",
|
|
439
|
+
"type": "address"
|
|
440
|
+
}
|
|
441
|
+
],
|
|
442
|
+
"name": "delegates",
|
|
443
|
+
"outputs": [
|
|
444
|
+
{
|
|
445
|
+
"internalType": "address",
|
|
446
|
+
"name": "",
|
|
447
|
+
"type": "address"
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
"stateMutability": "view",
|
|
451
|
+
"type": "function"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"inputs": [
|
|
455
|
+
{
|
|
456
|
+
"internalType": "uint256",
|
|
457
|
+
"name": "blockNumber",
|
|
458
|
+
"type": "uint256"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"name": "getPastTotalSupply",
|
|
462
|
+
"outputs": [
|
|
463
|
+
{
|
|
464
|
+
"internalType": "uint96",
|
|
465
|
+
"name": "",
|
|
466
|
+
"type": "uint96"
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
"stateMutability": "view",
|
|
470
|
+
"type": "function"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"inputs": [
|
|
474
|
+
{
|
|
475
|
+
"internalType": "address",
|
|
476
|
+
"name": "account",
|
|
477
|
+
"type": "address"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"internalType": "uint256",
|
|
481
|
+
"name": "blockNumber",
|
|
482
|
+
"type": "uint256"
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
"name": "getPastVotes",
|
|
486
|
+
"outputs": [
|
|
487
|
+
{
|
|
488
|
+
"internalType": "uint96",
|
|
489
|
+
"name": "",
|
|
490
|
+
"type": "uint96"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
"stateMutability": "view",
|
|
494
|
+
"type": "function"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"inputs": [
|
|
498
|
+
{
|
|
499
|
+
"internalType": "address",
|
|
500
|
+
"name": "account",
|
|
501
|
+
"type": "address"
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
"name": "getVotes",
|
|
505
|
+
"outputs": [
|
|
506
|
+
{
|
|
507
|
+
"internalType": "uint96",
|
|
508
|
+
"name": "",
|
|
509
|
+
"type": "uint96"
|
|
510
|
+
}
|
|
511
|
+
],
|
|
512
|
+
"stateMutability": "view",
|
|
513
|
+
"type": "function"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"inputs": [
|
|
517
|
+
{
|
|
518
|
+
"internalType": "address",
|
|
519
|
+
"name": "recipient",
|
|
520
|
+
"type": "address"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"internalType": "uint256",
|
|
524
|
+
"name": "amount",
|
|
525
|
+
"type": "uint256"
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
"name": "mint",
|
|
529
|
+
"outputs": [],
|
|
530
|
+
"stateMutability": "nonpayable",
|
|
531
|
+
"type": "function"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"inputs": [],
|
|
535
|
+
"name": "name",
|
|
536
|
+
"outputs": [
|
|
537
|
+
{
|
|
538
|
+
"internalType": "string",
|
|
539
|
+
"name": "",
|
|
540
|
+
"type": "string"
|
|
541
|
+
}
|
|
542
|
+
],
|
|
543
|
+
"stateMutability": "view",
|
|
544
|
+
"type": "function"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"inputs": [
|
|
548
|
+
{
|
|
549
|
+
"internalType": "address",
|
|
550
|
+
"name": "",
|
|
551
|
+
"type": "address"
|
|
552
|
+
}
|
|
553
|
+
],
|
|
554
|
+
"name": "nonce",
|
|
555
|
+
"outputs": [
|
|
556
|
+
{
|
|
557
|
+
"internalType": "uint256",
|
|
558
|
+
"name": "",
|
|
559
|
+
"type": "uint256"
|
|
560
|
+
}
|
|
561
|
+
],
|
|
562
|
+
"stateMutability": "view",
|
|
563
|
+
"type": "function"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"inputs": [
|
|
567
|
+
{
|
|
568
|
+
"internalType": "address",
|
|
569
|
+
"name": "account",
|
|
570
|
+
"type": "address"
|
|
571
|
+
}
|
|
572
|
+
],
|
|
573
|
+
"name": "numCheckpoints",
|
|
574
|
+
"outputs": [
|
|
575
|
+
{
|
|
576
|
+
"internalType": "uint32",
|
|
577
|
+
"name": "",
|
|
578
|
+
"type": "uint32"
|
|
579
|
+
}
|
|
580
|
+
],
|
|
581
|
+
"stateMutability": "view",
|
|
582
|
+
"type": "function"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
"inputs": [],
|
|
586
|
+
"name": "owner",
|
|
587
|
+
"outputs": [
|
|
588
|
+
{
|
|
589
|
+
"internalType": "address",
|
|
590
|
+
"name": "",
|
|
591
|
+
"type": "address"
|
|
592
|
+
}
|
|
593
|
+
],
|
|
594
|
+
"stateMutability": "view",
|
|
595
|
+
"type": "function"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"inputs": [
|
|
599
|
+
{
|
|
600
|
+
"internalType": "address",
|
|
601
|
+
"name": "owner",
|
|
602
|
+
"type": "address"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"internalType": "address",
|
|
606
|
+
"name": "spender",
|
|
607
|
+
"type": "address"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"internalType": "uint256",
|
|
611
|
+
"name": "amount",
|
|
612
|
+
"type": "uint256"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"internalType": "uint256",
|
|
616
|
+
"name": "deadline",
|
|
617
|
+
"type": "uint256"
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
"internalType": "uint8",
|
|
621
|
+
"name": "v",
|
|
622
|
+
"type": "uint8"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"internalType": "bytes32",
|
|
626
|
+
"name": "r",
|
|
627
|
+
"type": "bytes32"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"internalType": "bytes32",
|
|
631
|
+
"name": "s",
|
|
632
|
+
"type": "bytes32"
|
|
633
|
+
}
|
|
634
|
+
],
|
|
635
|
+
"name": "permit",
|
|
636
|
+
"outputs": [],
|
|
637
|
+
"stateMutability": "nonpayable",
|
|
638
|
+
"type": "function"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"inputs": [
|
|
642
|
+
{
|
|
643
|
+
"internalType": "contract IERC20",
|
|
644
|
+
"name": "token",
|
|
645
|
+
"type": "address"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"internalType": "address",
|
|
649
|
+
"name": "recipient",
|
|
650
|
+
"type": "address"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"internalType": "uint256",
|
|
654
|
+
"name": "amount",
|
|
655
|
+
"type": "uint256"
|
|
656
|
+
}
|
|
657
|
+
],
|
|
658
|
+
"name": "recoverERC20",
|
|
659
|
+
"outputs": [],
|
|
660
|
+
"stateMutability": "nonpayable",
|
|
661
|
+
"type": "function"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"inputs": [
|
|
665
|
+
{
|
|
666
|
+
"internalType": "contract IERC721",
|
|
667
|
+
"name": "token",
|
|
668
|
+
"type": "address"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"internalType": "address",
|
|
672
|
+
"name": "recipient",
|
|
673
|
+
"type": "address"
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"internalType": "uint256",
|
|
677
|
+
"name": "tokenId",
|
|
678
|
+
"type": "uint256"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"internalType": "bytes",
|
|
682
|
+
"name": "data",
|
|
683
|
+
"type": "bytes"
|
|
684
|
+
}
|
|
685
|
+
],
|
|
686
|
+
"name": "recoverERC721",
|
|
687
|
+
"outputs": [],
|
|
688
|
+
"stateMutability": "nonpayable",
|
|
689
|
+
"type": "function"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"inputs": [],
|
|
693
|
+
"name": "renounceOwnership",
|
|
694
|
+
"outputs": [],
|
|
695
|
+
"stateMutability": "nonpayable",
|
|
696
|
+
"type": "function"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"inputs": [],
|
|
700
|
+
"name": "symbol",
|
|
701
|
+
"outputs": [
|
|
702
|
+
{
|
|
703
|
+
"internalType": "string",
|
|
704
|
+
"name": "",
|
|
705
|
+
"type": "string"
|
|
706
|
+
}
|
|
707
|
+
],
|
|
708
|
+
"stateMutability": "view",
|
|
709
|
+
"type": "function"
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"inputs": [],
|
|
713
|
+
"name": "totalSupply",
|
|
714
|
+
"outputs": [
|
|
715
|
+
{
|
|
716
|
+
"internalType": "uint256",
|
|
717
|
+
"name": "",
|
|
718
|
+
"type": "uint256"
|
|
719
|
+
}
|
|
720
|
+
],
|
|
721
|
+
"stateMutability": "view",
|
|
722
|
+
"type": "function"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"inputs": [
|
|
726
|
+
{
|
|
727
|
+
"internalType": "address",
|
|
728
|
+
"name": "recipient",
|
|
729
|
+
"type": "address"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"internalType": "uint256",
|
|
733
|
+
"name": "amount",
|
|
734
|
+
"type": "uint256"
|
|
735
|
+
}
|
|
736
|
+
],
|
|
737
|
+
"name": "transfer",
|
|
738
|
+
"outputs": [
|
|
739
|
+
{
|
|
740
|
+
"internalType": "bool",
|
|
741
|
+
"name": "",
|
|
742
|
+
"type": "bool"
|
|
743
|
+
}
|
|
744
|
+
],
|
|
745
|
+
"stateMutability": "nonpayable",
|
|
746
|
+
"type": "function"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"inputs": [
|
|
750
|
+
{
|
|
751
|
+
"internalType": "address",
|
|
752
|
+
"name": "spender",
|
|
753
|
+
"type": "address"
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"internalType": "address",
|
|
757
|
+
"name": "recipient",
|
|
758
|
+
"type": "address"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"internalType": "uint256",
|
|
762
|
+
"name": "amount",
|
|
763
|
+
"type": "uint256"
|
|
764
|
+
}
|
|
765
|
+
],
|
|
766
|
+
"name": "transferFrom",
|
|
767
|
+
"outputs": [
|
|
768
|
+
{
|
|
769
|
+
"internalType": "bool",
|
|
770
|
+
"name": "",
|
|
771
|
+
"type": "bool"
|
|
772
|
+
}
|
|
773
|
+
],
|
|
774
|
+
"stateMutability": "nonpayable",
|
|
775
|
+
"type": "function"
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
"inputs": [
|
|
779
|
+
{
|
|
780
|
+
"internalType": "address",
|
|
781
|
+
"name": "newOwner",
|
|
782
|
+
"type": "address"
|
|
783
|
+
}
|
|
784
|
+
],
|
|
785
|
+
"name": "transferOwnership",
|
|
786
|
+
"outputs": [],
|
|
787
|
+
"stateMutability": "nonpayable",
|
|
788
|
+
"type": "function"
|
|
789
|
+
}
|
|
790
|
+
] as const satisfies Abi;
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Type-safe ABI for T
|
|
794
|
+
*/
|
|
795
|
+
export type TAbi = typeof TAbi;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Contract instance type for T
|
|
799
|
+
*/
|
|
800
|
+
// Use any for contract type to avoid complex viem type issues
|
|
801
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
802
|
+
export type TContract = any;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* T Contract Class
|
|
806
|
+
*
|
|
807
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* ```typescript
|
|
811
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
812
|
+
* import { mainnet } from 'viem/chains';
|
|
813
|
+
* import { T } from 'T';
|
|
814
|
+
*
|
|
815
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
816
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
817
|
+
*
|
|
818
|
+
* const contract = new T('0x...', { publicClient, walletClient });
|
|
819
|
+
*
|
|
820
|
+
* // Read functions
|
|
821
|
+
* const result = await contract.balanceOf('0x...');
|
|
822
|
+
*
|
|
823
|
+
* // Write functions
|
|
824
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
825
|
+
*
|
|
826
|
+
* // Simulate transactions (dry-run)
|
|
827
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
828
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
829
|
+
*
|
|
830
|
+
* // Watch events
|
|
831
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
832
|
+
* console.log('Transfer event:', event);
|
|
833
|
+
* });
|
|
834
|
+
* ```
|
|
835
|
+
*/
|
|
836
|
+
export class T {
|
|
837
|
+
private contract: TContract;
|
|
838
|
+
private contractAddress: Address;
|
|
839
|
+
private publicClient: PublicClient;
|
|
840
|
+
|
|
841
|
+
constructor(
|
|
842
|
+
address: Address,
|
|
843
|
+
clients: {
|
|
844
|
+
publicClient: PublicClient;
|
|
845
|
+
walletClient?: WalletClient;
|
|
846
|
+
}
|
|
847
|
+
) {
|
|
848
|
+
this.contractAddress = address;
|
|
849
|
+
this.publicClient = clients.publicClient;
|
|
850
|
+
this.contract = getContract({
|
|
851
|
+
address,
|
|
852
|
+
abi: TAbi,
|
|
853
|
+
client: {
|
|
854
|
+
public: clients.publicClient,
|
|
855
|
+
wallet: clients.walletClient,
|
|
856
|
+
},
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* Get the contract address
|
|
862
|
+
*/
|
|
863
|
+
get address(): Address {
|
|
864
|
+
return this.contractAddress;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Get the underlying viem contract instance.
|
|
869
|
+
*/
|
|
870
|
+
getContract(): TContract {
|
|
871
|
+
return this.contract;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* DELEGATION_TYPEHASH
|
|
876
|
+
* view
|
|
877
|
+
*/
|
|
878
|
+
async DELEGATION_TYPEHASH(): Promise<`0x${string}`> {
|
|
879
|
+
return this.contract.read.DELEGATION_TYPEHASH() as Promise<`0x${string}`>;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* DOMAIN_SEPARATOR
|
|
884
|
+
* view
|
|
885
|
+
*/
|
|
886
|
+
async DOMAIN_SEPARATOR(): Promise<`0x${string}`> {
|
|
887
|
+
return this.contract.read.DOMAIN_SEPARATOR() as Promise<`0x${string}`>;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* PERMIT_TYPEHASH
|
|
892
|
+
* view
|
|
893
|
+
*/
|
|
894
|
+
async PERMIT_TYPEHASH(): Promise<`0x${string}`> {
|
|
895
|
+
return this.contract.read.PERMIT_TYPEHASH() as Promise<`0x${string}`>;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* allowance
|
|
900
|
+
* view
|
|
901
|
+
*/
|
|
902
|
+
async allowance(arg0: `0x${string}`, arg1: `0x${string}`): Promise<bigint> {
|
|
903
|
+
return this.contract.read.allowance([arg0, arg1] as const) as Promise<bigint>;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* balanceOf
|
|
908
|
+
* view
|
|
909
|
+
*/
|
|
910
|
+
async balanceOf(arg0: `0x${string}`): Promise<bigint> {
|
|
911
|
+
return this.contract.read.balanceOf([arg0] as const) as Promise<bigint>;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* cachedChainId
|
|
916
|
+
* view
|
|
917
|
+
*/
|
|
918
|
+
async cachedChainId(): Promise<bigint> {
|
|
919
|
+
return this.contract.read.cachedChainId() as Promise<bigint>;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* cachedDomainSeparator
|
|
924
|
+
* view
|
|
925
|
+
*/
|
|
926
|
+
async cachedDomainSeparator(): Promise<`0x${string}`> {
|
|
927
|
+
return this.contract.read.cachedDomainSeparator() as Promise<`0x${string}`>;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* checkpoints
|
|
932
|
+
* view
|
|
933
|
+
*/
|
|
934
|
+
async checkpoints(account: `0x${string}`, pos: bigint): Promise<Checkpoints_Checkpoint> {
|
|
935
|
+
return this.contract.read.checkpoints([account, pos] as const) as Promise<Checkpoints_Checkpoint>;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* decimals
|
|
940
|
+
* view
|
|
941
|
+
*/
|
|
942
|
+
async decimals(): Promise<bigint> {
|
|
943
|
+
return this.contract.read.decimals() as Promise<bigint>;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* delegates
|
|
948
|
+
* view
|
|
949
|
+
*/
|
|
950
|
+
async delegates(account: `0x${string}`): Promise<`0x${string}`> {
|
|
951
|
+
return this.contract.read.delegates([account] as const) as Promise<`0x${string}`>;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* getPastTotalSupply
|
|
956
|
+
* view
|
|
957
|
+
*/
|
|
958
|
+
async getPastTotalSupply(blockNumber: bigint): Promise<bigint> {
|
|
959
|
+
return this.contract.read.getPastTotalSupply([blockNumber] as const) as Promise<bigint>;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* getPastVotes
|
|
964
|
+
* view
|
|
965
|
+
*/
|
|
966
|
+
async getPastVotes(account: `0x${string}`, blockNumber: bigint): Promise<bigint> {
|
|
967
|
+
return this.contract.read.getPastVotes([account, blockNumber] as const) as Promise<bigint>;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* getVotes
|
|
972
|
+
* view
|
|
973
|
+
*/
|
|
974
|
+
async getVotes(account: `0x${string}`): Promise<bigint> {
|
|
975
|
+
return this.contract.read.getVotes([account] as const) as Promise<bigint>;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* name
|
|
980
|
+
* view
|
|
981
|
+
*/
|
|
982
|
+
async name(): Promise<string> {
|
|
983
|
+
return this.contract.read.name() as Promise<string>;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* nonce
|
|
988
|
+
* view
|
|
989
|
+
*/
|
|
990
|
+
async nonce(arg0: `0x${string}`): Promise<bigint> {
|
|
991
|
+
return this.contract.read.nonce([arg0] as const) as Promise<bigint>;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* numCheckpoints
|
|
996
|
+
* view
|
|
997
|
+
*/
|
|
998
|
+
async numCheckpoints(account: `0x${string}`): Promise<bigint> {
|
|
999
|
+
return this.contract.read.numCheckpoints([account] as const) as Promise<bigint>;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* owner
|
|
1004
|
+
* view
|
|
1005
|
+
*/
|
|
1006
|
+
async owner(): Promise<`0x${string}`> {
|
|
1007
|
+
return this.contract.read.owner() as Promise<`0x${string}`>;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* symbol
|
|
1012
|
+
* view
|
|
1013
|
+
*/
|
|
1014
|
+
async symbol(): Promise<string> {
|
|
1015
|
+
return this.contract.read.symbol() as Promise<string>;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* totalSupply
|
|
1020
|
+
* view
|
|
1021
|
+
*/
|
|
1022
|
+
async totalSupply(): Promise<bigint> {
|
|
1023
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* approve
|
|
1028
|
+
* nonpayable
|
|
1029
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1030
|
+
*/
|
|
1031
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
1032
|
+
accessList?: import('viem').AccessList;
|
|
1033
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1034
|
+
chain?: import('viem').Chain | null;
|
|
1035
|
+
dataSuffix?: `0x${string}`;
|
|
1036
|
+
gas?: bigint;
|
|
1037
|
+
gasPrice?: bigint;
|
|
1038
|
+
maxFeePerGas?: bigint;
|
|
1039
|
+
maxPriorityFeePerGas?: bigint;
|
|
1040
|
+
nonce?: number;
|
|
1041
|
+
value?: bigint;
|
|
1042
|
+
}): Promise<`0x${string}`> {
|
|
1043
|
+
if (!this.contract.write) {
|
|
1044
|
+
throw new Error('Wallet client is required for write operations');
|
|
1045
|
+
}
|
|
1046
|
+
return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* approveAndCall
|
|
1051
|
+
* nonpayable
|
|
1052
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1053
|
+
*/
|
|
1054
|
+
async approveAndCall(spender: `0x${string}`, amount: bigint, extraData: `0x${string}`, options?: {
|
|
1055
|
+
accessList?: import('viem').AccessList;
|
|
1056
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1057
|
+
chain?: import('viem').Chain | null;
|
|
1058
|
+
dataSuffix?: `0x${string}`;
|
|
1059
|
+
gas?: bigint;
|
|
1060
|
+
gasPrice?: bigint;
|
|
1061
|
+
maxFeePerGas?: bigint;
|
|
1062
|
+
maxPriorityFeePerGas?: bigint;
|
|
1063
|
+
nonce?: number;
|
|
1064
|
+
value?: bigint;
|
|
1065
|
+
}): Promise<`0x${string}`> {
|
|
1066
|
+
if (!this.contract.write) {
|
|
1067
|
+
throw new Error('Wallet client is required for write operations');
|
|
1068
|
+
}
|
|
1069
|
+
return this.contract.write.approveAndCall([spender, amount, extraData] as const, options) as Promise<`0x${string}`>;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* burn
|
|
1074
|
+
* nonpayable
|
|
1075
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1076
|
+
*/
|
|
1077
|
+
async burn(amount: bigint, options?: {
|
|
1078
|
+
accessList?: import('viem').AccessList;
|
|
1079
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1080
|
+
chain?: import('viem').Chain | null;
|
|
1081
|
+
dataSuffix?: `0x${string}`;
|
|
1082
|
+
gas?: bigint;
|
|
1083
|
+
gasPrice?: bigint;
|
|
1084
|
+
maxFeePerGas?: bigint;
|
|
1085
|
+
maxPriorityFeePerGas?: bigint;
|
|
1086
|
+
nonce?: number;
|
|
1087
|
+
value?: bigint;
|
|
1088
|
+
}): Promise<`0x${string}`> {
|
|
1089
|
+
if (!this.contract.write) {
|
|
1090
|
+
throw new Error('Wallet client is required for write operations');
|
|
1091
|
+
}
|
|
1092
|
+
return this.contract.write.burn([amount] as const, options) as Promise<`0x${string}`>;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* burnFrom
|
|
1097
|
+
* nonpayable
|
|
1098
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1099
|
+
*/
|
|
1100
|
+
async burnFrom(account: `0x${string}`, amount: bigint, options?: {
|
|
1101
|
+
accessList?: import('viem').AccessList;
|
|
1102
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1103
|
+
chain?: import('viem').Chain | null;
|
|
1104
|
+
dataSuffix?: `0x${string}`;
|
|
1105
|
+
gas?: bigint;
|
|
1106
|
+
gasPrice?: bigint;
|
|
1107
|
+
maxFeePerGas?: bigint;
|
|
1108
|
+
maxPriorityFeePerGas?: bigint;
|
|
1109
|
+
nonce?: number;
|
|
1110
|
+
value?: bigint;
|
|
1111
|
+
}): Promise<`0x${string}`> {
|
|
1112
|
+
if (!this.contract.write) {
|
|
1113
|
+
throw new Error('Wallet client is required for write operations');
|
|
1114
|
+
}
|
|
1115
|
+
return this.contract.write.burnFrom([account, amount] as const, options) as Promise<`0x${string}`>;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* delegate
|
|
1120
|
+
* nonpayable
|
|
1121
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1122
|
+
*/
|
|
1123
|
+
async delegate(delegatee: `0x${string}`, options?: {
|
|
1124
|
+
accessList?: import('viem').AccessList;
|
|
1125
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1126
|
+
chain?: import('viem').Chain | null;
|
|
1127
|
+
dataSuffix?: `0x${string}`;
|
|
1128
|
+
gas?: bigint;
|
|
1129
|
+
gasPrice?: bigint;
|
|
1130
|
+
maxFeePerGas?: bigint;
|
|
1131
|
+
maxPriorityFeePerGas?: bigint;
|
|
1132
|
+
nonce?: number;
|
|
1133
|
+
value?: bigint;
|
|
1134
|
+
}): Promise<`0x${string}`> {
|
|
1135
|
+
if (!this.contract.write) {
|
|
1136
|
+
throw new Error('Wallet client is required for write operations');
|
|
1137
|
+
}
|
|
1138
|
+
return this.contract.write.delegate([delegatee] as const, options) as Promise<`0x${string}`>;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* delegateBySig
|
|
1143
|
+
* nonpayable
|
|
1144
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1145
|
+
*/
|
|
1146
|
+
async delegateBySig(signatory: `0x${string}`, delegatee: `0x${string}`, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
|
|
1147
|
+
accessList?: import('viem').AccessList;
|
|
1148
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1149
|
+
chain?: import('viem').Chain | null;
|
|
1150
|
+
dataSuffix?: `0x${string}`;
|
|
1151
|
+
gas?: bigint;
|
|
1152
|
+
gasPrice?: bigint;
|
|
1153
|
+
maxFeePerGas?: bigint;
|
|
1154
|
+
maxPriorityFeePerGas?: bigint;
|
|
1155
|
+
nonce?: number;
|
|
1156
|
+
value?: bigint;
|
|
1157
|
+
}): Promise<`0x${string}`> {
|
|
1158
|
+
if (!this.contract.write) {
|
|
1159
|
+
throw new Error('Wallet client is required for write operations');
|
|
1160
|
+
}
|
|
1161
|
+
return this.contract.write.delegateBySig([signatory, delegatee, deadline, v, r, s] as const, options) as Promise<`0x${string}`>;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* mint
|
|
1166
|
+
* nonpayable
|
|
1167
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1168
|
+
*/
|
|
1169
|
+
async mint(recipient: `0x${string}`, amount: bigint, options?: {
|
|
1170
|
+
accessList?: import('viem').AccessList;
|
|
1171
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1172
|
+
chain?: import('viem').Chain | null;
|
|
1173
|
+
dataSuffix?: `0x${string}`;
|
|
1174
|
+
gas?: bigint;
|
|
1175
|
+
gasPrice?: bigint;
|
|
1176
|
+
maxFeePerGas?: bigint;
|
|
1177
|
+
maxPriorityFeePerGas?: bigint;
|
|
1178
|
+
nonce?: number;
|
|
1179
|
+
value?: bigint;
|
|
1180
|
+
}): Promise<`0x${string}`> {
|
|
1181
|
+
if (!this.contract.write) {
|
|
1182
|
+
throw new Error('Wallet client is required for write operations');
|
|
1183
|
+
}
|
|
1184
|
+
return this.contract.write.mint([recipient, amount] as const, options) as Promise<`0x${string}`>;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* permit
|
|
1189
|
+
* nonpayable
|
|
1190
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1191
|
+
*/
|
|
1192
|
+
async permit(owner: `0x${string}`, spender: `0x${string}`, amount: bigint, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
|
|
1193
|
+
accessList?: import('viem').AccessList;
|
|
1194
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1195
|
+
chain?: import('viem').Chain | null;
|
|
1196
|
+
dataSuffix?: `0x${string}`;
|
|
1197
|
+
gas?: bigint;
|
|
1198
|
+
gasPrice?: bigint;
|
|
1199
|
+
maxFeePerGas?: bigint;
|
|
1200
|
+
maxPriorityFeePerGas?: bigint;
|
|
1201
|
+
nonce?: number;
|
|
1202
|
+
value?: bigint;
|
|
1203
|
+
}): Promise<`0x${string}`> {
|
|
1204
|
+
if (!this.contract.write) {
|
|
1205
|
+
throw new Error('Wallet client is required for write operations');
|
|
1206
|
+
}
|
|
1207
|
+
return this.contract.write.permit([owner, spender, amount, deadline, v, r, s] as const, options) as Promise<`0x${string}`>;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* recoverERC20
|
|
1212
|
+
* nonpayable
|
|
1213
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1214
|
+
*/
|
|
1215
|
+
async recoverERC20(token: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
|
|
1216
|
+
accessList?: import('viem').AccessList;
|
|
1217
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1218
|
+
chain?: import('viem').Chain | null;
|
|
1219
|
+
dataSuffix?: `0x${string}`;
|
|
1220
|
+
gas?: bigint;
|
|
1221
|
+
gasPrice?: bigint;
|
|
1222
|
+
maxFeePerGas?: bigint;
|
|
1223
|
+
maxPriorityFeePerGas?: bigint;
|
|
1224
|
+
nonce?: number;
|
|
1225
|
+
value?: bigint;
|
|
1226
|
+
}): Promise<`0x${string}`> {
|
|
1227
|
+
if (!this.contract.write) {
|
|
1228
|
+
throw new Error('Wallet client is required for write operations');
|
|
1229
|
+
}
|
|
1230
|
+
return this.contract.write.recoverERC20([token, recipient, amount] as const, options) as Promise<`0x${string}`>;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* recoverERC721
|
|
1235
|
+
* nonpayable
|
|
1236
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1237
|
+
*/
|
|
1238
|
+
async recoverERC721(token: `0x${string}`, recipient: `0x${string}`, tokenId: bigint, data: `0x${string}`, options?: {
|
|
1239
|
+
accessList?: import('viem').AccessList;
|
|
1240
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1241
|
+
chain?: import('viem').Chain | null;
|
|
1242
|
+
dataSuffix?: `0x${string}`;
|
|
1243
|
+
gas?: bigint;
|
|
1244
|
+
gasPrice?: bigint;
|
|
1245
|
+
maxFeePerGas?: bigint;
|
|
1246
|
+
maxPriorityFeePerGas?: bigint;
|
|
1247
|
+
nonce?: number;
|
|
1248
|
+
value?: bigint;
|
|
1249
|
+
}): Promise<`0x${string}`> {
|
|
1250
|
+
if (!this.contract.write) {
|
|
1251
|
+
throw new Error('Wallet client is required for write operations');
|
|
1252
|
+
}
|
|
1253
|
+
return this.contract.write.recoverERC721([token, recipient, tokenId, data] as const, options) as Promise<`0x${string}`>;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* renounceOwnership
|
|
1258
|
+
* nonpayable
|
|
1259
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1260
|
+
*/
|
|
1261
|
+
async renounceOwnership(options?: {
|
|
1262
|
+
accessList?: import('viem').AccessList;
|
|
1263
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1264
|
+
chain?: import('viem').Chain | null;
|
|
1265
|
+
dataSuffix?: `0x${string}`;
|
|
1266
|
+
gas?: bigint;
|
|
1267
|
+
gasPrice?: bigint;
|
|
1268
|
+
maxFeePerGas?: bigint;
|
|
1269
|
+
maxPriorityFeePerGas?: bigint;
|
|
1270
|
+
nonce?: number;
|
|
1271
|
+
value?: bigint;
|
|
1272
|
+
}): Promise<`0x${string}`> {
|
|
1273
|
+
if (!this.contract.write) {
|
|
1274
|
+
throw new Error('Wallet client is required for write operations');
|
|
1275
|
+
}
|
|
1276
|
+
return this.contract.write.renounceOwnership(options) as Promise<`0x${string}`>;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* transfer
|
|
1281
|
+
* nonpayable
|
|
1282
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1283
|
+
*/
|
|
1284
|
+
async transfer(recipient: `0x${string}`, amount: bigint, options?: {
|
|
1285
|
+
accessList?: import('viem').AccessList;
|
|
1286
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1287
|
+
chain?: import('viem').Chain | null;
|
|
1288
|
+
dataSuffix?: `0x${string}`;
|
|
1289
|
+
gas?: bigint;
|
|
1290
|
+
gasPrice?: bigint;
|
|
1291
|
+
maxFeePerGas?: bigint;
|
|
1292
|
+
maxPriorityFeePerGas?: bigint;
|
|
1293
|
+
nonce?: number;
|
|
1294
|
+
value?: bigint;
|
|
1295
|
+
}): Promise<`0x${string}`> {
|
|
1296
|
+
if (!this.contract.write) {
|
|
1297
|
+
throw new Error('Wallet client is required for write operations');
|
|
1298
|
+
}
|
|
1299
|
+
return this.contract.write.transfer([recipient, amount] as const, options) as Promise<`0x${string}`>;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* transferFrom
|
|
1304
|
+
* nonpayable
|
|
1305
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1306
|
+
*/
|
|
1307
|
+
async transferFrom(spender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
|
|
1308
|
+
accessList?: import('viem').AccessList;
|
|
1309
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1310
|
+
chain?: import('viem').Chain | null;
|
|
1311
|
+
dataSuffix?: `0x${string}`;
|
|
1312
|
+
gas?: bigint;
|
|
1313
|
+
gasPrice?: bigint;
|
|
1314
|
+
maxFeePerGas?: bigint;
|
|
1315
|
+
maxPriorityFeePerGas?: bigint;
|
|
1316
|
+
nonce?: number;
|
|
1317
|
+
value?: bigint;
|
|
1318
|
+
}): Promise<`0x${string}`> {
|
|
1319
|
+
if (!this.contract.write) {
|
|
1320
|
+
throw new Error('Wallet client is required for write operations');
|
|
1321
|
+
}
|
|
1322
|
+
return this.contract.write.transferFrom([spender, recipient, amount] as const, options) as Promise<`0x${string}`>;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* transferOwnership
|
|
1327
|
+
* nonpayable
|
|
1328
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1329
|
+
*/
|
|
1330
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1331
|
+
accessList?: import('viem').AccessList;
|
|
1332
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1333
|
+
chain?: import('viem').Chain | null;
|
|
1334
|
+
dataSuffix?: `0x${string}`;
|
|
1335
|
+
gas?: bigint;
|
|
1336
|
+
gasPrice?: bigint;
|
|
1337
|
+
maxFeePerGas?: bigint;
|
|
1338
|
+
maxPriorityFeePerGas?: bigint;
|
|
1339
|
+
nonce?: number;
|
|
1340
|
+
value?: bigint;
|
|
1341
|
+
}): Promise<`0x${string}`> {
|
|
1342
|
+
if (!this.contract.write) {
|
|
1343
|
+
throw new Error('Wallet client is required for write operations');
|
|
1344
|
+
}
|
|
1345
|
+
return this.contract.write.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1352
|
+
*
|
|
1353
|
+
* @example
|
|
1354
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1355
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1356
|
+
* console.log('Would succeed:', result.result);
|
|
1357
|
+
*/
|
|
1358
|
+
get simulate() {
|
|
1359
|
+
const contract = this.contract;
|
|
1360
|
+
if (!contract.simulate) {
|
|
1361
|
+
throw new Error('Public client is required for simulation');
|
|
1362
|
+
}
|
|
1363
|
+
return {
|
|
1364
|
+
/**
|
|
1365
|
+
* Simulate approve
|
|
1366
|
+
* Returns gas estimate and result without sending transaction
|
|
1367
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1368
|
+
*/
|
|
1369
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
1370
|
+
accessList?: import('viem').AccessList;
|
|
1371
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1372
|
+
chain?: import('viem').Chain | null;
|
|
1373
|
+
dataSuffix?: `0x${string}`;
|
|
1374
|
+
gas?: bigint;
|
|
1375
|
+
gasPrice?: bigint;
|
|
1376
|
+
maxFeePerGas?: bigint;
|
|
1377
|
+
maxPriorityFeePerGas?: bigint;
|
|
1378
|
+
nonce?: number;
|
|
1379
|
+
value?: bigint;
|
|
1380
|
+
}): Promise<boolean> {
|
|
1381
|
+
return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
|
|
1382
|
+
},
|
|
1383
|
+
/**
|
|
1384
|
+
* Simulate approveAndCall
|
|
1385
|
+
* Returns gas estimate and result without sending transaction
|
|
1386
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1387
|
+
*/
|
|
1388
|
+
async approveAndCall(spender: `0x${string}`, amount: bigint, extraData: `0x${string}`, options?: {
|
|
1389
|
+
accessList?: import('viem').AccessList;
|
|
1390
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1391
|
+
chain?: import('viem').Chain | null;
|
|
1392
|
+
dataSuffix?: `0x${string}`;
|
|
1393
|
+
gas?: bigint;
|
|
1394
|
+
gasPrice?: bigint;
|
|
1395
|
+
maxFeePerGas?: bigint;
|
|
1396
|
+
maxPriorityFeePerGas?: bigint;
|
|
1397
|
+
nonce?: number;
|
|
1398
|
+
value?: bigint;
|
|
1399
|
+
}): Promise<boolean> {
|
|
1400
|
+
return contract.simulate.approveAndCall([spender, amount, extraData] as const, options) as Promise<boolean>;
|
|
1401
|
+
},
|
|
1402
|
+
/**
|
|
1403
|
+
* Simulate burn
|
|
1404
|
+
* Returns gas estimate and result without sending transaction
|
|
1405
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1406
|
+
*/
|
|
1407
|
+
async burn(amount: bigint, options?: {
|
|
1408
|
+
accessList?: import('viem').AccessList;
|
|
1409
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1410
|
+
chain?: import('viem').Chain | null;
|
|
1411
|
+
dataSuffix?: `0x${string}`;
|
|
1412
|
+
gas?: bigint;
|
|
1413
|
+
gasPrice?: bigint;
|
|
1414
|
+
maxFeePerGas?: bigint;
|
|
1415
|
+
maxPriorityFeePerGas?: bigint;
|
|
1416
|
+
nonce?: number;
|
|
1417
|
+
value?: bigint;
|
|
1418
|
+
}): Promise<void> {
|
|
1419
|
+
return contract.simulate.burn([amount] as const, options) as Promise<void>;
|
|
1420
|
+
},
|
|
1421
|
+
/**
|
|
1422
|
+
* Simulate burnFrom
|
|
1423
|
+
* Returns gas estimate and result without sending transaction
|
|
1424
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1425
|
+
*/
|
|
1426
|
+
async burnFrom(account: `0x${string}`, amount: bigint, options?: {
|
|
1427
|
+
accessList?: import('viem').AccessList;
|
|
1428
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1429
|
+
chain?: import('viem').Chain | null;
|
|
1430
|
+
dataSuffix?: `0x${string}`;
|
|
1431
|
+
gas?: bigint;
|
|
1432
|
+
gasPrice?: bigint;
|
|
1433
|
+
maxFeePerGas?: bigint;
|
|
1434
|
+
maxPriorityFeePerGas?: bigint;
|
|
1435
|
+
nonce?: number;
|
|
1436
|
+
value?: bigint;
|
|
1437
|
+
}): Promise<void> {
|
|
1438
|
+
return contract.simulate.burnFrom([account, amount] as const, options) as Promise<void>;
|
|
1439
|
+
},
|
|
1440
|
+
/**
|
|
1441
|
+
* Simulate delegate
|
|
1442
|
+
* Returns gas estimate and result without sending transaction
|
|
1443
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1444
|
+
*/
|
|
1445
|
+
async delegate(delegatee: `0x${string}`, options?: {
|
|
1446
|
+
accessList?: import('viem').AccessList;
|
|
1447
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1448
|
+
chain?: import('viem').Chain | null;
|
|
1449
|
+
dataSuffix?: `0x${string}`;
|
|
1450
|
+
gas?: bigint;
|
|
1451
|
+
gasPrice?: bigint;
|
|
1452
|
+
maxFeePerGas?: bigint;
|
|
1453
|
+
maxPriorityFeePerGas?: bigint;
|
|
1454
|
+
nonce?: number;
|
|
1455
|
+
value?: bigint;
|
|
1456
|
+
}): Promise<void> {
|
|
1457
|
+
return contract.simulate.delegate([delegatee] as const, options) as Promise<void>;
|
|
1458
|
+
},
|
|
1459
|
+
/**
|
|
1460
|
+
* Simulate delegateBySig
|
|
1461
|
+
* Returns gas estimate and result without sending transaction
|
|
1462
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1463
|
+
*/
|
|
1464
|
+
async delegateBySig(signatory: `0x${string}`, delegatee: `0x${string}`, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
|
|
1465
|
+
accessList?: import('viem').AccessList;
|
|
1466
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1467
|
+
chain?: import('viem').Chain | null;
|
|
1468
|
+
dataSuffix?: `0x${string}`;
|
|
1469
|
+
gas?: bigint;
|
|
1470
|
+
gasPrice?: bigint;
|
|
1471
|
+
maxFeePerGas?: bigint;
|
|
1472
|
+
maxPriorityFeePerGas?: bigint;
|
|
1473
|
+
nonce?: number;
|
|
1474
|
+
value?: bigint;
|
|
1475
|
+
}): Promise<void> {
|
|
1476
|
+
return contract.simulate.delegateBySig([signatory, delegatee, deadline, v, r, s] as const, options) as Promise<void>;
|
|
1477
|
+
},
|
|
1478
|
+
/**
|
|
1479
|
+
* Simulate mint
|
|
1480
|
+
* Returns gas estimate and result without sending transaction
|
|
1481
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1482
|
+
*/
|
|
1483
|
+
async mint(recipient: `0x${string}`, amount: bigint, options?: {
|
|
1484
|
+
accessList?: import('viem').AccessList;
|
|
1485
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1486
|
+
chain?: import('viem').Chain | null;
|
|
1487
|
+
dataSuffix?: `0x${string}`;
|
|
1488
|
+
gas?: bigint;
|
|
1489
|
+
gasPrice?: bigint;
|
|
1490
|
+
maxFeePerGas?: bigint;
|
|
1491
|
+
maxPriorityFeePerGas?: bigint;
|
|
1492
|
+
nonce?: number;
|
|
1493
|
+
value?: bigint;
|
|
1494
|
+
}): Promise<void> {
|
|
1495
|
+
return contract.simulate.mint([recipient, amount] as const, options) as Promise<void>;
|
|
1496
|
+
},
|
|
1497
|
+
/**
|
|
1498
|
+
* Simulate permit
|
|
1499
|
+
* Returns gas estimate and result without sending transaction
|
|
1500
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1501
|
+
*/
|
|
1502
|
+
async permit(owner: `0x${string}`, spender: `0x${string}`, amount: bigint, deadline: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
|
|
1503
|
+
accessList?: import('viem').AccessList;
|
|
1504
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1505
|
+
chain?: import('viem').Chain | null;
|
|
1506
|
+
dataSuffix?: `0x${string}`;
|
|
1507
|
+
gas?: bigint;
|
|
1508
|
+
gasPrice?: bigint;
|
|
1509
|
+
maxFeePerGas?: bigint;
|
|
1510
|
+
maxPriorityFeePerGas?: bigint;
|
|
1511
|
+
nonce?: number;
|
|
1512
|
+
value?: bigint;
|
|
1513
|
+
}): Promise<void> {
|
|
1514
|
+
return contract.simulate.permit([owner, spender, amount, deadline, v, r, s] as const, options) as Promise<void>;
|
|
1515
|
+
},
|
|
1516
|
+
/**
|
|
1517
|
+
* Simulate recoverERC20
|
|
1518
|
+
* Returns gas estimate and result without sending transaction
|
|
1519
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1520
|
+
*/
|
|
1521
|
+
async recoverERC20(token: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
|
|
1522
|
+
accessList?: import('viem').AccessList;
|
|
1523
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1524
|
+
chain?: import('viem').Chain | null;
|
|
1525
|
+
dataSuffix?: `0x${string}`;
|
|
1526
|
+
gas?: bigint;
|
|
1527
|
+
gasPrice?: bigint;
|
|
1528
|
+
maxFeePerGas?: bigint;
|
|
1529
|
+
maxPriorityFeePerGas?: bigint;
|
|
1530
|
+
nonce?: number;
|
|
1531
|
+
value?: bigint;
|
|
1532
|
+
}): Promise<void> {
|
|
1533
|
+
return contract.simulate.recoverERC20([token, recipient, amount] as const, options) as Promise<void>;
|
|
1534
|
+
},
|
|
1535
|
+
/**
|
|
1536
|
+
* Simulate recoverERC721
|
|
1537
|
+
* Returns gas estimate and result without sending transaction
|
|
1538
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1539
|
+
*/
|
|
1540
|
+
async recoverERC721(token: `0x${string}`, recipient: `0x${string}`, tokenId: bigint, data: `0x${string}`, options?: {
|
|
1541
|
+
accessList?: import('viem').AccessList;
|
|
1542
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1543
|
+
chain?: import('viem').Chain | null;
|
|
1544
|
+
dataSuffix?: `0x${string}`;
|
|
1545
|
+
gas?: bigint;
|
|
1546
|
+
gasPrice?: bigint;
|
|
1547
|
+
maxFeePerGas?: bigint;
|
|
1548
|
+
maxPriorityFeePerGas?: bigint;
|
|
1549
|
+
nonce?: number;
|
|
1550
|
+
value?: bigint;
|
|
1551
|
+
}): Promise<void> {
|
|
1552
|
+
return contract.simulate.recoverERC721([token, recipient, tokenId, data] as const, options) as Promise<void>;
|
|
1553
|
+
},
|
|
1554
|
+
/**
|
|
1555
|
+
* Simulate renounceOwnership
|
|
1556
|
+
* Returns gas estimate and result without sending transaction
|
|
1557
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1558
|
+
*/
|
|
1559
|
+
async renounceOwnership(options?: {
|
|
1560
|
+
accessList?: import('viem').AccessList;
|
|
1561
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1562
|
+
chain?: import('viem').Chain | null;
|
|
1563
|
+
dataSuffix?: `0x${string}`;
|
|
1564
|
+
gas?: bigint;
|
|
1565
|
+
gasPrice?: bigint;
|
|
1566
|
+
maxFeePerGas?: bigint;
|
|
1567
|
+
maxPriorityFeePerGas?: bigint;
|
|
1568
|
+
nonce?: number;
|
|
1569
|
+
value?: bigint;
|
|
1570
|
+
}): Promise<void> {
|
|
1571
|
+
return contract.simulate.renounceOwnership(options) as Promise<void>;
|
|
1572
|
+
},
|
|
1573
|
+
/**
|
|
1574
|
+
* Simulate transfer
|
|
1575
|
+
* Returns gas estimate and result without sending transaction
|
|
1576
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1577
|
+
*/
|
|
1578
|
+
async transfer(recipient: `0x${string}`, amount: bigint, options?: {
|
|
1579
|
+
accessList?: import('viem').AccessList;
|
|
1580
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1581
|
+
chain?: import('viem').Chain | null;
|
|
1582
|
+
dataSuffix?: `0x${string}`;
|
|
1583
|
+
gas?: bigint;
|
|
1584
|
+
gasPrice?: bigint;
|
|
1585
|
+
maxFeePerGas?: bigint;
|
|
1586
|
+
maxPriorityFeePerGas?: bigint;
|
|
1587
|
+
nonce?: number;
|
|
1588
|
+
value?: bigint;
|
|
1589
|
+
}): Promise<boolean> {
|
|
1590
|
+
return contract.simulate.transfer([recipient, amount] as const, options) as Promise<boolean>;
|
|
1591
|
+
},
|
|
1592
|
+
/**
|
|
1593
|
+
* Simulate transferFrom
|
|
1594
|
+
* Returns gas estimate and result without sending transaction
|
|
1595
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1596
|
+
*/
|
|
1597
|
+
async transferFrom(spender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
|
|
1598
|
+
accessList?: import('viem').AccessList;
|
|
1599
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1600
|
+
chain?: import('viem').Chain | null;
|
|
1601
|
+
dataSuffix?: `0x${string}`;
|
|
1602
|
+
gas?: bigint;
|
|
1603
|
+
gasPrice?: bigint;
|
|
1604
|
+
maxFeePerGas?: bigint;
|
|
1605
|
+
maxPriorityFeePerGas?: bigint;
|
|
1606
|
+
nonce?: number;
|
|
1607
|
+
value?: bigint;
|
|
1608
|
+
}): Promise<boolean> {
|
|
1609
|
+
return contract.simulate.transferFrom([spender, recipient, amount] as const, options) as Promise<boolean>;
|
|
1610
|
+
},
|
|
1611
|
+
/**
|
|
1612
|
+
* Simulate transferOwnership
|
|
1613
|
+
* Returns gas estimate and result without sending transaction
|
|
1614
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1615
|
+
*/
|
|
1616
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1617
|
+
accessList?: import('viem').AccessList;
|
|
1618
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1619
|
+
chain?: import('viem').Chain | null;
|
|
1620
|
+
dataSuffix?: `0x${string}`;
|
|
1621
|
+
gas?: bigint;
|
|
1622
|
+
gasPrice?: bigint;
|
|
1623
|
+
maxFeePerGas?: bigint;
|
|
1624
|
+
maxPriorityFeePerGas?: bigint;
|
|
1625
|
+
nonce?: number;
|
|
1626
|
+
value?: bigint;
|
|
1627
|
+
}): Promise<void> {
|
|
1628
|
+
return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<void>;
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Watch contract events
|
|
1635
|
+
*
|
|
1636
|
+
* @example
|
|
1637
|
+
* // Watch all Transfer events
|
|
1638
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1639
|
+
* console.log('Transfer:', event);
|
|
1640
|
+
* });
|
|
1641
|
+
*
|
|
1642
|
+
* // Stop watching
|
|
1643
|
+
* unwatch();
|
|
1644
|
+
*/
|
|
1645
|
+
get watch() {
|
|
1646
|
+
return {
|
|
1647
|
+
/**
|
|
1648
|
+
* Watch Approval events
|
|
1649
|
+
* @param callback Function to call when event is emitted
|
|
1650
|
+
* @param filter Optional filter for indexed parameters
|
|
1651
|
+
* @returns Unwatch function to stop listening
|
|
1652
|
+
*/
|
|
1653
|
+
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner?: `0x${string}` | `0x${string}`[] | null; spender?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1654
|
+
return this.publicClient.watchContractEvent({
|
|
1655
|
+
address: this.contractAddress,
|
|
1656
|
+
abi: TAbi,
|
|
1657
|
+
eventName: 'Approval',
|
|
1658
|
+
args: filter as any,
|
|
1659
|
+
onLogs: (logs: any[]) => {
|
|
1660
|
+
logs.forEach((log: any) => {
|
|
1661
|
+
callback(log.args as any);
|
|
1662
|
+
});
|
|
1663
|
+
},
|
|
1664
|
+
}) as () => void;
|
|
1665
|
+
},
|
|
1666
|
+
/**
|
|
1667
|
+
* Watch DelegateChanged events
|
|
1668
|
+
* @param callback Function to call when event is emitted
|
|
1669
|
+
* @param filter Optional filter for indexed parameters
|
|
1670
|
+
* @returns Unwatch function to stop listening
|
|
1671
|
+
*/
|
|
1672
|
+
DelegateChanged: (callback: (event: { delegator: `0x${string}`; fromDelegate: `0x${string}`; toDelegate: `0x${string}` }) => void, filter?: { delegator?: `0x${string}` | `0x${string}`[] | null; fromDelegate?: `0x${string}` | `0x${string}`[] | null; toDelegate?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1673
|
+
return this.publicClient.watchContractEvent({
|
|
1674
|
+
address: this.contractAddress,
|
|
1675
|
+
abi: TAbi,
|
|
1676
|
+
eventName: 'DelegateChanged',
|
|
1677
|
+
args: filter as any,
|
|
1678
|
+
onLogs: (logs: any[]) => {
|
|
1679
|
+
logs.forEach((log: any) => {
|
|
1680
|
+
callback(log.args as any);
|
|
1681
|
+
});
|
|
1682
|
+
},
|
|
1683
|
+
}) as () => void;
|
|
1684
|
+
},
|
|
1685
|
+
/**
|
|
1686
|
+
* Watch DelegateVotesChanged events
|
|
1687
|
+
* @param callback Function to call when event is emitted
|
|
1688
|
+
* @param filter Optional filter for indexed parameters
|
|
1689
|
+
* @returns Unwatch function to stop listening
|
|
1690
|
+
*/
|
|
1691
|
+
DelegateVotesChanged: (callback: (event: { delegate: `0x${string}`; previousBalance: bigint; newBalance: bigint }) => void, filter?: { delegate?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1692
|
+
return this.publicClient.watchContractEvent({
|
|
1693
|
+
address: this.contractAddress,
|
|
1694
|
+
abi: TAbi,
|
|
1695
|
+
eventName: 'DelegateVotesChanged',
|
|
1696
|
+
args: filter as any,
|
|
1697
|
+
onLogs: (logs: any[]) => {
|
|
1698
|
+
logs.forEach((log: any) => {
|
|
1699
|
+
callback(log.args as any);
|
|
1700
|
+
});
|
|
1701
|
+
},
|
|
1702
|
+
}) as () => void;
|
|
1703
|
+
},
|
|
1704
|
+
/**
|
|
1705
|
+
* Watch OwnershipTransferred events
|
|
1706
|
+
* @param callback Function to call when event is emitted
|
|
1707
|
+
* @param filter Optional filter for indexed parameters
|
|
1708
|
+
* @returns Unwatch function to stop listening
|
|
1709
|
+
*/
|
|
1710
|
+
OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner?: `0x${string}` | `0x${string}`[] | null; newOwner?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1711
|
+
return this.publicClient.watchContractEvent({
|
|
1712
|
+
address: this.contractAddress,
|
|
1713
|
+
abi: TAbi,
|
|
1714
|
+
eventName: 'OwnershipTransferred',
|
|
1715
|
+
args: filter as any,
|
|
1716
|
+
onLogs: (logs: any[]) => {
|
|
1717
|
+
logs.forEach((log: any) => {
|
|
1718
|
+
callback(log.args as any);
|
|
1719
|
+
});
|
|
1720
|
+
},
|
|
1721
|
+
}) as () => void;
|
|
1722
|
+
},
|
|
1723
|
+
/**
|
|
1724
|
+
* Watch Transfer events
|
|
1725
|
+
* @param callback Function to call when event is emitted
|
|
1726
|
+
* @param filter Optional filter for indexed parameters
|
|
1727
|
+
* @returns Unwatch function to stop listening
|
|
1728
|
+
*/
|
|
1729
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from?: `0x${string}` | `0x${string}`[] | null; to?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1730
|
+
return this.publicClient.watchContractEvent({
|
|
1731
|
+
address: this.contractAddress,
|
|
1732
|
+
abi: TAbi,
|
|
1733
|
+
eventName: 'Transfer',
|
|
1734
|
+
args: filter as any,
|
|
1735
|
+
onLogs: (logs: any[]) => {
|
|
1736
|
+
logs.forEach((log: any) => {
|
|
1737
|
+
callback(log.args as any);
|
|
1738
|
+
});
|
|
1739
|
+
},
|
|
1740
|
+
}) as () => void;
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1744
|
+
}
|