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