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