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