@gitmyabi/dot 1.0.2 → 1.0.3

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