@gitmyabi/cicada-maker 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2019 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+
5
+ /**
6
+ * IQuote.RFQMQuote struct type
7
+ */
8
+ export type IQuote_RFQMQuote = {
9
+ pool: `0x${string}`;
10
+ externalAccount: `0x${string}`;
11
+ trader: `0x${string}`;
12
+ baseToken: `0x${string}`;
13
+ quoteToken: `0x${string}`;
14
+ baseTokenAmount: bigint;
15
+ quoteTokenAmount: bigint;
16
+ quoteExpiry: bigint;
17
+ txid: `0x${string}`;
18
+ takerSignature: `0x${string}`;
19
+ makerSignature: `0x${string}`;
20
+ };
21
+
22
+ /**
23
+ * IQuote.RFQTQuote struct type
24
+ */
25
+ export type IQuote_RFQTQuote = {
26
+ pool: `0x${string}`;
27
+ externalAccount: `0x${string}`;
28
+ trader: `0x${string}`;
29
+ effectiveTrader: `0x${string}`;
30
+ baseToken: `0x${string}`;
31
+ quoteToken: `0x${string}`;
32
+ effectiveBaseTokenAmount: bigint;
33
+ baseTokenAmount: bigint;
34
+ quoteTokenAmount: bigint;
35
+ quoteExpiry: bigint;
36
+ nonce: bigint;
37
+ txid: `0x${string}`;
38
+ signature: `0x${string}`;
39
+ };
40
+
41
+ /**
42
+ * IQuote.XChainRFQMQuote struct type
43
+ */
44
+ export type IQuote_XChainRFQMQuote = {
45
+ srcChainId: bigint;
46
+ dstChainId: bigint;
47
+ srcPool: `0x${string}`;
48
+ dstPool: `0x${string}`;
49
+ srcExternalAccount: `0x${string}`;
50
+ dstExternalAccount: `0x${string}`;
51
+ trader: `0x${string}`;
52
+ dstTrader: `0x${string}`;
53
+ baseToken: `0x${string}`;
54
+ quoteToken: `0x${string}`;
55
+ baseTokenAmount: bigint;
56
+ quoteTokenAmount: bigint;
57
+ quoteExpiry: bigint;
58
+ txid: `0x${string}`;
59
+ xChainMessenger: `0x${string}`;
60
+ takerSignature: `0x${string}`;
61
+ makerSignature: `0x${string}`;
62
+ };
63
+
64
+ /**
65
+ * IQuote.XChainRFQTQuote struct type
66
+ */
67
+ export type IQuote_XChainRFQTQuote = {
68
+ srcChainId: bigint;
69
+ dstChainId: bigint;
70
+ srcPool: `0x${string}`;
71
+ dstPool: `0x${string}`;
72
+ srcExternalAccount: `0x${string}`;
73
+ dstExternalAccount: `0x${string}`;
74
+ dstTrader: `0x${string}`;
75
+ baseToken: `0x${string}`;
76
+ quoteToken: `0x${string}`;
77
+ effectiveBaseTokenAmount: bigint;
78
+ baseTokenAmount: bigint;
79
+ quoteTokenAmount: bigint;
80
+ quoteExpiry: bigint;
81
+ nonce: bigint;
82
+ txid: `0x${string}`;
83
+ xChainMessenger: `0x${string}`;
84
+ signature: `0x${string}`;
85
+ };
86
+
87
+ /**
88
+ * IHashflowPool.AuthorizedXChainPool struct type
89
+ */
90
+ export type IHashflowPool_AuthorizedXChainPool = {
91
+ chainId: bigint;
92
+ pool: `0x${string}`;
93
+ };
94
+ /**
95
+ * HashflowPool ABI
96
+ *
97
+ * This ABI is typed using viem's type system for full type safety.
98
+ */
99
+ export const HashflowPoolAbi = [
100
+ {
101
+ "inputs": [
102
+ {
103
+ "internalType": "address",
104
+ "name": "weth",
105
+ "type": "address"
106
+ }
107
+ ],
108
+ "stateMutability": "nonpayable",
109
+ "type": "constructor"
110
+ },
111
+ {
112
+ "anonymous": false,
113
+ "inputs": [
114
+ {
115
+ "indexed": false,
116
+ "internalType": "uint8",
117
+ "name": "version",
118
+ "type": "uint8"
119
+ }
120
+ ],
121
+ "name": "Initialized",
122
+ "type": "event"
123
+ },
124
+ {
125
+ "anonymous": false,
126
+ "inputs": [
127
+ {
128
+ "indexed": false,
129
+ "internalType": "address",
130
+ "name": "token",
131
+ "type": "address"
132
+ },
133
+ {
134
+ "indexed": false,
135
+ "internalType": "address",
136
+ "name": "recipient",
137
+ "type": "address"
138
+ },
139
+ {
140
+ "indexed": false,
141
+ "internalType": "uint256",
142
+ "name": "withdrawAmount",
143
+ "type": "uint256"
144
+ }
145
+ ],
146
+ "name": "RemoveLiquidity",
147
+ "type": "event"
148
+ },
149
+ {
150
+ "anonymous": false,
151
+ "inputs": [
152
+ {
153
+ "indexed": false,
154
+ "internalType": "address",
155
+ "name": "trader",
156
+ "type": "address"
157
+ },
158
+ {
159
+ "indexed": false,
160
+ "internalType": "address",
161
+ "name": "effectiveTrader",
162
+ "type": "address"
163
+ },
164
+ {
165
+ "indexed": false,
166
+ "internalType": "bytes32",
167
+ "name": "txid",
168
+ "type": "bytes32"
169
+ },
170
+ {
171
+ "indexed": false,
172
+ "internalType": "address",
173
+ "name": "baseToken",
174
+ "type": "address"
175
+ },
176
+ {
177
+ "indexed": false,
178
+ "internalType": "address",
179
+ "name": "quoteToken",
180
+ "type": "address"
181
+ },
182
+ {
183
+ "indexed": false,
184
+ "internalType": "uint256",
185
+ "name": "baseTokenAmount",
186
+ "type": "uint256"
187
+ },
188
+ {
189
+ "indexed": false,
190
+ "internalType": "uint256",
191
+ "name": "quoteTokenAmount",
192
+ "type": "uint256"
193
+ }
194
+ ],
195
+ "name": "Trade",
196
+ "type": "event"
197
+ },
198
+ {
199
+ "anonymous": false,
200
+ "inputs": [
201
+ {
202
+ "indexed": false,
203
+ "internalType": "address",
204
+ "name": "signer",
205
+ "type": "address"
206
+ },
207
+ {
208
+ "indexed": false,
209
+ "internalType": "address",
210
+ "name": "prevSigner",
211
+ "type": "address"
212
+ }
213
+ ],
214
+ "name": "UpdateSigner",
215
+ "type": "event"
216
+ },
217
+ {
218
+ "anonymous": false,
219
+ "inputs": [
220
+ {
221
+ "indexed": false,
222
+ "internalType": "address",
223
+ "name": "account",
224
+ "type": "address"
225
+ },
226
+ {
227
+ "indexed": false,
228
+ "internalType": "bool",
229
+ "name": "authorized",
230
+ "type": "bool"
231
+ }
232
+ ],
233
+ "name": "UpdateWithdrawalAccount",
234
+ "type": "event"
235
+ },
236
+ {
237
+ "anonymous": false,
238
+ "inputs": [
239
+ {
240
+ "indexed": false,
241
+ "internalType": "uint16",
242
+ "name": "dstChainId",
243
+ "type": "uint16"
244
+ },
245
+ {
246
+ "indexed": false,
247
+ "internalType": "bytes32",
248
+ "name": "dstPool",
249
+ "type": "bytes32"
250
+ },
251
+ {
252
+ "indexed": false,
253
+ "internalType": "address",
254
+ "name": "trader",
255
+ "type": "address"
256
+ },
257
+ {
258
+ "indexed": false,
259
+ "internalType": "bytes32",
260
+ "name": "dstTrader",
261
+ "type": "bytes32"
262
+ },
263
+ {
264
+ "indexed": false,
265
+ "internalType": "bytes32",
266
+ "name": "txid",
267
+ "type": "bytes32"
268
+ },
269
+ {
270
+ "indexed": false,
271
+ "internalType": "address",
272
+ "name": "baseToken",
273
+ "type": "address"
274
+ },
275
+ {
276
+ "indexed": false,
277
+ "internalType": "bytes32",
278
+ "name": "quoteToken",
279
+ "type": "bytes32"
280
+ },
281
+ {
282
+ "indexed": false,
283
+ "internalType": "uint256",
284
+ "name": "baseTokenAmount",
285
+ "type": "uint256"
286
+ },
287
+ {
288
+ "indexed": false,
289
+ "internalType": "uint256",
290
+ "name": "quoteTokenAmount",
291
+ "type": "uint256"
292
+ }
293
+ ],
294
+ "name": "XChainTrade",
295
+ "type": "event"
296
+ },
297
+ {
298
+ "anonymous": false,
299
+ "inputs": [
300
+ {
301
+ "indexed": false,
302
+ "internalType": "bytes32",
303
+ "name": "txid",
304
+ "type": "bytes32"
305
+ }
306
+ ],
307
+ "name": "XChainTradeFill",
308
+ "type": "event"
309
+ },
310
+ {
311
+ "inputs": [],
312
+ "name": "_WETH",
313
+ "outputs": [
314
+ {
315
+ "internalType": "address",
316
+ "name": "",
317
+ "type": "address"
318
+ }
319
+ ],
320
+ "stateMutability": "view",
321
+ "type": "function"
322
+ },
323
+ {
324
+ "inputs": [
325
+ {
326
+ "internalType": "address",
327
+ "name": "token",
328
+ "type": "address"
329
+ },
330
+ {
331
+ "internalType": "address",
332
+ "name": "spender",
333
+ "type": "address"
334
+ },
335
+ {
336
+ "internalType": "uint256",
337
+ "name": "amount",
338
+ "type": "uint256"
339
+ }
340
+ ],
341
+ "name": "approveToken",
342
+ "outputs": [],
343
+ "stateMutability": "nonpayable",
344
+ "type": "function"
345
+ },
346
+ {
347
+ "inputs": [
348
+ {
349
+ "internalType": "address",
350
+ "name": "token",
351
+ "type": "address"
352
+ },
353
+ {
354
+ "internalType": "address",
355
+ "name": "spender",
356
+ "type": "address"
357
+ },
358
+ {
359
+ "internalType": "uint256",
360
+ "name": "amount",
361
+ "type": "uint256"
362
+ }
363
+ ],
364
+ "name": "decreaseTokenAllowance",
365
+ "outputs": [],
366
+ "stateMutability": "nonpayable",
367
+ "type": "function"
368
+ },
369
+ {
370
+ "inputs": [
371
+ {
372
+ "internalType": "address",
373
+ "name": "externalAccount",
374
+ "type": "address"
375
+ },
376
+ {
377
+ "internalType": "bytes32",
378
+ "name": "txid",
379
+ "type": "bytes32"
380
+ },
381
+ {
382
+ "internalType": "address",
383
+ "name": "trader",
384
+ "type": "address"
385
+ },
386
+ {
387
+ "internalType": "address",
388
+ "name": "quoteToken",
389
+ "type": "address"
390
+ },
391
+ {
392
+ "internalType": "uint256",
393
+ "name": "quoteTokenAmount",
394
+ "type": "uint256"
395
+ }
396
+ ],
397
+ "name": "fillXChain",
398
+ "outputs": [],
399
+ "stateMutability": "nonpayable",
400
+ "type": "function"
401
+ },
402
+ {
403
+ "inputs": [
404
+ {
405
+ "internalType": "address",
406
+ "name": "token",
407
+ "type": "address"
408
+ }
409
+ ],
410
+ "name": "getReserves",
411
+ "outputs": [
412
+ {
413
+ "internalType": "uint256",
414
+ "name": "",
415
+ "type": "uint256"
416
+ }
417
+ ],
418
+ "stateMutability": "view",
419
+ "type": "function"
420
+ },
421
+ {
422
+ "inputs": [
423
+ {
424
+ "internalType": "address",
425
+ "name": "token",
426
+ "type": "address"
427
+ },
428
+ {
429
+ "internalType": "address",
430
+ "name": "spender",
431
+ "type": "address"
432
+ },
433
+ {
434
+ "internalType": "uint256",
435
+ "name": "amount",
436
+ "type": "uint256"
437
+ }
438
+ ],
439
+ "name": "increaseTokenAllowance",
440
+ "outputs": [],
441
+ "stateMutability": "nonpayable",
442
+ "type": "function"
443
+ },
444
+ {
445
+ "inputs": [
446
+ {
447
+ "internalType": "string",
448
+ "name": "_name",
449
+ "type": "string"
450
+ },
451
+ {
452
+ "internalType": "address",
453
+ "name": "_signer",
454
+ "type": "address"
455
+ },
456
+ {
457
+ "internalType": "address",
458
+ "name": "_operations",
459
+ "type": "address"
460
+ },
461
+ {
462
+ "internalType": "address",
463
+ "name": "_router",
464
+ "type": "address"
465
+ }
466
+ ],
467
+ "name": "initialize",
468
+ "outputs": [],
469
+ "stateMutability": "nonpayable",
470
+ "type": "function"
471
+ },
472
+ {
473
+ "inputs": [
474
+ {
475
+ "internalType": "bytes32",
476
+ "name": "hash",
477
+ "type": "bytes32"
478
+ },
479
+ {
480
+ "internalType": "bytes",
481
+ "name": "signature",
482
+ "type": "bytes"
483
+ }
484
+ ],
485
+ "name": "isValidSignature",
486
+ "outputs": [
487
+ {
488
+ "internalType": "bytes4",
489
+ "name": "magicValue",
490
+ "type": "bytes4"
491
+ }
492
+ ],
493
+ "stateMutability": "view",
494
+ "type": "function"
495
+ },
496
+ {
497
+ "inputs": [
498
+ {
499
+ "internalType": "bool",
500
+ "name": "enabled",
501
+ "type": "bool"
502
+ }
503
+ ],
504
+ "name": "killswitchOperations",
505
+ "outputs": [],
506
+ "stateMutability": "nonpayable",
507
+ "type": "function"
508
+ },
509
+ {
510
+ "inputs": [],
511
+ "name": "name",
512
+ "outputs": [
513
+ {
514
+ "internalType": "string",
515
+ "name": "",
516
+ "type": "string"
517
+ }
518
+ ],
519
+ "stateMutability": "view",
520
+ "type": "function"
521
+ },
522
+ {
523
+ "inputs": [
524
+ {
525
+ "internalType": "address",
526
+ "name": "",
527
+ "type": "address"
528
+ }
529
+ ],
530
+ "name": "nonces",
531
+ "outputs": [
532
+ {
533
+ "internalType": "uint256",
534
+ "name": "",
535
+ "type": "uint256"
536
+ }
537
+ ],
538
+ "stateMutability": "view",
539
+ "type": "function"
540
+ },
541
+ {
542
+ "inputs": [],
543
+ "name": "operations",
544
+ "outputs": [
545
+ {
546
+ "internalType": "address",
547
+ "name": "",
548
+ "type": "address"
549
+ }
550
+ ],
551
+ "stateMutability": "view",
552
+ "type": "function"
553
+ },
554
+ {
555
+ "inputs": [
556
+ {
557
+ "internalType": "address",
558
+ "name": "token",
559
+ "type": "address"
560
+ },
561
+ {
562
+ "internalType": "address",
563
+ "name": "recipient",
564
+ "type": "address"
565
+ },
566
+ {
567
+ "internalType": "uint256",
568
+ "name": "amount",
569
+ "type": "uint256"
570
+ }
571
+ ],
572
+ "name": "removeLiquidity",
573
+ "outputs": [],
574
+ "stateMutability": "nonpayable",
575
+ "type": "function"
576
+ },
577
+ {
578
+ "inputs": [],
579
+ "name": "router",
580
+ "outputs": [
581
+ {
582
+ "internalType": "address",
583
+ "name": "",
584
+ "type": "address"
585
+ }
586
+ ],
587
+ "stateMutability": "view",
588
+ "type": "function"
589
+ },
590
+ {
591
+ "inputs": [],
592
+ "name": "signerConfiguration",
593
+ "outputs": [
594
+ {
595
+ "internalType": "address",
596
+ "name": "signer",
597
+ "type": "address"
598
+ },
599
+ {
600
+ "internalType": "bool",
601
+ "name": "enabled",
602
+ "type": "bool"
603
+ }
604
+ ],
605
+ "stateMutability": "view",
606
+ "type": "function"
607
+ },
608
+ {
609
+ "inputs": [
610
+ {
611
+ "components": [
612
+ {
613
+ "internalType": "address",
614
+ "name": "pool",
615
+ "type": "address"
616
+ },
617
+ {
618
+ "internalType": "address",
619
+ "name": "externalAccount",
620
+ "type": "address"
621
+ },
622
+ {
623
+ "internalType": "address",
624
+ "name": "trader",
625
+ "type": "address"
626
+ },
627
+ {
628
+ "internalType": "address",
629
+ "name": "baseToken",
630
+ "type": "address"
631
+ },
632
+ {
633
+ "internalType": "address",
634
+ "name": "quoteToken",
635
+ "type": "address"
636
+ },
637
+ {
638
+ "internalType": "uint256",
639
+ "name": "baseTokenAmount",
640
+ "type": "uint256"
641
+ },
642
+ {
643
+ "internalType": "uint256",
644
+ "name": "quoteTokenAmount",
645
+ "type": "uint256"
646
+ },
647
+ {
648
+ "internalType": "uint256",
649
+ "name": "quoteExpiry",
650
+ "type": "uint256"
651
+ },
652
+ {
653
+ "internalType": "bytes32",
654
+ "name": "txid",
655
+ "type": "bytes32"
656
+ },
657
+ {
658
+ "internalType": "bytes",
659
+ "name": "takerSignature",
660
+ "type": "bytes"
661
+ },
662
+ {
663
+ "internalType": "bytes",
664
+ "name": "makerSignature",
665
+ "type": "bytes"
666
+ }
667
+ ],
668
+ "internalType": "struct IQuote.RFQMQuote",
669
+ "name": "quote",
670
+ "type": "tuple"
671
+ }
672
+ ],
673
+ "name": "tradeRFQM",
674
+ "outputs": [],
675
+ "stateMutability": "nonpayable",
676
+ "type": "function"
677
+ },
678
+ {
679
+ "inputs": [
680
+ {
681
+ "components": [
682
+ {
683
+ "internalType": "address",
684
+ "name": "pool",
685
+ "type": "address"
686
+ },
687
+ {
688
+ "internalType": "address",
689
+ "name": "externalAccount",
690
+ "type": "address"
691
+ },
692
+ {
693
+ "internalType": "address",
694
+ "name": "trader",
695
+ "type": "address"
696
+ },
697
+ {
698
+ "internalType": "address",
699
+ "name": "effectiveTrader",
700
+ "type": "address"
701
+ },
702
+ {
703
+ "internalType": "address",
704
+ "name": "baseToken",
705
+ "type": "address"
706
+ },
707
+ {
708
+ "internalType": "address",
709
+ "name": "quoteToken",
710
+ "type": "address"
711
+ },
712
+ {
713
+ "internalType": "uint256",
714
+ "name": "effectiveBaseTokenAmount",
715
+ "type": "uint256"
716
+ },
717
+ {
718
+ "internalType": "uint256",
719
+ "name": "baseTokenAmount",
720
+ "type": "uint256"
721
+ },
722
+ {
723
+ "internalType": "uint256",
724
+ "name": "quoteTokenAmount",
725
+ "type": "uint256"
726
+ },
727
+ {
728
+ "internalType": "uint256",
729
+ "name": "quoteExpiry",
730
+ "type": "uint256"
731
+ },
732
+ {
733
+ "internalType": "uint256",
734
+ "name": "nonce",
735
+ "type": "uint256"
736
+ },
737
+ {
738
+ "internalType": "bytes32",
739
+ "name": "txid",
740
+ "type": "bytes32"
741
+ },
742
+ {
743
+ "internalType": "bytes",
744
+ "name": "signature",
745
+ "type": "bytes"
746
+ }
747
+ ],
748
+ "internalType": "struct IQuote.RFQTQuote",
749
+ "name": "quote",
750
+ "type": "tuple"
751
+ }
752
+ ],
753
+ "name": "tradeRFQT",
754
+ "outputs": [],
755
+ "stateMutability": "payable",
756
+ "type": "function"
757
+ },
758
+ {
759
+ "inputs": [
760
+ {
761
+ "components": [
762
+ {
763
+ "internalType": "uint16",
764
+ "name": "srcChainId",
765
+ "type": "uint16"
766
+ },
767
+ {
768
+ "internalType": "uint16",
769
+ "name": "dstChainId",
770
+ "type": "uint16"
771
+ },
772
+ {
773
+ "internalType": "address",
774
+ "name": "srcPool",
775
+ "type": "address"
776
+ },
777
+ {
778
+ "internalType": "bytes32",
779
+ "name": "dstPool",
780
+ "type": "bytes32"
781
+ },
782
+ {
783
+ "internalType": "address",
784
+ "name": "srcExternalAccount",
785
+ "type": "address"
786
+ },
787
+ {
788
+ "internalType": "bytes32",
789
+ "name": "dstExternalAccount",
790
+ "type": "bytes32"
791
+ },
792
+ {
793
+ "internalType": "address",
794
+ "name": "trader",
795
+ "type": "address"
796
+ },
797
+ {
798
+ "internalType": "bytes32",
799
+ "name": "dstTrader",
800
+ "type": "bytes32"
801
+ },
802
+ {
803
+ "internalType": "address",
804
+ "name": "baseToken",
805
+ "type": "address"
806
+ },
807
+ {
808
+ "internalType": "bytes32",
809
+ "name": "quoteToken",
810
+ "type": "bytes32"
811
+ },
812
+ {
813
+ "internalType": "uint256",
814
+ "name": "baseTokenAmount",
815
+ "type": "uint256"
816
+ },
817
+ {
818
+ "internalType": "uint256",
819
+ "name": "quoteTokenAmount",
820
+ "type": "uint256"
821
+ },
822
+ {
823
+ "internalType": "uint256",
824
+ "name": "quoteExpiry",
825
+ "type": "uint256"
826
+ },
827
+ {
828
+ "internalType": "bytes32",
829
+ "name": "txid",
830
+ "type": "bytes32"
831
+ },
832
+ {
833
+ "internalType": "address",
834
+ "name": "xChainMessenger",
835
+ "type": "address"
836
+ },
837
+ {
838
+ "internalType": "bytes",
839
+ "name": "takerSignature",
840
+ "type": "bytes"
841
+ },
842
+ {
843
+ "internalType": "bytes",
844
+ "name": "makerSignature",
845
+ "type": "bytes"
846
+ }
847
+ ],
848
+ "internalType": "struct IQuote.XChainRFQMQuote",
849
+ "name": "quote",
850
+ "type": "tuple"
851
+ }
852
+ ],
853
+ "name": "tradeXChainRFQM",
854
+ "outputs": [],
855
+ "stateMutability": "nonpayable",
856
+ "type": "function"
857
+ },
858
+ {
859
+ "inputs": [
860
+ {
861
+ "components": [
862
+ {
863
+ "internalType": "uint16",
864
+ "name": "srcChainId",
865
+ "type": "uint16"
866
+ },
867
+ {
868
+ "internalType": "uint16",
869
+ "name": "dstChainId",
870
+ "type": "uint16"
871
+ },
872
+ {
873
+ "internalType": "address",
874
+ "name": "srcPool",
875
+ "type": "address"
876
+ },
877
+ {
878
+ "internalType": "bytes32",
879
+ "name": "dstPool",
880
+ "type": "bytes32"
881
+ },
882
+ {
883
+ "internalType": "address",
884
+ "name": "srcExternalAccount",
885
+ "type": "address"
886
+ },
887
+ {
888
+ "internalType": "bytes32",
889
+ "name": "dstExternalAccount",
890
+ "type": "bytes32"
891
+ },
892
+ {
893
+ "internalType": "bytes32",
894
+ "name": "dstTrader",
895
+ "type": "bytes32"
896
+ },
897
+ {
898
+ "internalType": "address",
899
+ "name": "baseToken",
900
+ "type": "address"
901
+ },
902
+ {
903
+ "internalType": "bytes32",
904
+ "name": "quoteToken",
905
+ "type": "bytes32"
906
+ },
907
+ {
908
+ "internalType": "uint256",
909
+ "name": "effectiveBaseTokenAmount",
910
+ "type": "uint256"
911
+ },
912
+ {
913
+ "internalType": "uint256",
914
+ "name": "baseTokenAmount",
915
+ "type": "uint256"
916
+ },
917
+ {
918
+ "internalType": "uint256",
919
+ "name": "quoteTokenAmount",
920
+ "type": "uint256"
921
+ },
922
+ {
923
+ "internalType": "uint256",
924
+ "name": "quoteExpiry",
925
+ "type": "uint256"
926
+ },
927
+ {
928
+ "internalType": "uint256",
929
+ "name": "nonce",
930
+ "type": "uint256"
931
+ },
932
+ {
933
+ "internalType": "bytes32",
934
+ "name": "txid",
935
+ "type": "bytes32"
936
+ },
937
+ {
938
+ "internalType": "address",
939
+ "name": "xChainMessenger",
940
+ "type": "address"
941
+ },
942
+ {
943
+ "internalType": "bytes",
944
+ "name": "signature",
945
+ "type": "bytes"
946
+ }
947
+ ],
948
+ "internalType": "struct IQuote.XChainRFQTQuote",
949
+ "name": "quote",
950
+ "type": "tuple"
951
+ },
952
+ {
953
+ "internalType": "address",
954
+ "name": "trader",
955
+ "type": "address"
956
+ }
957
+ ],
958
+ "name": "tradeXChainRFQT",
959
+ "outputs": [],
960
+ "stateMutability": "payable",
961
+ "type": "function"
962
+ },
963
+ {
964
+ "inputs": [
965
+ {
966
+ "internalType": "address",
967
+ "name": "newSigner",
968
+ "type": "address"
969
+ }
970
+ ],
971
+ "name": "updateSigner",
972
+ "outputs": [],
973
+ "stateMutability": "nonpayable",
974
+ "type": "function"
975
+ },
976
+ {
977
+ "inputs": [
978
+ {
979
+ "internalType": "address[]",
980
+ "name": "withdrawalAccounts",
981
+ "type": "address[]"
982
+ },
983
+ {
984
+ "internalType": "bool",
985
+ "name": "authorized",
986
+ "type": "bool"
987
+ }
988
+ ],
989
+ "name": "updateWithdrawalAccount",
990
+ "outputs": [],
991
+ "stateMutability": "nonpayable",
992
+ "type": "function"
993
+ },
994
+ {
995
+ "inputs": [
996
+ {
997
+ "internalType": "address",
998
+ "name": "xChainMessenger",
999
+ "type": "address"
1000
+ },
1001
+ {
1002
+ "internalType": "bool",
1003
+ "name": "authorized",
1004
+ "type": "bool"
1005
+ }
1006
+ ],
1007
+ "name": "updateXChainMessengerAuthorization",
1008
+ "outputs": [],
1009
+ "stateMutability": "nonpayable",
1010
+ "type": "function"
1011
+ },
1012
+ {
1013
+ "inputs": [
1014
+ {
1015
+ "components": [
1016
+ {
1017
+ "internalType": "uint16",
1018
+ "name": "chainId",
1019
+ "type": "uint16"
1020
+ },
1021
+ {
1022
+ "internalType": "bytes32",
1023
+ "name": "pool",
1024
+ "type": "bytes32"
1025
+ }
1026
+ ],
1027
+ "internalType": "struct IHashflowPool.AuthorizedXChainPool[]",
1028
+ "name": "pools",
1029
+ "type": "tuple[]"
1030
+ },
1031
+ {
1032
+ "internalType": "bool",
1033
+ "name": "status",
1034
+ "type": "bool"
1035
+ }
1036
+ ],
1037
+ "name": "updateXChainPoolAuthorization",
1038
+ "outputs": [],
1039
+ "stateMutability": "nonpayable",
1040
+ "type": "function"
1041
+ },
1042
+ {
1043
+ "inputs": [
1044
+ {
1045
+ "internalType": "bytes32",
1046
+ "name": "",
1047
+ "type": "bytes32"
1048
+ }
1049
+ ],
1050
+ "name": "xChainNonces",
1051
+ "outputs": [
1052
+ {
1053
+ "internalType": "uint256",
1054
+ "name": "",
1055
+ "type": "uint256"
1056
+ }
1057
+ ],
1058
+ "stateMutability": "view",
1059
+ "type": "function"
1060
+ },
1061
+ {
1062
+ "stateMutability": "payable",
1063
+ "type": "receive"
1064
+ }
1065
+ ] as const satisfies Abi;
1066
+
1067
+ /**
1068
+ * Type-safe ABI for HashflowPool
1069
+ */
1070
+ export type HashflowPoolAbi = typeof HashflowPoolAbi;
1071
+
1072
+ /**
1073
+ * Contract instance type for HashflowPool
1074
+ */
1075
+ // Use any for contract type to avoid complex viem type issues
1076
+ // The runtime behavior is type-safe through viem's ABI typing
1077
+ export type HashflowPoolContract = any;
1078
+
1079
+ /**
1080
+ * HashflowPool Contract Class
1081
+ *
1082
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
1083
+ *
1084
+ * @example
1085
+ * ```typescript
1086
+ * import { createPublicClient, createWalletClient, http } from 'viem';
1087
+ * import { mainnet } from 'viem/chains';
1088
+ * import { HashflowPool } from 'HashflowPool';
1089
+ *
1090
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
1091
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
1092
+ *
1093
+ * const contract = new HashflowPool('0x...', { publicClient, walletClient });
1094
+ *
1095
+ * // Read functions
1096
+ * const result = await contract.balanceOf('0x...');
1097
+ *
1098
+ * // Write functions
1099
+ * const hash = await contract.transfer('0x...', 1000n);
1100
+ *
1101
+ * // Simulate transactions (dry-run)
1102
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
1103
+ * console.log('Gas estimate:', simulation.request.gas);
1104
+ *
1105
+ * // Watch events
1106
+ * const unwatch = contract.watch.Transfer((event) => {
1107
+ * console.log('Transfer event:', event);
1108
+ * });
1109
+ * ```
1110
+ */
1111
+ export class HashflowPool {
1112
+ private contract: HashflowPoolContract;
1113
+ private contractAddress: Address;
1114
+ private publicClient: PublicClient;
1115
+
1116
+ constructor(
1117
+ address: Address,
1118
+ clients: {
1119
+ publicClient: PublicClient;
1120
+ walletClient?: WalletClient;
1121
+ }
1122
+ ) {
1123
+ this.contractAddress = address;
1124
+ this.publicClient = clients.publicClient;
1125
+ this.contract = getContract({
1126
+ address,
1127
+ abi: HashflowPoolAbi,
1128
+ client: {
1129
+ public: clients.publicClient,
1130
+ wallet: clients.walletClient,
1131
+ },
1132
+ });
1133
+ }
1134
+
1135
+ /**
1136
+ * Get the contract address
1137
+ */
1138
+ get address(): Address {
1139
+ return this.contractAddress;
1140
+ }
1141
+
1142
+ /**
1143
+ * Get the underlying viem contract instance.
1144
+ */
1145
+ getContract(): HashflowPoolContract {
1146
+ return this.contract;
1147
+ }
1148
+
1149
+ /**
1150
+ * _WETH
1151
+ * view
1152
+ */
1153
+ async _WETH(): Promise<`0x${string}`> {
1154
+ return this.contract.read._WETH() as Promise<`0x${string}`>;
1155
+ }
1156
+
1157
+ /**
1158
+ * getReserves
1159
+ * view
1160
+ */
1161
+ async getReserves(token: `0x${string}`): Promise<bigint> {
1162
+ return this.contract.read.getReserves([token] as const) as Promise<bigint>;
1163
+ }
1164
+
1165
+ /**
1166
+ * isValidSignature
1167
+ * view
1168
+ */
1169
+ async isValidSignature(hash: `0x${string}`, signature: `0x${string}`): Promise<`0x${string}`> {
1170
+ return this.contract.read.isValidSignature([hash, signature] as const) as Promise<`0x${string}`>;
1171
+ }
1172
+
1173
+ /**
1174
+ * name
1175
+ * view
1176
+ */
1177
+ async name(): Promise<string> {
1178
+ return this.contract.read.name() as Promise<string>;
1179
+ }
1180
+
1181
+ /**
1182
+ * nonces
1183
+ * view
1184
+ */
1185
+ async nonces(arg0: `0x${string}`): Promise<bigint> {
1186
+ return this.contract.read.nonces([arg0] as const) as Promise<bigint>;
1187
+ }
1188
+
1189
+ /**
1190
+ * operations
1191
+ * view
1192
+ */
1193
+ async operations(): Promise<`0x${string}`> {
1194
+ return this.contract.read.operations() as Promise<`0x${string}`>;
1195
+ }
1196
+
1197
+ /**
1198
+ * router
1199
+ * view
1200
+ */
1201
+ async router(): Promise<`0x${string}`> {
1202
+ return this.contract.read.router() as Promise<`0x${string}`>;
1203
+ }
1204
+
1205
+ /**
1206
+ * signerConfiguration
1207
+ * view
1208
+ */
1209
+ async signerConfiguration(): Promise<[`0x${string}`, boolean]> {
1210
+ return this.contract.read.signerConfiguration() as Promise<[`0x${string}`, boolean]>;
1211
+ }
1212
+
1213
+ /**
1214
+ * xChainNonces
1215
+ * view
1216
+ */
1217
+ async xChainNonces(arg0: `0x${string}`): Promise<bigint> {
1218
+ return this.contract.read.xChainNonces([arg0] as const) as Promise<bigint>;
1219
+ }
1220
+
1221
+ /**
1222
+ * approveToken
1223
+ * nonpayable
1224
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1225
+ */
1226
+ async approveToken(token: `0x${string}`, spender: `0x${string}`, amount: bigint, options?: {
1227
+ accessList?: import('viem').AccessList;
1228
+ authorizationList?: import('viem').AuthorizationList;
1229
+ chain?: import('viem').Chain | null;
1230
+ dataSuffix?: `0x${string}`;
1231
+ gas?: bigint;
1232
+ gasPrice?: bigint;
1233
+ maxFeePerGas?: bigint;
1234
+ maxPriorityFeePerGas?: bigint;
1235
+ nonce?: number;
1236
+ value?: bigint;
1237
+ }): Promise<`0x${string}`> {
1238
+ if (!this.contract.write) {
1239
+ throw new Error('Wallet client is required for write operations');
1240
+ }
1241
+ return this.contract.write.approveToken([token, spender, amount] as const, options) as Promise<`0x${string}`>;
1242
+ }
1243
+
1244
+ /**
1245
+ * decreaseTokenAllowance
1246
+ * nonpayable
1247
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1248
+ */
1249
+ async decreaseTokenAllowance(token: `0x${string}`, spender: `0x${string}`, amount: bigint, options?: {
1250
+ accessList?: import('viem').AccessList;
1251
+ authorizationList?: import('viem').AuthorizationList;
1252
+ chain?: import('viem').Chain | null;
1253
+ dataSuffix?: `0x${string}`;
1254
+ gas?: bigint;
1255
+ gasPrice?: bigint;
1256
+ maxFeePerGas?: bigint;
1257
+ maxPriorityFeePerGas?: bigint;
1258
+ nonce?: number;
1259
+ value?: bigint;
1260
+ }): Promise<`0x${string}`> {
1261
+ if (!this.contract.write) {
1262
+ throw new Error('Wallet client is required for write operations');
1263
+ }
1264
+ return this.contract.write.decreaseTokenAllowance([token, spender, amount] as const, options) as Promise<`0x${string}`>;
1265
+ }
1266
+
1267
+ /**
1268
+ * fillXChain
1269
+ * nonpayable
1270
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1271
+ */
1272
+ async fillXChain(externalAccount: `0x${string}`, txid: `0x${string}`, trader: `0x${string}`, quoteToken: `0x${string}`, quoteTokenAmount: bigint, options?: {
1273
+ accessList?: import('viem').AccessList;
1274
+ authorizationList?: import('viem').AuthorizationList;
1275
+ chain?: import('viem').Chain | null;
1276
+ dataSuffix?: `0x${string}`;
1277
+ gas?: bigint;
1278
+ gasPrice?: bigint;
1279
+ maxFeePerGas?: bigint;
1280
+ maxPriorityFeePerGas?: bigint;
1281
+ nonce?: number;
1282
+ value?: bigint;
1283
+ }): Promise<`0x${string}`> {
1284
+ if (!this.contract.write) {
1285
+ throw new Error('Wallet client is required for write operations');
1286
+ }
1287
+ return this.contract.write.fillXChain([externalAccount, txid, trader, quoteToken, quoteTokenAmount] as const, options) as Promise<`0x${string}`>;
1288
+ }
1289
+
1290
+ /**
1291
+ * increaseTokenAllowance
1292
+ * nonpayable
1293
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1294
+ */
1295
+ async increaseTokenAllowance(token: `0x${string}`, spender: `0x${string}`, amount: bigint, options?: {
1296
+ accessList?: import('viem').AccessList;
1297
+ authorizationList?: import('viem').AuthorizationList;
1298
+ chain?: import('viem').Chain | null;
1299
+ dataSuffix?: `0x${string}`;
1300
+ gas?: bigint;
1301
+ gasPrice?: bigint;
1302
+ maxFeePerGas?: bigint;
1303
+ maxPriorityFeePerGas?: bigint;
1304
+ nonce?: number;
1305
+ value?: bigint;
1306
+ }): Promise<`0x${string}`> {
1307
+ if (!this.contract.write) {
1308
+ throw new Error('Wallet client is required for write operations');
1309
+ }
1310
+ return this.contract.write.increaseTokenAllowance([token, spender, amount] as const, options) as Promise<`0x${string}`>;
1311
+ }
1312
+
1313
+ /**
1314
+ * initialize
1315
+ * nonpayable
1316
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1317
+ */
1318
+ async initialize(_name: string, _signer: `0x${string}`, _operations: `0x${string}`, _router: `0x${string}`, options?: {
1319
+ accessList?: import('viem').AccessList;
1320
+ authorizationList?: import('viem').AuthorizationList;
1321
+ chain?: import('viem').Chain | null;
1322
+ dataSuffix?: `0x${string}`;
1323
+ gas?: bigint;
1324
+ gasPrice?: bigint;
1325
+ maxFeePerGas?: bigint;
1326
+ maxPriorityFeePerGas?: bigint;
1327
+ nonce?: number;
1328
+ value?: bigint;
1329
+ }): Promise<`0x${string}`> {
1330
+ if (!this.contract.write) {
1331
+ throw new Error('Wallet client is required for write operations');
1332
+ }
1333
+ return this.contract.write.initialize([_name, _signer, _operations, _router] as const, options) as Promise<`0x${string}`>;
1334
+ }
1335
+
1336
+ /**
1337
+ * killswitchOperations
1338
+ * nonpayable
1339
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1340
+ */
1341
+ async killswitchOperations(enabled: boolean, options?: {
1342
+ accessList?: import('viem').AccessList;
1343
+ authorizationList?: import('viem').AuthorizationList;
1344
+ chain?: import('viem').Chain | null;
1345
+ dataSuffix?: `0x${string}`;
1346
+ gas?: bigint;
1347
+ gasPrice?: bigint;
1348
+ maxFeePerGas?: bigint;
1349
+ maxPriorityFeePerGas?: bigint;
1350
+ nonce?: number;
1351
+ value?: bigint;
1352
+ }): Promise<`0x${string}`> {
1353
+ if (!this.contract.write) {
1354
+ throw new Error('Wallet client is required for write operations');
1355
+ }
1356
+ return this.contract.write.killswitchOperations([enabled] as const, options) as Promise<`0x${string}`>;
1357
+ }
1358
+
1359
+ /**
1360
+ * removeLiquidity
1361
+ * nonpayable
1362
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1363
+ */
1364
+ async removeLiquidity(token: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
1365
+ accessList?: import('viem').AccessList;
1366
+ authorizationList?: import('viem').AuthorizationList;
1367
+ chain?: import('viem').Chain | null;
1368
+ dataSuffix?: `0x${string}`;
1369
+ gas?: bigint;
1370
+ gasPrice?: bigint;
1371
+ maxFeePerGas?: bigint;
1372
+ maxPriorityFeePerGas?: bigint;
1373
+ nonce?: number;
1374
+ value?: bigint;
1375
+ }): Promise<`0x${string}`> {
1376
+ if (!this.contract.write) {
1377
+ throw new Error('Wallet client is required for write operations');
1378
+ }
1379
+ return this.contract.write.removeLiquidity([token, recipient, amount] as const, options) as Promise<`0x${string}`>;
1380
+ }
1381
+
1382
+ /**
1383
+ * tradeRFQM
1384
+ * nonpayable
1385
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1386
+ */
1387
+ async tradeRFQM(quote: IQuote_RFQMQuote, options?: {
1388
+ accessList?: import('viem').AccessList;
1389
+ authorizationList?: import('viem').AuthorizationList;
1390
+ chain?: import('viem').Chain | null;
1391
+ dataSuffix?: `0x${string}`;
1392
+ gas?: bigint;
1393
+ gasPrice?: bigint;
1394
+ maxFeePerGas?: bigint;
1395
+ maxPriorityFeePerGas?: bigint;
1396
+ nonce?: number;
1397
+ value?: bigint;
1398
+ }): Promise<`0x${string}`> {
1399
+ if (!this.contract.write) {
1400
+ throw new Error('Wallet client is required for write operations');
1401
+ }
1402
+ return this.contract.write.tradeRFQM([quote] as const, options) as Promise<`0x${string}`>;
1403
+ }
1404
+
1405
+ /**
1406
+ * tradeRFQT
1407
+ * payable
1408
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1409
+ */
1410
+ async tradeRFQT(quote: IQuote_RFQTQuote, options?: {
1411
+ accessList?: import('viem').AccessList;
1412
+ authorizationList?: import('viem').AuthorizationList;
1413
+ chain?: import('viem').Chain | null;
1414
+ dataSuffix?: `0x${string}`;
1415
+ gas?: bigint;
1416
+ gasPrice?: bigint;
1417
+ maxFeePerGas?: bigint;
1418
+ maxPriorityFeePerGas?: bigint;
1419
+ nonce?: number;
1420
+ value?: bigint;
1421
+ }): Promise<`0x${string}`> {
1422
+ if (!this.contract.write) {
1423
+ throw new Error('Wallet client is required for write operations');
1424
+ }
1425
+ return this.contract.write.tradeRFQT([quote] as const, options) as Promise<`0x${string}`>;
1426
+ }
1427
+
1428
+ /**
1429
+ * tradeXChainRFQM
1430
+ * nonpayable
1431
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1432
+ */
1433
+ async tradeXChainRFQM(quote: IQuote_XChainRFQMQuote, options?: {
1434
+ accessList?: import('viem').AccessList;
1435
+ authorizationList?: import('viem').AuthorizationList;
1436
+ chain?: import('viem').Chain | null;
1437
+ dataSuffix?: `0x${string}`;
1438
+ gas?: bigint;
1439
+ gasPrice?: bigint;
1440
+ maxFeePerGas?: bigint;
1441
+ maxPriorityFeePerGas?: bigint;
1442
+ nonce?: number;
1443
+ value?: bigint;
1444
+ }): Promise<`0x${string}`> {
1445
+ if (!this.contract.write) {
1446
+ throw new Error('Wallet client is required for write operations');
1447
+ }
1448
+ return this.contract.write.tradeXChainRFQM([quote] as const, options) as Promise<`0x${string}`>;
1449
+ }
1450
+
1451
+ /**
1452
+ * tradeXChainRFQT
1453
+ * payable
1454
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1455
+ */
1456
+ async tradeXChainRFQT(quote: IQuote_XChainRFQTQuote, trader: `0x${string}`, options?: {
1457
+ accessList?: import('viem').AccessList;
1458
+ authorizationList?: import('viem').AuthorizationList;
1459
+ chain?: import('viem').Chain | null;
1460
+ dataSuffix?: `0x${string}`;
1461
+ gas?: bigint;
1462
+ gasPrice?: bigint;
1463
+ maxFeePerGas?: bigint;
1464
+ maxPriorityFeePerGas?: bigint;
1465
+ nonce?: number;
1466
+ value?: bigint;
1467
+ }): Promise<`0x${string}`> {
1468
+ if (!this.contract.write) {
1469
+ throw new Error('Wallet client is required for write operations');
1470
+ }
1471
+ return this.contract.write.tradeXChainRFQT([quote, trader] as const, options) as Promise<`0x${string}`>;
1472
+ }
1473
+
1474
+ /**
1475
+ * updateSigner
1476
+ * nonpayable
1477
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1478
+ */
1479
+ async updateSigner(newSigner: `0x${string}`, options?: {
1480
+ accessList?: import('viem').AccessList;
1481
+ authorizationList?: import('viem').AuthorizationList;
1482
+ chain?: import('viem').Chain | null;
1483
+ dataSuffix?: `0x${string}`;
1484
+ gas?: bigint;
1485
+ gasPrice?: bigint;
1486
+ maxFeePerGas?: bigint;
1487
+ maxPriorityFeePerGas?: bigint;
1488
+ nonce?: number;
1489
+ value?: bigint;
1490
+ }): Promise<`0x${string}`> {
1491
+ if (!this.contract.write) {
1492
+ throw new Error('Wallet client is required for write operations');
1493
+ }
1494
+ return this.contract.write.updateSigner([newSigner] as const, options) as Promise<`0x${string}`>;
1495
+ }
1496
+
1497
+ /**
1498
+ * updateWithdrawalAccount
1499
+ * nonpayable
1500
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1501
+ */
1502
+ async updateWithdrawalAccount(withdrawalAccounts: `0x${string}`[], authorized: boolean, options?: {
1503
+ accessList?: import('viem').AccessList;
1504
+ authorizationList?: import('viem').AuthorizationList;
1505
+ chain?: import('viem').Chain | null;
1506
+ dataSuffix?: `0x${string}`;
1507
+ gas?: bigint;
1508
+ gasPrice?: bigint;
1509
+ maxFeePerGas?: bigint;
1510
+ maxPriorityFeePerGas?: bigint;
1511
+ nonce?: number;
1512
+ value?: bigint;
1513
+ }): Promise<`0x${string}`> {
1514
+ if (!this.contract.write) {
1515
+ throw new Error('Wallet client is required for write operations');
1516
+ }
1517
+ return this.contract.write.updateWithdrawalAccount([withdrawalAccounts, authorized] as const, options) as Promise<`0x${string}`>;
1518
+ }
1519
+
1520
+ /**
1521
+ * updateXChainMessengerAuthorization
1522
+ * nonpayable
1523
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1524
+ */
1525
+ async updateXChainMessengerAuthorization(xChainMessenger: `0x${string}`, authorized: boolean, options?: {
1526
+ accessList?: import('viem').AccessList;
1527
+ authorizationList?: import('viem').AuthorizationList;
1528
+ chain?: import('viem').Chain | null;
1529
+ dataSuffix?: `0x${string}`;
1530
+ gas?: bigint;
1531
+ gasPrice?: bigint;
1532
+ maxFeePerGas?: bigint;
1533
+ maxPriorityFeePerGas?: bigint;
1534
+ nonce?: number;
1535
+ value?: bigint;
1536
+ }): Promise<`0x${string}`> {
1537
+ if (!this.contract.write) {
1538
+ throw new Error('Wallet client is required for write operations');
1539
+ }
1540
+ return this.contract.write.updateXChainMessengerAuthorization([xChainMessenger, authorized] as const, options) as Promise<`0x${string}`>;
1541
+ }
1542
+
1543
+ /**
1544
+ * updateXChainPoolAuthorization
1545
+ * nonpayable
1546
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1547
+ */
1548
+ async updateXChainPoolAuthorization(pools: IHashflowPool_AuthorizedXChainPool[], status: boolean, options?: {
1549
+ accessList?: import('viem').AccessList;
1550
+ authorizationList?: import('viem').AuthorizationList;
1551
+ chain?: import('viem').Chain | null;
1552
+ dataSuffix?: `0x${string}`;
1553
+ gas?: bigint;
1554
+ gasPrice?: bigint;
1555
+ maxFeePerGas?: bigint;
1556
+ maxPriorityFeePerGas?: bigint;
1557
+ nonce?: number;
1558
+ value?: bigint;
1559
+ }): Promise<`0x${string}`> {
1560
+ if (!this.contract.write) {
1561
+ throw new Error('Wallet client is required for write operations');
1562
+ }
1563
+ return this.contract.write.updateXChainPoolAuthorization([pools, status] as const, options) as Promise<`0x${string}`>;
1564
+ }
1565
+
1566
+
1567
+
1568
+ /**
1569
+ * Simulate contract write operations (dry-run without sending transaction)
1570
+ *
1571
+ * @example
1572
+ * const result = await contract.simulate.transfer('0x...', 1000n);
1573
+ * console.log('Gas estimate:', result.request.gas);
1574
+ * console.log('Would succeed:', result.result);
1575
+ */
1576
+ get simulate() {
1577
+ const contract = this.contract;
1578
+ if (!contract.simulate) {
1579
+ throw new Error('Public client is required for simulation');
1580
+ }
1581
+ return {
1582
+ /**
1583
+ * Simulate approveToken
1584
+ * Returns gas estimate and result without sending transaction
1585
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1586
+ */
1587
+ async approveToken(token: `0x${string}`, spender: `0x${string}`, amount: bigint, options?: {
1588
+ accessList?: import('viem').AccessList;
1589
+ authorizationList?: import('viem').AuthorizationList;
1590
+ chain?: import('viem').Chain | null;
1591
+ dataSuffix?: `0x${string}`;
1592
+ gas?: bigint;
1593
+ gasPrice?: bigint;
1594
+ maxFeePerGas?: bigint;
1595
+ maxPriorityFeePerGas?: bigint;
1596
+ nonce?: number;
1597
+ value?: bigint;
1598
+ }): Promise<void> {
1599
+ return contract.simulate.approveToken([token, spender, amount] as const, options) as Promise<void>;
1600
+ },
1601
+ /**
1602
+ * Simulate decreaseTokenAllowance
1603
+ * Returns gas estimate and result without sending transaction
1604
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1605
+ */
1606
+ async decreaseTokenAllowance(token: `0x${string}`, spender: `0x${string}`, amount: bigint, options?: {
1607
+ accessList?: import('viem').AccessList;
1608
+ authorizationList?: import('viem').AuthorizationList;
1609
+ chain?: import('viem').Chain | null;
1610
+ dataSuffix?: `0x${string}`;
1611
+ gas?: bigint;
1612
+ gasPrice?: bigint;
1613
+ maxFeePerGas?: bigint;
1614
+ maxPriorityFeePerGas?: bigint;
1615
+ nonce?: number;
1616
+ value?: bigint;
1617
+ }): Promise<void> {
1618
+ return contract.simulate.decreaseTokenAllowance([token, spender, amount] as const, options) as Promise<void>;
1619
+ },
1620
+ /**
1621
+ * Simulate fillXChain
1622
+ * Returns gas estimate and result without sending transaction
1623
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1624
+ */
1625
+ async fillXChain(externalAccount: `0x${string}`, txid: `0x${string}`, trader: `0x${string}`, quoteToken: `0x${string}`, quoteTokenAmount: bigint, options?: {
1626
+ accessList?: import('viem').AccessList;
1627
+ authorizationList?: import('viem').AuthorizationList;
1628
+ chain?: import('viem').Chain | null;
1629
+ dataSuffix?: `0x${string}`;
1630
+ gas?: bigint;
1631
+ gasPrice?: bigint;
1632
+ maxFeePerGas?: bigint;
1633
+ maxPriorityFeePerGas?: bigint;
1634
+ nonce?: number;
1635
+ value?: bigint;
1636
+ }): Promise<void> {
1637
+ return contract.simulate.fillXChain([externalAccount, txid, trader, quoteToken, quoteTokenAmount] as const, options) as Promise<void>;
1638
+ },
1639
+ /**
1640
+ * Simulate increaseTokenAllowance
1641
+ * Returns gas estimate and result without sending transaction
1642
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1643
+ */
1644
+ async increaseTokenAllowance(token: `0x${string}`, spender: `0x${string}`, amount: bigint, options?: {
1645
+ accessList?: import('viem').AccessList;
1646
+ authorizationList?: import('viem').AuthorizationList;
1647
+ chain?: import('viem').Chain | null;
1648
+ dataSuffix?: `0x${string}`;
1649
+ gas?: bigint;
1650
+ gasPrice?: bigint;
1651
+ maxFeePerGas?: bigint;
1652
+ maxPriorityFeePerGas?: bigint;
1653
+ nonce?: number;
1654
+ value?: bigint;
1655
+ }): Promise<void> {
1656
+ return contract.simulate.increaseTokenAllowance([token, spender, amount] as const, options) as Promise<void>;
1657
+ },
1658
+ /**
1659
+ * Simulate initialize
1660
+ * Returns gas estimate and result without sending transaction
1661
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1662
+ */
1663
+ async initialize(_name: string, _signer: `0x${string}`, _operations: `0x${string}`, _router: `0x${string}`, options?: {
1664
+ accessList?: import('viem').AccessList;
1665
+ authorizationList?: import('viem').AuthorizationList;
1666
+ chain?: import('viem').Chain | null;
1667
+ dataSuffix?: `0x${string}`;
1668
+ gas?: bigint;
1669
+ gasPrice?: bigint;
1670
+ maxFeePerGas?: bigint;
1671
+ maxPriorityFeePerGas?: bigint;
1672
+ nonce?: number;
1673
+ value?: bigint;
1674
+ }): Promise<void> {
1675
+ return contract.simulate.initialize([_name, _signer, _operations, _router] as const, options) as Promise<void>;
1676
+ },
1677
+ /**
1678
+ * Simulate killswitchOperations
1679
+ * Returns gas estimate and result without sending transaction
1680
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1681
+ */
1682
+ async killswitchOperations(enabled: boolean, options?: {
1683
+ accessList?: import('viem').AccessList;
1684
+ authorizationList?: import('viem').AuthorizationList;
1685
+ chain?: import('viem').Chain | null;
1686
+ dataSuffix?: `0x${string}`;
1687
+ gas?: bigint;
1688
+ gasPrice?: bigint;
1689
+ maxFeePerGas?: bigint;
1690
+ maxPriorityFeePerGas?: bigint;
1691
+ nonce?: number;
1692
+ value?: bigint;
1693
+ }): Promise<void> {
1694
+ return contract.simulate.killswitchOperations([enabled] as const, options) as Promise<void>;
1695
+ },
1696
+ /**
1697
+ * Simulate removeLiquidity
1698
+ * Returns gas estimate and result without sending transaction
1699
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1700
+ */
1701
+ async removeLiquidity(token: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
1702
+ accessList?: import('viem').AccessList;
1703
+ authorizationList?: import('viem').AuthorizationList;
1704
+ chain?: import('viem').Chain | null;
1705
+ dataSuffix?: `0x${string}`;
1706
+ gas?: bigint;
1707
+ gasPrice?: bigint;
1708
+ maxFeePerGas?: bigint;
1709
+ maxPriorityFeePerGas?: bigint;
1710
+ nonce?: number;
1711
+ value?: bigint;
1712
+ }): Promise<void> {
1713
+ return contract.simulate.removeLiquidity([token, recipient, amount] as const, options) as Promise<void>;
1714
+ },
1715
+ /**
1716
+ * Simulate tradeRFQM
1717
+ * Returns gas estimate and result without sending transaction
1718
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1719
+ */
1720
+ async tradeRFQM(quote: IQuote_RFQMQuote, options?: {
1721
+ accessList?: import('viem').AccessList;
1722
+ authorizationList?: import('viem').AuthorizationList;
1723
+ chain?: import('viem').Chain | null;
1724
+ dataSuffix?: `0x${string}`;
1725
+ gas?: bigint;
1726
+ gasPrice?: bigint;
1727
+ maxFeePerGas?: bigint;
1728
+ maxPriorityFeePerGas?: bigint;
1729
+ nonce?: number;
1730
+ value?: bigint;
1731
+ }): Promise<void> {
1732
+ return contract.simulate.tradeRFQM([quote] as const, options) as Promise<void>;
1733
+ },
1734
+ /**
1735
+ * Simulate tradeRFQT
1736
+ * Returns gas estimate and result without sending transaction
1737
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1738
+ */
1739
+ async tradeRFQT(quote: IQuote_RFQTQuote, options?: {
1740
+ accessList?: import('viem').AccessList;
1741
+ authorizationList?: import('viem').AuthorizationList;
1742
+ chain?: import('viem').Chain | null;
1743
+ dataSuffix?: `0x${string}`;
1744
+ gas?: bigint;
1745
+ gasPrice?: bigint;
1746
+ maxFeePerGas?: bigint;
1747
+ maxPriorityFeePerGas?: bigint;
1748
+ nonce?: number;
1749
+ value?: bigint;
1750
+ }): Promise<void> {
1751
+ return contract.simulate.tradeRFQT([quote] as const, options) as Promise<void>;
1752
+ },
1753
+ /**
1754
+ * Simulate tradeXChainRFQM
1755
+ * Returns gas estimate and result without sending transaction
1756
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1757
+ */
1758
+ async tradeXChainRFQM(quote: IQuote_XChainRFQMQuote, options?: {
1759
+ accessList?: import('viem').AccessList;
1760
+ authorizationList?: import('viem').AuthorizationList;
1761
+ chain?: import('viem').Chain | null;
1762
+ dataSuffix?: `0x${string}`;
1763
+ gas?: bigint;
1764
+ gasPrice?: bigint;
1765
+ maxFeePerGas?: bigint;
1766
+ maxPriorityFeePerGas?: bigint;
1767
+ nonce?: number;
1768
+ value?: bigint;
1769
+ }): Promise<void> {
1770
+ return contract.simulate.tradeXChainRFQM([quote] as const, options) as Promise<void>;
1771
+ },
1772
+ /**
1773
+ * Simulate tradeXChainRFQT
1774
+ * Returns gas estimate and result without sending transaction
1775
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1776
+ */
1777
+ async tradeXChainRFQT(quote: IQuote_XChainRFQTQuote, trader: `0x${string}`, options?: {
1778
+ accessList?: import('viem').AccessList;
1779
+ authorizationList?: import('viem').AuthorizationList;
1780
+ chain?: import('viem').Chain | null;
1781
+ dataSuffix?: `0x${string}`;
1782
+ gas?: bigint;
1783
+ gasPrice?: bigint;
1784
+ maxFeePerGas?: bigint;
1785
+ maxPriorityFeePerGas?: bigint;
1786
+ nonce?: number;
1787
+ value?: bigint;
1788
+ }): Promise<void> {
1789
+ return contract.simulate.tradeXChainRFQT([quote, trader] as const, options) as Promise<void>;
1790
+ },
1791
+ /**
1792
+ * Simulate updateSigner
1793
+ * Returns gas estimate and result without sending transaction
1794
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1795
+ */
1796
+ async updateSigner(newSigner: `0x${string}`, options?: {
1797
+ accessList?: import('viem').AccessList;
1798
+ authorizationList?: import('viem').AuthorizationList;
1799
+ chain?: import('viem').Chain | null;
1800
+ dataSuffix?: `0x${string}`;
1801
+ gas?: bigint;
1802
+ gasPrice?: bigint;
1803
+ maxFeePerGas?: bigint;
1804
+ maxPriorityFeePerGas?: bigint;
1805
+ nonce?: number;
1806
+ value?: bigint;
1807
+ }): Promise<void> {
1808
+ return contract.simulate.updateSigner([newSigner] as const, options) as Promise<void>;
1809
+ },
1810
+ /**
1811
+ * Simulate updateWithdrawalAccount
1812
+ * Returns gas estimate and result without sending transaction
1813
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1814
+ */
1815
+ async updateWithdrawalAccount(withdrawalAccounts: `0x${string}`[], authorized: boolean, options?: {
1816
+ accessList?: import('viem').AccessList;
1817
+ authorizationList?: import('viem').AuthorizationList;
1818
+ chain?: import('viem').Chain | null;
1819
+ dataSuffix?: `0x${string}`;
1820
+ gas?: bigint;
1821
+ gasPrice?: bigint;
1822
+ maxFeePerGas?: bigint;
1823
+ maxPriorityFeePerGas?: bigint;
1824
+ nonce?: number;
1825
+ value?: bigint;
1826
+ }): Promise<void> {
1827
+ return contract.simulate.updateWithdrawalAccount([withdrawalAccounts, authorized] as const, options) as Promise<void>;
1828
+ },
1829
+ /**
1830
+ * Simulate updateXChainMessengerAuthorization
1831
+ * Returns gas estimate and result without sending transaction
1832
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1833
+ */
1834
+ async updateXChainMessengerAuthorization(xChainMessenger: `0x${string}`, authorized: boolean, options?: {
1835
+ accessList?: import('viem').AccessList;
1836
+ authorizationList?: import('viem').AuthorizationList;
1837
+ chain?: import('viem').Chain | null;
1838
+ dataSuffix?: `0x${string}`;
1839
+ gas?: bigint;
1840
+ gasPrice?: bigint;
1841
+ maxFeePerGas?: bigint;
1842
+ maxPriorityFeePerGas?: bigint;
1843
+ nonce?: number;
1844
+ value?: bigint;
1845
+ }): Promise<void> {
1846
+ return contract.simulate.updateXChainMessengerAuthorization([xChainMessenger, authorized] as const, options) as Promise<void>;
1847
+ },
1848
+ /**
1849
+ * Simulate updateXChainPoolAuthorization
1850
+ * Returns gas estimate and result without sending transaction
1851
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1852
+ */
1853
+ async updateXChainPoolAuthorization(pools: IHashflowPool_AuthorizedXChainPool[], status: boolean, options?: {
1854
+ accessList?: import('viem').AccessList;
1855
+ authorizationList?: import('viem').AuthorizationList;
1856
+ chain?: import('viem').Chain | null;
1857
+ dataSuffix?: `0x${string}`;
1858
+ gas?: bigint;
1859
+ gasPrice?: bigint;
1860
+ maxFeePerGas?: bigint;
1861
+ maxPriorityFeePerGas?: bigint;
1862
+ nonce?: number;
1863
+ value?: bigint;
1864
+ }): Promise<void> {
1865
+ return contract.simulate.updateXChainPoolAuthorization([pools, status] as const, options) as Promise<void>;
1866
+ }
1867
+ };
1868
+ }
1869
+
1870
+ /**
1871
+ * Watch contract events
1872
+ *
1873
+ * @example
1874
+ * // Watch all Transfer events
1875
+ * const unwatch = contract.watch.Transfer((event) => {
1876
+ * console.log('Transfer:', event);
1877
+ * });
1878
+ *
1879
+ * // Stop watching
1880
+ * unwatch();
1881
+ */
1882
+ get watch() {
1883
+ return {
1884
+ /**
1885
+ * Watch Initialized events
1886
+ * @param callback Function to call when event is emitted
1887
+ * @param filter Optional filter for indexed parameters
1888
+ * @returns Unwatch function to stop listening
1889
+ */
1890
+ Initialized: (callback: (event: { version: bigint }) => void) => {
1891
+ return this.publicClient.watchContractEvent({
1892
+ address: this.contractAddress,
1893
+ abi: HashflowPoolAbi,
1894
+ eventName: 'Initialized',
1895
+
1896
+ onLogs: (logs: any[]) => {
1897
+ logs.forEach((log: any) => {
1898
+ callback(log.args as any);
1899
+ });
1900
+ },
1901
+ }) as () => void;
1902
+ },
1903
+ /**
1904
+ * Watch RemoveLiquidity events
1905
+ * @param callback Function to call when event is emitted
1906
+ * @param filter Optional filter for indexed parameters
1907
+ * @returns Unwatch function to stop listening
1908
+ */
1909
+ RemoveLiquidity: (callback: (event: { token: `0x${string}`; recipient: `0x${string}`; withdrawAmount: bigint }) => void) => {
1910
+ return this.publicClient.watchContractEvent({
1911
+ address: this.contractAddress,
1912
+ abi: HashflowPoolAbi,
1913
+ eventName: 'RemoveLiquidity',
1914
+
1915
+ onLogs: (logs: any[]) => {
1916
+ logs.forEach((log: any) => {
1917
+ callback(log.args as any);
1918
+ });
1919
+ },
1920
+ }) as () => void;
1921
+ },
1922
+ /**
1923
+ * Watch Trade events
1924
+ * @param callback Function to call when event is emitted
1925
+ * @param filter Optional filter for indexed parameters
1926
+ * @returns Unwatch function to stop listening
1927
+ */
1928
+ Trade: (callback: (event: { trader: `0x${string}`; effectiveTrader: `0x${string}`; txid: `0x${string}`; baseToken: `0x${string}`; quoteToken: `0x${string}`; baseTokenAmount: bigint; quoteTokenAmount: bigint }) => void) => {
1929
+ return this.publicClient.watchContractEvent({
1930
+ address: this.contractAddress,
1931
+ abi: HashflowPoolAbi,
1932
+ eventName: 'Trade',
1933
+
1934
+ onLogs: (logs: any[]) => {
1935
+ logs.forEach((log: any) => {
1936
+ callback(log.args as any);
1937
+ });
1938
+ },
1939
+ }) as () => void;
1940
+ },
1941
+ /**
1942
+ * Watch UpdateSigner events
1943
+ * @param callback Function to call when event is emitted
1944
+ * @param filter Optional filter for indexed parameters
1945
+ * @returns Unwatch function to stop listening
1946
+ */
1947
+ UpdateSigner: (callback: (event: { signer: `0x${string}`; prevSigner: `0x${string}` }) => void) => {
1948
+ return this.publicClient.watchContractEvent({
1949
+ address: this.contractAddress,
1950
+ abi: HashflowPoolAbi,
1951
+ eventName: 'UpdateSigner',
1952
+
1953
+ onLogs: (logs: any[]) => {
1954
+ logs.forEach((log: any) => {
1955
+ callback(log.args as any);
1956
+ });
1957
+ },
1958
+ }) as () => void;
1959
+ },
1960
+ /**
1961
+ * Watch UpdateWithdrawalAccount events
1962
+ * @param callback Function to call when event is emitted
1963
+ * @param filter Optional filter for indexed parameters
1964
+ * @returns Unwatch function to stop listening
1965
+ */
1966
+ UpdateWithdrawalAccount: (callback: (event: { account: `0x${string}`; authorized: boolean }) => void) => {
1967
+ return this.publicClient.watchContractEvent({
1968
+ address: this.contractAddress,
1969
+ abi: HashflowPoolAbi,
1970
+ eventName: 'UpdateWithdrawalAccount',
1971
+
1972
+ onLogs: (logs: any[]) => {
1973
+ logs.forEach((log: any) => {
1974
+ callback(log.args as any);
1975
+ });
1976
+ },
1977
+ }) as () => void;
1978
+ },
1979
+ /**
1980
+ * Watch XChainTrade events
1981
+ * @param callback Function to call when event is emitted
1982
+ * @param filter Optional filter for indexed parameters
1983
+ * @returns Unwatch function to stop listening
1984
+ */
1985
+ XChainTrade: (callback: (event: { dstChainId: bigint; dstPool: `0x${string}`; trader: `0x${string}`; dstTrader: `0x${string}`; txid: `0x${string}`; baseToken: `0x${string}`; quoteToken: `0x${string}`; baseTokenAmount: bigint; quoteTokenAmount: bigint }) => void) => {
1986
+ return this.publicClient.watchContractEvent({
1987
+ address: this.contractAddress,
1988
+ abi: HashflowPoolAbi,
1989
+ eventName: 'XChainTrade',
1990
+
1991
+ onLogs: (logs: any[]) => {
1992
+ logs.forEach((log: any) => {
1993
+ callback(log.args as any);
1994
+ });
1995
+ },
1996
+ }) as () => void;
1997
+ },
1998
+ /**
1999
+ * Watch XChainTradeFill events
2000
+ * @param callback Function to call when event is emitted
2001
+ * @param filter Optional filter for indexed parameters
2002
+ * @returns Unwatch function to stop listening
2003
+ */
2004
+ XChainTradeFill: (callback: (event: { txid: `0x${string}` }) => void) => {
2005
+ return this.publicClient.watchContractEvent({
2006
+ address: this.contractAddress,
2007
+ abi: HashflowPoolAbi,
2008
+ eventName: 'XChainTradeFill',
2009
+
2010
+ onLogs: (logs: any[]) => {
2011
+ logs.forEach((log: any) => {
2012
+ callback(log.args as any);
2013
+ });
2014
+ },
2015
+ }) as () => void;
2016
+ }
2017
+ };
2018
+ }
2019
+ }