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