@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.
@@ -0,0 +1,2585 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+
5
+ /**
6
+ * BuyCoverParams struct type
7
+ */
8
+ export type BuyCoverParams = {
9
+ coverId: bigint;
10
+ owner: `0x${string}`;
11
+ productId: bigint;
12
+ coverAsset: bigint;
13
+ amount: bigint;
14
+ period: bigint;
15
+ maxPremiumInAsset: bigint;
16
+ paymentAsset: bigint;
17
+ commissionRatio: bigint;
18
+ commissionDestination: `0x${string}`;
19
+ ipfsData: string;
20
+ };
21
+
22
+ /**
23
+ * PoolAllocationRequest struct type
24
+ */
25
+ export type PoolAllocationRequest = {
26
+ poolId: bigint;
27
+ coverAmountInAsset: bigint;
28
+ };
29
+
30
+ /**
31
+ * RiRequest struct type
32
+ */
33
+ export type RiRequest = {
34
+ providerId: bigint;
35
+ amount: bigint;
36
+ premium: bigint;
37
+ signature: `0x${string}`;
38
+ data: `0x${string}`;
39
+ dataFormat: bigint;
40
+ deadline: bigint;
41
+ };
42
+
43
+ /**
44
+ * CoverData struct type
45
+ */
46
+ export type CoverData = {
47
+ productId: bigint;
48
+ coverAsset: bigint;
49
+ amount: bigint;
50
+ start: bigint;
51
+ period: bigint;
52
+ gracePeriod: bigint;
53
+ rewardsRatio: bigint;
54
+ capacityRatio: bigint;
55
+ };
56
+
57
+ /**
58
+ * CoverReference struct type
59
+ */
60
+ export type CoverReference = {
61
+ originalCoverId: bigint;
62
+ latestCoverId: bigint;
63
+ };
64
+
65
+ /**
66
+ * Ri struct type
67
+ */
68
+ export type Ri = {
69
+ providerId: bigint;
70
+ amount: bigint;
71
+ };
72
+
73
+ /**
74
+ * PoolAllocation struct type
75
+ */
76
+ export type PoolAllocation = {
77
+ poolId: bigint;
78
+ coverAmountInNXM: bigint;
79
+ premiumInNXM: bigint;
80
+ allocationId: bigint;
81
+ };
82
+
83
+ /**
84
+ * RiConfig struct type
85
+ */
86
+ export type RiConfig = {
87
+ nextNonce: bigint;
88
+ premiumDestination: `0x${string}`;
89
+ };
90
+ /**
91
+ * Cover ABI
92
+ *
93
+ * This ABI is typed using viem's type system for full type safety.
94
+ */
95
+ export const CoverAbi = [
96
+ {
97
+ "inputs": [
98
+ {
99
+ "internalType": "address",
100
+ "name": "_registry",
101
+ "type": "address"
102
+ },
103
+ {
104
+ "internalType": "address",
105
+ "name": "_stakingPoolImplementation",
106
+ "type": "address"
107
+ },
108
+ {
109
+ "internalType": "address",
110
+ "name": "_verifyingAddress",
111
+ "type": "address"
112
+ }
113
+ ],
114
+ "stateMutability": "nonpayable",
115
+ "type": "constructor"
116
+ },
117
+ {
118
+ "inputs": [
119
+ {
120
+ "internalType": "uint256",
121
+ "name": "coverId",
122
+ "type": "uint256"
123
+ }
124
+ ],
125
+ "name": "AlreadyMigratedCoverData",
126
+ "type": "error"
127
+ },
128
+ {
129
+ "inputs": [],
130
+ "name": "CommissionRateTooHigh",
131
+ "type": "error"
132
+ },
133
+ {
134
+ "inputs": [],
135
+ "name": "CoverAmountIsZero",
136
+ "type": "error"
137
+ },
138
+ {
139
+ "inputs": [],
140
+ "name": "CoverAssetMismatch",
141
+ "type": "error"
142
+ },
143
+ {
144
+ "inputs": [],
145
+ "name": "CoverAssetNotSupported",
146
+ "type": "error"
147
+ },
148
+ {
149
+ "inputs": [
150
+ {
151
+ "internalType": "uint256",
152
+ "name": "coverId",
153
+ "type": "uint256"
154
+ }
155
+ ],
156
+ "name": "CoverNotYetExpired",
157
+ "type": "error"
158
+ },
159
+ {
160
+ "inputs": [],
161
+ "name": "CoverPeriodTooLong",
162
+ "type": "error"
163
+ },
164
+ {
165
+ "inputs": [],
166
+ "name": "CoverPeriodTooShort",
167
+ "type": "error"
168
+ },
169
+ {
170
+ "inputs": [
171
+ {
172
+ "internalType": "address",
173
+ "name": "to",
174
+ "type": "address"
175
+ },
176
+ {
177
+ "internalType": "uint256",
178
+ "name": "amount",
179
+ "type": "uint256"
180
+ }
181
+ ],
182
+ "name": "ETHTransferFailed",
183
+ "type": "error"
184
+ },
185
+ {
186
+ "inputs": [],
187
+ "name": "EditNotSupported",
188
+ "type": "error"
189
+ },
190
+ {
191
+ "inputs": [],
192
+ "name": "ExpiredCoversCannotBeEdited",
193
+ "type": "error"
194
+ },
195
+ {
196
+ "inputs": [],
197
+ "name": "InsufficientCoverAmountAllocated",
198
+ "type": "error"
199
+ },
200
+ {
201
+ "inputs": [],
202
+ "name": "InsufficientEthSent",
203
+ "type": "error"
204
+ },
205
+ {
206
+ "inputs": [],
207
+ "name": "InvalidPaymentAsset",
208
+ "type": "error"
209
+ },
210
+ {
211
+ "inputs": [],
212
+ "name": "InvalidRiConfig",
213
+ "type": "error"
214
+ },
215
+ {
216
+ "inputs": [],
217
+ "name": "InvalidSignature",
218
+ "type": "error"
219
+ },
220
+ {
221
+ "inputs": [],
222
+ "name": "IpfsMetadataAlreadySet",
223
+ "type": "error"
224
+ },
225
+ {
226
+ "inputs": [
227
+ {
228
+ "internalType": "uint256",
229
+ "name": "originalCoverId",
230
+ "type": "uint256"
231
+ }
232
+ ],
233
+ "name": "MustBeOriginalCoverId",
234
+ "type": "error"
235
+ },
236
+ {
237
+ "inputs": [],
238
+ "name": "OnlyAdvisoryBoard",
239
+ "type": "error"
240
+ },
241
+ {
242
+ "inputs": [],
243
+ "name": "OnlyMember",
244
+ "type": "error"
245
+ },
246
+ {
247
+ "inputs": [],
248
+ "name": "OnlyOwnerOrApproved",
249
+ "type": "error"
250
+ },
251
+ {
252
+ "inputs": [
253
+ {
254
+ "internalType": "uint256",
255
+ "name": "currentState",
256
+ "type": "uint256"
257
+ },
258
+ {
259
+ "internalType": "uint256",
260
+ "name": "checks",
261
+ "type": "uint256"
262
+ }
263
+ ],
264
+ "name": "Paused",
265
+ "type": "error"
266
+ },
267
+ {
268
+ "inputs": [],
269
+ "name": "PriceExceedsMaxPremiumInAsset",
270
+ "type": "error"
271
+ },
272
+ {
273
+ "inputs": [],
274
+ "name": "ProductDeprecated",
275
+ "type": "error"
276
+ },
277
+ {
278
+ "inputs": [],
279
+ "name": "ProductNotFound",
280
+ "type": "error"
281
+ },
282
+ {
283
+ "inputs": [],
284
+ "name": "ReentrantCall",
285
+ "type": "error"
286
+ },
287
+ {
288
+ "inputs": [
289
+ {
290
+ "internalType": "uint256",
291
+ "name": "index",
292
+ "type": "uint256"
293
+ }
294
+ ],
295
+ "name": "RevertedWithoutReason",
296
+ "type": "error"
297
+ },
298
+ {
299
+ "inputs": [],
300
+ "name": "RiAmountIsZero",
301
+ "type": "error"
302
+ },
303
+ {
304
+ "inputs": [],
305
+ "name": "SignatureExpired",
306
+ "type": "error"
307
+ },
308
+ {
309
+ "inputs": [
310
+ {
311
+ "internalType": "address",
312
+ "name": "caller",
313
+ "type": "address"
314
+ },
315
+ {
316
+ "internalType": "uint256",
317
+ "name": "callerIndex",
318
+ "type": "uint256"
319
+ },
320
+ {
321
+ "internalType": "uint256",
322
+ "name": "authorizedBitmap",
323
+ "type": "uint256"
324
+ }
325
+ ],
326
+ "name": "Unauthorized",
327
+ "type": "error"
328
+ },
329
+ {
330
+ "inputs": [],
331
+ "name": "UnexpectedEthSent",
332
+ "type": "error"
333
+ },
334
+ {
335
+ "inputs": [],
336
+ "name": "UnexpectedRiPremium",
337
+ "type": "error"
338
+ },
339
+ {
340
+ "inputs": [],
341
+ "name": "WrongCoverEditEntrypoint",
342
+ "type": "error"
343
+ },
344
+ {
345
+ "anonymous": false,
346
+ "inputs": [
347
+ {
348
+ "indexed": true,
349
+ "internalType": "uint256",
350
+ "name": "coverId",
351
+ "type": "uint256"
352
+ },
353
+ {
354
+ "indexed": true,
355
+ "internalType": "uint256",
356
+ "name": "originalCoverId",
357
+ "type": "uint256"
358
+ },
359
+ {
360
+ "indexed": true,
361
+ "internalType": "uint256",
362
+ "name": "buyerMemberId",
363
+ "type": "uint256"
364
+ },
365
+ {
366
+ "indexed": false,
367
+ "internalType": "uint256",
368
+ "name": "productId",
369
+ "type": "uint256"
370
+ }
371
+ ],
372
+ "name": "CoverBought",
373
+ "type": "event"
374
+ },
375
+ {
376
+ "anonymous": false,
377
+ "inputs": [
378
+ {
379
+ "indexed": true,
380
+ "internalType": "uint256",
381
+ "name": "coverId",
382
+ "type": "uint256"
383
+ },
384
+ {
385
+ "indexed": false,
386
+ "internalType": "uint256",
387
+ "name": "premium",
388
+ "type": "uint256"
389
+ },
390
+ {
391
+ "indexed": false,
392
+ "internalType": "uint256",
393
+ "name": "paymentAsset",
394
+ "type": "uint256"
395
+ },
396
+ {
397
+ "indexed": false,
398
+ "internalType": "bytes",
399
+ "name": "data",
400
+ "type": "bytes"
401
+ },
402
+ {
403
+ "indexed": false,
404
+ "internalType": "uint8",
405
+ "name": "dataFormatVersion",
406
+ "type": "uint8"
407
+ }
408
+ ],
409
+ "name": "CoverRiAllocated",
410
+ "type": "event"
411
+ },
412
+ {
413
+ "inputs": [],
414
+ "name": "DEFAULT_MIN_PRICE_RATIO",
415
+ "outputs": [
416
+ {
417
+ "internalType": "uint256",
418
+ "name": "",
419
+ "type": "uint256"
420
+ }
421
+ ],
422
+ "stateMutability": "view",
423
+ "type": "function"
424
+ },
425
+ {
426
+ "inputs": [],
427
+ "name": "DOMAIN_SEPARATOR",
428
+ "outputs": [
429
+ {
430
+ "internalType": "bytes32",
431
+ "name": "",
432
+ "type": "bytes32"
433
+ }
434
+ ],
435
+ "stateMutability": "view",
436
+ "type": "function"
437
+ },
438
+ {
439
+ "inputs": [],
440
+ "name": "MAX_COMMISSION_RATIO",
441
+ "outputs": [
442
+ {
443
+ "internalType": "uint256",
444
+ "name": "",
445
+ "type": "uint256"
446
+ }
447
+ ],
448
+ "stateMutability": "view",
449
+ "type": "function"
450
+ },
451
+ {
452
+ "inputs": [],
453
+ "name": "NXM_PER_ALLOCATION_UNIT",
454
+ "outputs": [
455
+ {
456
+ "internalType": "uint256",
457
+ "name": "",
458
+ "type": "uint256"
459
+ }
460
+ ],
461
+ "stateMutability": "view",
462
+ "type": "function"
463
+ },
464
+ {
465
+ "inputs": [
466
+ {
467
+ "internalType": "uint256",
468
+ "name": "assetId",
469
+ "type": "uint256"
470
+ }
471
+ ],
472
+ "name": "activeCover",
473
+ "outputs": [
474
+ {
475
+ "internalType": "uint192",
476
+ "name": "totalActiveCoverInAsset",
477
+ "type": "uint192"
478
+ },
479
+ {
480
+ "internalType": "uint64",
481
+ "name": "lastBucketUpdateId",
482
+ "type": "uint64"
483
+ }
484
+ ],
485
+ "stateMutability": "view",
486
+ "type": "function"
487
+ },
488
+ {
489
+ "inputs": [
490
+ {
491
+ "internalType": "uint256",
492
+ "name": "coverId",
493
+ "type": "uint256"
494
+ },
495
+ {
496
+ "internalType": "uint256",
497
+ "name": "payoutAmountInAsset",
498
+ "type": "uint256"
499
+ }
500
+ ],
501
+ "name": "burnStake",
502
+ "outputs": [],
503
+ "stateMutability": "nonpayable",
504
+ "type": "function"
505
+ },
506
+ {
507
+ "inputs": [
508
+ {
509
+ "components": [
510
+ {
511
+ "internalType": "uint256",
512
+ "name": "coverId",
513
+ "type": "uint256"
514
+ },
515
+ {
516
+ "internalType": "address",
517
+ "name": "owner",
518
+ "type": "address"
519
+ },
520
+ {
521
+ "internalType": "uint24",
522
+ "name": "productId",
523
+ "type": "uint24"
524
+ },
525
+ {
526
+ "internalType": "uint8",
527
+ "name": "coverAsset",
528
+ "type": "uint8"
529
+ },
530
+ {
531
+ "internalType": "uint96",
532
+ "name": "amount",
533
+ "type": "uint96"
534
+ },
535
+ {
536
+ "internalType": "uint32",
537
+ "name": "period",
538
+ "type": "uint32"
539
+ },
540
+ {
541
+ "internalType": "uint256",
542
+ "name": "maxPremiumInAsset",
543
+ "type": "uint256"
544
+ },
545
+ {
546
+ "internalType": "uint8",
547
+ "name": "paymentAsset",
548
+ "type": "uint8"
549
+ },
550
+ {
551
+ "internalType": "uint16",
552
+ "name": "commissionRatio",
553
+ "type": "uint16"
554
+ },
555
+ {
556
+ "internalType": "address",
557
+ "name": "commissionDestination",
558
+ "type": "address"
559
+ },
560
+ {
561
+ "internalType": "string",
562
+ "name": "ipfsData",
563
+ "type": "string"
564
+ }
565
+ ],
566
+ "internalType": "struct BuyCoverParams",
567
+ "name": "params",
568
+ "type": "tuple"
569
+ },
570
+ {
571
+ "components": [
572
+ {
573
+ "internalType": "uint256",
574
+ "name": "poolId",
575
+ "type": "uint256"
576
+ },
577
+ {
578
+ "internalType": "uint256",
579
+ "name": "coverAmountInAsset",
580
+ "type": "uint256"
581
+ }
582
+ ],
583
+ "internalType": "struct PoolAllocationRequest[]",
584
+ "name": "poolAllocationRequests",
585
+ "type": "tuple[]"
586
+ }
587
+ ],
588
+ "name": "buyCover",
589
+ "outputs": [
590
+ {
591
+ "internalType": "uint256",
592
+ "name": "coverId",
593
+ "type": "uint256"
594
+ }
595
+ ],
596
+ "stateMutability": "payable",
597
+ "type": "function"
598
+ },
599
+ {
600
+ "inputs": [
601
+ {
602
+ "components": [
603
+ {
604
+ "internalType": "uint256",
605
+ "name": "coverId",
606
+ "type": "uint256"
607
+ },
608
+ {
609
+ "internalType": "address",
610
+ "name": "owner",
611
+ "type": "address"
612
+ },
613
+ {
614
+ "internalType": "uint24",
615
+ "name": "productId",
616
+ "type": "uint24"
617
+ },
618
+ {
619
+ "internalType": "uint8",
620
+ "name": "coverAsset",
621
+ "type": "uint8"
622
+ },
623
+ {
624
+ "internalType": "uint96",
625
+ "name": "amount",
626
+ "type": "uint96"
627
+ },
628
+ {
629
+ "internalType": "uint32",
630
+ "name": "period",
631
+ "type": "uint32"
632
+ },
633
+ {
634
+ "internalType": "uint256",
635
+ "name": "maxPremiumInAsset",
636
+ "type": "uint256"
637
+ },
638
+ {
639
+ "internalType": "uint8",
640
+ "name": "paymentAsset",
641
+ "type": "uint8"
642
+ },
643
+ {
644
+ "internalType": "uint16",
645
+ "name": "commissionRatio",
646
+ "type": "uint16"
647
+ },
648
+ {
649
+ "internalType": "address",
650
+ "name": "commissionDestination",
651
+ "type": "address"
652
+ },
653
+ {
654
+ "internalType": "string",
655
+ "name": "ipfsData",
656
+ "type": "string"
657
+ }
658
+ ],
659
+ "internalType": "struct BuyCoverParams",
660
+ "name": "params",
661
+ "type": "tuple"
662
+ },
663
+ {
664
+ "components": [
665
+ {
666
+ "internalType": "uint256",
667
+ "name": "poolId",
668
+ "type": "uint256"
669
+ },
670
+ {
671
+ "internalType": "uint256",
672
+ "name": "coverAmountInAsset",
673
+ "type": "uint256"
674
+ }
675
+ ],
676
+ "internalType": "struct PoolAllocationRequest[]",
677
+ "name": "poolAllocationRequests",
678
+ "type": "tuple[]"
679
+ },
680
+ {
681
+ "components": [
682
+ {
683
+ "internalType": "uint256",
684
+ "name": "providerId",
685
+ "type": "uint256"
686
+ },
687
+ {
688
+ "internalType": "uint256",
689
+ "name": "amount",
690
+ "type": "uint256"
691
+ },
692
+ {
693
+ "internalType": "uint256",
694
+ "name": "premium",
695
+ "type": "uint256"
696
+ },
697
+ {
698
+ "internalType": "bytes",
699
+ "name": "signature",
700
+ "type": "bytes"
701
+ },
702
+ {
703
+ "internalType": "bytes",
704
+ "name": "data",
705
+ "type": "bytes"
706
+ },
707
+ {
708
+ "internalType": "uint8",
709
+ "name": "dataFormat",
710
+ "type": "uint8"
711
+ },
712
+ {
713
+ "internalType": "uint32",
714
+ "name": "deadline",
715
+ "type": "uint32"
716
+ }
717
+ ],
718
+ "internalType": "struct RiRequest",
719
+ "name": "riRequest",
720
+ "type": "tuple"
721
+ }
722
+ ],
723
+ "name": "buyCoverWithRi",
724
+ "outputs": [
725
+ {
726
+ "internalType": "uint256",
727
+ "name": "coverId",
728
+ "type": "uint256"
729
+ }
730
+ ],
731
+ "stateMutability": "payable",
732
+ "type": "function"
733
+ },
734
+ {
735
+ "inputs": [
736
+ {
737
+ "internalType": "address",
738
+ "name": "_coverNFTDescriptor",
739
+ "type": "address"
740
+ }
741
+ ],
742
+ "name": "changeCoverNFTDescriptor",
743
+ "outputs": [],
744
+ "stateMutability": "nonpayable",
745
+ "type": "function"
746
+ },
747
+ {
748
+ "inputs": [
749
+ {
750
+ "internalType": "address",
751
+ "name": "_stakingNFTDescriptor",
752
+ "type": "address"
753
+ }
754
+ ],
755
+ "name": "changeStakingNFTDescriptor",
756
+ "outputs": [],
757
+ "stateMutability": "nonpayable",
758
+ "type": "function"
759
+ },
760
+ {
761
+ "inputs": [],
762
+ "name": "claims",
763
+ "outputs": [
764
+ {
765
+ "internalType": "address",
766
+ "name": "",
767
+ "type": "address"
768
+ }
769
+ ],
770
+ "stateMutability": "view",
771
+ "type": "function"
772
+ },
773
+ {
774
+ "inputs": [],
775
+ "name": "coverNFT",
776
+ "outputs": [
777
+ {
778
+ "internalType": "contract ICoverNFT",
779
+ "name": "",
780
+ "type": "address"
781
+ }
782
+ ],
783
+ "stateMutability": "view",
784
+ "type": "function"
785
+ },
786
+ {
787
+ "inputs": [],
788
+ "name": "coverProducts",
789
+ "outputs": [
790
+ {
791
+ "internalType": "contract ICoverProducts",
792
+ "name": "",
793
+ "type": "address"
794
+ }
795
+ ],
796
+ "stateMutability": "view",
797
+ "type": "function"
798
+ },
799
+ {
800
+ "inputs": [
801
+ {
802
+ "components": [
803
+ {
804
+ "internalType": "uint256",
805
+ "name": "coverId",
806
+ "type": "uint256"
807
+ },
808
+ {
809
+ "internalType": "address",
810
+ "name": "owner",
811
+ "type": "address"
812
+ },
813
+ {
814
+ "internalType": "uint24",
815
+ "name": "productId",
816
+ "type": "uint24"
817
+ },
818
+ {
819
+ "internalType": "uint8",
820
+ "name": "coverAsset",
821
+ "type": "uint8"
822
+ },
823
+ {
824
+ "internalType": "uint96",
825
+ "name": "amount",
826
+ "type": "uint96"
827
+ },
828
+ {
829
+ "internalType": "uint32",
830
+ "name": "period",
831
+ "type": "uint32"
832
+ },
833
+ {
834
+ "internalType": "uint256",
835
+ "name": "maxPremiumInAsset",
836
+ "type": "uint256"
837
+ },
838
+ {
839
+ "internalType": "uint8",
840
+ "name": "paymentAsset",
841
+ "type": "uint8"
842
+ },
843
+ {
844
+ "internalType": "uint16",
845
+ "name": "commissionRatio",
846
+ "type": "uint16"
847
+ },
848
+ {
849
+ "internalType": "address",
850
+ "name": "commissionDestination",
851
+ "type": "address"
852
+ },
853
+ {
854
+ "internalType": "string",
855
+ "name": "ipfsData",
856
+ "type": "string"
857
+ }
858
+ ],
859
+ "internalType": "struct BuyCoverParams",
860
+ "name": "params",
861
+ "type": "tuple"
862
+ },
863
+ {
864
+ "components": [
865
+ {
866
+ "internalType": "uint256",
867
+ "name": "poolId",
868
+ "type": "uint256"
869
+ },
870
+ {
871
+ "internalType": "uint256",
872
+ "name": "coverAmountInAsset",
873
+ "type": "uint256"
874
+ }
875
+ ],
876
+ "internalType": "struct PoolAllocationRequest[]",
877
+ "name": "poolAllocationRequests",
878
+ "type": "tuple[]"
879
+ },
880
+ {
881
+ "internalType": "address",
882
+ "name": "buyer",
883
+ "type": "address"
884
+ }
885
+ ],
886
+ "name": "executeCoverBuy",
887
+ "outputs": [
888
+ {
889
+ "internalType": "uint256",
890
+ "name": "coverId",
891
+ "type": "uint256"
892
+ }
893
+ ],
894
+ "stateMutability": "payable",
895
+ "type": "function"
896
+ },
897
+ {
898
+ "inputs": [
899
+ {
900
+ "internalType": "uint256",
901
+ "name": "coverId",
902
+ "type": "uint256"
903
+ }
904
+ ],
905
+ "name": "expireCover",
906
+ "outputs": [],
907
+ "stateMutability": "nonpayable",
908
+ "type": "function"
909
+ },
910
+ {
911
+ "inputs": [
912
+ {
913
+ "internalType": "uint256",
914
+ "name": "coverId",
915
+ "type": "uint256"
916
+ }
917
+ ],
918
+ "name": "getCoverData",
919
+ "outputs": [
920
+ {
921
+ "components": [
922
+ {
923
+ "internalType": "uint24",
924
+ "name": "productId",
925
+ "type": "uint24"
926
+ },
927
+ {
928
+ "internalType": "uint8",
929
+ "name": "coverAsset",
930
+ "type": "uint8"
931
+ },
932
+ {
933
+ "internalType": "uint96",
934
+ "name": "amount",
935
+ "type": "uint96"
936
+ },
937
+ {
938
+ "internalType": "uint32",
939
+ "name": "start",
940
+ "type": "uint32"
941
+ },
942
+ {
943
+ "internalType": "uint32",
944
+ "name": "period",
945
+ "type": "uint32"
946
+ },
947
+ {
948
+ "internalType": "uint32",
949
+ "name": "gracePeriod",
950
+ "type": "uint32"
951
+ },
952
+ {
953
+ "internalType": "uint16",
954
+ "name": "rewardsRatio",
955
+ "type": "uint16"
956
+ },
957
+ {
958
+ "internalType": "uint16",
959
+ "name": "capacityRatio",
960
+ "type": "uint16"
961
+ }
962
+ ],
963
+ "internalType": "struct CoverData",
964
+ "name": "",
965
+ "type": "tuple"
966
+ }
967
+ ],
968
+ "stateMutability": "view",
969
+ "type": "function"
970
+ },
971
+ {
972
+ "inputs": [],
973
+ "name": "getCoverDataCount",
974
+ "outputs": [
975
+ {
976
+ "internalType": "uint256",
977
+ "name": "",
978
+ "type": "uint256"
979
+ }
980
+ ],
981
+ "stateMutability": "view",
982
+ "type": "function"
983
+ },
984
+ {
985
+ "inputs": [
986
+ {
987
+ "internalType": "uint256",
988
+ "name": "coverId",
989
+ "type": "uint256"
990
+ }
991
+ ],
992
+ "name": "getCoverDataWithReference",
993
+ "outputs": [
994
+ {
995
+ "components": [
996
+ {
997
+ "internalType": "uint24",
998
+ "name": "productId",
999
+ "type": "uint24"
1000
+ },
1001
+ {
1002
+ "internalType": "uint8",
1003
+ "name": "coverAsset",
1004
+ "type": "uint8"
1005
+ },
1006
+ {
1007
+ "internalType": "uint96",
1008
+ "name": "amount",
1009
+ "type": "uint96"
1010
+ },
1011
+ {
1012
+ "internalType": "uint32",
1013
+ "name": "start",
1014
+ "type": "uint32"
1015
+ },
1016
+ {
1017
+ "internalType": "uint32",
1018
+ "name": "period",
1019
+ "type": "uint32"
1020
+ },
1021
+ {
1022
+ "internalType": "uint32",
1023
+ "name": "gracePeriod",
1024
+ "type": "uint32"
1025
+ },
1026
+ {
1027
+ "internalType": "uint16",
1028
+ "name": "rewardsRatio",
1029
+ "type": "uint16"
1030
+ },
1031
+ {
1032
+ "internalType": "uint16",
1033
+ "name": "capacityRatio",
1034
+ "type": "uint16"
1035
+ }
1036
+ ],
1037
+ "internalType": "struct CoverData",
1038
+ "name": "",
1039
+ "type": "tuple"
1040
+ },
1041
+ {
1042
+ "components": [
1043
+ {
1044
+ "internalType": "uint32",
1045
+ "name": "originalCoverId",
1046
+ "type": "uint32"
1047
+ },
1048
+ {
1049
+ "internalType": "uint32",
1050
+ "name": "latestCoverId",
1051
+ "type": "uint32"
1052
+ }
1053
+ ],
1054
+ "internalType": "struct CoverReference",
1055
+ "name": "",
1056
+ "type": "tuple"
1057
+ }
1058
+ ],
1059
+ "stateMutability": "view",
1060
+ "type": "function"
1061
+ },
1062
+ {
1063
+ "inputs": [
1064
+ {
1065
+ "internalType": "uint256",
1066
+ "name": "coverId",
1067
+ "type": "uint256"
1068
+ }
1069
+ ],
1070
+ "name": "getCoverDataWithRi",
1071
+ "outputs": [
1072
+ {
1073
+ "components": [
1074
+ {
1075
+ "internalType": "uint24",
1076
+ "name": "productId",
1077
+ "type": "uint24"
1078
+ },
1079
+ {
1080
+ "internalType": "uint8",
1081
+ "name": "coverAsset",
1082
+ "type": "uint8"
1083
+ },
1084
+ {
1085
+ "internalType": "uint96",
1086
+ "name": "amount",
1087
+ "type": "uint96"
1088
+ },
1089
+ {
1090
+ "internalType": "uint32",
1091
+ "name": "start",
1092
+ "type": "uint32"
1093
+ },
1094
+ {
1095
+ "internalType": "uint32",
1096
+ "name": "period",
1097
+ "type": "uint32"
1098
+ },
1099
+ {
1100
+ "internalType": "uint32",
1101
+ "name": "gracePeriod",
1102
+ "type": "uint32"
1103
+ },
1104
+ {
1105
+ "internalType": "uint16",
1106
+ "name": "rewardsRatio",
1107
+ "type": "uint16"
1108
+ },
1109
+ {
1110
+ "internalType": "uint16",
1111
+ "name": "capacityRatio",
1112
+ "type": "uint16"
1113
+ }
1114
+ ],
1115
+ "internalType": "struct CoverData",
1116
+ "name": "",
1117
+ "type": "tuple"
1118
+ },
1119
+ {
1120
+ "components": [
1121
+ {
1122
+ "internalType": "uint24",
1123
+ "name": "providerId",
1124
+ "type": "uint24"
1125
+ },
1126
+ {
1127
+ "internalType": "uint96",
1128
+ "name": "amount",
1129
+ "type": "uint96"
1130
+ }
1131
+ ],
1132
+ "internalType": "struct Ri",
1133
+ "name": "",
1134
+ "type": "tuple"
1135
+ }
1136
+ ],
1137
+ "stateMutability": "view",
1138
+ "type": "function"
1139
+ },
1140
+ {
1141
+ "inputs": [
1142
+ {
1143
+ "internalType": "uint256",
1144
+ "name": "coverId",
1145
+ "type": "uint256"
1146
+ }
1147
+ ],
1148
+ "name": "getCoverMetadata",
1149
+ "outputs": [
1150
+ {
1151
+ "internalType": "string",
1152
+ "name": "",
1153
+ "type": "string"
1154
+ }
1155
+ ],
1156
+ "stateMutability": "view",
1157
+ "type": "function"
1158
+ },
1159
+ {
1160
+ "inputs": [
1161
+ {
1162
+ "internalType": "uint256",
1163
+ "name": "coverId",
1164
+ "type": "uint256"
1165
+ }
1166
+ ],
1167
+ "name": "getCoverReference",
1168
+ "outputs": [
1169
+ {
1170
+ "components": [
1171
+ {
1172
+ "internalType": "uint32",
1173
+ "name": "originalCoverId",
1174
+ "type": "uint32"
1175
+ },
1176
+ {
1177
+ "internalType": "uint32",
1178
+ "name": "latestCoverId",
1179
+ "type": "uint32"
1180
+ }
1181
+ ],
1182
+ "internalType": "struct CoverReference",
1183
+ "name": "coverReference",
1184
+ "type": "tuple"
1185
+ }
1186
+ ],
1187
+ "stateMutability": "view",
1188
+ "type": "function"
1189
+ },
1190
+ {
1191
+ "inputs": [
1192
+ {
1193
+ "internalType": "uint256",
1194
+ "name": "coverId",
1195
+ "type": "uint256"
1196
+ }
1197
+ ],
1198
+ "name": "getCoverRi",
1199
+ "outputs": [
1200
+ {
1201
+ "components": [
1202
+ {
1203
+ "internalType": "uint24",
1204
+ "name": "providerId",
1205
+ "type": "uint24"
1206
+ },
1207
+ {
1208
+ "internalType": "uint96",
1209
+ "name": "amount",
1210
+ "type": "uint96"
1211
+ }
1212
+ ],
1213
+ "internalType": "struct Ri",
1214
+ "name": "",
1215
+ "type": "tuple"
1216
+ }
1217
+ ],
1218
+ "stateMutability": "view",
1219
+ "type": "function"
1220
+ },
1221
+ {
1222
+ "inputs": [],
1223
+ "name": "getDefaultMinPriceRatio",
1224
+ "outputs": [
1225
+ {
1226
+ "internalType": "uint256",
1227
+ "name": "",
1228
+ "type": "uint256"
1229
+ }
1230
+ ],
1231
+ "stateMutability": "pure",
1232
+ "type": "function"
1233
+ },
1234
+ {
1235
+ "inputs": [],
1236
+ "name": "getGlobalCapacityAndPriceRatios",
1237
+ "outputs": [
1238
+ {
1239
+ "internalType": "uint256",
1240
+ "name": "_globalCapacityRatio",
1241
+ "type": "uint256"
1242
+ },
1243
+ {
1244
+ "internalType": "uint256",
1245
+ "name": "_defaultMinPriceRatio",
1246
+ "type": "uint256"
1247
+ }
1248
+ ],
1249
+ "stateMutability": "pure",
1250
+ "type": "function"
1251
+ },
1252
+ {
1253
+ "inputs": [],
1254
+ "name": "getGlobalCapacityRatio",
1255
+ "outputs": [
1256
+ {
1257
+ "internalType": "uint256",
1258
+ "name": "",
1259
+ "type": "uint256"
1260
+ }
1261
+ ],
1262
+ "stateMutability": "pure",
1263
+ "type": "function"
1264
+ },
1265
+ {
1266
+ "inputs": [],
1267
+ "name": "getGlobalRewardsRatio",
1268
+ "outputs": [
1269
+ {
1270
+ "internalType": "uint256",
1271
+ "name": "",
1272
+ "type": "uint256"
1273
+ }
1274
+ ],
1275
+ "stateMutability": "pure",
1276
+ "type": "function"
1277
+ },
1278
+ {
1279
+ "inputs": [
1280
+ {
1281
+ "internalType": "uint256",
1282
+ "name": "coverId",
1283
+ "type": "uint256"
1284
+ }
1285
+ ],
1286
+ "name": "getLatestEditCoverData",
1287
+ "outputs": [
1288
+ {
1289
+ "components": [
1290
+ {
1291
+ "internalType": "uint24",
1292
+ "name": "productId",
1293
+ "type": "uint24"
1294
+ },
1295
+ {
1296
+ "internalType": "uint8",
1297
+ "name": "coverAsset",
1298
+ "type": "uint8"
1299
+ },
1300
+ {
1301
+ "internalType": "uint96",
1302
+ "name": "amount",
1303
+ "type": "uint96"
1304
+ },
1305
+ {
1306
+ "internalType": "uint32",
1307
+ "name": "start",
1308
+ "type": "uint32"
1309
+ },
1310
+ {
1311
+ "internalType": "uint32",
1312
+ "name": "period",
1313
+ "type": "uint32"
1314
+ },
1315
+ {
1316
+ "internalType": "uint32",
1317
+ "name": "gracePeriod",
1318
+ "type": "uint32"
1319
+ },
1320
+ {
1321
+ "internalType": "uint16",
1322
+ "name": "rewardsRatio",
1323
+ "type": "uint16"
1324
+ },
1325
+ {
1326
+ "internalType": "uint16",
1327
+ "name": "capacityRatio",
1328
+ "type": "uint16"
1329
+ }
1330
+ ],
1331
+ "internalType": "struct CoverData",
1332
+ "name": "",
1333
+ "type": "tuple"
1334
+ }
1335
+ ],
1336
+ "stateMutability": "view",
1337
+ "type": "function"
1338
+ },
1339
+ {
1340
+ "inputs": [
1341
+ {
1342
+ "internalType": "uint256",
1343
+ "name": "coverId",
1344
+ "type": "uint256"
1345
+ }
1346
+ ],
1347
+ "name": "getPoolAllocations",
1348
+ "outputs": [
1349
+ {
1350
+ "components": [
1351
+ {
1352
+ "internalType": "uint40",
1353
+ "name": "poolId",
1354
+ "type": "uint40"
1355
+ },
1356
+ {
1357
+ "internalType": "uint96",
1358
+ "name": "coverAmountInNXM",
1359
+ "type": "uint96"
1360
+ },
1361
+ {
1362
+ "internalType": "uint96",
1363
+ "name": "premiumInNXM",
1364
+ "type": "uint96"
1365
+ },
1366
+ {
1367
+ "internalType": "uint24",
1368
+ "name": "allocationId",
1369
+ "type": "uint24"
1370
+ }
1371
+ ],
1372
+ "internalType": "struct PoolAllocation[]",
1373
+ "name": "",
1374
+ "type": "tuple[]"
1375
+ }
1376
+ ],
1377
+ "stateMutability": "view",
1378
+ "type": "function"
1379
+ },
1380
+ {
1381
+ "inputs": [
1382
+ {
1383
+ "internalType": "uint256",
1384
+ "name": "providerId",
1385
+ "type": "uint256"
1386
+ }
1387
+ ],
1388
+ "name": "getRiProviderConfig",
1389
+ "outputs": [
1390
+ {
1391
+ "components": [
1392
+ {
1393
+ "internalType": "uint24",
1394
+ "name": "nextNonce",
1395
+ "type": "uint24"
1396
+ },
1397
+ {
1398
+ "internalType": "address",
1399
+ "name": "premiumDestination",
1400
+ "type": "address"
1401
+ }
1402
+ ],
1403
+ "internalType": "struct RiConfig",
1404
+ "name": "",
1405
+ "type": "tuple"
1406
+ }
1407
+ ],
1408
+ "stateMutability": "view",
1409
+ "type": "function"
1410
+ },
1411
+ {
1412
+ "inputs": [
1413
+ {
1414
+ "internalType": "bytes[]",
1415
+ "name": "data",
1416
+ "type": "bytes[]"
1417
+ }
1418
+ ],
1419
+ "name": "multicall",
1420
+ "outputs": [
1421
+ {
1422
+ "internalType": "bytes[]",
1423
+ "name": "results",
1424
+ "type": "bytes[]"
1425
+ }
1426
+ ],
1427
+ "stateMutability": "nonpayable",
1428
+ "type": "function"
1429
+ },
1430
+ {
1431
+ "inputs": [],
1432
+ "name": "pool",
1433
+ "outputs": [
1434
+ {
1435
+ "internalType": "contract IPool",
1436
+ "name": "",
1437
+ "type": "address"
1438
+ }
1439
+ ],
1440
+ "stateMutability": "view",
1441
+ "type": "function"
1442
+ },
1443
+ {
1444
+ "inputs": [
1445
+ {
1446
+ "internalType": "uint256[]",
1447
+ "name": "coverIds",
1448
+ "type": "uint256[]"
1449
+ },
1450
+ {
1451
+ "internalType": "string[]",
1452
+ "name": "ipfsMetadata",
1453
+ "type": "string[]"
1454
+ }
1455
+ ],
1456
+ "name": "populateIpfsMetadata",
1457
+ "outputs": [],
1458
+ "stateMutability": "nonpayable",
1459
+ "type": "function"
1460
+ },
1461
+ {
1462
+ "inputs": [
1463
+ {
1464
+ "internalType": "uint256",
1465
+ "name": "coverAsset",
1466
+ "type": "uint256"
1467
+ }
1468
+ ],
1469
+ "name": "recalculateActiveCoverInAsset",
1470
+ "outputs": [],
1471
+ "stateMutability": "nonpayable",
1472
+ "type": "function"
1473
+ },
1474
+ {
1475
+ "inputs": [],
1476
+ "name": "registry",
1477
+ "outputs": [
1478
+ {
1479
+ "internalType": "contract IRegistry",
1480
+ "name": "",
1481
+ "type": "address"
1482
+ }
1483
+ ],
1484
+ "stateMutability": "view",
1485
+ "type": "function"
1486
+ },
1487
+ {
1488
+ "inputs": [],
1489
+ "name": "riSigner",
1490
+ "outputs": [
1491
+ {
1492
+ "internalType": "address",
1493
+ "name": "",
1494
+ "type": "address"
1495
+ }
1496
+ ],
1497
+ "stateMutability": "view",
1498
+ "type": "function"
1499
+ },
1500
+ {
1501
+ "inputs": [
1502
+ {
1503
+ "internalType": "uint256",
1504
+ "name": "providerId",
1505
+ "type": "uint256"
1506
+ },
1507
+ {
1508
+ "internalType": "address",
1509
+ "name": "premiumDestination",
1510
+ "type": "address"
1511
+ }
1512
+ ],
1513
+ "name": "setRiConfig",
1514
+ "outputs": [],
1515
+ "stateMutability": "nonpayable",
1516
+ "type": "function"
1517
+ },
1518
+ {
1519
+ "inputs": [
1520
+ {
1521
+ "internalType": "address",
1522
+ "name": "_riSigner",
1523
+ "type": "address"
1524
+ }
1525
+ ],
1526
+ "name": "setRiSigner",
1527
+ "outputs": [],
1528
+ "stateMutability": "nonpayable",
1529
+ "type": "function"
1530
+ },
1531
+ {
1532
+ "inputs": [],
1533
+ "name": "stakingNFT",
1534
+ "outputs": [
1535
+ {
1536
+ "internalType": "contract IStakingNFT",
1537
+ "name": "",
1538
+ "type": "address"
1539
+ }
1540
+ ],
1541
+ "stateMutability": "view",
1542
+ "type": "function"
1543
+ },
1544
+ {
1545
+ "inputs": [
1546
+ {
1547
+ "internalType": "uint256",
1548
+ "name": "poolId",
1549
+ "type": "uint256"
1550
+ }
1551
+ ],
1552
+ "name": "stakingPool",
1553
+ "outputs": [
1554
+ {
1555
+ "internalType": "contract IStakingPool",
1556
+ "name": "",
1557
+ "type": "address"
1558
+ }
1559
+ ],
1560
+ "stateMutability": "view",
1561
+ "type": "function"
1562
+ },
1563
+ {
1564
+ "inputs": [],
1565
+ "name": "stakingPoolFactory",
1566
+ "outputs": [
1567
+ {
1568
+ "internalType": "address",
1569
+ "name": "",
1570
+ "type": "address"
1571
+ }
1572
+ ],
1573
+ "stateMutability": "view",
1574
+ "type": "function"
1575
+ },
1576
+ {
1577
+ "inputs": [],
1578
+ "name": "stakingPoolImplementation",
1579
+ "outputs": [
1580
+ {
1581
+ "internalType": "address",
1582
+ "name": "",
1583
+ "type": "address"
1584
+ }
1585
+ ],
1586
+ "stateMutability": "view",
1587
+ "type": "function"
1588
+ },
1589
+ {
1590
+ "inputs": [],
1591
+ "name": "tokenController",
1592
+ "outputs": [
1593
+ {
1594
+ "internalType": "contract ITokenController",
1595
+ "name": "",
1596
+ "type": "address"
1597
+ }
1598
+ ],
1599
+ "stateMutability": "view",
1600
+ "type": "function"
1601
+ },
1602
+ {
1603
+ "inputs": [
1604
+ {
1605
+ "internalType": "uint256",
1606
+ "name": "assetId",
1607
+ "type": "uint256"
1608
+ }
1609
+ ],
1610
+ "name": "totalActiveCoverInAsset",
1611
+ "outputs": [
1612
+ {
1613
+ "internalType": "uint256",
1614
+ "name": "",
1615
+ "type": "uint256"
1616
+ }
1617
+ ],
1618
+ "stateMutability": "view",
1619
+ "type": "function"
1620
+ },
1621
+ {
1622
+ "inputs": [
1623
+ {
1624
+ "internalType": "uint256",
1625
+ "name": "coverAsset",
1626
+ "type": "uint256"
1627
+ }
1628
+ ],
1629
+ "name": "updateTotalActiveCoverAmount",
1630
+ "outputs": [],
1631
+ "stateMutability": "nonpayable",
1632
+ "type": "function"
1633
+ }
1634
+ ] as const satisfies Abi;
1635
+
1636
+ /**
1637
+ * Type-safe ABI for Cover
1638
+ */
1639
+ export type CoverAbi = typeof CoverAbi;
1640
+
1641
+ /**
1642
+ * Contract instance type for Cover
1643
+ */
1644
+ // Use any for contract type to avoid complex viem type issues
1645
+ // The runtime behavior is type-safe through viem's ABI typing
1646
+ export type CoverContract = any;
1647
+
1648
+ /**
1649
+ * Cover Contract Class
1650
+ *
1651
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
1652
+ *
1653
+ * @example
1654
+ * ```typescript
1655
+ * import { createPublicClient, createWalletClient, http } from 'viem';
1656
+ * import { mainnet } from 'viem/chains';
1657
+ * import { Cover } from 'Cover';
1658
+ *
1659
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
1660
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
1661
+ *
1662
+ * const contract = new Cover('0x...', { publicClient, walletClient });
1663
+ *
1664
+ * // Read functions
1665
+ * const result = await contract.balanceOf('0x...');
1666
+ *
1667
+ * // Write functions
1668
+ * const hash = await contract.transfer('0x...', 1000n);
1669
+ *
1670
+ * // Simulate transactions (dry-run)
1671
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
1672
+ * console.log('Gas estimate:', simulation.request.gas);
1673
+ *
1674
+ * // Watch events
1675
+ * const unwatch = contract.watch.Transfer((event) => {
1676
+ * console.log('Transfer event:', event);
1677
+ * });
1678
+ * ```
1679
+ */
1680
+ export class Cover {
1681
+ private contract: CoverContract;
1682
+ private contractAddress: Address;
1683
+ private publicClient: PublicClient;
1684
+
1685
+ constructor(
1686
+ address: Address,
1687
+ clients: {
1688
+ publicClient: PublicClient;
1689
+ walletClient?: WalletClient;
1690
+ }
1691
+ ) {
1692
+ this.contractAddress = address;
1693
+ this.publicClient = clients.publicClient;
1694
+ this.contract = getContract({
1695
+ address,
1696
+ abi: CoverAbi,
1697
+ client: {
1698
+ public: clients.publicClient,
1699
+ wallet: clients.walletClient,
1700
+ },
1701
+ });
1702
+ }
1703
+
1704
+ /**
1705
+ * Get the contract address
1706
+ */
1707
+ get address(): Address {
1708
+ return this.contractAddress;
1709
+ }
1710
+
1711
+ /**
1712
+ * Get the underlying viem contract instance.
1713
+ */
1714
+ getContract(): CoverContract {
1715
+ return this.contract;
1716
+ }
1717
+
1718
+ /**
1719
+ * DEFAULT_MIN_PRICE_RATIO
1720
+ * view
1721
+ */
1722
+ async DEFAULT_MIN_PRICE_RATIO(): Promise<bigint> {
1723
+ return this.contract.read.DEFAULT_MIN_PRICE_RATIO() as Promise<bigint>;
1724
+ }
1725
+
1726
+ /**
1727
+ * DOMAIN_SEPARATOR
1728
+ * view
1729
+ */
1730
+ async DOMAIN_SEPARATOR(): Promise<`0x${string}`> {
1731
+ return this.contract.read.DOMAIN_SEPARATOR() as Promise<`0x${string}`>;
1732
+ }
1733
+
1734
+ /**
1735
+ * MAX_COMMISSION_RATIO
1736
+ * view
1737
+ */
1738
+ async MAX_COMMISSION_RATIO(): Promise<bigint> {
1739
+ return this.contract.read.MAX_COMMISSION_RATIO() as Promise<bigint>;
1740
+ }
1741
+
1742
+ /**
1743
+ * NXM_PER_ALLOCATION_UNIT
1744
+ * view
1745
+ */
1746
+ async NXM_PER_ALLOCATION_UNIT(): Promise<bigint> {
1747
+ return this.contract.read.NXM_PER_ALLOCATION_UNIT() as Promise<bigint>;
1748
+ }
1749
+
1750
+ /**
1751
+ * activeCover
1752
+ * view
1753
+ */
1754
+ async activeCover(assetId: bigint): Promise<[bigint, bigint]> {
1755
+ return this.contract.read.activeCover([assetId] as const) as Promise<[bigint, bigint]>;
1756
+ }
1757
+
1758
+ /**
1759
+ * claims
1760
+ * view
1761
+ */
1762
+ async claims(): Promise<`0x${string}`> {
1763
+ return this.contract.read.claims() as Promise<`0x${string}`>;
1764
+ }
1765
+
1766
+ /**
1767
+ * coverNFT
1768
+ * view
1769
+ */
1770
+ async coverNFT(): Promise<`0x${string}`> {
1771
+ return this.contract.read.coverNFT() as Promise<`0x${string}`>;
1772
+ }
1773
+
1774
+ /**
1775
+ * coverProducts
1776
+ * view
1777
+ */
1778
+ async coverProducts(): Promise<`0x${string}`> {
1779
+ return this.contract.read.coverProducts() as Promise<`0x${string}`>;
1780
+ }
1781
+
1782
+ /**
1783
+ * getCoverData
1784
+ * view
1785
+ */
1786
+ async getCoverData(coverId: bigint): Promise<CoverData> {
1787
+ return this.contract.read.getCoverData([coverId] as const) as Promise<CoverData>;
1788
+ }
1789
+
1790
+ /**
1791
+ * getCoverDataCount
1792
+ * view
1793
+ */
1794
+ async getCoverDataCount(): Promise<bigint> {
1795
+ return this.contract.read.getCoverDataCount() as Promise<bigint>;
1796
+ }
1797
+
1798
+ /**
1799
+ * getCoverDataWithReference
1800
+ * view
1801
+ */
1802
+ async getCoverDataWithReference(coverId: bigint): Promise<[CoverData, CoverReference]> {
1803
+ return this.contract.read.getCoverDataWithReference([coverId] as const) as Promise<[CoverData, CoverReference]>;
1804
+ }
1805
+
1806
+ /**
1807
+ * getCoverDataWithRi
1808
+ * view
1809
+ */
1810
+ async getCoverDataWithRi(coverId: bigint): Promise<[CoverData, Ri]> {
1811
+ return this.contract.read.getCoverDataWithRi([coverId] as const) as Promise<[CoverData, Ri]>;
1812
+ }
1813
+
1814
+ /**
1815
+ * getCoverMetadata
1816
+ * view
1817
+ */
1818
+ async getCoverMetadata(coverId: bigint): Promise<string> {
1819
+ return this.contract.read.getCoverMetadata([coverId] as const) as Promise<string>;
1820
+ }
1821
+
1822
+ /**
1823
+ * getCoverReference
1824
+ * view
1825
+ */
1826
+ async getCoverReference(coverId: bigint): Promise<CoverReference> {
1827
+ return this.contract.read.getCoverReference([coverId] as const) as Promise<CoverReference>;
1828
+ }
1829
+
1830
+ /**
1831
+ * getCoverRi
1832
+ * view
1833
+ */
1834
+ async getCoverRi(coverId: bigint): Promise<Ri> {
1835
+ return this.contract.read.getCoverRi([coverId] as const) as Promise<Ri>;
1836
+ }
1837
+
1838
+ /**
1839
+ * getDefaultMinPriceRatio
1840
+ * pure
1841
+ */
1842
+ async getDefaultMinPriceRatio(): Promise<bigint> {
1843
+ return this.contract.read.getDefaultMinPriceRatio() as Promise<bigint>;
1844
+ }
1845
+
1846
+ /**
1847
+ * getGlobalCapacityAndPriceRatios
1848
+ * pure
1849
+ */
1850
+ async getGlobalCapacityAndPriceRatios(): Promise<[bigint, bigint]> {
1851
+ return this.contract.read.getGlobalCapacityAndPriceRatios() as Promise<[bigint, bigint]>;
1852
+ }
1853
+
1854
+ /**
1855
+ * getGlobalCapacityRatio
1856
+ * pure
1857
+ */
1858
+ async getGlobalCapacityRatio(): Promise<bigint> {
1859
+ return this.contract.read.getGlobalCapacityRatio() as Promise<bigint>;
1860
+ }
1861
+
1862
+ /**
1863
+ * getGlobalRewardsRatio
1864
+ * pure
1865
+ */
1866
+ async getGlobalRewardsRatio(): Promise<bigint> {
1867
+ return this.contract.read.getGlobalRewardsRatio() as Promise<bigint>;
1868
+ }
1869
+
1870
+ /**
1871
+ * getLatestEditCoverData
1872
+ * view
1873
+ */
1874
+ async getLatestEditCoverData(coverId: bigint): Promise<CoverData> {
1875
+ return this.contract.read.getLatestEditCoverData([coverId] as const) as Promise<CoverData>;
1876
+ }
1877
+
1878
+ /**
1879
+ * getPoolAllocations
1880
+ * view
1881
+ */
1882
+ async getPoolAllocations(coverId: bigint): Promise<PoolAllocation[]> {
1883
+ return this.contract.read.getPoolAllocations([coverId] as const) as Promise<PoolAllocation[]>;
1884
+ }
1885
+
1886
+ /**
1887
+ * getRiProviderConfig
1888
+ * view
1889
+ */
1890
+ async getRiProviderConfig(providerId: bigint): Promise<RiConfig> {
1891
+ return this.contract.read.getRiProviderConfig([providerId] as const) as Promise<RiConfig>;
1892
+ }
1893
+
1894
+ /**
1895
+ * pool
1896
+ * view
1897
+ */
1898
+ async pool(): Promise<`0x${string}`> {
1899
+ return this.contract.read.pool() as Promise<`0x${string}`>;
1900
+ }
1901
+
1902
+ /**
1903
+ * registry
1904
+ * view
1905
+ */
1906
+ async registry(): Promise<`0x${string}`> {
1907
+ return this.contract.read.registry() as Promise<`0x${string}`>;
1908
+ }
1909
+
1910
+ /**
1911
+ * riSigner
1912
+ * view
1913
+ */
1914
+ async riSigner(): Promise<`0x${string}`> {
1915
+ return this.contract.read.riSigner() as Promise<`0x${string}`>;
1916
+ }
1917
+
1918
+ /**
1919
+ * stakingNFT
1920
+ * view
1921
+ */
1922
+ async stakingNFT(): Promise<`0x${string}`> {
1923
+ return this.contract.read.stakingNFT() as Promise<`0x${string}`>;
1924
+ }
1925
+
1926
+ /**
1927
+ * stakingPool
1928
+ * view
1929
+ */
1930
+ async stakingPool(poolId: bigint): Promise<`0x${string}`> {
1931
+ return this.contract.read.stakingPool([poolId] as const) as Promise<`0x${string}`>;
1932
+ }
1933
+
1934
+ /**
1935
+ * stakingPoolFactory
1936
+ * view
1937
+ */
1938
+ async stakingPoolFactory(): Promise<`0x${string}`> {
1939
+ return this.contract.read.stakingPoolFactory() as Promise<`0x${string}`>;
1940
+ }
1941
+
1942
+ /**
1943
+ * stakingPoolImplementation
1944
+ * view
1945
+ */
1946
+ async stakingPoolImplementation(): Promise<`0x${string}`> {
1947
+ return this.contract.read.stakingPoolImplementation() as Promise<`0x${string}`>;
1948
+ }
1949
+
1950
+ /**
1951
+ * tokenController
1952
+ * view
1953
+ */
1954
+ async tokenController(): Promise<`0x${string}`> {
1955
+ return this.contract.read.tokenController() as Promise<`0x${string}`>;
1956
+ }
1957
+
1958
+ /**
1959
+ * totalActiveCoverInAsset
1960
+ * view
1961
+ */
1962
+ async totalActiveCoverInAsset(assetId: bigint): Promise<bigint> {
1963
+ return this.contract.read.totalActiveCoverInAsset([assetId] as const) as Promise<bigint>;
1964
+ }
1965
+
1966
+ /**
1967
+ * burnStake
1968
+ * nonpayable
1969
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1970
+ */
1971
+ async burnStake(coverId: bigint, payoutAmountInAsset: bigint, options?: {
1972
+ accessList?: import('viem').AccessList;
1973
+ authorizationList?: import('viem').AuthorizationList;
1974
+ chain?: import('viem').Chain | null;
1975
+ dataSuffix?: `0x${string}`;
1976
+ gas?: bigint;
1977
+ gasPrice?: bigint;
1978
+ maxFeePerGas?: bigint;
1979
+ maxPriorityFeePerGas?: bigint;
1980
+ nonce?: number;
1981
+ value?: bigint;
1982
+ }): Promise<`0x${string}`> {
1983
+ if (!this.contract.write) {
1984
+ throw new Error('Wallet client is required for write operations');
1985
+ }
1986
+ return this.contract.write.burnStake([coverId, payoutAmountInAsset] as const, options) as Promise<`0x${string}`>;
1987
+ }
1988
+
1989
+ /**
1990
+ * buyCover
1991
+ * payable
1992
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1993
+ */
1994
+ async buyCover(params: BuyCoverParams, poolAllocationRequests: PoolAllocationRequest[], options?: {
1995
+ accessList?: import('viem').AccessList;
1996
+ authorizationList?: import('viem').AuthorizationList;
1997
+ chain?: import('viem').Chain | null;
1998
+ dataSuffix?: `0x${string}`;
1999
+ gas?: bigint;
2000
+ gasPrice?: bigint;
2001
+ maxFeePerGas?: bigint;
2002
+ maxPriorityFeePerGas?: bigint;
2003
+ nonce?: number;
2004
+ value?: bigint;
2005
+ }): Promise<`0x${string}`> {
2006
+ if (!this.contract.write) {
2007
+ throw new Error('Wallet client is required for write operations');
2008
+ }
2009
+ return this.contract.write.buyCover([params, poolAllocationRequests] as const, options) as Promise<`0x${string}`>;
2010
+ }
2011
+
2012
+ /**
2013
+ * buyCoverWithRi
2014
+ * payable
2015
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2016
+ */
2017
+ async buyCoverWithRi(params: BuyCoverParams, poolAllocationRequests: PoolAllocationRequest[], riRequest: RiRequest, options?: {
2018
+ accessList?: import('viem').AccessList;
2019
+ authorizationList?: import('viem').AuthorizationList;
2020
+ chain?: import('viem').Chain | null;
2021
+ dataSuffix?: `0x${string}`;
2022
+ gas?: bigint;
2023
+ gasPrice?: bigint;
2024
+ maxFeePerGas?: bigint;
2025
+ maxPriorityFeePerGas?: bigint;
2026
+ nonce?: number;
2027
+ value?: bigint;
2028
+ }): Promise<`0x${string}`> {
2029
+ if (!this.contract.write) {
2030
+ throw new Error('Wallet client is required for write operations');
2031
+ }
2032
+ return this.contract.write.buyCoverWithRi([params, poolAllocationRequests, riRequest] as const, options) as Promise<`0x${string}`>;
2033
+ }
2034
+
2035
+ /**
2036
+ * changeCoverNFTDescriptor
2037
+ * nonpayable
2038
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2039
+ */
2040
+ async changeCoverNFTDescriptor(_coverNFTDescriptor: `0x${string}`, options?: {
2041
+ accessList?: import('viem').AccessList;
2042
+ authorizationList?: import('viem').AuthorizationList;
2043
+ chain?: import('viem').Chain | null;
2044
+ dataSuffix?: `0x${string}`;
2045
+ gas?: bigint;
2046
+ gasPrice?: bigint;
2047
+ maxFeePerGas?: bigint;
2048
+ maxPriorityFeePerGas?: bigint;
2049
+ nonce?: number;
2050
+ value?: bigint;
2051
+ }): Promise<`0x${string}`> {
2052
+ if (!this.contract.write) {
2053
+ throw new Error('Wallet client is required for write operations');
2054
+ }
2055
+ return this.contract.write.changeCoverNFTDescriptor([_coverNFTDescriptor] as const, options) as Promise<`0x${string}`>;
2056
+ }
2057
+
2058
+ /**
2059
+ * changeStakingNFTDescriptor
2060
+ * nonpayable
2061
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2062
+ */
2063
+ async changeStakingNFTDescriptor(_stakingNFTDescriptor: `0x${string}`, options?: {
2064
+ accessList?: import('viem').AccessList;
2065
+ authorizationList?: import('viem').AuthorizationList;
2066
+ chain?: import('viem').Chain | null;
2067
+ dataSuffix?: `0x${string}`;
2068
+ gas?: bigint;
2069
+ gasPrice?: bigint;
2070
+ maxFeePerGas?: bigint;
2071
+ maxPriorityFeePerGas?: bigint;
2072
+ nonce?: number;
2073
+ value?: bigint;
2074
+ }): Promise<`0x${string}`> {
2075
+ if (!this.contract.write) {
2076
+ throw new Error('Wallet client is required for write operations');
2077
+ }
2078
+ return this.contract.write.changeStakingNFTDescriptor([_stakingNFTDescriptor] as const, options) as Promise<`0x${string}`>;
2079
+ }
2080
+
2081
+ /**
2082
+ * executeCoverBuy
2083
+ * payable
2084
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2085
+ */
2086
+ async executeCoverBuy(params: BuyCoverParams, poolAllocationRequests: PoolAllocationRequest[], buyer: `0x${string}`, options?: {
2087
+ accessList?: import('viem').AccessList;
2088
+ authorizationList?: import('viem').AuthorizationList;
2089
+ chain?: import('viem').Chain | null;
2090
+ dataSuffix?: `0x${string}`;
2091
+ gas?: bigint;
2092
+ gasPrice?: bigint;
2093
+ maxFeePerGas?: bigint;
2094
+ maxPriorityFeePerGas?: bigint;
2095
+ nonce?: number;
2096
+ value?: bigint;
2097
+ }): Promise<`0x${string}`> {
2098
+ if (!this.contract.write) {
2099
+ throw new Error('Wallet client is required for write operations');
2100
+ }
2101
+ return this.contract.write.executeCoverBuy([params, poolAllocationRequests, buyer] as const, options) as Promise<`0x${string}`>;
2102
+ }
2103
+
2104
+ /**
2105
+ * expireCover
2106
+ * nonpayable
2107
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2108
+ */
2109
+ async expireCover(coverId: bigint, options?: {
2110
+ accessList?: import('viem').AccessList;
2111
+ authorizationList?: import('viem').AuthorizationList;
2112
+ chain?: import('viem').Chain | null;
2113
+ dataSuffix?: `0x${string}`;
2114
+ gas?: bigint;
2115
+ gasPrice?: bigint;
2116
+ maxFeePerGas?: bigint;
2117
+ maxPriorityFeePerGas?: bigint;
2118
+ nonce?: number;
2119
+ value?: bigint;
2120
+ }): Promise<`0x${string}`> {
2121
+ if (!this.contract.write) {
2122
+ throw new Error('Wallet client is required for write operations');
2123
+ }
2124
+ return this.contract.write.expireCover([coverId] as const, options) as Promise<`0x${string}`>;
2125
+ }
2126
+
2127
+ /**
2128
+ * multicall
2129
+ * nonpayable
2130
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2131
+ */
2132
+ async multicall(data: `0x${string}`[], options?: {
2133
+ accessList?: import('viem').AccessList;
2134
+ authorizationList?: import('viem').AuthorizationList;
2135
+ chain?: import('viem').Chain | null;
2136
+ dataSuffix?: `0x${string}`;
2137
+ gas?: bigint;
2138
+ gasPrice?: bigint;
2139
+ maxFeePerGas?: bigint;
2140
+ maxPriorityFeePerGas?: bigint;
2141
+ nonce?: number;
2142
+ value?: bigint;
2143
+ }): Promise<`0x${string}`> {
2144
+ if (!this.contract.write) {
2145
+ throw new Error('Wallet client is required for write operations');
2146
+ }
2147
+ return this.contract.write.multicall([data] as const, options) as Promise<`0x${string}`>;
2148
+ }
2149
+
2150
+ /**
2151
+ * populateIpfsMetadata
2152
+ * nonpayable
2153
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2154
+ */
2155
+ async populateIpfsMetadata(coverIds: bigint[], ipfsMetadata: string[], options?: {
2156
+ accessList?: import('viem').AccessList;
2157
+ authorizationList?: import('viem').AuthorizationList;
2158
+ chain?: import('viem').Chain | null;
2159
+ dataSuffix?: `0x${string}`;
2160
+ gas?: bigint;
2161
+ gasPrice?: bigint;
2162
+ maxFeePerGas?: bigint;
2163
+ maxPriorityFeePerGas?: bigint;
2164
+ nonce?: number;
2165
+ value?: bigint;
2166
+ }): Promise<`0x${string}`> {
2167
+ if (!this.contract.write) {
2168
+ throw new Error('Wallet client is required for write operations');
2169
+ }
2170
+ return this.contract.write.populateIpfsMetadata([coverIds, ipfsMetadata] as const, options) as Promise<`0x${string}`>;
2171
+ }
2172
+
2173
+ /**
2174
+ * recalculateActiveCoverInAsset
2175
+ * nonpayable
2176
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2177
+ */
2178
+ async recalculateActiveCoverInAsset(coverAsset: bigint, options?: {
2179
+ accessList?: import('viem').AccessList;
2180
+ authorizationList?: import('viem').AuthorizationList;
2181
+ chain?: import('viem').Chain | null;
2182
+ dataSuffix?: `0x${string}`;
2183
+ gas?: bigint;
2184
+ gasPrice?: bigint;
2185
+ maxFeePerGas?: bigint;
2186
+ maxPriorityFeePerGas?: bigint;
2187
+ nonce?: number;
2188
+ value?: bigint;
2189
+ }): Promise<`0x${string}`> {
2190
+ if (!this.contract.write) {
2191
+ throw new Error('Wallet client is required for write operations');
2192
+ }
2193
+ return this.contract.write.recalculateActiveCoverInAsset([coverAsset] as const, options) as Promise<`0x${string}`>;
2194
+ }
2195
+
2196
+ /**
2197
+ * setRiConfig
2198
+ * nonpayable
2199
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2200
+ */
2201
+ async setRiConfig(providerId: bigint, premiumDestination: `0x${string}`, options?: {
2202
+ accessList?: import('viem').AccessList;
2203
+ authorizationList?: import('viem').AuthorizationList;
2204
+ chain?: import('viem').Chain | null;
2205
+ dataSuffix?: `0x${string}`;
2206
+ gas?: bigint;
2207
+ gasPrice?: bigint;
2208
+ maxFeePerGas?: bigint;
2209
+ maxPriorityFeePerGas?: bigint;
2210
+ nonce?: number;
2211
+ value?: bigint;
2212
+ }): Promise<`0x${string}`> {
2213
+ if (!this.contract.write) {
2214
+ throw new Error('Wallet client is required for write operations');
2215
+ }
2216
+ return this.contract.write.setRiConfig([providerId, premiumDestination] as const, options) as Promise<`0x${string}`>;
2217
+ }
2218
+
2219
+ /**
2220
+ * setRiSigner
2221
+ * nonpayable
2222
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2223
+ */
2224
+ async setRiSigner(_riSigner: `0x${string}`, options?: {
2225
+ accessList?: import('viem').AccessList;
2226
+ authorizationList?: import('viem').AuthorizationList;
2227
+ chain?: import('viem').Chain | null;
2228
+ dataSuffix?: `0x${string}`;
2229
+ gas?: bigint;
2230
+ gasPrice?: bigint;
2231
+ maxFeePerGas?: bigint;
2232
+ maxPriorityFeePerGas?: bigint;
2233
+ nonce?: number;
2234
+ value?: bigint;
2235
+ }): Promise<`0x${string}`> {
2236
+ if (!this.contract.write) {
2237
+ throw new Error('Wallet client is required for write operations');
2238
+ }
2239
+ return this.contract.write.setRiSigner([_riSigner] as const, options) as Promise<`0x${string}`>;
2240
+ }
2241
+
2242
+ /**
2243
+ * updateTotalActiveCoverAmount
2244
+ * nonpayable
2245
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2246
+ */
2247
+ async updateTotalActiveCoverAmount(coverAsset: bigint, options?: {
2248
+ accessList?: import('viem').AccessList;
2249
+ authorizationList?: import('viem').AuthorizationList;
2250
+ chain?: import('viem').Chain | null;
2251
+ dataSuffix?: `0x${string}`;
2252
+ gas?: bigint;
2253
+ gasPrice?: bigint;
2254
+ maxFeePerGas?: bigint;
2255
+ maxPriorityFeePerGas?: bigint;
2256
+ nonce?: number;
2257
+ value?: bigint;
2258
+ }): Promise<`0x${string}`> {
2259
+ if (!this.contract.write) {
2260
+ throw new Error('Wallet client is required for write operations');
2261
+ }
2262
+ return this.contract.write.updateTotalActiveCoverAmount([coverAsset] as const, options) as Promise<`0x${string}`>;
2263
+ }
2264
+
2265
+
2266
+
2267
+ /**
2268
+ * Simulate contract write operations (dry-run without sending transaction)
2269
+ *
2270
+ * @example
2271
+ * const result = await contract.simulate.transfer('0x...', 1000n);
2272
+ * console.log('Gas estimate:', result.request.gas);
2273
+ * console.log('Would succeed:', result.result);
2274
+ */
2275
+ get simulate() {
2276
+ const contract = this.contract;
2277
+ if (!contract.simulate) {
2278
+ throw new Error('Public client is required for simulation');
2279
+ }
2280
+ return {
2281
+ /**
2282
+ * Simulate burnStake
2283
+ * Returns gas estimate and result without sending transaction
2284
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2285
+ */
2286
+ async burnStake(coverId: bigint, payoutAmountInAsset: bigint, options?: {
2287
+ accessList?: import('viem').AccessList;
2288
+ authorizationList?: import('viem').AuthorizationList;
2289
+ chain?: import('viem').Chain | null;
2290
+ dataSuffix?: `0x${string}`;
2291
+ gas?: bigint;
2292
+ gasPrice?: bigint;
2293
+ maxFeePerGas?: bigint;
2294
+ maxPriorityFeePerGas?: bigint;
2295
+ nonce?: number;
2296
+ value?: bigint;
2297
+ }): Promise<void> {
2298
+ return contract.simulate.burnStake([coverId, payoutAmountInAsset] as const, options) as Promise<void>;
2299
+ },
2300
+ /**
2301
+ * Simulate buyCover
2302
+ * Returns gas estimate and result without sending transaction
2303
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2304
+ */
2305
+ async buyCover(params: BuyCoverParams, poolAllocationRequests: PoolAllocationRequest[], options?: {
2306
+ accessList?: import('viem').AccessList;
2307
+ authorizationList?: import('viem').AuthorizationList;
2308
+ chain?: import('viem').Chain | null;
2309
+ dataSuffix?: `0x${string}`;
2310
+ gas?: bigint;
2311
+ gasPrice?: bigint;
2312
+ maxFeePerGas?: bigint;
2313
+ maxPriorityFeePerGas?: bigint;
2314
+ nonce?: number;
2315
+ value?: bigint;
2316
+ }): Promise<bigint> {
2317
+ return contract.simulate.buyCover([params, poolAllocationRequests] as const, options) as Promise<bigint>;
2318
+ },
2319
+ /**
2320
+ * Simulate buyCoverWithRi
2321
+ * Returns gas estimate and result without sending transaction
2322
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2323
+ */
2324
+ async buyCoverWithRi(params: BuyCoverParams, poolAllocationRequests: PoolAllocationRequest[], riRequest: RiRequest, options?: {
2325
+ accessList?: import('viem').AccessList;
2326
+ authorizationList?: import('viem').AuthorizationList;
2327
+ chain?: import('viem').Chain | null;
2328
+ dataSuffix?: `0x${string}`;
2329
+ gas?: bigint;
2330
+ gasPrice?: bigint;
2331
+ maxFeePerGas?: bigint;
2332
+ maxPriorityFeePerGas?: bigint;
2333
+ nonce?: number;
2334
+ value?: bigint;
2335
+ }): Promise<bigint> {
2336
+ return contract.simulate.buyCoverWithRi([params, poolAllocationRequests, riRequest] as const, options) as Promise<bigint>;
2337
+ },
2338
+ /**
2339
+ * Simulate changeCoverNFTDescriptor
2340
+ * Returns gas estimate and result without sending transaction
2341
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2342
+ */
2343
+ async changeCoverNFTDescriptor(_coverNFTDescriptor: `0x${string}`, options?: {
2344
+ accessList?: import('viem').AccessList;
2345
+ authorizationList?: import('viem').AuthorizationList;
2346
+ chain?: import('viem').Chain | null;
2347
+ dataSuffix?: `0x${string}`;
2348
+ gas?: bigint;
2349
+ gasPrice?: bigint;
2350
+ maxFeePerGas?: bigint;
2351
+ maxPriorityFeePerGas?: bigint;
2352
+ nonce?: number;
2353
+ value?: bigint;
2354
+ }): Promise<void> {
2355
+ return contract.simulate.changeCoverNFTDescriptor([_coverNFTDescriptor] as const, options) as Promise<void>;
2356
+ },
2357
+ /**
2358
+ * Simulate changeStakingNFTDescriptor
2359
+ * Returns gas estimate and result without sending transaction
2360
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2361
+ */
2362
+ async changeStakingNFTDescriptor(_stakingNFTDescriptor: `0x${string}`, options?: {
2363
+ accessList?: import('viem').AccessList;
2364
+ authorizationList?: import('viem').AuthorizationList;
2365
+ chain?: import('viem').Chain | null;
2366
+ dataSuffix?: `0x${string}`;
2367
+ gas?: bigint;
2368
+ gasPrice?: bigint;
2369
+ maxFeePerGas?: bigint;
2370
+ maxPriorityFeePerGas?: bigint;
2371
+ nonce?: number;
2372
+ value?: bigint;
2373
+ }): Promise<void> {
2374
+ return contract.simulate.changeStakingNFTDescriptor([_stakingNFTDescriptor] as const, options) as Promise<void>;
2375
+ },
2376
+ /**
2377
+ * Simulate executeCoverBuy
2378
+ * Returns gas estimate and result without sending transaction
2379
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2380
+ */
2381
+ async executeCoverBuy(params: BuyCoverParams, poolAllocationRequests: PoolAllocationRequest[], buyer: `0x${string}`, options?: {
2382
+ accessList?: import('viem').AccessList;
2383
+ authorizationList?: import('viem').AuthorizationList;
2384
+ chain?: import('viem').Chain | null;
2385
+ dataSuffix?: `0x${string}`;
2386
+ gas?: bigint;
2387
+ gasPrice?: bigint;
2388
+ maxFeePerGas?: bigint;
2389
+ maxPriorityFeePerGas?: bigint;
2390
+ nonce?: number;
2391
+ value?: bigint;
2392
+ }): Promise<bigint> {
2393
+ return contract.simulate.executeCoverBuy([params, poolAllocationRequests, buyer] as const, options) as Promise<bigint>;
2394
+ },
2395
+ /**
2396
+ * Simulate expireCover
2397
+ * Returns gas estimate and result without sending transaction
2398
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2399
+ */
2400
+ async expireCover(coverId: bigint, options?: {
2401
+ accessList?: import('viem').AccessList;
2402
+ authorizationList?: import('viem').AuthorizationList;
2403
+ chain?: import('viem').Chain | null;
2404
+ dataSuffix?: `0x${string}`;
2405
+ gas?: bigint;
2406
+ gasPrice?: bigint;
2407
+ maxFeePerGas?: bigint;
2408
+ maxPriorityFeePerGas?: bigint;
2409
+ nonce?: number;
2410
+ value?: bigint;
2411
+ }): Promise<void> {
2412
+ return contract.simulate.expireCover([coverId] as const, options) as Promise<void>;
2413
+ },
2414
+ /**
2415
+ * Simulate multicall
2416
+ * Returns gas estimate and result without sending transaction
2417
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2418
+ */
2419
+ async multicall(data: `0x${string}`[], options?: {
2420
+ accessList?: import('viem').AccessList;
2421
+ authorizationList?: import('viem').AuthorizationList;
2422
+ chain?: import('viem').Chain | null;
2423
+ dataSuffix?: `0x${string}`;
2424
+ gas?: bigint;
2425
+ gasPrice?: bigint;
2426
+ maxFeePerGas?: bigint;
2427
+ maxPriorityFeePerGas?: bigint;
2428
+ nonce?: number;
2429
+ value?: bigint;
2430
+ }): Promise<`0x${string}`[]> {
2431
+ return contract.simulate.multicall([data] as const, options) as Promise<`0x${string}`[]>;
2432
+ },
2433
+ /**
2434
+ * Simulate populateIpfsMetadata
2435
+ * Returns gas estimate and result without sending transaction
2436
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2437
+ */
2438
+ async populateIpfsMetadata(coverIds: bigint[], ipfsMetadata: string[], options?: {
2439
+ accessList?: import('viem').AccessList;
2440
+ authorizationList?: import('viem').AuthorizationList;
2441
+ chain?: import('viem').Chain | null;
2442
+ dataSuffix?: `0x${string}`;
2443
+ gas?: bigint;
2444
+ gasPrice?: bigint;
2445
+ maxFeePerGas?: bigint;
2446
+ maxPriorityFeePerGas?: bigint;
2447
+ nonce?: number;
2448
+ value?: bigint;
2449
+ }): Promise<void> {
2450
+ return contract.simulate.populateIpfsMetadata([coverIds, ipfsMetadata] as const, options) as Promise<void>;
2451
+ },
2452
+ /**
2453
+ * Simulate recalculateActiveCoverInAsset
2454
+ * Returns gas estimate and result without sending transaction
2455
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2456
+ */
2457
+ async recalculateActiveCoverInAsset(coverAsset: bigint, options?: {
2458
+ accessList?: import('viem').AccessList;
2459
+ authorizationList?: import('viem').AuthorizationList;
2460
+ chain?: import('viem').Chain | null;
2461
+ dataSuffix?: `0x${string}`;
2462
+ gas?: bigint;
2463
+ gasPrice?: bigint;
2464
+ maxFeePerGas?: bigint;
2465
+ maxPriorityFeePerGas?: bigint;
2466
+ nonce?: number;
2467
+ value?: bigint;
2468
+ }): Promise<void> {
2469
+ return contract.simulate.recalculateActiveCoverInAsset([coverAsset] as const, options) as Promise<void>;
2470
+ },
2471
+ /**
2472
+ * Simulate setRiConfig
2473
+ * Returns gas estimate and result without sending transaction
2474
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2475
+ */
2476
+ async setRiConfig(providerId: bigint, premiumDestination: `0x${string}`, options?: {
2477
+ accessList?: import('viem').AccessList;
2478
+ authorizationList?: import('viem').AuthorizationList;
2479
+ chain?: import('viem').Chain | null;
2480
+ dataSuffix?: `0x${string}`;
2481
+ gas?: bigint;
2482
+ gasPrice?: bigint;
2483
+ maxFeePerGas?: bigint;
2484
+ maxPriorityFeePerGas?: bigint;
2485
+ nonce?: number;
2486
+ value?: bigint;
2487
+ }): Promise<void> {
2488
+ return contract.simulate.setRiConfig([providerId, premiumDestination] as const, options) as Promise<void>;
2489
+ },
2490
+ /**
2491
+ * Simulate setRiSigner
2492
+ * Returns gas estimate and result without sending transaction
2493
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2494
+ */
2495
+ async setRiSigner(_riSigner: `0x${string}`, options?: {
2496
+ accessList?: import('viem').AccessList;
2497
+ authorizationList?: import('viem').AuthorizationList;
2498
+ chain?: import('viem').Chain | null;
2499
+ dataSuffix?: `0x${string}`;
2500
+ gas?: bigint;
2501
+ gasPrice?: bigint;
2502
+ maxFeePerGas?: bigint;
2503
+ maxPriorityFeePerGas?: bigint;
2504
+ nonce?: number;
2505
+ value?: bigint;
2506
+ }): Promise<void> {
2507
+ return contract.simulate.setRiSigner([_riSigner] as const, options) as Promise<void>;
2508
+ },
2509
+ /**
2510
+ * Simulate updateTotalActiveCoverAmount
2511
+ * Returns gas estimate and result without sending transaction
2512
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
2513
+ */
2514
+ async updateTotalActiveCoverAmount(coverAsset: bigint, options?: {
2515
+ accessList?: import('viem').AccessList;
2516
+ authorizationList?: import('viem').AuthorizationList;
2517
+ chain?: import('viem').Chain | null;
2518
+ dataSuffix?: `0x${string}`;
2519
+ gas?: bigint;
2520
+ gasPrice?: bigint;
2521
+ maxFeePerGas?: bigint;
2522
+ maxPriorityFeePerGas?: bigint;
2523
+ nonce?: number;
2524
+ value?: bigint;
2525
+ }): Promise<void> {
2526
+ return contract.simulate.updateTotalActiveCoverAmount([coverAsset] as const, options) as Promise<void>;
2527
+ }
2528
+ };
2529
+ }
2530
+
2531
+ /**
2532
+ * Watch contract events
2533
+ *
2534
+ * @example
2535
+ * // Watch all Transfer events
2536
+ * const unwatch = contract.watch.Transfer((event) => {
2537
+ * console.log('Transfer:', event);
2538
+ * });
2539
+ *
2540
+ * // Stop watching
2541
+ * unwatch();
2542
+ */
2543
+ get watch() {
2544
+ return {
2545
+ /**
2546
+ * Watch CoverBought events
2547
+ * @param callback Function to call when event is emitted
2548
+ * @param filter Optional filter for indexed parameters
2549
+ * @returns Unwatch function to stop listening
2550
+ */
2551
+ CoverBought: (callback: (event: { coverId: bigint; originalCoverId: bigint; buyerMemberId: bigint; productId: bigint }) => void, filter?: { coverId?: bigint | bigint[] | null; originalCoverId?: bigint | bigint[] | null; buyerMemberId?: bigint | bigint[] | null }) => {
2552
+ return this.publicClient.watchContractEvent({
2553
+ address: this.contractAddress,
2554
+ abi: CoverAbi,
2555
+ eventName: 'CoverBought',
2556
+ args: filter as any,
2557
+ onLogs: (logs: any[]) => {
2558
+ logs.forEach((log: any) => {
2559
+ callback(log.args as any);
2560
+ });
2561
+ },
2562
+ }) as () => void;
2563
+ },
2564
+ /**
2565
+ * Watch CoverRiAllocated events
2566
+ * @param callback Function to call when event is emitted
2567
+ * @param filter Optional filter for indexed parameters
2568
+ * @returns Unwatch function to stop listening
2569
+ */
2570
+ CoverRiAllocated: (callback: (event: { coverId: bigint; premium: bigint; paymentAsset: bigint; data: `0x${string}`; dataFormatVersion: bigint }) => void, filter?: { coverId?: bigint | bigint[] | null }) => {
2571
+ return this.publicClient.watchContractEvent({
2572
+ address: this.contractAddress,
2573
+ abi: CoverAbi,
2574
+ eventName: 'CoverRiAllocated',
2575
+ args: filter as any,
2576
+ onLogs: (logs: any[]) => {
2577
+ logs.forEach((log: any) => {
2578
+ callback(log.args as any);
2579
+ });
2580
+ },
2581
+ }) as () => void;
2582
+ }
2583
+ };
2584
+ }
2585
+ }