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