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