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