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