@gitmyabi/sx 1.0.0 → 1.0.1

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