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