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