@gitmyabi/yee 1.0.0 → 1.0.2

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