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