@optimex-xyz/market-maker-sdk 0.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.
package/dist/index.mjs ADDED
@@ -0,0 +1,3928 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/config/config.ts
8
+ var environments = {
9
+ dev: {
10
+ solverUrl: "https://pre-bitfi-solver.kyberengineering.io",
11
+ backendUrl: "https://api-stg.bitdex.xyz",
12
+ rpcUrl: "https://rpc-bitfi-p00c4t1rul.t.conduit.xyz",
13
+ routerAddress: "0xc0B01A53B15bacAF6f81aF1F6B001E8c8130256e",
14
+ paymentAddressMap: {
15
+ ethereum_sepolia: "0x7387DcCfE2f1D5F80b4ECDF91eF58541517e90D2"
16
+ }
17
+ },
18
+ production: {
19
+ solverUrl: "https://bitfi-solver.kyberengineering.io",
20
+ backendUrl: "https://api.petafi.xyz",
21
+ rpcUrl: "https://bitfi-ledger-testnet.alt.technology",
22
+ routerAddress: "0x07468dF194817257e73cA71E938C1ef977Be032F",
23
+ paymentAddressMap: {
24
+ ethereum: "0x05d60d78ec4896c041268b68fcef2294b16123c3"
25
+ }
26
+ }
27
+ };
28
+ var Config = class {
29
+ constructor() {
30
+ this.env = process.env.SDK_ENV || "production";
31
+ if (!environments[this.env]) {
32
+ throw new Error(`Unsupported environment: ${this.env}`);
33
+ }
34
+ this.config = environments[this.env];
35
+ }
36
+ get() {
37
+ return {
38
+ env: this.env,
39
+ ...this.config
40
+ };
41
+ }
42
+ getSolverUrl() {
43
+ return this.config.solverUrl;
44
+ }
45
+ getBackendUrl() {
46
+ return this.config.backendUrl;
47
+ }
48
+ getRpcUrl() {
49
+ return this.config.rpcUrl;
50
+ }
51
+ getRouterAddress() {
52
+ return this.config.routerAddress;
53
+ }
54
+ getPaymentAddress(networkId) {
55
+ return this.config.paymentAddressMap[networkId];
56
+ }
57
+ };
58
+ var config = new Config();
59
+
60
+ // src/contracts/contract/factories/index.ts
61
+ var factories_exports = {};
62
+ __export(factories_exports, {
63
+ ERC20__factory: () => ERC20__factory,
64
+ Payment__factory: () => Payment__factory,
65
+ Router__factory: () => Router__factory,
66
+ Signer__factory: () => Signer__factory
67
+ });
68
+
69
+ // src/contracts/contract/factories/ERC20__factory.ts
70
+ import { Contract, Interface } from "ethers";
71
+ var _abi = [
72
+ {
73
+ anonymous: false,
74
+ inputs: [
75
+ {
76
+ indexed: true,
77
+ internalType: "address",
78
+ name: "owner",
79
+ type: "address"
80
+ },
81
+ {
82
+ indexed: true,
83
+ internalType: "address",
84
+ name: "spender",
85
+ type: "address"
86
+ },
87
+ {
88
+ indexed: false,
89
+ internalType: "uint256",
90
+ name: "value",
91
+ type: "uint256"
92
+ }
93
+ ],
94
+ name: "Approval",
95
+ type: "event"
96
+ },
97
+ {
98
+ anonymous: false,
99
+ inputs: [
100
+ {
101
+ indexed: true,
102
+ internalType: "address",
103
+ name: "authorizer",
104
+ type: "address"
105
+ },
106
+ {
107
+ indexed: true,
108
+ internalType: "bytes32",
109
+ name: "nonce",
110
+ type: "bytes32"
111
+ }
112
+ ],
113
+ name: "AuthorizationCanceled",
114
+ type: "event"
115
+ },
116
+ {
117
+ anonymous: false,
118
+ inputs: [
119
+ {
120
+ indexed: true,
121
+ internalType: "address",
122
+ name: "authorizer",
123
+ type: "address"
124
+ },
125
+ {
126
+ indexed: true,
127
+ internalType: "bytes32",
128
+ name: "nonce",
129
+ type: "bytes32"
130
+ }
131
+ ],
132
+ name: "AuthorizationUsed",
133
+ type: "event"
134
+ },
135
+ {
136
+ anonymous: false,
137
+ inputs: [
138
+ {
139
+ indexed: true,
140
+ internalType: "address",
141
+ name: "_account",
142
+ type: "address"
143
+ }
144
+ ],
145
+ name: "Blacklisted",
146
+ type: "event"
147
+ },
148
+ {
149
+ anonymous: false,
150
+ inputs: [
151
+ {
152
+ indexed: true,
153
+ internalType: "address",
154
+ name: "newBlacklister",
155
+ type: "address"
156
+ }
157
+ ],
158
+ name: "BlacklisterChanged",
159
+ type: "event"
160
+ },
161
+ {
162
+ anonymous: false,
163
+ inputs: [
164
+ {
165
+ indexed: true,
166
+ internalType: "address",
167
+ name: "burner",
168
+ type: "address"
169
+ },
170
+ {
171
+ indexed: false,
172
+ internalType: "uint256",
173
+ name: "amount",
174
+ type: "uint256"
175
+ }
176
+ ],
177
+ name: "Burn",
178
+ type: "event"
179
+ },
180
+ {
181
+ anonymous: false,
182
+ inputs: [
183
+ {
184
+ indexed: true,
185
+ internalType: "address",
186
+ name: "newMasterMinter",
187
+ type: "address"
188
+ }
189
+ ],
190
+ name: "MasterMinterChanged",
191
+ type: "event"
192
+ },
193
+ {
194
+ anonymous: false,
195
+ inputs: [
196
+ {
197
+ indexed: true,
198
+ internalType: "address",
199
+ name: "minter",
200
+ type: "address"
201
+ },
202
+ {
203
+ indexed: true,
204
+ internalType: "address",
205
+ name: "to",
206
+ type: "address"
207
+ },
208
+ {
209
+ indexed: false,
210
+ internalType: "uint256",
211
+ name: "amount",
212
+ type: "uint256"
213
+ }
214
+ ],
215
+ name: "Mint",
216
+ type: "event"
217
+ },
218
+ {
219
+ anonymous: false,
220
+ inputs: [
221
+ {
222
+ indexed: true,
223
+ internalType: "address",
224
+ name: "minter",
225
+ type: "address"
226
+ },
227
+ {
228
+ indexed: false,
229
+ internalType: "uint256",
230
+ name: "minterAllowedAmount",
231
+ type: "uint256"
232
+ }
233
+ ],
234
+ name: "MinterConfigured",
235
+ type: "event"
236
+ },
237
+ {
238
+ anonymous: false,
239
+ inputs: [
240
+ {
241
+ indexed: true,
242
+ internalType: "address",
243
+ name: "oldMinter",
244
+ type: "address"
245
+ }
246
+ ],
247
+ name: "MinterRemoved",
248
+ type: "event"
249
+ },
250
+ {
251
+ anonymous: false,
252
+ inputs: [
253
+ {
254
+ indexed: false,
255
+ internalType: "address",
256
+ name: "previousOwner",
257
+ type: "address"
258
+ },
259
+ {
260
+ indexed: false,
261
+ internalType: "address",
262
+ name: "newOwner",
263
+ type: "address"
264
+ }
265
+ ],
266
+ name: "OwnershipTransferred",
267
+ type: "event"
268
+ },
269
+ {
270
+ anonymous: false,
271
+ inputs: [],
272
+ name: "Pause",
273
+ type: "event"
274
+ },
275
+ {
276
+ anonymous: false,
277
+ inputs: [
278
+ {
279
+ indexed: true,
280
+ internalType: "address",
281
+ name: "newAddress",
282
+ type: "address"
283
+ }
284
+ ],
285
+ name: "PauserChanged",
286
+ type: "event"
287
+ },
288
+ {
289
+ anonymous: false,
290
+ inputs: [
291
+ {
292
+ indexed: true,
293
+ internalType: "address",
294
+ name: "newRescuer",
295
+ type: "address"
296
+ }
297
+ ],
298
+ name: "RescuerChanged",
299
+ type: "event"
300
+ },
301
+ {
302
+ anonymous: false,
303
+ inputs: [
304
+ {
305
+ indexed: true,
306
+ internalType: "address",
307
+ name: "from",
308
+ type: "address"
309
+ },
310
+ {
311
+ indexed: true,
312
+ internalType: "address",
313
+ name: "to",
314
+ type: "address"
315
+ },
316
+ {
317
+ indexed: false,
318
+ internalType: "uint256",
319
+ name: "value",
320
+ type: "uint256"
321
+ }
322
+ ],
323
+ name: "Transfer",
324
+ type: "event"
325
+ },
326
+ {
327
+ anonymous: false,
328
+ inputs: [
329
+ {
330
+ indexed: true,
331
+ internalType: "address",
332
+ name: "_account",
333
+ type: "address"
334
+ }
335
+ ],
336
+ name: "UnBlacklisted",
337
+ type: "event"
338
+ },
339
+ {
340
+ anonymous: false,
341
+ inputs: [],
342
+ name: "Unpause",
343
+ type: "event"
344
+ },
345
+ {
346
+ inputs: [],
347
+ name: "CANCEL_AUTHORIZATION_TYPEHASH",
348
+ outputs: [
349
+ {
350
+ internalType: "bytes32",
351
+ name: "",
352
+ type: "bytes32"
353
+ }
354
+ ],
355
+ stateMutability: "view",
356
+ type: "function"
357
+ },
358
+ {
359
+ inputs: [],
360
+ name: "DOMAIN_SEPARATOR",
361
+ outputs: [
362
+ {
363
+ internalType: "bytes32",
364
+ name: "",
365
+ type: "bytes32"
366
+ }
367
+ ],
368
+ stateMutability: "view",
369
+ type: "function"
370
+ },
371
+ {
372
+ inputs: [],
373
+ name: "PERMIT_TYPEHASH",
374
+ outputs: [
375
+ {
376
+ internalType: "bytes32",
377
+ name: "",
378
+ type: "bytes32"
379
+ }
380
+ ],
381
+ stateMutability: "view",
382
+ type: "function"
383
+ },
384
+ {
385
+ inputs: [],
386
+ name: "RECEIVE_WITH_AUTHORIZATION_TYPEHASH",
387
+ outputs: [
388
+ {
389
+ internalType: "bytes32",
390
+ name: "",
391
+ type: "bytes32"
392
+ }
393
+ ],
394
+ stateMutability: "view",
395
+ type: "function"
396
+ },
397
+ {
398
+ inputs: [],
399
+ name: "TRANSFER_WITH_AUTHORIZATION_TYPEHASH",
400
+ outputs: [
401
+ {
402
+ internalType: "bytes32",
403
+ name: "",
404
+ type: "bytes32"
405
+ }
406
+ ],
407
+ stateMutability: "view",
408
+ type: "function"
409
+ },
410
+ {
411
+ inputs: [
412
+ {
413
+ internalType: "address",
414
+ name: "owner",
415
+ type: "address"
416
+ },
417
+ {
418
+ internalType: "address",
419
+ name: "spender",
420
+ type: "address"
421
+ }
422
+ ],
423
+ name: "allowance",
424
+ outputs: [
425
+ {
426
+ internalType: "uint256",
427
+ name: "",
428
+ type: "uint256"
429
+ }
430
+ ],
431
+ stateMutability: "view",
432
+ type: "function"
433
+ },
434
+ {
435
+ inputs: [
436
+ {
437
+ internalType: "address",
438
+ name: "spender",
439
+ type: "address"
440
+ },
441
+ {
442
+ internalType: "uint256",
443
+ name: "value",
444
+ type: "uint256"
445
+ }
446
+ ],
447
+ name: "approve",
448
+ outputs: [
449
+ {
450
+ internalType: "bool",
451
+ name: "",
452
+ type: "bool"
453
+ }
454
+ ],
455
+ stateMutability: "nonpayable",
456
+ type: "function"
457
+ },
458
+ {
459
+ inputs: [
460
+ {
461
+ internalType: "address",
462
+ name: "authorizer",
463
+ type: "address"
464
+ },
465
+ {
466
+ internalType: "bytes32",
467
+ name: "nonce",
468
+ type: "bytes32"
469
+ }
470
+ ],
471
+ name: "authorizationState",
472
+ outputs: [
473
+ {
474
+ internalType: "bool",
475
+ name: "",
476
+ type: "bool"
477
+ }
478
+ ],
479
+ stateMutability: "view",
480
+ type: "function"
481
+ },
482
+ {
483
+ inputs: [
484
+ {
485
+ internalType: "address",
486
+ name: "account",
487
+ type: "address"
488
+ }
489
+ ],
490
+ name: "balanceOf",
491
+ outputs: [
492
+ {
493
+ internalType: "uint256",
494
+ name: "",
495
+ type: "uint256"
496
+ }
497
+ ],
498
+ stateMutability: "view",
499
+ type: "function"
500
+ },
501
+ {
502
+ inputs: [
503
+ {
504
+ internalType: "address",
505
+ name: "_account",
506
+ type: "address"
507
+ }
508
+ ],
509
+ name: "blacklist",
510
+ outputs: [],
511
+ stateMutability: "nonpayable",
512
+ type: "function"
513
+ },
514
+ {
515
+ inputs: [],
516
+ name: "blacklister",
517
+ outputs: [
518
+ {
519
+ internalType: "address",
520
+ name: "",
521
+ type: "address"
522
+ }
523
+ ],
524
+ stateMutability: "view",
525
+ type: "function"
526
+ },
527
+ {
528
+ inputs: [
529
+ {
530
+ internalType: "uint256",
531
+ name: "_amount",
532
+ type: "uint256"
533
+ }
534
+ ],
535
+ name: "burn",
536
+ outputs: [],
537
+ stateMutability: "nonpayable",
538
+ type: "function"
539
+ },
540
+ {
541
+ inputs: [
542
+ {
543
+ internalType: "address",
544
+ name: "authorizer",
545
+ type: "address"
546
+ },
547
+ {
548
+ internalType: "bytes32",
549
+ name: "nonce",
550
+ type: "bytes32"
551
+ },
552
+ {
553
+ internalType: "uint8",
554
+ name: "v",
555
+ type: "uint8"
556
+ },
557
+ {
558
+ internalType: "bytes32",
559
+ name: "r",
560
+ type: "bytes32"
561
+ },
562
+ {
563
+ internalType: "bytes32",
564
+ name: "s",
565
+ type: "bytes32"
566
+ }
567
+ ],
568
+ name: "cancelAuthorization",
569
+ outputs: [],
570
+ stateMutability: "nonpayable",
571
+ type: "function"
572
+ },
573
+ {
574
+ inputs: [
575
+ {
576
+ internalType: "address",
577
+ name: "authorizer",
578
+ type: "address"
579
+ },
580
+ {
581
+ internalType: "bytes32",
582
+ name: "nonce",
583
+ type: "bytes32"
584
+ },
585
+ {
586
+ internalType: "bytes",
587
+ name: "signature",
588
+ type: "bytes"
589
+ }
590
+ ],
591
+ name: "cancelAuthorization",
592
+ outputs: [],
593
+ stateMutability: "nonpayable",
594
+ type: "function"
595
+ },
596
+ {
597
+ inputs: [
598
+ {
599
+ internalType: "address",
600
+ name: "minter",
601
+ type: "address"
602
+ },
603
+ {
604
+ internalType: "uint256",
605
+ name: "minterAllowedAmount",
606
+ type: "uint256"
607
+ }
608
+ ],
609
+ name: "configureMinter",
610
+ outputs: [
611
+ {
612
+ internalType: "bool",
613
+ name: "",
614
+ type: "bool"
615
+ }
616
+ ],
617
+ stateMutability: "nonpayable",
618
+ type: "function"
619
+ },
620
+ {
621
+ inputs: [],
622
+ name: "currency",
623
+ outputs: [
624
+ {
625
+ internalType: "string",
626
+ name: "",
627
+ type: "string"
628
+ }
629
+ ],
630
+ stateMutability: "view",
631
+ type: "function"
632
+ },
633
+ {
634
+ inputs: [],
635
+ name: "decimals",
636
+ outputs: [
637
+ {
638
+ internalType: "uint8",
639
+ name: "",
640
+ type: "uint8"
641
+ }
642
+ ],
643
+ stateMutability: "view",
644
+ type: "function"
645
+ },
646
+ {
647
+ inputs: [
648
+ {
649
+ internalType: "address",
650
+ name: "spender",
651
+ type: "address"
652
+ },
653
+ {
654
+ internalType: "uint256",
655
+ name: "decrement",
656
+ type: "uint256"
657
+ }
658
+ ],
659
+ name: "decreaseAllowance",
660
+ outputs: [
661
+ {
662
+ internalType: "bool",
663
+ name: "",
664
+ type: "bool"
665
+ }
666
+ ],
667
+ stateMutability: "nonpayable",
668
+ type: "function"
669
+ },
670
+ {
671
+ inputs: [
672
+ {
673
+ internalType: "address",
674
+ name: "spender",
675
+ type: "address"
676
+ },
677
+ {
678
+ internalType: "uint256",
679
+ name: "increment",
680
+ type: "uint256"
681
+ }
682
+ ],
683
+ name: "increaseAllowance",
684
+ outputs: [
685
+ {
686
+ internalType: "bool",
687
+ name: "",
688
+ type: "bool"
689
+ }
690
+ ],
691
+ stateMutability: "nonpayable",
692
+ type: "function"
693
+ },
694
+ {
695
+ inputs: [
696
+ {
697
+ internalType: "string",
698
+ name: "tokenName",
699
+ type: "string"
700
+ },
701
+ {
702
+ internalType: "string",
703
+ name: "tokenSymbol",
704
+ type: "string"
705
+ },
706
+ {
707
+ internalType: "string",
708
+ name: "tokenCurrency",
709
+ type: "string"
710
+ },
711
+ {
712
+ internalType: "uint8",
713
+ name: "tokenDecimals",
714
+ type: "uint8"
715
+ },
716
+ {
717
+ internalType: "address",
718
+ name: "newMasterMinter",
719
+ type: "address"
720
+ },
721
+ {
722
+ internalType: "address",
723
+ name: "newPauser",
724
+ type: "address"
725
+ },
726
+ {
727
+ internalType: "address",
728
+ name: "newBlacklister",
729
+ type: "address"
730
+ },
731
+ {
732
+ internalType: "address",
733
+ name: "newOwner",
734
+ type: "address"
735
+ }
736
+ ],
737
+ name: "initialize",
738
+ outputs: [],
739
+ stateMutability: "nonpayable",
740
+ type: "function"
741
+ },
742
+ {
743
+ inputs: [
744
+ {
745
+ internalType: "string",
746
+ name: "newName",
747
+ type: "string"
748
+ }
749
+ ],
750
+ name: "initializeV2",
751
+ outputs: [],
752
+ stateMutability: "nonpayable",
753
+ type: "function"
754
+ },
755
+ {
756
+ inputs: [
757
+ {
758
+ internalType: "address",
759
+ name: "lostAndFound",
760
+ type: "address"
761
+ }
762
+ ],
763
+ name: "initializeV2_1",
764
+ outputs: [],
765
+ stateMutability: "nonpayable",
766
+ type: "function"
767
+ },
768
+ {
769
+ inputs: [
770
+ {
771
+ internalType: "address[]",
772
+ name: "accountsToBlacklist",
773
+ type: "address[]"
774
+ },
775
+ {
776
+ internalType: "string",
777
+ name: "newSymbol",
778
+ type: "string"
779
+ }
780
+ ],
781
+ name: "initializeV2_2",
782
+ outputs: [],
783
+ stateMutability: "nonpayable",
784
+ type: "function"
785
+ },
786
+ {
787
+ inputs: [
788
+ {
789
+ internalType: "address",
790
+ name: "_account",
791
+ type: "address"
792
+ }
793
+ ],
794
+ name: "isBlacklisted",
795
+ outputs: [
796
+ {
797
+ internalType: "bool",
798
+ name: "",
799
+ type: "bool"
800
+ }
801
+ ],
802
+ stateMutability: "view",
803
+ type: "function"
804
+ },
805
+ {
806
+ inputs: [
807
+ {
808
+ internalType: "address",
809
+ name: "account",
810
+ type: "address"
811
+ }
812
+ ],
813
+ name: "isMinter",
814
+ outputs: [
815
+ {
816
+ internalType: "bool",
817
+ name: "",
818
+ type: "bool"
819
+ }
820
+ ],
821
+ stateMutability: "view",
822
+ type: "function"
823
+ },
824
+ {
825
+ inputs: [],
826
+ name: "masterMinter",
827
+ outputs: [
828
+ {
829
+ internalType: "address",
830
+ name: "",
831
+ type: "address"
832
+ }
833
+ ],
834
+ stateMutability: "view",
835
+ type: "function"
836
+ },
837
+ {
838
+ inputs: [
839
+ {
840
+ internalType: "address",
841
+ name: "_to",
842
+ type: "address"
843
+ },
844
+ {
845
+ internalType: "uint256",
846
+ name: "_amount",
847
+ type: "uint256"
848
+ }
849
+ ],
850
+ name: "mint",
851
+ outputs: [
852
+ {
853
+ internalType: "bool",
854
+ name: "",
855
+ type: "bool"
856
+ }
857
+ ],
858
+ stateMutability: "nonpayable",
859
+ type: "function"
860
+ },
861
+ {
862
+ inputs: [
863
+ {
864
+ internalType: "address",
865
+ name: "minter",
866
+ type: "address"
867
+ }
868
+ ],
869
+ name: "minterAllowance",
870
+ outputs: [
871
+ {
872
+ internalType: "uint256",
873
+ name: "",
874
+ type: "uint256"
875
+ }
876
+ ],
877
+ stateMutability: "view",
878
+ type: "function"
879
+ },
880
+ {
881
+ inputs: [],
882
+ name: "name",
883
+ outputs: [
884
+ {
885
+ internalType: "string",
886
+ name: "",
887
+ type: "string"
888
+ }
889
+ ],
890
+ stateMutability: "view",
891
+ type: "function"
892
+ },
893
+ {
894
+ inputs: [
895
+ {
896
+ internalType: "address",
897
+ name: "owner",
898
+ type: "address"
899
+ }
900
+ ],
901
+ name: "nonces",
902
+ outputs: [
903
+ {
904
+ internalType: "uint256",
905
+ name: "",
906
+ type: "uint256"
907
+ }
908
+ ],
909
+ stateMutability: "view",
910
+ type: "function"
911
+ },
912
+ {
913
+ inputs: [],
914
+ name: "owner",
915
+ outputs: [
916
+ {
917
+ internalType: "address",
918
+ name: "",
919
+ type: "address"
920
+ }
921
+ ],
922
+ stateMutability: "view",
923
+ type: "function"
924
+ },
925
+ {
926
+ inputs: [],
927
+ name: "pause",
928
+ outputs: [],
929
+ stateMutability: "nonpayable",
930
+ type: "function"
931
+ },
932
+ {
933
+ inputs: [],
934
+ name: "paused",
935
+ outputs: [
936
+ {
937
+ internalType: "bool",
938
+ name: "",
939
+ type: "bool"
940
+ }
941
+ ],
942
+ stateMutability: "view",
943
+ type: "function"
944
+ },
945
+ {
946
+ inputs: [],
947
+ name: "pauser",
948
+ outputs: [
949
+ {
950
+ internalType: "address",
951
+ name: "",
952
+ type: "address"
953
+ }
954
+ ],
955
+ stateMutability: "view",
956
+ type: "function"
957
+ },
958
+ {
959
+ inputs: [
960
+ {
961
+ internalType: "address",
962
+ name: "owner",
963
+ type: "address"
964
+ },
965
+ {
966
+ internalType: "address",
967
+ name: "spender",
968
+ type: "address"
969
+ },
970
+ {
971
+ internalType: "uint256",
972
+ name: "value",
973
+ type: "uint256"
974
+ },
975
+ {
976
+ internalType: "uint256",
977
+ name: "deadline",
978
+ type: "uint256"
979
+ },
980
+ {
981
+ internalType: "bytes",
982
+ name: "signature",
983
+ type: "bytes"
984
+ }
985
+ ],
986
+ name: "permit",
987
+ outputs: [],
988
+ stateMutability: "nonpayable",
989
+ type: "function"
990
+ },
991
+ {
992
+ inputs: [
993
+ {
994
+ internalType: "address",
995
+ name: "owner",
996
+ type: "address"
997
+ },
998
+ {
999
+ internalType: "address",
1000
+ name: "spender",
1001
+ type: "address"
1002
+ },
1003
+ {
1004
+ internalType: "uint256",
1005
+ name: "value",
1006
+ type: "uint256"
1007
+ },
1008
+ {
1009
+ internalType: "uint256",
1010
+ name: "deadline",
1011
+ type: "uint256"
1012
+ },
1013
+ {
1014
+ internalType: "uint8",
1015
+ name: "v",
1016
+ type: "uint8"
1017
+ },
1018
+ {
1019
+ internalType: "bytes32",
1020
+ name: "r",
1021
+ type: "bytes32"
1022
+ },
1023
+ {
1024
+ internalType: "bytes32",
1025
+ name: "s",
1026
+ type: "bytes32"
1027
+ }
1028
+ ],
1029
+ name: "permit",
1030
+ outputs: [],
1031
+ stateMutability: "nonpayable",
1032
+ type: "function"
1033
+ },
1034
+ {
1035
+ inputs: [
1036
+ {
1037
+ internalType: "address",
1038
+ name: "from",
1039
+ type: "address"
1040
+ },
1041
+ {
1042
+ internalType: "address",
1043
+ name: "to",
1044
+ type: "address"
1045
+ },
1046
+ {
1047
+ internalType: "uint256",
1048
+ name: "value",
1049
+ type: "uint256"
1050
+ },
1051
+ {
1052
+ internalType: "uint256",
1053
+ name: "validAfter",
1054
+ type: "uint256"
1055
+ },
1056
+ {
1057
+ internalType: "uint256",
1058
+ name: "validBefore",
1059
+ type: "uint256"
1060
+ },
1061
+ {
1062
+ internalType: "bytes32",
1063
+ name: "nonce",
1064
+ type: "bytes32"
1065
+ },
1066
+ {
1067
+ internalType: "bytes",
1068
+ name: "signature",
1069
+ type: "bytes"
1070
+ }
1071
+ ],
1072
+ name: "receiveWithAuthorization",
1073
+ outputs: [],
1074
+ stateMutability: "nonpayable",
1075
+ type: "function"
1076
+ },
1077
+ {
1078
+ inputs: [
1079
+ {
1080
+ internalType: "address",
1081
+ name: "from",
1082
+ type: "address"
1083
+ },
1084
+ {
1085
+ internalType: "address",
1086
+ name: "to",
1087
+ type: "address"
1088
+ },
1089
+ {
1090
+ internalType: "uint256",
1091
+ name: "value",
1092
+ type: "uint256"
1093
+ },
1094
+ {
1095
+ internalType: "uint256",
1096
+ name: "validAfter",
1097
+ type: "uint256"
1098
+ },
1099
+ {
1100
+ internalType: "uint256",
1101
+ name: "validBefore",
1102
+ type: "uint256"
1103
+ },
1104
+ {
1105
+ internalType: "bytes32",
1106
+ name: "nonce",
1107
+ type: "bytes32"
1108
+ },
1109
+ {
1110
+ internalType: "uint8",
1111
+ name: "v",
1112
+ type: "uint8"
1113
+ },
1114
+ {
1115
+ internalType: "bytes32",
1116
+ name: "r",
1117
+ type: "bytes32"
1118
+ },
1119
+ {
1120
+ internalType: "bytes32",
1121
+ name: "s",
1122
+ type: "bytes32"
1123
+ }
1124
+ ],
1125
+ name: "receiveWithAuthorization",
1126
+ outputs: [],
1127
+ stateMutability: "nonpayable",
1128
+ type: "function"
1129
+ },
1130
+ {
1131
+ inputs: [
1132
+ {
1133
+ internalType: "address",
1134
+ name: "minter",
1135
+ type: "address"
1136
+ }
1137
+ ],
1138
+ name: "removeMinter",
1139
+ outputs: [
1140
+ {
1141
+ internalType: "bool",
1142
+ name: "",
1143
+ type: "bool"
1144
+ }
1145
+ ],
1146
+ stateMutability: "nonpayable",
1147
+ type: "function"
1148
+ },
1149
+ {
1150
+ inputs: [
1151
+ {
1152
+ internalType: "contract IERC20",
1153
+ name: "tokenContract",
1154
+ type: "address"
1155
+ },
1156
+ {
1157
+ internalType: "address",
1158
+ name: "to",
1159
+ type: "address"
1160
+ },
1161
+ {
1162
+ internalType: "uint256",
1163
+ name: "amount",
1164
+ type: "uint256"
1165
+ }
1166
+ ],
1167
+ name: "rescueERC20",
1168
+ outputs: [],
1169
+ stateMutability: "nonpayable",
1170
+ type: "function"
1171
+ },
1172
+ {
1173
+ inputs: [],
1174
+ name: "rescuer",
1175
+ outputs: [
1176
+ {
1177
+ internalType: "address",
1178
+ name: "",
1179
+ type: "address"
1180
+ }
1181
+ ],
1182
+ stateMutability: "view",
1183
+ type: "function"
1184
+ },
1185
+ {
1186
+ inputs: [],
1187
+ name: "symbol",
1188
+ outputs: [
1189
+ {
1190
+ internalType: "string",
1191
+ name: "",
1192
+ type: "string"
1193
+ }
1194
+ ],
1195
+ stateMutability: "view",
1196
+ type: "function"
1197
+ },
1198
+ {
1199
+ inputs: [],
1200
+ name: "totalSupply",
1201
+ outputs: [
1202
+ {
1203
+ internalType: "uint256",
1204
+ name: "",
1205
+ type: "uint256"
1206
+ }
1207
+ ],
1208
+ stateMutability: "view",
1209
+ type: "function"
1210
+ },
1211
+ {
1212
+ inputs: [
1213
+ {
1214
+ internalType: "address",
1215
+ name: "to",
1216
+ type: "address"
1217
+ },
1218
+ {
1219
+ internalType: "uint256",
1220
+ name: "value",
1221
+ type: "uint256"
1222
+ }
1223
+ ],
1224
+ name: "transfer",
1225
+ outputs: [
1226
+ {
1227
+ internalType: "bool",
1228
+ name: "",
1229
+ type: "bool"
1230
+ }
1231
+ ],
1232
+ stateMutability: "nonpayable",
1233
+ type: "function"
1234
+ },
1235
+ {
1236
+ inputs: [
1237
+ {
1238
+ internalType: "address",
1239
+ name: "from",
1240
+ type: "address"
1241
+ },
1242
+ {
1243
+ internalType: "address",
1244
+ name: "to",
1245
+ type: "address"
1246
+ },
1247
+ {
1248
+ internalType: "uint256",
1249
+ name: "value",
1250
+ type: "uint256"
1251
+ }
1252
+ ],
1253
+ name: "transferFrom",
1254
+ outputs: [
1255
+ {
1256
+ internalType: "bool",
1257
+ name: "",
1258
+ type: "bool"
1259
+ }
1260
+ ],
1261
+ stateMutability: "nonpayable",
1262
+ type: "function"
1263
+ },
1264
+ {
1265
+ inputs: [
1266
+ {
1267
+ internalType: "address",
1268
+ name: "newOwner",
1269
+ type: "address"
1270
+ }
1271
+ ],
1272
+ name: "transferOwnership",
1273
+ outputs: [],
1274
+ stateMutability: "nonpayable",
1275
+ type: "function"
1276
+ },
1277
+ {
1278
+ inputs: [
1279
+ {
1280
+ internalType: "address",
1281
+ name: "from",
1282
+ type: "address"
1283
+ },
1284
+ {
1285
+ internalType: "address",
1286
+ name: "to",
1287
+ type: "address"
1288
+ },
1289
+ {
1290
+ internalType: "uint256",
1291
+ name: "value",
1292
+ type: "uint256"
1293
+ },
1294
+ {
1295
+ internalType: "uint256",
1296
+ name: "validAfter",
1297
+ type: "uint256"
1298
+ },
1299
+ {
1300
+ internalType: "uint256",
1301
+ name: "validBefore",
1302
+ type: "uint256"
1303
+ },
1304
+ {
1305
+ internalType: "bytes32",
1306
+ name: "nonce",
1307
+ type: "bytes32"
1308
+ },
1309
+ {
1310
+ internalType: "bytes",
1311
+ name: "signature",
1312
+ type: "bytes"
1313
+ }
1314
+ ],
1315
+ name: "transferWithAuthorization",
1316
+ outputs: [],
1317
+ stateMutability: "nonpayable",
1318
+ type: "function"
1319
+ },
1320
+ {
1321
+ inputs: [
1322
+ {
1323
+ internalType: "address",
1324
+ name: "from",
1325
+ type: "address"
1326
+ },
1327
+ {
1328
+ internalType: "address",
1329
+ name: "to",
1330
+ type: "address"
1331
+ },
1332
+ {
1333
+ internalType: "uint256",
1334
+ name: "value",
1335
+ type: "uint256"
1336
+ },
1337
+ {
1338
+ internalType: "uint256",
1339
+ name: "validAfter",
1340
+ type: "uint256"
1341
+ },
1342
+ {
1343
+ internalType: "uint256",
1344
+ name: "validBefore",
1345
+ type: "uint256"
1346
+ },
1347
+ {
1348
+ internalType: "bytes32",
1349
+ name: "nonce",
1350
+ type: "bytes32"
1351
+ },
1352
+ {
1353
+ internalType: "uint8",
1354
+ name: "v",
1355
+ type: "uint8"
1356
+ },
1357
+ {
1358
+ internalType: "bytes32",
1359
+ name: "r",
1360
+ type: "bytes32"
1361
+ },
1362
+ {
1363
+ internalType: "bytes32",
1364
+ name: "s",
1365
+ type: "bytes32"
1366
+ }
1367
+ ],
1368
+ name: "transferWithAuthorization",
1369
+ outputs: [],
1370
+ stateMutability: "nonpayable",
1371
+ type: "function"
1372
+ },
1373
+ {
1374
+ inputs: [
1375
+ {
1376
+ internalType: "address",
1377
+ name: "_account",
1378
+ type: "address"
1379
+ }
1380
+ ],
1381
+ name: "unBlacklist",
1382
+ outputs: [],
1383
+ stateMutability: "nonpayable",
1384
+ type: "function"
1385
+ },
1386
+ {
1387
+ inputs: [],
1388
+ name: "unpause",
1389
+ outputs: [],
1390
+ stateMutability: "nonpayable",
1391
+ type: "function"
1392
+ },
1393
+ {
1394
+ inputs: [
1395
+ {
1396
+ internalType: "address",
1397
+ name: "_newBlacklister",
1398
+ type: "address"
1399
+ }
1400
+ ],
1401
+ name: "updateBlacklister",
1402
+ outputs: [],
1403
+ stateMutability: "nonpayable",
1404
+ type: "function"
1405
+ },
1406
+ {
1407
+ inputs: [
1408
+ {
1409
+ internalType: "address",
1410
+ name: "_newMasterMinter",
1411
+ type: "address"
1412
+ }
1413
+ ],
1414
+ name: "updateMasterMinter",
1415
+ outputs: [],
1416
+ stateMutability: "nonpayable",
1417
+ type: "function"
1418
+ },
1419
+ {
1420
+ inputs: [
1421
+ {
1422
+ internalType: "address",
1423
+ name: "_newPauser",
1424
+ type: "address"
1425
+ }
1426
+ ],
1427
+ name: "updatePauser",
1428
+ outputs: [],
1429
+ stateMutability: "nonpayable",
1430
+ type: "function"
1431
+ },
1432
+ {
1433
+ inputs: [
1434
+ {
1435
+ internalType: "address",
1436
+ name: "newRescuer",
1437
+ type: "address"
1438
+ }
1439
+ ],
1440
+ name: "updateRescuer",
1441
+ outputs: [],
1442
+ stateMutability: "nonpayable",
1443
+ type: "function"
1444
+ },
1445
+ {
1446
+ inputs: [],
1447
+ name: "version",
1448
+ outputs: [
1449
+ {
1450
+ internalType: "string",
1451
+ name: "",
1452
+ type: "string"
1453
+ }
1454
+ ],
1455
+ stateMutability: "pure",
1456
+ type: "function"
1457
+ }
1458
+ ];
1459
+ var ERC20__factory = class {
1460
+ static createInterface() {
1461
+ return new Interface(_abi);
1462
+ }
1463
+ static connect(address, runner) {
1464
+ return new Contract(address, _abi, runner);
1465
+ }
1466
+ };
1467
+ ERC20__factory.abi = _abi;
1468
+
1469
+ // src/contracts/contract/factories/Payment__factory.ts
1470
+ import { Contract as Contract2, Interface as Interface2 } from "ethers";
1471
+ var _abi2 = [
1472
+ {
1473
+ inputs: [
1474
+ {
1475
+ internalType: "address",
1476
+ name: "pAddress",
1477
+ type: "address"
1478
+ }
1479
+ ],
1480
+ stateMutability: "nonpayable",
1481
+ type: "constructor"
1482
+ },
1483
+ {
1484
+ inputs: [],
1485
+ name: "AddressZero",
1486
+ type: "error"
1487
+ },
1488
+ {
1489
+ inputs: [],
1490
+ name: "DeadlineExceeded",
1491
+ type: "error"
1492
+ },
1493
+ {
1494
+ inputs: [],
1495
+ name: "FailedCall",
1496
+ type: "error"
1497
+ },
1498
+ {
1499
+ inputs: [
1500
+ {
1501
+ internalType: "uint256",
1502
+ name: "balance",
1503
+ type: "uint256"
1504
+ },
1505
+ {
1506
+ internalType: "uint256",
1507
+ name: "needed",
1508
+ type: "uint256"
1509
+ }
1510
+ ],
1511
+ name: "InsufficientBalance",
1512
+ type: "error"
1513
+ },
1514
+ {
1515
+ inputs: [],
1516
+ name: "InvalidPaymentAmount",
1517
+ type: "error"
1518
+ },
1519
+ {
1520
+ inputs: [],
1521
+ name: "NativeCoinNotMatched",
1522
+ type: "error"
1523
+ },
1524
+ {
1525
+ inputs: [],
1526
+ name: "ReentrancyGuardReentrantCall",
1527
+ type: "error"
1528
+ },
1529
+ {
1530
+ inputs: [
1531
+ {
1532
+ internalType: "address",
1533
+ name: "token",
1534
+ type: "address"
1535
+ }
1536
+ ],
1537
+ name: "SafeERC20FailedOperation",
1538
+ type: "error"
1539
+ },
1540
+ {
1541
+ inputs: [],
1542
+ name: "Unauthorized",
1543
+ type: "error"
1544
+ },
1545
+ {
1546
+ anonymous: false,
1547
+ inputs: [
1548
+ {
1549
+ indexed: true,
1550
+ internalType: "bytes32",
1551
+ name: "tradeId",
1552
+ type: "bytes32"
1553
+ },
1554
+ {
1555
+ indexed: true,
1556
+ internalType: "address",
1557
+ name: "from",
1558
+ type: "address"
1559
+ },
1560
+ {
1561
+ indexed: true,
1562
+ internalType: "address",
1563
+ name: "to",
1564
+ type: "address"
1565
+ },
1566
+ {
1567
+ indexed: false,
1568
+ internalType: "address",
1569
+ name: "pFeeAddr",
1570
+ type: "address"
1571
+ },
1572
+ {
1573
+ indexed: false,
1574
+ internalType: "address",
1575
+ name: "token",
1576
+ type: "address"
1577
+ },
1578
+ {
1579
+ indexed: false,
1580
+ internalType: "uint256",
1581
+ name: "payToUser",
1582
+ type: "uint256"
1583
+ },
1584
+ {
1585
+ indexed: false,
1586
+ internalType: "uint256",
1587
+ name: "totalFee",
1588
+ type: "uint256"
1589
+ }
1590
+ ],
1591
+ name: "PaymentTransferred",
1592
+ type: "event"
1593
+ },
1594
+ {
1595
+ anonymous: false,
1596
+ inputs: [
1597
+ {
1598
+ indexed: true,
1599
+ internalType: "address",
1600
+ name: "owner",
1601
+ type: "address"
1602
+ },
1603
+ {
1604
+ indexed: true,
1605
+ internalType: "address",
1606
+ name: "newProtocol",
1607
+ type: "address"
1608
+ }
1609
+ ],
1610
+ name: "ProtocolUpdated",
1611
+ type: "event"
1612
+ },
1613
+ {
1614
+ inputs: [
1615
+ {
1616
+ internalType: "bytes32",
1617
+ name: "tradeId",
1618
+ type: "bytes32"
1619
+ },
1620
+ {
1621
+ internalType: "address",
1622
+ name: "token",
1623
+ type: "address"
1624
+ },
1625
+ {
1626
+ internalType: "address",
1627
+ name: "toUser",
1628
+ type: "address"
1629
+ },
1630
+ {
1631
+ internalType: "uint256",
1632
+ name: "amount",
1633
+ type: "uint256"
1634
+ },
1635
+ {
1636
+ internalType: "uint256",
1637
+ name: "totalFee",
1638
+ type: "uint256"
1639
+ },
1640
+ {
1641
+ internalType: "uint256",
1642
+ name: "deadline",
1643
+ type: "uint256"
1644
+ }
1645
+ ],
1646
+ name: "payment",
1647
+ outputs: [],
1648
+ stateMutability: "payable",
1649
+ type: "function"
1650
+ },
1651
+ {
1652
+ inputs: [],
1653
+ name: "protocol",
1654
+ outputs: [
1655
+ {
1656
+ internalType: "contract IProtocol",
1657
+ name: "",
1658
+ type: "address"
1659
+ }
1660
+ ],
1661
+ stateMutability: "view",
1662
+ type: "function"
1663
+ },
1664
+ {
1665
+ inputs: [
1666
+ {
1667
+ internalType: "address",
1668
+ name: "newProtocol",
1669
+ type: "address"
1670
+ }
1671
+ ],
1672
+ name: "setProtocol",
1673
+ outputs: [],
1674
+ stateMutability: "nonpayable",
1675
+ type: "function"
1676
+ }
1677
+ ];
1678
+ var Payment__factory = class {
1679
+ static createInterface() {
1680
+ return new Interface2(_abi2);
1681
+ }
1682
+ static connect(address, runner) {
1683
+ return new Contract2(address, _abi2, runner);
1684
+ }
1685
+ };
1686
+ Payment__factory.abi = _abi2;
1687
+
1688
+ // src/contracts/contract/factories/Router__factory.ts
1689
+ import { Contract as Contract3, Interface as Interface3 } from "ethers";
1690
+ var _abi3 = [
1691
+ {
1692
+ inputs: [
1693
+ {
1694
+ internalType: "contract IManagement",
1695
+ name: "management_",
1696
+ type: "address"
1697
+ },
1698
+ {
1699
+ internalType: "address",
1700
+ name: "signer",
1701
+ type: "address"
1702
+ }
1703
+ ],
1704
+ stateMutability: "nonpayable",
1705
+ type: "constructor"
1706
+ },
1707
+ {
1708
+ inputs: [],
1709
+ name: "AddressZero",
1710
+ type: "error"
1711
+ },
1712
+ {
1713
+ inputs: [],
1714
+ name: "BundlePaymentEmpty",
1715
+ type: "error"
1716
+ },
1717
+ {
1718
+ inputs: [],
1719
+ name: "InconsistentCoreType",
1720
+ type: "error"
1721
+ },
1722
+ {
1723
+ inputs: [],
1724
+ name: "InconsistentPMM",
1725
+ type: "error"
1726
+ },
1727
+ {
1728
+ inputs: [],
1729
+ name: "RegisteredAlready",
1730
+ type: "error"
1731
+ },
1732
+ {
1733
+ inputs: [],
1734
+ name: "RouteNotFound",
1735
+ type: "error"
1736
+ },
1737
+ {
1738
+ inputs: [],
1739
+ name: "RouteNotSupported",
1740
+ type: "error"
1741
+ },
1742
+ {
1743
+ inputs: [],
1744
+ name: "Unauthorized",
1745
+ type: "error"
1746
+ },
1747
+ {
1748
+ anonymous: false,
1749
+ inputs: [
1750
+ {
1751
+ indexed: true,
1752
+ internalType: "address",
1753
+ name: "mpc",
1754
+ type: "address"
1755
+ },
1756
+ {
1757
+ indexed: true,
1758
+ internalType: "bytes32",
1759
+ name: "tradeId",
1760
+ type: "bytes32"
1761
+ },
1762
+ {
1763
+ indexed: false,
1764
+ internalType: "uint256",
1765
+ name: "pFeeRate",
1766
+ type: "uint256"
1767
+ },
1768
+ {
1769
+ indexed: false,
1770
+ internalType: "uint256",
1771
+ name: "aFeeRate",
1772
+ type: "uint256"
1773
+ },
1774
+ {
1775
+ indexed: false,
1776
+ internalType: "bytes[]",
1777
+ name: "list",
1778
+ type: "bytes[]"
1779
+ }
1780
+ ],
1781
+ name: "ConfirmDeposit",
1782
+ type: "event"
1783
+ },
1784
+ {
1785
+ anonymous: false,
1786
+ inputs: [
1787
+ {
1788
+ indexed: true,
1789
+ internalType: "address",
1790
+ name: "mpc",
1791
+ type: "address"
1792
+ },
1793
+ {
1794
+ indexed: true,
1795
+ internalType: "bytes32",
1796
+ name: "tradeId",
1797
+ type: "bytes32"
1798
+ }
1799
+ ],
1800
+ name: "ConfirmPayment",
1801
+ type: "event"
1802
+ },
1803
+ {
1804
+ anonymous: false,
1805
+ inputs: [
1806
+ {
1807
+ indexed: true,
1808
+ internalType: "address",
1809
+ name: "mpc",
1810
+ type: "address"
1811
+ },
1812
+ {
1813
+ indexed: true,
1814
+ internalType: "bytes32",
1815
+ name: "tradeId",
1816
+ type: "bytes32"
1817
+ }
1818
+ ],
1819
+ name: "ConfirmSettlement",
1820
+ type: "event"
1821
+ },
1822
+ {
1823
+ anonymous: false,
1824
+ inputs: [
1825
+ {
1826
+ indexed: true,
1827
+ internalType: "address",
1828
+ name: "operator",
1829
+ type: "address"
1830
+ },
1831
+ {
1832
+ indexed: true,
1833
+ internalType: "bytes32",
1834
+ name: "tradeId",
1835
+ type: "bytes32"
1836
+ }
1837
+ ],
1838
+ name: "MakePayment",
1839
+ type: "event"
1840
+ },
1841
+ {
1842
+ anonymous: false,
1843
+ inputs: [
1844
+ {
1845
+ indexed: true,
1846
+ internalType: "address",
1847
+ name: "solver",
1848
+ type: "address"
1849
+ },
1850
+ {
1851
+ indexed: true,
1852
+ internalType: "bytes32",
1853
+ name: "tradeId",
1854
+ type: "bytes32"
1855
+ }
1856
+ ],
1857
+ name: "SelectPMM",
1858
+ type: "event"
1859
+ },
1860
+ {
1861
+ anonymous: false,
1862
+ inputs: [
1863
+ {
1864
+ indexed: true,
1865
+ internalType: "address",
1866
+ name: "solver",
1867
+ type: "address"
1868
+ },
1869
+ {
1870
+ indexed: true,
1871
+ internalType: "bytes32",
1872
+ name: "tradeId",
1873
+ type: "bytes32"
1874
+ }
1875
+ ],
1876
+ name: "SubmitTradeInfo",
1877
+ type: "event"
1878
+ },
1879
+ {
1880
+ anonymous: false,
1881
+ inputs: [
1882
+ {
1883
+ indexed: true,
1884
+ internalType: "address",
1885
+ name: "core",
1886
+ type: "address"
1887
+ },
1888
+ {
1889
+ indexed: true,
1890
+ internalType: "uint256",
1891
+ name: "version",
1892
+ type: "uint256"
1893
+ },
1894
+ {
1895
+ indexed: false,
1896
+ internalType: "bytes",
1897
+ name: "fromChain",
1898
+ type: "bytes"
1899
+ },
1900
+ {
1901
+ indexed: false,
1902
+ internalType: "bytes",
1903
+ name: "toChain",
1904
+ type: "bytes"
1905
+ }
1906
+ ],
1907
+ name: "UpdatedRoute",
1908
+ type: "event"
1909
+ },
1910
+ {
1911
+ inputs: [],
1912
+ name: "SIGNER",
1913
+ outputs: [
1914
+ {
1915
+ internalType: "address",
1916
+ name: "",
1917
+ type: "address"
1918
+ }
1919
+ ],
1920
+ stateMutability: "view",
1921
+ type: "function"
1922
+ },
1923
+ {
1924
+ inputs: [
1925
+ {
1926
+ components: [
1927
+ {
1928
+ internalType: "bytes32[]",
1929
+ name: "tradeIds",
1930
+ type: "bytes32[]"
1931
+ },
1932
+ {
1933
+ internalType: "uint64",
1934
+ name: "signedAt",
1935
+ type: "uint64"
1936
+ },
1937
+ {
1938
+ internalType: "uint64",
1939
+ name: "startIdx",
1940
+ type: "uint64"
1941
+ },
1942
+ {
1943
+ internalType: "bytes",
1944
+ name: "paymentTxId",
1945
+ type: "bytes"
1946
+ },
1947
+ {
1948
+ internalType: "bytes",
1949
+ name: "signature",
1950
+ type: "bytes"
1951
+ }
1952
+ ],
1953
+ internalType: "struct ITypes.BundlePayment",
1954
+ name: "bundle",
1955
+ type: "tuple"
1956
+ }
1957
+ ],
1958
+ name: "bundlePayment",
1959
+ outputs: [],
1960
+ stateMutability: "nonpayable",
1961
+ type: "function"
1962
+ },
1963
+ {
1964
+ inputs: [
1965
+ {
1966
+ internalType: "bytes32",
1967
+ name: "tradeId",
1968
+ type: "bytes32"
1969
+ },
1970
+ {
1971
+ internalType: "bytes",
1972
+ name: "signature",
1973
+ type: "bytes"
1974
+ },
1975
+ {
1976
+ internalType: "bytes[]",
1977
+ name: "depositFromList",
1978
+ type: "bytes[]"
1979
+ }
1980
+ ],
1981
+ name: "confirmDeposit",
1982
+ outputs: [],
1983
+ stateMutability: "nonpayable",
1984
+ type: "function"
1985
+ },
1986
+ {
1987
+ inputs: [
1988
+ {
1989
+ internalType: "bytes32",
1990
+ name: "tradeId",
1991
+ type: "bytes32"
1992
+ },
1993
+ {
1994
+ internalType: "bytes",
1995
+ name: "signature",
1996
+ type: "bytes"
1997
+ }
1998
+ ],
1999
+ name: "confirmPayment",
2000
+ outputs: [],
2001
+ stateMutability: "nonpayable",
2002
+ type: "function"
2003
+ },
2004
+ {
2005
+ inputs: [
2006
+ {
2007
+ internalType: "bytes32",
2008
+ name: "tradeId",
2009
+ type: "bytes32"
2010
+ },
2011
+ {
2012
+ internalType: "bytes",
2013
+ name: "releaseTxId",
2014
+ type: "bytes"
2015
+ },
2016
+ {
2017
+ internalType: "bytes",
2018
+ name: "signature",
2019
+ type: "bytes"
2020
+ }
2021
+ ],
2022
+ name: "confirmSettlement",
2023
+ outputs: [],
2024
+ stateMutability: "nonpayable",
2025
+ type: "function"
2026
+ },
2027
+ {
2028
+ inputs: [
2029
+ {
2030
+ internalType: "bytes32",
2031
+ name: "tradeId",
2032
+ type: "bytes32"
2033
+ }
2034
+ ],
2035
+ name: "getAffiliateInfo",
2036
+ outputs: [
2037
+ {
2038
+ components: [
2039
+ {
2040
+ internalType: "uint256",
2041
+ name: "aggregatedValue",
2042
+ type: "uint256"
2043
+ },
2044
+ {
2045
+ internalType: "string",
2046
+ name: "schema",
2047
+ type: "string"
2048
+ },
2049
+ {
2050
+ internalType: "bytes",
2051
+ name: "data",
2052
+ type: "bytes"
2053
+ }
2054
+ ],
2055
+ internalType: "struct ITypes.Affiliate",
2056
+ name: "",
2057
+ type: "tuple"
2058
+ }
2059
+ ],
2060
+ stateMutability: "view",
2061
+ type: "function"
2062
+ },
2063
+ {
2064
+ inputs: [
2065
+ {
2066
+ internalType: "bytes32",
2067
+ name: "tradeId",
2068
+ type: "bytes32"
2069
+ }
2070
+ ],
2071
+ name: "getCurrentStage",
2072
+ outputs: [
2073
+ {
2074
+ internalType: "uint256",
2075
+ name: "",
2076
+ type: "uint256"
2077
+ }
2078
+ ],
2079
+ stateMutability: "view",
2080
+ type: "function"
2081
+ },
2082
+ {
2083
+ inputs: [
2084
+ {
2085
+ internalType: "bytes32",
2086
+ name: "tradeId",
2087
+ type: "bytes32"
2088
+ }
2089
+ ],
2090
+ name: "getDepositAddressList",
2091
+ outputs: [
2092
+ {
2093
+ internalType: "bytes[]",
2094
+ name: "",
2095
+ type: "bytes[]"
2096
+ }
2097
+ ],
2098
+ stateMutability: "view",
2099
+ type: "function"
2100
+ },
2101
+ {
2102
+ inputs: [
2103
+ {
2104
+ internalType: "bytes32",
2105
+ name: "tradeId",
2106
+ type: "bytes32"
2107
+ }
2108
+ ],
2109
+ name: "getFeeDetails",
2110
+ outputs: [
2111
+ {
2112
+ components: [
2113
+ {
2114
+ internalType: "uint256",
2115
+ name: "totalAmount",
2116
+ type: "uint256"
2117
+ },
2118
+ {
2119
+ internalType: "uint256",
2120
+ name: "pFeeAmount",
2121
+ type: "uint256"
2122
+ },
2123
+ {
2124
+ internalType: "uint256",
2125
+ name: "aFeeAmount",
2126
+ type: "uint256"
2127
+ },
2128
+ {
2129
+ internalType: "uint128",
2130
+ name: "pFeeRate",
2131
+ type: "uint128"
2132
+ },
2133
+ {
2134
+ internalType: "uint128",
2135
+ name: "aFeeRate",
2136
+ type: "uint128"
2137
+ }
2138
+ ],
2139
+ internalType: "struct ITypes.FeeDetails",
2140
+ name: "",
2141
+ type: "tuple"
2142
+ }
2143
+ ],
2144
+ stateMutability: "view",
2145
+ type: "function"
2146
+ },
2147
+ {
2148
+ inputs: [
2149
+ {
2150
+ internalType: "bytes",
2151
+ name: "fromChain",
2152
+ type: "bytes"
2153
+ },
2154
+ {
2155
+ internalType: "bytes",
2156
+ name: "toChain",
2157
+ type: "bytes"
2158
+ }
2159
+ ],
2160
+ name: "getHandler",
2161
+ outputs: [
2162
+ {
2163
+ internalType: "address",
2164
+ name: "handler",
2165
+ type: "address"
2166
+ },
2167
+ {
2168
+ internalType: "string",
2169
+ name: "handlerType",
2170
+ type: "string"
2171
+ }
2172
+ ],
2173
+ stateMutability: "view",
2174
+ type: "function"
2175
+ },
2176
+ {
2177
+ inputs: [
2178
+ {
2179
+ internalType: "bytes32",
2180
+ name: "tradeId",
2181
+ type: "bytes32"
2182
+ }
2183
+ ],
2184
+ name: "getHandlerOf",
2185
+ outputs: [
2186
+ {
2187
+ internalType: "address",
2188
+ name: "handler",
2189
+ type: "address"
2190
+ },
2191
+ {
2192
+ internalType: "string",
2193
+ name: "handlerType",
2194
+ type: "string"
2195
+ }
2196
+ ],
2197
+ stateMutability: "view",
2198
+ type: "function"
2199
+ },
2200
+ {
2201
+ inputs: [
2202
+ {
2203
+ internalType: "bytes32",
2204
+ name: "tradeId",
2205
+ type: "bytes32"
2206
+ }
2207
+ ],
2208
+ name: "getLastSignedPayment",
2209
+ outputs: [
2210
+ {
2211
+ internalType: "uint64",
2212
+ name: "",
2213
+ type: "uint64"
2214
+ }
2215
+ ],
2216
+ stateMutability: "view",
2217
+ type: "function"
2218
+ },
2219
+ {
2220
+ inputs: [
2221
+ {
2222
+ internalType: "bytes",
2223
+ name: "networkId",
2224
+ type: "bytes"
2225
+ }
2226
+ ],
2227
+ name: "getLatestMPCInfo",
2228
+ outputs: [
2229
+ {
2230
+ components: [
2231
+ {
2232
+ internalType: "address",
2233
+ name: "mpcL2Address",
2234
+ type: "address"
2235
+ },
2236
+ {
2237
+ internalType: "uint64",
2238
+ name: "expireTime",
2239
+ type: "uint64"
2240
+ },
2241
+ {
2242
+ internalType: "bytes",
2243
+ name: "mpcL2Pubkey",
2244
+ type: "bytes"
2245
+ },
2246
+ {
2247
+ internalType: "bytes",
2248
+ name: "mpcAssetPubkey",
2249
+ type: "bytes"
2250
+ }
2251
+ ],
2252
+ internalType: "struct ITypes.MPCInfo",
2253
+ name: "",
2254
+ type: "tuple"
2255
+ }
2256
+ ],
2257
+ stateMutability: "view",
2258
+ type: "function"
2259
+ },
2260
+ {
2261
+ inputs: [
2262
+ {
2263
+ internalType: "bytes",
2264
+ name: "networkId",
2265
+ type: "bytes"
2266
+ },
2267
+ {
2268
+ internalType: "bytes",
2269
+ name: "pubkey",
2270
+ type: "bytes"
2271
+ }
2272
+ ],
2273
+ name: "getMPCInfo",
2274
+ outputs: [
2275
+ {
2276
+ components: [
2277
+ {
2278
+ internalType: "address",
2279
+ name: "mpcL2Address",
2280
+ type: "address"
2281
+ },
2282
+ {
2283
+ internalType: "uint64",
2284
+ name: "expireTime",
2285
+ type: "uint64"
2286
+ },
2287
+ {
2288
+ internalType: "bytes",
2289
+ name: "mpcL2Pubkey",
2290
+ type: "bytes"
2291
+ },
2292
+ {
2293
+ internalType: "bytes",
2294
+ name: "mpcAssetPubkey",
2295
+ type: "bytes"
2296
+ }
2297
+ ],
2298
+ internalType: "struct ITypes.MPCInfo",
2299
+ name: "info",
2300
+ type: "tuple"
2301
+ }
2302
+ ],
2303
+ stateMutability: "view",
2304
+ type: "function"
2305
+ },
2306
+ {
2307
+ inputs: [],
2308
+ name: "getManagementOwner",
2309
+ outputs: [
2310
+ {
2311
+ internalType: "address",
2312
+ name: "",
2313
+ type: "address"
2314
+ }
2315
+ ],
2316
+ stateMutability: "view",
2317
+ type: "function"
2318
+ },
2319
+ {
2320
+ inputs: [
2321
+ {
2322
+ internalType: "bytes",
2323
+ name: "fromChain",
2324
+ type: "bytes"
2325
+ },
2326
+ {
2327
+ internalType: "bytes",
2328
+ name: "toChain",
2329
+ type: "bytes"
2330
+ }
2331
+ ],
2332
+ name: "getMaxAffiliateFeeRate",
2333
+ outputs: [
2334
+ {
2335
+ internalType: "uint256",
2336
+ name: "",
2337
+ type: "uint256"
2338
+ }
2339
+ ],
2340
+ stateMutability: "view",
2341
+ type: "function"
2342
+ },
2343
+ {
2344
+ inputs: [],
2345
+ name: "getPFeeRate",
2346
+ outputs: [
2347
+ {
2348
+ internalType: "uint256",
2349
+ name: "",
2350
+ type: "uint256"
2351
+ }
2352
+ ],
2353
+ stateMutability: "view",
2354
+ type: "function"
2355
+ },
2356
+ {
2357
+ inputs: [
2358
+ {
2359
+ internalType: "bytes32",
2360
+ name: "pmmId",
2361
+ type: "bytes32"
2362
+ },
2363
+ {
2364
+ internalType: "uint256",
2365
+ name: "fromIdx",
2366
+ type: "uint256"
2367
+ },
2368
+ {
2369
+ internalType: "uint256",
2370
+ name: "toIdx",
2371
+ type: "uint256"
2372
+ }
2373
+ ],
2374
+ name: "getPMMAccounts",
2375
+ outputs: [
2376
+ {
2377
+ internalType: "address[]",
2378
+ name: "list",
2379
+ type: "address[]"
2380
+ }
2381
+ ],
2382
+ stateMutability: "view",
2383
+ type: "function"
2384
+ },
2385
+ {
2386
+ inputs: [
2387
+ {
2388
+ internalType: "bytes32",
2389
+ name: "tradeId",
2390
+ type: "bytes32"
2391
+ }
2392
+ ],
2393
+ name: "getPMMSelection",
2394
+ outputs: [
2395
+ {
2396
+ components: [
2397
+ {
2398
+ components: [
2399
+ {
2400
+ internalType: "uint256",
2401
+ name: "minAmountOut",
2402
+ type: "uint256"
2403
+ },
2404
+ {
2405
+ internalType: "uint64",
2406
+ name: "tradeTimeout",
2407
+ type: "uint64"
2408
+ },
2409
+ {
2410
+ internalType: "bytes",
2411
+ name: "rfqInfoSignature",
2412
+ type: "bytes"
2413
+ }
2414
+ ],
2415
+ internalType: "struct ITypes.RFQInfo",
2416
+ name: "rfqInfo",
2417
+ type: "tuple"
2418
+ },
2419
+ {
2420
+ components: [
2421
+ {
2422
+ internalType: "uint256",
2423
+ name: "amountOut",
2424
+ type: "uint256"
2425
+ },
2426
+ {
2427
+ internalType: "bytes32",
2428
+ name: "selectedPMMId",
2429
+ type: "bytes32"
2430
+ },
2431
+ {
2432
+ internalType: "bytes[2]",
2433
+ name: "info",
2434
+ type: "bytes[2]"
2435
+ },
2436
+ {
2437
+ internalType: "uint64",
2438
+ name: "sigExpiry",
2439
+ type: "uint64"
2440
+ }
2441
+ ],
2442
+ internalType: "struct ITypes.SelectedPMMInfo",
2443
+ name: "pmmInfo",
2444
+ type: "tuple"
2445
+ }
2446
+ ],
2447
+ internalType: "struct ITypes.PMMSelection",
2448
+ name: "",
2449
+ type: "tuple"
2450
+ }
2451
+ ],
2452
+ stateMutability: "view",
2453
+ type: "function"
2454
+ },
2455
+ {
2456
+ inputs: [
2457
+ {
2458
+ internalType: "bytes32",
2459
+ name: "tradeId",
2460
+ type: "bytes32"
2461
+ }
2462
+ ],
2463
+ name: "getPresigns",
2464
+ outputs: [
2465
+ {
2466
+ components: [
2467
+ {
2468
+ internalType: "bytes32",
2469
+ name: "pmmId",
2470
+ type: "bytes32"
2471
+ },
2472
+ {
2473
+ internalType: "bytes",
2474
+ name: "pmmRecvAddress",
2475
+ type: "bytes"
2476
+ },
2477
+ {
2478
+ internalType: "bytes[]",
2479
+ name: "presigns",
2480
+ type: "bytes[]"
2481
+ }
2482
+ ],
2483
+ internalType: "struct ITypes.Presign[]",
2484
+ name: "",
2485
+ type: "tuple[]"
2486
+ }
2487
+ ],
2488
+ stateMutability: "view",
2489
+ type: "function"
2490
+ },
2491
+ {
2492
+ inputs: [],
2493
+ name: "getProtocolState",
2494
+ outputs: [
2495
+ {
2496
+ internalType: "uint256",
2497
+ name: "",
2498
+ type: "uint256"
2499
+ }
2500
+ ],
2501
+ stateMutability: "view",
2502
+ type: "function"
2503
+ },
2504
+ {
2505
+ inputs: [
2506
+ {
2507
+ internalType: "bytes32",
2508
+ name: "tradeId",
2509
+ type: "bytes32"
2510
+ }
2511
+ ],
2512
+ name: "getSettledPayment",
2513
+ outputs: [
2514
+ {
2515
+ components: [
2516
+ {
2517
+ internalType: "bytes32",
2518
+ name: "bundlerHash",
2519
+ type: "bytes32"
2520
+ },
2521
+ {
2522
+ internalType: "bytes",
2523
+ name: "paymentTxId",
2524
+ type: "bytes"
2525
+ },
2526
+ {
2527
+ internalType: "bytes",
2528
+ name: "releaseTxId",
2529
+ type: "bytes"
2530
+ },
2531
+ {
2532
+ internalType: "bool",
2533
+ name: "isConfirmed",
2534
+ type: "bool"
2535
+ }
2536
+ ],
2537
+ internalType: "struct ITypes.SettledPayment",
2538
+ name: "",
2539
+ type: "tuple"
2540
+ }
2541
+ ],
2542
+ stateMutability: "view",
2543
+ type: "function"
2544
+ },
2545
+ {
2546
+ inputs: [
2547
+ {
2548
+ internalType: "uint256",
2549
+ name: "fromIdx",
2550
+ type: "uint256"
2551
+ },
2552
+ {
2553
+ internalType: "uint256",
2554
+ name: "toIdx",
2555
+ type: "uint256"
2556
+ }
2557
+ ],
2558
+ name: "getTokens",
2559
+ outputs: [
2560
+ {
2561
+ components: [
2562
+ {
2563
+ internalType: "bytes[5]",
2564
+ name: "info",
2565
+ type: "bytes[5]"
2566
+ },
2567
+ {
2568
+ internalType: "uint256",
2569
+ name: "decimals",
2570
+ type: "uint256"
2571
+ }
2572
+ ],
2573
+ internalType: "struct ITypes.TokenInfo[]",
2574
+ name: "list",
2575
+ type: "tuple[]"
2576
+ }
2577
+ ],
2578
+ stateMutability: "view",
2579
+ type: "function"
2580
+ },
2581
+ {
2582
+ inputs: [
2583
+ {
2584
+ internalType: "bytes32",
2585
+ name: "tradeId",
2586
+ type: "bytes32"
2587
+ }
2588
+ ],
2589
+ name: "getTradeData",
2590
+ outputs: [
2591
+ {
2592
+ components: [
2593
+ {
2594
+ internalType: "uint256",
2595
+ name: "sessionId",
2596
+ type: "uint256"
2597
+ },
2598
+ {
2599
+ components: [
2600
+ {
2601
+ internalType: "uint256",
2602
+ name: "amountIn",
2603
+ type: "uint256"
2604
+ },
2605
+ {
2606
+ internalType: "bytes[3]",
2607
+ name: "fromChain",
2608
+ type: "bytes[3]"
2609
+ },
2610
+ {
2611
+ internalType: "bytes[3]",
2612
+ name: "toChain",
2613
+ type: "bytes[3]"
2614
+ }
2615
+ ],
2616
+ internalType: "struct ITypes.TradeInfo",
2617
+ name: "tradeInfo",
2618
+ type: "tuple"
2619
+ },
2620
+ {
2621
+ components: [
2622
+ {
2623
+ internalType: "bytes[5]",
2624
+ name: "depositInfo",
2625
+ type: "bytes[5]"
2626
+ },
2627
+ {
2628
+ internalType: "address",
2629
+ name: "userEphemeralL2Address",
2630
+ type: "address"
2631
+ },
2632
+ {
2633
+ internalType: "uint64",
2634
+ name: "scriptTimeout",
2635
+ type: "uint64"
2636
+ }
2637
+ ],
2638
+ internalType: "struct ITypes.ScriptInfo",
2639
+ name: "scriptInfo",
2640
+ type: "tuple"
2641
+ }
2642
+ ],
2643
+ internalType: "struct ITypes.TradeData",
2644
+ name: "",
2645
+ type: "tuple"
2646
+ }
2647
+ ],
2648
+ stateMutability: "view",
2649
+ type: "function"
2650
+ },
2651
+ {
2652
+ inputs: [
2653
+ {
2654
+ internalType: "address",
2655
+ name: "account",
2656
+ type: "address"
2657
+ }
2658
+ ],
2659
+ name: "isMPCNode",
2660
+ outputs: [
2661
+ {
2662
+ internalType: "bool",
2663
+ name: "",
2664
+ type: "bool"
2665
+ }
2666
+ ],
2667
+ stateMutability: "view",
2668
+ type: "function"
2669
+ },
2670
+ {
2671
+ inputs: [
2672
+ {
2673
+ internalType: "address",
2674
+ name: "account",
2675
+ type: "address"
2676
+ }
2677
+ ],
2678
+ name: "isSolver",
2679
+ outputs: [
2680
+ {
2681
+ internalType: "bool",
2682
+ name: "",
2683
+ type: "bool"
2684
+ }
2685
+ ],
2686
+ stateMutability: "view",
2687
+ type: "function"
2688
+ },
2689
+ {
2690
+ inputs: [
2691
+ {
2692
+ internalType: "enum ITypes.STAGE",
2693
+ name: "stage",
2694
+ type: "uint8"
2695
+ }
2696
+ ],
2697
+ name: "isSuspended",
2698
+ outputs: [
2699
+ {
2700
+ internalType: "bool",
2701
+ name: "",
2702
+ type: "bool"
2703
+ }
2704
+ ],
2705
+ stateMutability: "view",
2706
+ type: "function"
2707
+ },
2708
+ {
2709
+ inputs: [
2710
+ {
2711
+ internalType: "bytes",
2712
+ name: "networkId",
2713
+ type: "bytes"
2714
+ }
2715
+ ],
2716
+ name: "isValidNetwork",
2717
+ outputs: [
2718
+ {
2719
+ internalType: "bool",
2720
+ name: "",
2721
+ type: "bool"
2722
+ }
2723
+ ],
2724
+ stateMutability: "view",
2725
+ type: "function"
2726
+ },
2727
+ {
2728
+ inputs: [
2729
+ {
2730
+ internalType: "bytes32",
2731
+ name: "pmmId",
2732
+ type: "bytes32"
2733
+ }
2734
+ ],
2735
+ name: "isValidPMM",
2736
+ outputs: [
2737
+ {
2738
+ internalType: "bool",
2739
+ name: "",
2740
+ type: "bool"
2741
+ }
2742
+ ],
2743
+ stateMutability: "view",
2744
+ type: "function"
2745
+ },
2746
+ {
2747
+ inputs: [
2748
+ {
2749
+ internalType: "bytes32",
2750
+ name: "pmmId",
2751
+ type: "bytes32"
2752
+ },
2753
+ {
2754
+ internalType: "address",
2755
+ name: "account",
2756
+ type: "address"
2757
+ }
2758
+ ],
2759
+ name: "isValidPMMAccount",
2760
+ outputs: [
2761
+ {
2762
+ internalType: "bool",
2763
+ name: "",
2764
+ type: "bool"
2765
+ }
2766
+ ],
2767
+ stateMutability: "view",
2768
+ type: "function"
2769
+ },
2770
+ {
2771
+ inputs: [
2772
+ {
2773
+ internalType: "bytes",
2774
+ name: "networkId",
2775
+ type: "bytes"
2776
+ },
2777
+ {
2778
+ internalType: "bytes",
2779
+ name: "pubkey",
2780
+ type: "bytes"
2781
+ }
2782
+ ],
2783
+ name: "isValidPubkey",
2784
+ outputs: [
2785
+ {
2786
+ internalType: "bool",
2787
+ name: "",
2788
+ type: "bool"
2789
+ }
2790
+ ],
2791
+ stateMutability: "view",
2792
+ type: "function"
2793
+ },
2794
+ {
2795
+ inputs: [
2796
+ {
2797
+ internalType: "bytes",
2798
+ name: "networkId",
2799
+ type: "bytes"
2800
+ },
2801
+ {
2802
+ internalType: "bytes",
2803
+ name: "tokenId",
2804
+ type: "bytes"
2805
+ }
2806
+ ],
2807
+ name: "isValidToken",
2808
+ outputs: [
2809
+ {
2810
+ internalType: "bool",
2811
+ name: "",
2812
+ type: "bool"
2813
+ }
2814
+ ],
2815
+ stateMutability: "view",
2816
+ type: "function"
2817
+ },
2818
+ {
2819
+ inputs: [],
2820
+ name: "management",
2821
+ outputs: [
2822
+ {
2823
+ internalType: "contract IManagement",
2824
+ name: "",
2825
+ type: "address"
2826
+ }
2827
+ ],
2828
+ stateMutability: "view",
2829
+ type: "function"
2830
+ },
2831
+ {
2832
+ inputs: [
2833
+ {
2834
+ internalType: "bytes32",
2835
+ name: "pmmId",
2836
+ type: "bytes32"
2837
+ }
2838
+ ],
2839
+ name: "numOfPMMAccounts",
2840
+ outputs: [
2841
+ {
2842
+ internalType: "uint256",
2843
+ name: "",
2844
+ type: "uint256"
2845
+ }
2846
+ ],
2847
+ stateMutability: "view",
2848
+ type: "function"
2849
+ },
2850
+ {
2851
+ inputs: [],
2852
+ name: "numOfSupportedTokens",
2853
+ outputs: [
2854
+ {
2855
+ internalType: "uint256",
2856
+ name: "",
2857
+ type: "uint256"
2858
+ }
2859
+ ],
2860
+ stateMutability: "view",
2861
+ type: "function"
2862
+ },
2863
+ {
2864
+ inputs: [
2865
+ {
2866
+ internalType: "bytes32",
2867
+ name: "tradeId",
2868
+ type: "bytes32"
2869
+ },
2870
+ {
2871
+ components: [
2872
+ {
2873
+ components: [
2874
+ {
2875
+ internalType: "uint256",
2876
+ name: "minAmountOut",
2877
+ type: "uint256"
2878
+ },
2879
+ {
2880
+ internalType: "uint64",
2881
+ name: "tradeTimeout",
2882
+ type: "uint64"
2883
+ },
2884
+ {
2885
+ internalType: "bytes",
2886
+ name: "rfqInfoSignature",
2887
+ type: "bytes"
2888
+ }
2889
+ ],
2890
+ internalType: "struct ITypes.RFQInfo",
2891
+ name: "rfqInfo",
2892
+ type: "tuple"
2893
+ },
2894
+ {
2895
+ components: [
2896
+ {
2897
+ internalType: "uint256",
2898
+ name: "amountOut",
2899
+ type: "uint256"
2900
+ },
2901
+ {
2902
+ internalType: "bytes32",
2903
+ name: "selectedPMMId",
2904
+ type: "bytes32"
2905
+ },
2906
+ {
2907
+ internalType: "bytes[2]",
2908
+ name: "info",
2909
+ type: "bytes[2]"
2910
+ },
2911
+ {
2912
+ internalType: "uint64",
2913
+ name: "sigExpiry",
2914
+ type: "uint64"
2915
+ }
2916
+ ],
2917
+ internalType: "struct ITypes.SelectedPMMInfo",
2918
+ name: "pmmInfo",
2919
+ type: "tuple"
2920
+ }
2921
+ ],
2922
+ internalType: "struct ITypes.PMMSelection",
2923
+ name: "info",
2924
+ type: "tuple"
2925
+ }
2926
+ ],
2927
+ name: "selectPMM",
2928
+ outputs: [],
2929
+ stateMutability: "nonpayable",
2930
+ type: "function"
2931
+ },
2932
+ {
2933
+ inputs: [
2934
+ {
2935
+ internalType: "address",
2936
+ name: "newManagement",
2937
+ type: "address"
2938
+ }
2939
+ ],
2940
+ name: "setManagement",
2941
+ outputs: [],
2942
+ stateMutability: "nonpayable",
2943
+ type: "function"
2944
+ },
2945
+ {
2946
+ inputs: [
2947
+ {
2948
+ internalType: "address",
2949
+ name: "core",
2950
+ type: "address"
2951
+ },
2952
+ {
2953
+ internalType: "bytes",
2954
+ name: "fromChain",
2955
+ type: "bytes"
2956
+ },
2957
+ {
2958
+ internalType: "bytes",
2959
+ name: "toChain",
2960
+ type: "bytes"
2961
+ }
2962
+ ],
2963
+ name: "setRoute",
2964
+ outputs: [],
2965
+ stateMutability: "nonpayable",
2966
+ type: "function"
2967
+ },
2968
+ {
2969
+ inputs: [
2970
+ {
2971
+ internalType: "bytes32",
2972
+ name: "tradeId",
2973
+ type: "bytes32"
2974
+ },
2975
+ {
2976
+ components: [
2977
+ {
2978
+ internalType: "uint256",
2979
+ name: "sessionId",
2980
+ type: "uint256"
2981
+ },
2982
+ {
2983
+ components: [
2984
+ {
2985
+ internalType: "uint256",
2986
+ name: "amountIn",
2987
+ type: "uint256"
2988
+ },
2989
+ {
2990
+ internalType: "bytes[3]",
2991
+ name: "fromChain",
2992
+ type: "bytes[3]"
2993
+ },
2994
+ {
2995
+ internalType: "bytes[3]",
2996
+ name: "toChain",
2997
+ type: "bytes[3]"
2998
+ }
2999
+ ],
3000
+ internalType: "struct ITypes.TradeInfo",
3001
+ name: "tradeInfo",
3002
+ type: "tuple"
3003
+ },
3004
+ {
3005
+ components: [
3006
+ {
3007
+ internalType: "bytes[5]",
3008
+ name: "depositInfo",
3009
+ type: "bytes[5]"
3010
+ },
3011
+ {
3012
+ internalType: "address",
3013
+ name: "userEphemeralL2Address",
3014
+ type: "address"
3015
+ },
3016
+ {
3017
+ internalType: "uint64",
3018
+ name: "scriptTimeout",
3019
+ type: "uint64"
3020
+ }
3021
+ ],
3022
+ internalType: "struct ITypes.ScriptInfo",
3023
+ name: "scriptInfo",
3024
+ type: "tuple"
3025
+ }
3026
+ ],
3027
+ internalType: "struct ITypes.TradeData",
3028
+ name: "tradeData",
3029
+ type: "tuple"
3030
+ },
3031
+ {
3032
+ components: [
3033
+ {
3034
+ internalType: "uint256",
3035
+ name: "aggregatedValue",
3036
+ type: "uint256"
3037
+ },
3038
+ {
3039
+ internalType: "string",
3040
+ name: "schema",
3041
+ type: "string"
3042
+ },
3043
+ {
3044
+ internalType: "bytes",
3045
+ name: "data",
3046
+ type: "bytes"
3047
+ }
3048
+ ],
3049
+ internalType: "struct ITypes.Affiliate",
3050
+ name: "affiliateInfo",
3051
+ type: "tuple"
3052
+ },
3053
+ {
3054
+ components: [
3055
+ {
3056
+ internalType: "bytes32",
3057
+ name: "pmmId",
3058
+ type: "bytes32"
3059
+ },
3060
+ {
3061
+ internalType: "bytes",
3062
+ name: "pmmRecvAddress",
3063
+ type: "bytes"
3064
+ },
3065
+ {
3066
+ internalType: "bytes[]",
3067
+ name: "presigns",
3068
+ type: "bytes[]"
3069
+ }
3070
+ ],
3071
+ internalType: "struct ITypes.Presign[]",
3072
+ name: "presignList",
3073
+ type: "tuple[]"
3074
+ }
3075
+ ],
3076
+ name: "submitTrade",
3077
+ outputs: [],
3078
+ stateMutability: "nonpayable",
3079
+ type: "function"
3080
+ },
3081
+ {
3082
+ inputs: [
3083
+ {
3084
+ internalType: "address",
3085
+ name: "",
3086
+ type: "address"
3087
+ }
3088
+ ],
3089
+ name: "version",
3090
+ outputs: [
3091
+ {
3092
+ internalType: "uint256",
3093
+ name: "",
3094
+ type: "uint256"
3095
+ }
3096
+ ],
3097
+ stateMutability: "view",
3098
+ type: "function"
3099
+ }
3100
+ ];
3101
+ var Router__factory = class {
3102
+ static createInterface() {
3103
+ return new Interface3(_abi3);
3104
+ }
3105
+ static connect(address, runner) {
3106
+ return new Contract3(address, _abi3, runner);
3107
+ }
3108
+ };
3109
+ Router__factory.abi = _abi3;
3110
+
3111
+ // src/contracts/contract/factories/Signer__factory.ts
3112
+ import { Contract as Contract4, Interface as Interface4 } from "ethers";
3113
+ var _abi4 = [
3114
+ {
3115
+ inputs: [],
3116
+ stateMutability: "nonpayable",
3117
+ type: "constructor"
3118
+ },
3119
+ {
3120
+ inputs: [],
3121
+ name: "ECDSAInvalidSignature",
3122
+ type: "error"
3123
+ },
3124
+ {
3125
+ inputs: [
3126
+ {
3127
+ internalType: "uint256",
3128
+ name: "length",
3129
+ type: "uint256"
3130
+ }
3131
+ ],
3132
+ name: "ECDSAInvalidSignatureLength",
3133
+ type: "error"
3134
+ },
3135
+ {
3136
+ inputs: [
3137
+ {
3138
+ internalType: "bytes32",
3139
+ name: "s",
3140
+ type: "bytes32"
3141
+ }
3142
+ ],
3143
+ name: "ECDSAInvalidSignatureS",
3144
+ type: "error"
3145
+ },
3146
+ {
3147
+ inputs: [],
3148
+ name: "InvalidShortString",
3149
+ type: "error"
3150
+ },
3151
+ {
3152
+ inputs: [
3153
+ {
3154
+ internalType: "string",
3155
+ name: "str",
3156
+ type: "string"
3157
+ }
3158
+ ],
3159
+ name: "StringTooLong",
3160
+ type: "error"
3161
+ },
3162
+ {
3163
+ anonymous: false,
3164
+ inputs: [],
3165
+ name: "EIP712DomainChanged",
3166
+ type: "event"
3167
+ },
3168
+ {
3169
+ inputs: [],
3170
+ name: "eip712Domain",
3171
+ outputs: [
3172
+ {
3173
+ internalType: "bytes1",
3174
+ name: "fields",
3175
+ type: "bytes1"
3176
+ },
3177
+ {
3178
+ internalType: "string",
3179
+ name: "name",
3180
+ type: "string"
3181
+ },
3182
+ {
3183
+ internalType: "string",
3184
+ name: "version",
3185
+ type: "string"
3186
+ },
3187
+ {
3188
+ internalType: "uint256",
3189
+ name: "chainId",
3190
+ type: "uint256"
3191
+ },
3192
+ {
3193
+ internalType: "address",
3194
+ name: "verifyingContract",
3195
+ type: "address"
3196
+ },
3197
+ {
3198
+ internalType: "bytes32",
3199
+ name: "salt",
3200
+ type: "bytes32"
3201
+ },
3202
+ {
3203
+ internalType: "uint256[]",
3204
+ name: "extensions",
3205
+ type: "uint256[]"
3206
+ }
3207
+ ],
3208
+ stateMutability: "view",
3209
+ type: "function"
3210
+ },
3211
+ {
3212
+ inputs: [
3213
+ {
3214
+ internalType: "bytes32",
3215
+ name: "tradeId",
3216
+ type: "bytes32"
3217
+ },
3218
+ {
3219
+ internalType: "bytes32",
3220
+ name: "infoHash",
3221
+ type: "bytes32"
3222
+ },
3223
+ {
3224
+ internalType: "bytes",
3225
+ name: "signature",
3226
+ type: "bytes"
3227
+ }
3228
+ ],
3229
+ name: "getDepositConfirmationSigner",
3230
+ outputs: [
3231
+ {
3232
+ internalType: "address",
3233
+ name: "signer",
3234
+ type: "address"
3235
+ }
3236
+ ],
3237
+ stateMutability: "view",
3238
+ type: "function"
3239
+ },
3240
+ {
3241
+ inputs: [
3242
+ {
3243
+ internalType: "bytes32",
3244
+ name: "infoHash",
3245
+ type: "bytes32"
3246
+ },
3247
+ {
3248
+ internalType: "bytes",
3249
+ name: "signature",
3250
+ type: "bytes"
3251
+ }
3252
+ ],
3253
+ name: "getMakePaymentSigner",
3254
+ outputs: [
3255
+ {
3256
+ internalType: "address",
3257
+ name: "signer",
3258
+ type: "address"
3259
+ }
3260
+ ],
3261
+ stateMutability: "view",
3262
+ type: "function"
3263
+ },
3264
+ {
3265
+ inputs: [
3266
+ {
3267
+ internalType: "bytes32",
3268
+ name: "tradeId",
3269
+ type: "bytes32"
3270
+ },
3271
+ {
3272
+ internalType: "bytes32",
3273
+ name: "infoHash",
3274
+ type: "bytes32"
3275
+ },
3276
+ {
3277
+ internalType: "bytes",
3278
+ name: "signature",
3279
+ type: "bytes"
3280
+ }
3281
+ ],
3282
+ name: "getPMMSelectionSigner",
3283
+ outputs: [
3284
+ {
3285
+ internalType: "address",
3286
+ name: "signer",
3287
+ type: "address"
3288
+ }
3289
+ ],
3290
+ stateMutability: "view",
3291
+ type: "function"
3292
+ },
3293
+ {
3294
+ inputs: [
3295
+ {
3296
+ internalType: "bytes32",
3297
+ name: "tradeId",
3298
+ type: "bytes32"
3299
+ },
3300
+ {
3301
+ internalType: "bytes32",
3302
+ name: "infoHash",
3303
+ type: "bytes32"
3304
+ },
3305
+ {
3306
+ internalType: "bytes",
3307
+ name: "signature",
3308
+ type: "bytes"
3309
+ }
3310
+ ],
3311
+ name: "getPaymentConfirmationSigner",
3312
+ outputs: [
3313
+ {
3314
+ internalType: "address",
3315
+ name: "signer",
3316
+ type: "address"
3317
+ }
3318
+ ],
3319
+ stateMutability: "view",
3320
+ type: "function"
3321
+ },
3322
+ {
3323
+ inputs: [
3324
+ {
3325
+ internalType: "bytes32",
3326
+ name: "tradeId",
3327
+ type: "bytes32"
3328
+ },
3329
+ {
3330
+ internalType: "bytes32",
3331
+ name: "infoHash",
3332
+ type: "bytes32"
3333
+ },
3334
+ {
3335
+ internalType: "bytes",
3336
+ name: "signature",
3337
+ type: "bytes"
3338
+ }
3339
+ ],
3340
+ name: "getRFQSigner",
3341
+ outputs: [
3342
+ {
3343
+ internalType: "address",
3344
+ name: "signer",
3345
+ type: "address"
3346
+ }
3347
+ ],
3348
+ stateMutability: "view",
3349
+ type: "function"
3350
+ },
3351
+ {
3352
+ inputs: [
3353
+ {
3354
+ internalType: "bytes32",
3355
+ name: "tradeId",
3356
+ type: "bytes32"
3357
+ },
3358
+ {
3359
+ internalType: "bytes32",
3360
+ name: "infoHash",
3361
+ type: "bytes32"
3362
+ },
3363
+ {
3364
+ internalType: "bytes",
3365
+ name: "signature",
3366
+ type: "bytes"
3367
+ }
3368
+ ],
3369
+ name: "getSettlementConfirmationSigner",
3370
+ outputs: [
3371
+ {
3372
+ internalType: "address",
3373
+ name: "signer",
3374
+ type: "address"
3375
+ }
3376
+ ],
3377
+ stateMutability: "view",
3378
+ type: "function"
3379
+ }
3380
+ ];
3381
+ var Signer__factory = class {
3382
+ static createInterface() {
3383
+ return new Interface4(_abi4);
3384
+ }
3385
+ static connect(address, runner) {
3386
+ return new Contract4(address, _abi4, runner);
3387
+ }
3388
+ };
3389
+ Signer__factory.abi = _abi4;
3390
+
3391
+ // src/services/router.service.ts
3392
+ import { ethers, JsonRpcProvider } from "ethers";
3393
+ var RouterService = class {
3394
+ constructor() {
3395
+ this.provider = new JsonRpcProvider(config.getRpcUrl());
3396
+ this.contract = Router__factory.connect(config.getRouterAddress(), this.provider);
3397
+ }
3398
+ async getSigner() {
3399
+ return await this.contract.SIGNER();
3400
+ }
3401
+ async getCurrentPubkey(network) {
3402
+ return this.contract.getLatestMPCInfo(ethers.toUtf8Bytes(network));
3403
+ }
3404
+ async getCurrentStage(tradeId) {
3405
+ return await this.contract.getCurrentStage(tradeId);
3406
+ }
3407
+ async getDepositAddressList(tradeId) {
3408
+ return await this.contract.getDepositAddressList(tradeId);
3409
+ }
3410
+ async getHandler(fromChain, toChain) {
3411
+ return await this.contract.getHandler(fromChain, toChain);
3412
+ }
3413
+ async getPFeeRate() {
3414
+ return await this.contract.getPFeeRate();
3415
+ }
3416
+ async getPMMSelection(tradeId) {
3417
+ return await this.contract.getPMMSelection(tradeId);
3418
+ }
3419
+ async getPresigns(tradeId) {
3420
+ return await this.contract.getPresigns(tradeId);
3421
+ }
3422
+ async getProtocolState() {
3423
+ return await this.contract.getProtocolState();
3424
+ }
3425
+ async getFeeDetails(tradeId) {
3426
+ return await this.contract.getFeeDetails(tradeId);
3427
+ }
3428
+ async getSettledPayment(tradeId) {
3429
+ return await this.contract.getSettledPayment(tradeId);
3430
+ }
3431
+ async getTokens(fromIdx, toIdx) {
3432
+ return await this.contract.getTokens(fromIdx, toIdx);
3433
+ }
3434
+ async getTradeData(tradeId) {
3435
+ return await this.contract.getTradeData(tradeId);
3436
+ }
3437
+ async isMPCNode(account) {
3438
+ return await this.contract.isMPCNode(account);
3439
+ }
3440
+ async isSolver(account) {
3441
+ return await this.contract.isSolver(account);
3442
+ }
3443
+ async isSuspended(stage) {
3444
+ return await this.contract.isSuspended(stage);
3445
+ }
3446
+ async isValidNetwork(networkId) {
3447
+ return await this.contract.isValidNetwork(networkId);
3448
+ }
3449
+ async isValidPMM(pmmId) {
3450
+ return await this.contract.isValidPMM(pmmId);
3451
+ }
3452
+ async isValidPMMAccount(pmmId, account) {
3453
+ return await this.contract.isValidPMMAccount(pmmId, account);
3454
+ }
3455
+ async isValidToken(networkId, tokenId) {
3456
+ return await this.contract.isValidToken(networkId, tokenId);
3457
+ }
3458
+ async getManagement() {
3459
+ return await this.contract.management();
3460
+ }
3461
+ async getNumOfSupportedTokens() {
3462
+ return await this.contract.numOfSupportedTokens();
3463
+ }
3464
+ async getVersion(address) {
3465
+ return await this.contract.version(address);
3466
+ }
3467
+ };
3468
+ var routerService = new RouterService();
3469
+
3470
+ // src/services/signer.service.ts
3471
+ import { JsonRpcProvider as JsonRpcProvider2 } from "ethers";
3472
+ var SignerService = class {
3473
+ constructor() {
3474
+ this.routerService = routerService;
3475
+ this.provider = new JsonRpcProvider2(config.getRpcUrl());
3476
+ }
3477
+ async getDomain() {
3478
+ const signerAddress = await this.routerService.getSigner();
3479
+ const contract = Signer__factory.connect(signerAddress, this.provider);
3480
+ const domain = await contract.eip712Domain();
3481
+ return {
3482
+ name: domain.name,
3483
+ version: domain.version,
3484
+ chainId: domain.chainId,
3485
+ verifyingContract: domain.verifyingContract
3486
+ };
3487
+ }
3488
+ };
3489
+ var signerService = new SignerService();
3490
+
3491
+ // src/services/solver.service.ts
3492
+ import axios from "axios";
3493
+ import { z } from "zod";
3494
+
3495
+ // src/utils/casing.ts
3496
+ function convertToCamelCase(obj) {
3497
+ if (Array.isArray(obj)) {
3498
+ return obj.map((v) => convertToCamelCase(v));
3499
+ } else if (obj !== null && obj.constructor === Object) {
3500
+ return Object.keys(obj).reduce(
3501
+ (result, key) => ({
3502
+ ...result,
3503
+ [snakeToCamelCase(key)]: convertToCamelCase(obj[key])
3504
+ }),
3505
+ {}
3506
+ );
3507
+ }
3508
+ return obj;
3509
+ }
3510
+ function convertToSnakeCase(obj) {
3511
+ if (Array.isArray(obj)) {
3512
+ return obj.map((v) => convertToSnakeCase(v));
3513
+ } else if (obj !== null && obj.constructor === Object) {
3514
+ return Object.keys(obj).reduce(
3515
+ (result, key) => ({
3516
+ ...result,
3517
+ [camelToSnakeCase(key)]: convertToSnakeCase(obj[key])
3518
+ }),
3519
+ {}
3520
+ );
3521
+ }
3522
+ return obj;
3523
+ }
3524
+ function snakeToCamelCase(str) {
3525
+ return str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace("-", "").replace("_", ""));
3526
+ }
3527
+ function camelToSnakeCase(str) {
3528
+ return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
3529
+ }
3530
+
3531
+ // src/utils/hex.ts
3532
+ var ensureHexPrefix = (value) => {
3533
+ return value.startsWith("0x") ? value : `0x${value}`;
3534
+ };
3535
+ var removeHexPrefix = (value) => {
3536
+ return value.startsWith("0x") ? value.slice(2) : value;
3537
+ };
3538
+
3539
+ // src/services/solver.service.ts
3540
+ var SubmitSettlementRequestSchema = z.object({
3541
+ tradeIds: z.array(z.string()),
3542
+ pmmId: z.string(),
3543
+ settlementTx: z.string(),
3544
+ signature: z.string(),
3545
+ startIndex: z.number(),
3546
+ signedAt: z.number()
3547
+ });
3548
+ var SubmitSettlementResponseSchema = z.object({
3549
+ message: z.string()
3550
+ });
3551
+ var SolverService = class {
3552
+ constructor() {
3553
+ this.baseURL = config.getSolverUrl();
3554
+ }
3555
+ /**
3556
+ * Submits a settlement transaction to the solver backend
3557
+ * @param params Settlement transaction parameters
3558
+ * @returns Promise with the response message
3559
+ * @throws Error if the request fails or validation fails
3560
+ */
3561
+ async submitSettlementTx(params) {
3562
+ try {
3563
+ SubmitSettlementRequestSchema.parse(params);
3564
+ const snakeCaseParams = convertToSnakeCase(params);
3565
+ const response = await axios.post(
3566
+ `${this.baseURL}/submit-settlement-tx`,
3567
+ snakeCaseParams,
3568
+ {
3569
+ headers: {
3570
+ "Content-Type": "application/json",
3571
+ Accept: "application/json"
3572
+ }
3573
+ }
3574
+ );
3575
+ return SubmitSettlementResponseSchema.parse(response.data);
3576
+ } catch (error) {
3577
+ if (axios.isAxiosError(error)) {
3578
+ throw new Error(`Failed to submit settlement transaction: ${error.message}`);
3579
+ }
3580
+ if (error instanceof z.ZodError) {
3581
+ throw new Error(`Invalid data: ${error.message}`);
3582
+ }
3583
+ throw error;
3584
+ }
3585
+ }
3586
+ /**
3587
+ * Helper function to format and submit a single trade settlement
3588
+ * @param tradeId The ID of the trade to settle
3589
+ * @param pmmId The PMM's identifier
3590
+ * @param settlementTx The settlement transaction data
3591
+ * @param signature The PMM's signature
3592
+ */
3593
+ async submitSingleSettlement(tradeId, pmmId, settlementTx, signature, signedAt) {
3594
+ return this.submitSettlementTx({
3595
+ tradeIds: [tradeId],
3596
+ pmmId,
3597
+ settlementTx,
3598
+ signature,
3599
+ startIndex: 0,
3600
+ signedAt
3601
+ });
3602
+ }
3603
+ /**
3604
+ * Helper function to submit multiple trade settlements in one transaction
3605
+ * @param tradeIds Array of trade IDs to settle
3606
+ * @param pmmId The PMM's identifier
3607
+ * @param settlementTx The settlement transaction data
3608
+ * @param signature The PMM's signature
3609
+ * @param startIndex Starting index for batch processing
3610
+ */
3611
+ async submitBatchSettlement(tradeIds, pmmId, settlementTx, signature, signedAt, startIndex = 0) {
3612
+ return this.submitSettlementTx({
3613
+ tradeIds,
3614
+ pmmId,
3615
+ settlementTx,
3616
+ signature,
3617
+ startIndex,
3618
+ signedAt
3619
+ });
3620
+ }
3621
+ };
3622
+ var solverService = new SolverService();
3623
+
3624
+ // src/services/token.service.ts
3625
+ import axios2 from "axios";
3626
+ import { z as z3 } from "zod";
3627
+
3628
+ // src/types/token.ts
3629
+ import { z as z2 } from "zod";
3630
+ var TokenSchema = z2.object({
3631
+ networkId: z2.string(),
3632
+ tokenId: z2.string(),
3633
+ networkName: z2.string(),
3634
+ networkSymbol: z2.string(),
3635
+ networkType: z2.string(),
3636
+ tokenName: z2.string(),
3637
+ tokenSymbol: z2.string(),
3638
+ tokenAddress: z2.string(),
3639
+ tokenDecimals: z2.number(),
3640
+ tokenLogoUri: z2.string(),
3641
+ networkLogoUri: z2.string()
3642
+ });
3643
+
3644
+ // src/services/token.service.ts
3645
+ var TokenResponseSchema = z3.object({
3646
+ data: z3.object({
3647
+ tokens: z3.array(TokenSchema)
3648
+ }),
3649
+ traceId: z3.string()
3650
+ });
3651
+ var TokenService = class {
3652
+ constructor() {
3653
+ this.baseURL = config.getBackendUrl();
3654
+ }
3655
+ /**
3656
+ * Fetches all available tokens from the API
3657
+ * @returns Promise<Token[]> Array of tokens
3658
+ * @throws Error if the API request fails or response validation fails
3659
+ */
3660
+ async getTokens() {
3661
+ try {
3662
+ const response = await axios2.get(`${this.baseURL}/v1/tokens`, {
3663
+ headers: {
3664
+ Accept: "application/json"
3665
+ }
3666
+ });
3667
+ const camelCaseData = convertToCamelCase(response.data);
3668
+ const validatedResponse = TokenResponseSchema.parse(camelCaseData);
3669
+ return validatedResponse.data.tokens;
3670
+ } catch (error) {
3671
+ if (axios2.isAxiosError(error)) {
3672
+ throw new Error(`Failed to fetch tokens: ${error.message}`);
3673
+ }
3674
+ if (error instanceof z3.ZodError) {
3675
+ throw new Error(`Invalid token data received: ${error.message}`);
3676
+ }
3677
+ throw error;
3678
+ }
3679
+ }
3680
+ /**
3681
+ * Fetches a specific token by its token ID
3682
+ * @param tokenId Token ID to fetch
3683
+ * @returns Promise<Token> Token if found, null otherwise
3684
+ */
3685
+ async getTokenByTokenId(tokenId) {
3686
+ const tokens = await this.getTokens();
3687
+ const token = tokens.find((token2) => token2.tokenId === tokenId);
3688
+ if (!token) {
3689
+ throw new Error(`Token with tokenId ${tokenId} not found`);
3690
+ }
3691
+ return token;
3692
+ }
3693
+ /**
3694
+ * Fetches tokens by network ID
3695
+ * @param networkId Network ID to filter by
3696
+ * @returns Promise<Token[]> Array of tokens for the specified network
3697
+ */
3698
+ async getTokensByNetwork(networkId) {
3699
+ const tokens = await this.getTokens();
3700
+ return tokens.filter((token) => token.networkId === networkId);
3701
+ }
3702
+ /**
3703
+ * Finds a specific token by network ID and token address
3704
+ * @param networkId Network ID to search for
3705
+ * @param tokenAddress Token address to search for (use 'native' for native tokens)
3706
+ * @returns Promise<Token> Token if found
3707
+ * @throws Error if token is not found
3708
+ */
3709
+ async getToken(networkId, tokenAddress) {
3710
+ try {
3711
+ const tokens = await this.getTokens();
3712
+ const token = tokens.find(
3713
+ (t) => t.networkId === networkId && t.tokenAddress.toLowerCase() === tokenAddress.toLowerCase()
3714
+ );
3715
+ if (!token) {
3716
+ throw new Error(`Token not found for networkId: ${networkId} and address: ${tokenAddress}`);
3717
+ }
3718
+ return token;
3719
+ } catch (error) {
3720
+ if (error instanceof Error) {
3721
+ throw error;
3722
+ }
3723
+ throw new Error(`Failed to get token: ${error}`);
3724
+ }
3725
+ }
3726
+ };
3727
+ var tokenService = new TokenService();
3728
+
3729
+ // src/signatures/domain.ts
3730
+ async function defaultDomain(signerHelper, provider) {
3731
+ const chainId = (await provider.getNetwork()).chainId;
3732
+ const domainContract = {
3733
+ name: "BitFi",
3734
+ version: "Version 1",
3735
+ chainId,
3736
+ verifyingContract: signerHelper
3737
+ };
3738
+ return domainContract;
3739
+ }
3740
+
3741
+ // src/signatures/getInfoHash.ts
3742
+ import { AbiCoder, keccak256 } from "ethers";
3743
+ var abiCoder = AbiCoder.defaultAbiCoder();
3744
+ function getPresignHash(pmmRecvAddress, amountIn) {
3745
+ const infoHash = keccak256(abiCoder.encode(["address", "uint256"], [pmmRecvAddress, amountIn]));
3746
+ return infoHash;
3747
+ }
3748
+ function getDepositConfirmationHash(amountIn, fromChain, depositTxId, depositFromList) {
3749
+ const depositHash = keccak256(
3750
+ abiCoder.encode(["uint256", "bytes[3]", "bytes[]"], [amountIn, fromChain, depositFromList])
3751
+ );
3752
+ const infoHash = keccak256(abiCoder.encode(["bytes32", "bytes"], [depositHash, depositTxId]));
3753
+ return infoHash;
3754
+ }
3755
+ function getSelectPMMHash(pmmId, pmmRecvAddress, toChain, toToken, amountOut, expiry) {
3756
+ const infoHash = keccak256(
3757
+ abiCoder.encode(
3758
+ ["bytes32", "bytes", "bytes", "bytes", "uint256", "uint256"],
3759
+ [pmmId, pmmRecvAddress, toChain, toToken, amountOut, expiry]
3760
+ )
3761
+ );
3762
+ return infoHash;
3763
+ }
3764
+ function getRFQHash(minAmountOut, tradeTimeout) {
3765
+ const infoHash = keccak256(abiCoder.encode(["uint256", "uint256"], [minAmountOut, tradeTimeout]));
3766
+ return infoHash;
3767
+ }
3768
+ function getTradeIdsHash(tradeIds) {
3769
+ return keccak256(abiCoder.encode(["bytes32[]"], [tradeIds]));
3770
+ }
3771
+ function getMakePaymentHash(tradeIds, signedAt, startIdx, paymentTxId) {
3772
+ const bundlerHash = keccak256(abiCoder.encode(["bytes32[]"], [tradeIds]));
3773
+ const infoHash = keccak256(
3774
+ abiCoder.encode(["uint64", "uint256", "bytes32", "bytes"], [signedAt, startIdx, bundlerHash, paymentTxId])
3775
+ );
3776
+ return infoHash;
3777
+ }
3778
+ function getBTCEVMConfirmPaymentHash(protocolFee, paymentAmount, toChain, paymentTxId) {
3779
+ const paymentHash = keccak256(
3780
+ abiCoder.encode(["uint256", "uint256", "bytes[3]"], [protocolFee, paymentAmount, toChain])
3781
+ );
3782
+ const infoHash = keccak256(abiCoder.encode(["bytes32", "bytes"], [paymentHash, paymentTxId]));
3783
+ return infoHash;
3784
+ }
3785
+ function getEVMBTCConfirmPaymentHash(paymentAmount, toChain, paymentTxId) {
3786
+ const paymentHash = keccak256(abiCoder.encode(["uint256", "bytes[3]"], [paymentAmount, toChain]));
3787
+ const infoHash = keccak256(abiCoder.encode(["bytes32", "bytes"], [paymentHash, paymentTxId]));
3788
+ return infoHash;
3789
+ }
3790
+ function getBTCEVMConfirmSettlementHash(releaseTxId) {
3791
+ const infoHash = keccak256(releaseTxId);
3792
+ return infoHash;
3793
+ }
3794
+ function getEVMBTCConfirmSettlementHash(protocolFee, releaseTxId) {
3795
+ const infoHash = keccak256(abiCoder.encode(["uint256", "bytes"], [protocolFee, releaseTxId]));
3796
+ return infoHash;
3797
+ }
3798
+ function getCommitInfoHash(pmmId, pmmRecvAddr, toChain, toToken, amountOut, expiry) {
3799
+ const infoHash = keccak256(
3800
+ abiCoder.encode(
3801
+ ["bytes32", "bytes", "bytes", "bytes", "uint256", "uint64"],
3802
+ [pmmId, pmmRecvAddr, toChain, toToken, amountOut, expiry]
3803
+ )
3804
+ );
3805
+ return infoHash;
3806
+ }
3807
+
3808
+ // src/signatures/getSignature.ts
3809
+ import { verifyTypedData } from "ethers";
3810
+
3811
+ // src/signatures/types.ts
3812
+ var presignType = {
3813
+ Presign: [
3814
+ { name: "tradeId", type: "bytes32" },
3815
+ { name: "infoHash", type: "bytes32" }
3816
+ ]
3817
+ };
3818
+ var confirmDepositType = {
3819
+ ConfirmDeposit: [
3820
+ { name: "tradeId", type: "bytes32" },
3821
+ { name: "infoHash", type: "bytes32" }
3822
+ ]
3823
+ };
3824
+ var selectionType = {
3825
+ Selection: [
3826
+ { name: "tradeId", type: "bytes32" },
3827
+ { name: "infoHash", type: "bytes32" }
3828
+ ]
3829
+ };
3830
+ var rfqAuthenticationTypes = {
3831
+ Authentication: [
3832
+ { name: "tradeId", type: "bytes32" },
3833
+ { name: "infoHash", type: "bytes32" }
3834
+ ]
3835
+ };
3836
+ var makePaymentType = {
3837
+ MakePayment: [{ name: "infoHash", type: "bytes32" }]
3838
+ };
3839
+ var confirmPaymentType = {
3840
+ ConfirmPayment: [
3841
+ { name: "tradeId", type: "bytes32" },
3842
+ { name: "infoHash", type: "bytes32" }
3843
+ ]
3844
+ };
3845
+ var confirmSettlementType = {
3846
+ ConfirmSettlement: [
3847
+ { name: "tradeId", type: "bytes32" },
3848
+ { name: "infoHash", type: "bytes32" }
3849
+ ]
3850
+ };
3851
+
3852
+ // src/signatures/getSignature.ts
3853
+ var SignatureType = /* @__PURE__ */ ((SignatureType2) => {
3854
+ SignatureType2[SignatureType2["ConfirmDeposit"] = 0] = "ConfirmDeposit";
3855
+ SignatureType2[SignatureType2["SelectPMM"] = 1] = "SelectPMM";
3856
+ SignatureType2[SignatureType2["RFQ"] = 2] = "RFQ";
3857
+ SignatureType2[SignatureType2["MakePayment"] = 3] = "MakePayment";
3858
+ SignatureType2[SignatureType2["ConfirmPayment"] = 4] = "ConfirmPayment";
3859
+ SignatureType2[SignatureType2["ConfirmSettlement"] = 5] = "ConfirmSettlement";
3860
+ SignatureType2[SignatureType2["VerifyingContract"] = 6] = "VerifyingContract";
3861
+ return SignatureType2;
3862
+ })(SignatureType || {});
3863
+ function getSignatureType(type) {
3864
+ if (type === 0 /* ConfirmDeposit */) return confirmDepositType;
3865
+ else if (type === 1 /* SelectPMM */) return selectionType;
3866
+ else if (type === 6 /* VerifyingContract */) return selectionType;
3867
+ else if (type === 2 /* RFQ */) return rfqAuthenticationTypes;
3868
+ else if (type === 3 /* MakePayment */) return makePaymentType;
3869
+ else if (type === 4 /* ConfirmPayment */) return confirmPaymentType;
3870
+ else if (type === 5 /* ConfirmSettlement */) return confirmSettlementType;
3871
+ else throw new Error("Invalid signature type!");
3872
+ }
3873
+ async function getSigner(provider, signerHelper, tradeId, infoHash, type, signature) {
3874
+ const values = { tradeId, infoHash };
3875
+ const contractDomain = await defaultDomain(signerHelper, provider);
3876
+ return verifyTypedData(contractDomain, getSignatureType(type), values, signature);
3877
+ }
3878
+ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash, type, domain) {
3879
+ const contractDomain = await defaultDomain(signerHelper, provider);
3880
+ let values;
3881
+ if (type === 3 /* MakePayment */) values = { infoHash };
3882
+ else values = { tradeId, infoHash };
3883
+ return await Signer2.signTypedData(domain ?? contractDomain, getSignatureType(type), values);
3884
+ }
3885
+ export {
3886
+ ERC20__factory,
3887
+ Payment__factory,
3888
+ RouterService,
3889
+ Router__factory,
3890
+ SignatureType,
3891
+ SignerService,
3892
+ Signer__factory,
3893
+ SolverService,
3894
+ TokenSchema,
3895
+ TokenService,
3896
+ camelToSnakeCase,
3897
+ config,
3898
+ confirmDepositType,
3899
+ confirmPaymentType,
3900
+ confirmSettlementType,
3901
+ convertToCamelCase,
3902
+ convertToSnakeCase,
3903
+ ensureHexPrefix,
3904
+ factories_exports as factories,
3905
+ getBTCEVMConfirmPaymentHash,
3906
+ getBTCEVMConfirmSettlementHash,
3907
+ getCommitInfoHash,
3908
+ getDepositConfirmationHash,
3909
+ getEVMBTCConfirmPaymentHash,
3910
+ getEVMBTCConfirmSettlementHash,
3911
+ getMakePaymentHash,
3912
+ getPresignHash,
3913
+ getRFQHash,
3914
+ getSelectPMMHash,
3915
+ getSignature,
3916
+ getSigner,
3917
+ getTradeIdsHash,
3918
+ makePaymentType,
3919
+ presignType,
3920
+ removeHexPrefix,
3921
+ rfqAuthenticationTypes,
3922
+ routerService,
3923
+ selectionType,
3924
+ signerService,
3925
+ snakeToCamelCase,
3926
+ solverService,
3927
+ tokenService
3928
+ };