@gitmyabi-stg/borg 0.0.1

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