@gitmyabi/artlr 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,859 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Aartaler_json = exports.Aartaler_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * Aartaler_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.Aartaler_jsonAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "string",
15
+ "name": "name_",
16
+ "type": "string"
17
+ },
18
+ {
19
+ "internalType": "string",
20
+ "name": "symbol_",
21
+ "type": "string"
22
+ },
23
+ {
24
+ "internalType": "address",
25
+ "name": "initialOwner_",
26
+ "type": "address"
27
+ }
28
+ ],
29
+ "stateMutability": "nonpayable",
30
+ "type": "constructor"
31
+ },
32
+ {
33
+ "inputs": [
34
+ {
35
+ "internalType": "address",
36
+ "name": "spender",
37
+ "type": "address"
38
+ },
39
+ {
40
+ "internalType": "uint256",
41
+ "name": "allowance",
42
+ "type": "uint256"
43
+ },
44
+ {
45
+ "internalType": "uint256",
46
+ "name": "needed",
47
+ "type": "uint256"
48
+ }
49
+ ],
50
+ "name": "ERC20InsufficientAllowance",
51
+ "type": "error"
52
+ },
53
+ {
54
+ "inputs": [
55
+ {
56
+ "internalType": "address",
57
+ "name": "sender",
58
+ "type": "address"
59
+ },
60
+ {
61
+ "internalType": "uint256",
62
+ "name": "balance",
63
+ "type": "uint256"
64
+ },
65
+ {
66
+ "internalType": "uint256",
67
+ "name": "needed",
68
+ "type": "uint256"
69
+ }
70
+ ],
71
+ "name": "ERC20InsufficientBalance",
72
+ "type": "error"
73
+ },
74
+ {
75
+ "inputs": [
76
+ {
77
+ "internalType": "address",
78
+ "name": "approver",
79
+ "type": "address"
80
+ }
81
+ ],
82
+ "name": "ERC20InvalidApprover",
83
+ "type": "error"
84
+ },
85
+ {
86
+ "inputs": [
87
+ {
88
+ "internalType": "address",
89
+ "name": "receiver",
90
+ "type": "address"
91
+ }
92
+ ],
93
+ "name": "ERC20InvalidReceiver",
94
+ "type": "error"
95
+ },
96
+ {
97
+ "inputs": [
98
+ {
99
+ "internalType": "address",
100
+ "name": "sender",
101
+ "type": "address"
102
+ }
103
+ ],
104
+ "name": "ERC20InvalidSender",
105
+ "type": "error"
106
+ },
107
+ {
108
+ "inputs": [
109
+ {
110
+ "internalType": "address",
111
+ "name": "spender",
112
+ "type": "address"
113
+ }
114
+ ],
115
+ "name": "ERC20InvalidSpender",
116
+ "type": "error"
117
+ },
118
+ {
119
+ "inputs": [
120
+ {
121
+ "internalType": "address",
122
+ "name": "owner",
123
+ "type": "address"
124
+ }
125
+ ],
126
+ "name": "OwnableInvalidOwner",
127
+ "type": "error"
128
+ },
129
+ {
130
+ "inputs": [
131
+ {
132
+ "internalType": "address",
133
+ "name": "account",
134
+ "type": "address"
135
+ }
136
+ ],
137
+ "name": "OwnableUnauthorizedAccount",
138
+ "type": "error"
139
+ },
140
+ {
141
+ "anonymous": false,
142
+ "inputs": [
143
+ {
144
+ "indexed": true,
145
+ "internalType": "address",
146
+ "name": "owner",
147
+ "type": "address"
148
+ },
149
+ {
150
+ "indexed": true,
151
+ "internalType": "address",
152
+ "name": "spender",
153
+ "type": "address"
154
+ },
155
+ {
156
+ "indexed": false,
157
+ "internalType": "uint256",
158
+ "name": "value",
159
+ "type": "uint256"
160
+ }
161
+ ],
162
+ "name": "Approval",
163
+ "type": "event"
164
+ },
165
+ {
166
+ "anonymous": false,
167
+ "inputs": [
168
+ {
169
+ "indexed": true,
170
+ "internalType": "address",
171
+ "name": "previousOwner",
172
+ "type": "address"
173
+ },
174
+ {
175
+ "indexed": true,
176
+ "internalType": "address",
177
+ "name": "newOwner",
178
+ "type": "address"
179
+ }
180
+ ],
181
+ "name": "OwnershipTransferStarted",
182
+ "type": "event"
183
+ },
184
+ {
185
+ "anonymous": false,
186
+ "inputs": [
187
+ {
188
+ "indexed": true,
189
+ "internalType": "address",
190
+ "name": "previousOwner",
191
+ "type": "address"
192
+ },
193
+ {
194
+ "indexed": true,
195
+ "internalType": "address",
196
+ "name": "newOwner",
197
+ "type": "address"
198
+ }
199
+ ],
200
+ "name": "OwnershipTransferred",
201
+ "type": "event"
202
+ },
203
+ {
204
+ "anonymous": false,
205
+ "inputs": [
206
+ {
207
+ "indexed": true,
208
+ "internalType": "address",
209
+ "name": "from",
210
+ "type": "address"
211
+ },
212
+ {
213
+ "indexed": true,
214
+ "internalType": "address",
215
+ "name": "to",
216
+ "type": "address"
217
+ },
218
+ {
219
+ "indexed": false,
220
+ "internalType": "uint256",
221
+ "name": "value",
222
+ "type": "uint256"
223
+ }
224
+ ],
225
+ "name": "Transfer",
226
+ "type": "event"
227
+ },
228
+ {
229
+ "inputs": [],
230
+ "name": "acceptOwnership",
231
+ "outputs": [],
232
+ "stateMutability": "nonpayable",
233
+ "type": "function"
234
+ },
235
+ {
236
+ "inputs": [
237
+ {
238
+ "internalType": "address",
239
+ "name": "owner",
240
+ "type": "address"
241
+ },
242
+ {
243
+ "internalType": "address",
244
+ "name": "spender",
245
+ "type": "address"
246
+ }
247
+ ],
248
+ "name": "allowance",
249
+ "outputs": [
250
+ {
251
+ "internalType": "uint256",
252
+ "name": "",
253
+ "type": "uint256"
254
+ }
255
+ ],
256
+ "stateMutability": "view",
257
+ "type": "function"
258
+ },
259
+ {
260
+ "inputs": [
261
+ {
262
+ "internalType": "address",
263
+ "name": "spender",
264
+ "type": "address"
265
+ },
266
+ {
267
+ "internalType": "uint256",
268
+ "name": "value",
269
+ "type": "uint256"
270
+ }
271
+ ],
272
+ "name": "approve",
273
+ "outputs": [
274
+ {
275
+ "internalType": "bool",
276
+ "name": "",
277
+ "type": "bool"
278
+ }
279
+ ],
280
+ "stateMutability": "nonpayable",
281
+ "type": "function"
282
+ },
283
+ {
284
+ "inputs": [
285
+ {
286
+ "internalType": "address",
287
+ "name": "account",
288
+ "type": "address"
289
+ }
290
+ ],
291
+ "name": "balanceOf",
292
+ "outputs": [
293
+ {
294
+ "internalType": "uint256",
295
+ "name": "",
296
+ "type": "uint256"
297
+ }
298
+ ],
299
+ "stateMutability": "view",
300
+ "type": "function"
301
+ },
302
+ {
303
+ "inputs": [
304
+ {
305
+ "internalType": "uint256",
306
+ "name": "amount",
307
+ "type": "uint256"
308
+ }
309
+ ],
310
+ "name": "burn",
311
+ "outputs": [],
312
+ "stateMutability": "nonpayable",
313
+ "type": "function"
314
+ },
315
+ {
316
+ "inputs": [],
317
+ "name": "decimals",
318
+ "outputs": [
319
+ {
320
+ "internalType": "uint8",
321
+ "name": "",
322
+ "type": "uint8"
323
+ }
324
+ ],
325
+ "stateMutability": "pure",
326
+ "type": "function"
327
+ },
328
+ {
329
+ "inputs": [
330
+ {
331
+ "internalType": "address",
332
+ "name": "to",
333
+ "type": "address"
334
+ },
335
+ {
336
+ "internalType": "uint256",
337
+ "name": "amount",
338
+ "type": "uint256"
339
+ }
340
+ ],
341
+ "name": "mint",
342
+ "outputs": [],
343
+ "stateMutability": "nonpayable",
344
+ "type": "function"
345
+ },
346
+ {
347
+ "inputs": [],
348
+ "name": "name",
349
+ "outputs": [
350
+ {
351
+ "internalType": "string",
352
+ "name": "",
353
+ "type": "string"
354
+ }
355
+ ],
356
+ "stateMutability": "view",
357
+ "type": "function"
358
+ },
359
+ {
360
+ "inputs": [],
361
+ "name": "owner",
362
+ "outputs": [
363
+ {
364
+ "internalType": "address",
365
+ "name": "",
366
+ "type": "address"
367
+ }
368
+ ],
369
+ "stateMutability": "view",
370
+ "type": "function"
371
+ },
372
+ {
373
+ "inputs": [],
374
+ "name": "pendingOwner",
375
+ "outputs": [
376
+ {
377
+ "internalType": "address",
378
+ "name": "",
379
+ "type": "address"
380
+ }
381
+ ],
382
+ "stateMutability": "view",
383
+ "type": "function"
384
+ },
385
+ {
386
+ "inputs": [],
387
+ "name": "renounceOwnership",
388
+ "outputs": [],
389
+ "stateMutability": "nonpayable",
390
+ "type": "function"
391
+ },
392
+ {
393
+ "inputs": [],
394
+ "name": "symbol",
395
+ "outputs": [
396
+ {
397
+ "internalType": "string",
398
+ "name": "",
399
+ "type": "string"
400
+ }
401
+ ],
402
+ "stateMutability": "view",
403
+ "type": "function"
404
+ },
405
+ {
406
+ "inputs": [],
407
+ "name": "totalSupply",
408
+ "outputs": [
409
+ {
410
+ "internalType": "uint256",
411
+ "name": "",
412
+ "type": "uint256"
413
+ }
414
+ ],
415
+ "stateMutability": "view",
416
+ "type": "function"
417
+ },
418
+ {
419
+ "inputs": [
420
+ {
421
+ "internalType": "address",
422
+ "name": "to",
423
+ "type": "address"
424
+ },
425
+ {
426
+ "internalType": "uint256",
427
+ "name": "value",
428
+ "type": "uint256"
429
+ }
430
+ ],
431
+ "name": "transfer",
432
+ "outputs": [
433
+ {
434
+ "internalType": "bool",
435
+ "name": "",
436
+ "type": "bool"
437
+ }
438
+ ],
439
+ "stateMutability": "nonpayable",
440
+ "type": "function"
441
+ },
442
+ {
443
+ "inputs": [
444
+ {
445
+ "internalType": "address",
446
+ "name": "from",
447
+ "type": "address"
448
+ },
449
+ {
450
+ "internalType": "address",
451
+ "name": "to",
452
+ "type": "address"
453
+ },
454
+ {
455
+ "internalType": "uint256",
456
+ "name": "value",
457
+ "type": "uint256"
458
+ }
459
+ ],
460
+ "name": "transferFrom",
461
+ "outputs": [
462
+ {
463
+ "internalType": "bool",
464
+ "name": "",
465
+ "type": "bool"
466
+ }
467
+ ],
468
+ "stateMutability": "nonpayable",
469
+ "type": "function"
470
+ },
471
+ {
472
+ "inputs": [
473
+ {
474
+ "internalType": "address",
475
+ "name": "newOwner",
476
+ "type": "address"
477
+ }
478
+ ],
479
+ "name": "transferOwnership",
480
+ "outputs": [],
481
+ "stateMutability": "nonpayable",
482
+ "type": "function"
483
+ }
484
+ ];
485
+ /**
486
+ * Aartaler_json Contract Class
487
+ *
488
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
489
+ *
490
+ * @example
491
+ * ```typescript
492
+ * import { createPublicClient, createWalletClient, http } from 'viem';
493
+ * import { mainnet } from 'viem/chains';
494
+ * import { Aartaler_json } from 'Aartaler_json';
495
+ *
496
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
497
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
498
+ *
499
+ * const contract = new Aartaler_json('0x...', { publicClient, walletClient });
500
+ *
501
+ * // Read functions
502
+ * const result = await contract.balanceOf('0x...');
503
+ *
504
+ * // Write functions
505
+ * const hash = await contract.transfer('0x...', 1000n);
506
+ *
507
+ * // Simulate transactions (dry-run)
508
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
509
+ * console.log('Gas estimate:', simulation.request.gas);
510
+ *
511
+ * // Watch events
512
+ * const unwatch = contract.watch.Transfer((event) => {
513
+ * console.log('Transfer event:', event);
514
+ * });
515
+ * ```
516
+ */
517
+ class Aartaler_json {
518
+ constructor(address, clients) {
519
+ this.contractAddress = address;
520
+ this.publicClient = clients.publicClient;
521
+ this.contract = (0, viem_1.getContract)({
522
+ address,
523
+ abi: exports.Aartaler_jsonAbi,
524
+ client: {
525
+ public: clients.publicClient,
526
+ wallet: clients.walletClient,
527
+ },
528
+ });
529
+ }
530
+ /**
531
+ * Get the contract address
532
+ */
533
+ get address() {
534
+ return this.contractAddress;
535
+ }
536
+ /**
537
+ * Get the underlying viem contract instance
538
+ */
539
+ getContract() {
540
+ return this.contract;
541
+ }
542
+ /**
543
+ * allowance
544
+ * view
545
+ */
546
+ async allowance(owner, spender) {
547
+ return this.contract.read.allowance([owner, spender]);
548
+ }
549
+ /**
550
+ * balanceOf
551
+ * view
552
+ */
553
+ async balanceOf(account) {
554
+ return this.contract.read.balanceOf([account]);
555
+ }
556
+ /**
557
+ * decimals
558
+ * pure
559
+ */
560
+ async decimals() {
561
+ return this.contract.read.decimals();
562
+ }
563
+ /**
564
+ * name
565
+ * view
566
+ */
567
+ async name() {
568
+ return this.contract.read.name();
569
+ }
570
+ /**
571
+ * owner
572
+ * view
573
+ */
574
+ async owner() {
575
+ return this.contract.read.owner();
576
+ }
577
+ /**
578
+ * pendingOwner
579
+ * view
580
+ */
581
+ async pendingOwner() {
582
+ return this.contract.read.pendingOwner();
583
+ }
584
+ /**
585
+ * symbol
586
+ * view
587
+ */
588
+ async symbol() {
589
+ return this.contract.read.symbol();
590
+ }
591
+ /**
592
+ * totalSupply
593
+ * view
594
+ */
595
+ async totalSupply() {
596
+ return this.contract.read.totalSupply();
597
+ }
598
+ /**
599
+ * acceptOwnership
600
+ * nonpayable
601
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
602
+ */
603
+ async acceptOwnership(options) {
604
+ if (!this.contract.write) {
605
+ throw new Error('Wallet client is required for write operations');
606
+ }
607
+ return this.contract.write.acceptOwnership(options);
608
+ }
609
+ /**
610
+ * approve
611
+ * nonpayable
612
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
613
+ */
614
+ async approve(spender, value, options) {
615
+ if (!this.contract.write) {
616
+ throw new Error('Wallet client is required for write operations');
617
+ }
618
+ return this.contract.write.approve([spender, value], options);
619
+ }
620
+ /**
621
+ * burn
622
+ * nonpayable
623
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
624
+ */
625
+ async burn(amount, options) {
626
+ if (!this.contract.write) {
627
+ throw new Error('Wallet client is required for write operations');
628
+ }
629
+ return this.contract.write.burn([amount], options);
630
+ }
631
+ /**
632
+ * mint
633
+ * nonpayable
634
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
635
+ */
636
+ async mint(to, amount, options) {
637
+ if (!this.contract.write) {
638
+ throw new Error('Wallet client is required for write operations');
639
+ }
640
+ return this.contract.write.mint([to, amount], options);
641
+ }
642
+ /**
643
+ * renounceOwnership
644
+ * nonpayable
645
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
646
+ */
647
+ async renounceOwnership(options) {
648
+ if (!this.contract.write) {
649
+ throw new Error('Wallet client is required for write operations');
650
+ }
651
+ return this.contract.write.renounceOwnership(options);
652
+ }
653
+ /**
654
+ * transfer
655
+ * nonpayable
656
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
657
+ */
658
+ async transfer(to, value, options) {
659
+ if (!this.contract.write) {
660
+ throw new Error('Wallet client is required for write operations');
661
+ }
662
+ return this.contract.write.transfer([to, value], options);
663
+ }
664
+ /**
665
+ * transferFrom
666
+ * nonpayable
667
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
668
+ */
669
+ async transferFrom(from, to, value, options) {
670
+ if (!this.contract.write) {
671
+ throw new Error('Wallet client is required for write operations');
672
+ }
673
+ return this.contract.write.transferFrom([from, to, value], options);
674
+ }
675
+ /**
676
+ * transferOwnership
677
+ * nonpayable
678
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
679
+ */
680
+ async transferOwnership(newOwner, options) {
681
+ if (!this.contract.write) {
682
+ throw new Error('Wallet client is required for write operations');
683
+ }
684
+ return this.contract.write.transferOwnership([newOwner], options);
685
+ }
686
+ /**
687
+ * Simulate contract write operations (dry-run without sending transaction)
688
+ *
689
+ * @example
690
+ * const result = await contract.simulate.transfer('0x...', 1000n);
691
+ * console.log('Gas estimate:', result.request.gas);
692
+ * console.log('Would succeed:', result.result);
693
+ */
694
+ get simulate() {
695
+ const contract = this.contract;
696
+ if (!contract.simulate) {
697
+ throw new Error('Public client is required for simulation');
698
+ }
699
+ return {
700
+ /**
701
+ * Simulate acceptOwnership
702
+ * Returns gas estimate and result without sending transaction
703
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
704
+ */
705
+ async acceptOwnership(options) {
706
+ return contract.simulate.acceptOwnership(options);
707
+ },
708
+ /**
709
+ * Simulate approve
710
+ * Returns gas estimate and result without sending transaction
711
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
712
+ */
713
+ async approve(spender, value, options) {
714
+ return contract.simulate.approve([spender, value], options);
715
+ },
716
+ /**
717
+ * Simulate burn
718
+ * Returns gas estimate and result without sending transaction
719
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
720
+ */
721
+ async burn(amount, options) {
722
+ return contract.simulate.burn([amount], options);
723
+ },
724
+ /**
725
+ * Simulate mint
726
+ * Returns gas estimate and result without sending transaction
727
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
728
+ */
729
+ async mint(to, amount, options) {
730
+ return contract.simulate.mint([to, amount], options);
731
+ },
732
+ /**
733
+ * Simulate renounceOwnership
734
+ * Returns gas estimate and result without sending transaction
735
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
736
+ */
737
+ async renounceOwnership(options) {
738
+ return contract.simulate.renounceOwnership(options);
739
+ },
740
+ /**
741
+ * Simulate transfer
742
+ * Returns gas estimate and result without sending transaction
743
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
744
+ */
745
+ async transfer(to, value, options) {
746
+ return contract.simulate.transfer([to, value], options);
747
+ },
748
+ /**
749
+ * Simulate transferFrom
750
+ * Returns gas estimate and result without sending transaction
751
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
752
+ */
753
+ async transferFrom(from, to, value, options) {
754
+ return contract.simulate.transferFrom([from, to, value], options);
755
+ },
756
+ /**
757
+ * Simulate transferOwnership
758
+ * Returns gas estimate and result without sending transaction
759
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
760
+ */
761
+ async transferOwnership(newOwner, options) {
762
+ return contract.simulate.transferOwnership([newOwner], options);
763
+ }
764
+ };
765
+ }
766
+ /**
767
+ * Watch contract events
768
+ *
769
+ * @example
770
+ * // Watch all Transfer events
771
+ * const unwatch = contract.watch.Transfer((event) => {
772
+ * console.log('Transfer:', event);
773
+ * });
774
+ *
775
+ * // Stop watching
776
+ * unwatch();
777
+ */
778
+ get watch() {
779
+ return {
780
+ /**
781
+ * Watch Approval events
782
+ * @param callback Function to call when event is emitted
783
+ * @param filter Optional filter for indexed parameters
784
+ * @returns Unwatch function to stop listening
785
+ */
786
+ Approval: (callback, filter) => {
787
+ return this.publicClient.watchContractEvent({
788
+ address: this.contractAddress,
789
+ abi: exports.Aartaler_jsonAbi,
790
+ eventName: 'Approval',
791
+ args: filter,
792
+ onLogs: (logs) => {
793
+ logs.forEach((log) => {
794
+ callback(log.args);
795
+ });
796
+ },
797
+ });
798
+ },
799
+ /**
800
+ * Watch OwnershipTransferStarted events
801
+ * @param callback Function to call when event is emitted
802
+ * @param filter Optional filter for indexed parameters
803
+ * @returns Unwatch function to stop listening
804
+ */
805
+ OwnershipTransferStarted: (callback, filter) => {
806
+ return this.publicClient.watchContractEvent({
807
+ address: this.contractAddress,
808
+ abi: exports.Aartaler_jsonAbi,
809
+ eventName: 'OwnershipTransferStarted',
810
+ args: filter,
811
+ onLogs: (logs) => {
812
+ logs.forEach((log) => {
813
+ callback(log.args);
814
+ });
815
+ },
816
+ });
817
+ },
818
+ /**
819
+ * Watch OwnershipTransferred events
820
+ * @param callback Function to call when event is emitted
821
+ * @param filter Optional filter for indexed parameters
822
+ * @returns Unwatch function to stop listening
823
+ */
824
+ OwnershipTransferred: (callback, filter) => {
825
+ return this.publicClient.watchContractEvent({
826
+ address: this.contractAddress,
827
+ abi: exports.Aartaler_jsonAbi,
828
+ eventName: 'OwnershipTransferred',
829
+ args: filter,
830
+ onLogs: (logs) => {
831
+ logs.forEach((log) => {
832
+ callback(log.args);
833
+ });
834
+ },
835
+ });
836
+ },
837
+ /**
838
+ * Watch Transfer events
839
+ * @param callback Function to call when event is emitted
840
+ * @param filter Optional filter for indexed parameters
841
+ * @returns Unwatch function to stop listening
842
+ */
843
+ Transfer: (callback, filter) => {
844
+ return this.publicClient.watchContractEvent({
845
+ address: this.contractAddress,
846
+ abi: exports.Aartaler_jsonAbi,
847
+ eventName: 'Transfer',
848
+ args: filter,
849
+ onLogs: (logs) => {
850
+ logs.forEach((log) => {
851
+ callback(log.args);
852
+ });
853
+ },
854
+ });
855
+ }
856
+ };
857
+ }
858
+ }
859
+ exports.Aartaler_json = Aartaler_json;