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