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