@myx-trade/sdk 0.1.245-beta.9 → 0.1.246

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 CHANGED
@@ -1380,9 +1380,7 @@ var ARB_TEST_SEPOLIA = {
1380
1380
  DATA_PROVIDER: "0x1E1487d92f6FDbeEa8C2b48610CDCfbCC9c40fa3",
1381
1381
  ORACLE_RESERVE: "0xb5f9C48815ab45BdC080523cF82Aaa2F7892b578",
1382
1382
  FORWARDER: "0xc5A9f5786Ec4EBf5eeaD5C9263dD6105189C05F9",
1383
- TRADING_ROUTER: "0x9B9359C2a5C1B103cC5bf66bDB0B78370dc4E706",
1384
- REIMBURSEMENT: "0x4583A223299b94B95d6937bEF6753afee2b8f81A",
1385
- DISPUTE_COURT: "0xc6b8b22F0b06caae5C823926205a38276C65718f"
1383
+ TRADING_ROUTER: "0x9B9359C2a5C1B103cC5bf66bDB0B78370dc4E706"
1386
1384
  };
1387
1385
 
1388
1386
  // src/config/address/LINEA_SEPOLIA.ts
@@ -1405,9 +1403,7 @@ var LINEA_SEPOLIA = {
1405
1403
  DATA_PROVIDER: "0x0A64788b7FB6499fd2eFbb26A5D05e7C6B919db3",
1406
1404
  ORACLE_RESERVE: "0xA4da3417Ae7697A4fa494Bec49b37F0Fb08E86e9",
1407
1405
  FORWARDER: "0x702c06d4bb20Ee82Cf3DE8f5611FE3a86067e937",
1408
- TRADING_ROUTER: "0x97656464d608A7d1Ac5B6C42655C6806A16aF5C4",
1409
- REIMBURSEMENT: "0x427E0C7E84D8D75f971c62D0688009B421598cCb",
1410
- DISPUTE_COURT: "0x2f2dec0Cf321a9dA64BEf7dB0b84d998E37dBB11"
1406
+ TRADING_ROUTER: "0x97656464d608A7d1Ac5B6C42655C6806A16aF5C4"
1411
1407
  };
1412
1408
 
1413
1409
  // src/config/address/BSC_TEST_NET.ts
@@ -1430,9 +1426,7 @@ var BSC_TEST_NET = {
1430
1426
  DATA_PROVIDER: "0x827c4D63eCafE28bC7f1aFF460f9A14b4938d76e",
1431
1427
  ORACLE_RESERVE: "0xCF72C9fB77cF051F079151d5955753A5b93F4E92",
1432
1428
  FORWARDER: "0x2912Ae76E175776B44E3a0f67E60F2624AEeED03",
1433
- TRADING_ROUTER: "0x0000000000000000000000000000000000000000",
1434
- REIMBURSEMENT: "0x0000000000000000000000000000000000000000",
1435
- DISPUTE_COURT: "0x0000000000000000000000000000000000000000"
1429
+ TRADING_ROUTER: "0x0000000000000000000000000000000000000000"
1436
1430
  };
1437
1431
 
1438
1432
  // src/config/address.ts
@@ -1441,6 +1435,18 @@ var address_default = {
1441
1435
  [59141 /* LINEA_SEPOLIA */]: LINEA_SEPOLIA,
1442
1436
  [97 /* BSC_TESTNET */]: BSC_TEST_NET
1443
1437
  };
1438
+ var executeAddressByChainId = (chainId) => {
1439
+ if (chainId === 421614 /* ARB_TESTNET */) {
1440
+ return "0x7e248ec1721639413a280d9e82e2862cae2e6e28";
1441
+ }
1442
+ if (chainId === 59141 /* LINEA_SEPOLIA */) {
1443
+ return "";
1444
+ }
1445
+ if (chainId === 97 /* BSC_TESTNET */) {
1446
+ return "";
1447
+ }
1448
+ return "";
1449
+ };
1444
1450
 
1445
1451
  // src/web3/index.ts
1446
1452
  import {
@@ -1769,7 +1775,7 @@ var RotationProvider = class extends BaseProvider {
1769
1775
  // package.json
1770
1776
  var package_default = {
1771
1777
  name: "@myx-trade/sdk",
1772
- version: "0.1.245-beta.9",
1778
+ version: "0.1.246",
1773
1779
  private: false,
1774
1780
  publishConfig: {
1775
1781
  access: "public"
@@ -10276,1931 +10282,14 @@ var Forwarder_default = [
10276
10282
  }
10277
10283
  ];
10278
10284
 
10279
- // src/abi/Reimbursement.json
10280
- var Reimbursement_default = [
10281
- {
10282
- type: "error",
10283
- name: "AddressEmptyCode",
10284
- inputs: [
10285
- {
10286
- type: "address",
10287
- name: "target"
10288
- }
10289
- ]
10290
- },
10291
- {
10292
- type: "error",
10293
- name: "AlreadyClaimed",
10294
- inputs: [
10295
- {
10296
- type: "uint256",
10297
- name: "caseId"
10298
- },
10299
- {
10300
- type: "address",
10301
- name: "user"
10302
- }
10303
- ]
10304
- },
10305
- {
10306
- type: "error",
10307
- name: "ERC1967InvalidImplementation",
10308
- inputs: [
10309
- {
10310
- type: "address",
10311
- name: "implementation"
10312
- }
10313
- ]
10314
- },
10315
- {
10316
- type: "error",
10317
- name: "ERC1967NonPayable",
10318
- inputs: []
10319
- },
10320
- {
10321
- type: "error",
10322
- name: "FailedCall",
10323
- inputs: []
10324
- },
10325
- {
10326
- type: "error",
10327
- name: "InvalidAmount",
10328
- inputs: [
10329
- {
10330
- type: "uint256",
10331
- name: "caseId"
10332
- },
10333
- {
10334
- type: "address",
10335
- name: "user"
10336
- }
10337
- ]
10338
- },
10339
- {
10340
- type: "error",
10341
- name: "InvalidInitialization",
10342
- inputs: []
10343
- },
10344
- {
10345
- type: "error",
10346
- name: "MerkleTreeVerificationFailed",
10347
- inputs: [
10348
- {
10349
- type: "uint256",
10350
- name: "caseId"
10351
- },
10352
- {
10353
- type: "address",
10354
- name: "user"
10355
- }
10356
- ]
10357
- },
10358
- {
10359
- type: "error",
10360
- name: "NotAddressManager",
10361
- inputs: []
10362
- },
10363
- {
10364
- type: "error",
10365
- name: "NotDependencyManager",
10366
- inputs: []
10367
- },
10368
- {
10369
- type: "error",
10370
- name: "NotInitializing",
10371
- inputs: []
10372
- },
10373
- {
10374
- type: "error",
10375
- name: "NotProxyAdmin",
10376
- inputs: []
10377
- },
10378
- {
10379
- type: "error",
10380
- name: "PermissionDenied",
10381
- inputs: [
10382
- {
10383
- type: "address",
10384
- name: "caller"
10385
- },
10386
- {
10387
- type: "address",
10388
- name: "target"
10389
- }
10390
- ]
10391
- },
10392
- {
10393
- type: "error",
10394
- name: "ReimbursementValidity",
10395
- inputs: [
10396
- {
10397
- type: "uint256",
10398
- name: "caseId"
10399
- }
10400
- ]
10401
- },
10402
- {
10403
- type: "error",
10404
- name: "SafeERC20FailedOperation",
10405
- inputs: [
10406
- {
10407
- type: "address",
10408
- name: "token"
10409
- }
10410
- ]
10411
- },
10412
- {
10413
- type: "error",
10414
- name: "UUPSUnauthorizedCallContext",
10415
- inputs: []
10416
- },
10417
- {
10418
- type: "error",
10419
- name: "UUPSUnsupportedProxiableUUID",
10420
- inputs: [
10421
- {
10422
- type: "bytes32",
10423
- name: "slot"
10424
- }
10425
- ]
10426
- },
10427
- {
10428
- type: "event",
10429
- anonymous: false,
10430
- name: "Initialized",
10431
- inputs: [
10432
- {
10433
- type: "uint64",
10434
- name: "version",
10435
- indexed: false
10436
- }
10437
- ]
10438
- },
10439
- {
10440
- type: "event",
10441
- anonymous: false,
10442
- name: "ReimbursementClaimed",
10443
- inputs: [
10444
- {
10445
- type: "uint256",
10446
- name: "caseId",
10447
- indexed: false
10448
- },
10449
- {
10450
- type: "address",
10451
- name: "user",
10452
- indexed: false
10453
- },
10454
- {
10455
- type: "uint256",
10456
- name: "baseAmount",
10457
- indexed: false
10458
- },
10459
- {
10460
- type: "uint256",
10461
- name: "quoteAmount",
10462
- indexed: false
10463
- }
10464
- ]
10465
- },
10466
- {
10467
- type: "event",
10468
- anonymous: false,
10469
- name: "ReimbursementInfoSet",
10470
- inputs: [
10471
- {
10472
- type: "uint256",
10473
- name: "caseId",
10474
- indexed: false
10475
- },
10476
- {
10477
- type: "bytes32",
10478
- name: "merkleRoot",
10479
- indexed: false
10480
- },
10481
- {
10482
- type: "address",
10483
- name: "baseToken",
10484
- indexed: false
10485
- },
10486
- {
10487
- type: "address",
10488
- name: "quoteToken",
10489
- indexed: false
10490
- },
10491
- {
10492
- type: "uint256",
10493
- name: "totalBaseAmount",
10494
- indexed: false
10495
- },
10496
- {
10497
- type: "uint256",
10498
- name: "totalQuoteAmount",
10499
- indexed: false
10500
- },
10501
- {
10502
- type: "uint256",
10503
- name: "claimedBaseAmount",
10504
- indexed: false
10505
- },
10506
- {
10507
- type: "uint256",
10508
- name: "claimedQuoteAmount",
10509
- indexed: false
10510
- },
10511
- {
10512
- type: "uint256",
10513
- name: "expireTime",
10514
- indexed: false
10515
- }
10516
- ]
10517
- },
10518
- {
10519
- type: "event",
10520
- anonymous: false,
10521
- name: "Upgraded",
10522
- inputs: [
10523
- {
10524
- type: "address",
10525
- name: "implementation",
10526
- indexed: true
10527
- }
10528
- ]
10529
- },
10530
- {
10531
- type: "function",
10532
- name: "UPGRADE_INTERFACE_VERSION",
10533
- constant: true,
10534
- stateMutability: "view",
10535
- payable: false,
10536
- inputs: [],
10537
- outputs: [
10538
- {
10539
- type: "string"
10540
- }
10541
- ]
10542
- },
10543
- {
10544
- type: "function",
10545
- name: "claimReimbursement",
10546
- constant: false,
10547
- payable: false,
10548
- inputs: [
10549
- {
10550
- type: "uint256",
10551
- name: "caseId"
10552
- },
10553
- {
10554
- type: "uint256",
10555
- name: "baseAmount"
10556
- },
10557
- {
10558
- type: "uint256",
10559
- name: "quoteAmount"
10560
- },
10561
- {
10562
- type: "bytes32[]",
10563
- name: "merkleProof"
10564
- }
10565
- ],
10566
- outputs: []
10567
- },
10568
- {
10569
- type: "function",
10570
- name: "getAddressManager",
10571
- constant: true,
10572
- stateMutability: "view",
10573
- payable: false,
10574
- inputs: [],
10575
- outputs: [
10576
- {
10577
- type: "address"
10578
- }
10579
- ]
10580
- },
10581
- {
10582
- type: "function",
10583
- name: "getDependencyAddress",
10584
- constant: true,
10585
- stateMutability: "view",
10586
- payable: false,
10587
- inputs: [
10588
- {
10589
- type: "bytes32",
10590
- name: "identifier"
10591
- }
10592
- ],
10593
- outputs: [
10594
- {
10595
- type: "address"
10596
- }
10597
- ]
10598
- },
10599
- {
10600
- type: "function",
10601
- name: "getImplementation",
10602
- constant: true,
10603
- stateMutability: "view",
10604
- payable: false,
10605
- inputs: [],
10606
- outputs: [
10607
- {
10608
- type: "address"
10609
- }
10610
- ]
10611
- },
10612
- {
10613
- type: "function",
10614
- name: "getReimbursementInfo",
10615
- constant: true,
10616
- stateMutability: "view",
10617
- payable: false,
10618
- inputs: [
10619
- {
10620
- type: "uint256",
10621
- name: "caseId"
10622
- }
10623
- ],
10624
- outputs: [
10625
- {
10626
- type: "tuple",
10627
- components: [
10628
- {
10629
- type: "bytes32",
10630
- name: "merkleRoot"
10631
- },
10632
- {
10633
- type: "address",
10634
- name: "baseToken"
10635
- },
10636
- {
10637
- type: "address",
10638
- name: "quoteToken"
10639
- },
10640
- {
10641
- type: "uint256",
10642
- name: "totalBaseAmount"
10643
- },
10644
- {
10645
- type: "uint256",
10646
- name: "totalQuoteAmount"
10647
- },
10648
- {
10649
- type: "uint256",
10650
- name: "claimedBaseAmount"
10651
- },
10652
- {
10653
- type: "uint256",
10654
- name: "claimedQuoteAmount"
10655
- },
10656
- {
10657
- type: "uint256",
10658
- name: "expireTime"
10659
- }
10660
- ]
10661
- }
10662
- ]
10663
- },
10664
- {
10665
- type: "function",
10666
- name: "initialize",
10667
- constant: false,
10668
- payable: false,
10669
- inputs: [
10670
- {
10671
- type: "address",
10672
- name: "addressManager"
10673
- }
10674
- ],
10675
- outputs: []
10676
- },
10677
- {
10678
- type: "function",
10679
- name: "proxiableUUID",
10680
- constant: true,
10681
- stateMutability: "view",
10682
- payable: false,
10683
- inputs: [],
10684
- outputs: [
10685
- {
10686
- type: "bytes32"
10687
- }
10688
- ]
10689
- },
10690
- {
10691
- type: "function",
10692
- name: "setReimbursementInfo",
10693
- constant: false,
10694
- payable: false,
10695
- inputs: [
10696
- {
10697
- type: "uint256",
10698
- name: "caseId"
10699
- },
10700
- {
10701
- type: "tuple",
10702
- name: "reimbursementInfo",
10703
- components: [
10704
- {
10705
- type: "bytes32",
10706
- name: "merkleRoot"
10707
- },
10708
- {
10709
- type: "address",
10710
- name: "baseToken"
10711
- },
10712
- {
10713
- type: "address",
10714
- name: "quoteToken"
10715
- },
10716
- {
10717
- type: "uint256",
10718
- name: "totalBaseAmount"
10719
- },
10720
- {
10721
- type: "uint256",
10722
- name: "totalQuoteAmount"
10723
- },
10724
- {
10725
- type: "uint256",
10726
- name: "claimedBaseAmount"
10727
- },
10728
- {
10729
- type: "uint256",
10730
- name: "claimedQuoteAmount"
10731
- },
10732
- {
10733
- type: "uint256",
10734
- name: "expireTime"
10735
- }
10736
- ]
10737
- }
10738
- ],
10739
- outputs: []
10740
- },
10741
- {
10742
- type: "function",
10743
- name: "upgradeTo",
10744
- constant: false,
10745
- stateMutability: "payable",
10746
- payable: true,
10747
- inputs: [
10748
- {
10749
- type: "address",
10750
- name: "newImplementation"
10751
- },
10752
- {
10753
- type: "bytes",
10754
- name: "data"
10755
- }
10756
- ],
10757
- outputs: []
10758
- },
10759
- {
10760
- type: "function",
10761
- name: "upgradeToAndCall",
10762
- constant: false,
10763
- stateMutability: "payable",
10764
- payable: true,
10765
- inputs: [
10766
- {
10767
- type: "address",
10768
- name: "newImplementation"
10769
- },
10770
- {
10771
- type: "bytes",
10772
- name: "data"
10773
- }
10774
- ],
10775
- outputs: []
10776
- }
10777
- ];
10778
-
10779
- // src/abi/DisputeCourt.json
10780
- var DisputeCourt_default = [
10781
- {
10782
- type: "constructor",
10783
- payable: false,
10784
- inputs: []
10785
- },
10786
- {
10787
- type: "error",
10788
- name: "AddressEmptyCode",
10789
- inputs: [
10790
- {
10791
- type: "address",
10792
- name: "target"
10793
- }
10794
- ]
10795
- },
10796
- {
10797
- type: "error",
10798
- name: "AlreadyVoted",
10799
- inputs: []
10800
- },
10801
- {
10802
- type: "error",
10803
- name: "BondNotReleased",
10804
- inputs: []
10805
- },
10806
- {
10807
- type: "error",
10808
- name: "CaseAppealNotFinished",
10809
- inputs: []
10810
- },
10811
- {
10812
- type: "error",
10813
- name: "CaseDeadlineNotReached",
10814
- inputs: []
10815
- },
10816
- {
10817
- type: "error",
10818
- name: "CaseDeadlineReached",
10819
- inputs: []
10820
- },
10821
- {
10822
- type: "error",
10823
- name: "CaseNotAccepted",
10824
- inputs: []
10825
- },
10826
- {
10827
- type: "error",
10828
- name: "CaseNotExist",
10829
- inputs: [
10830
- {
10831
- type: "uint256",
10832
- name: "caseId"
10833
- }
10834
- ]
10835
- },
10836
- {
10837
- type: "error",
10838
- name: "CaseRespondentAppealed",
10839
- inputs: [
10840
- {
10841
- type: "uint256",
10842
- name: "caseId"
10843
- },
10844
- {
10845
- type: "address",
10846
- name: "respondent"
10847
- }
10848
- ]
10849
- },
10850
- {
10851
- type: "error",
10852
- name: "ChainIdMismatch",
10853
- inputs: []
10854
- },
10855
- {
10856
- type: "error",
10857
- name: "DisputeNotAllowed",
10858
- inputs: []
10859
- },
10860
- {
10861
- type: "error",
10862
- name: "ERC1967InvalidImplementation",
10863
- inputs: [
10864
- {
10865
- type: "address",
10866
- name: "implementation"
10867
- }
10868
- ]
10869
- },
10870
- {
10871
- type: "error",
10872
- name: "ERC1967NonPayable",
10873
- inputs: []
10874
- },
10875
- {
10876
- type: "error",
10877
- name: "FailedCall",
10878
- inputs: []
10879
- },
10880
- {
10881
- type: "error",
10882
- name: "InvalidAccountNonce",
10883
- inputs: [
10884
- {
10885
- type: "address",
10886
- name: "account"
10887
- },
10888
- {
10889
- type: "uint256",
10890
- name: "currentNonce"
10891
- }
10892
- ]
10893
- },
10894
- {
10895
- type: "error",
10896
- name: "InvalidContractAddress",
10897
- inputs: []
10898
- },
10899
- {
10900
- type: "error",
10901
- name: "InvalidFunctionSignature",
10902
- inputs: []
10903
- },
10904
- {
10905
- type: "error",
10906
- name: "InvalidInitialization",
10907
- inputs: []
10908
- },
10909
- {
10910
- type: "error",
10911
- name: "InvalidParameter",
10912
- inputs: []
10913
- },
10914
- {
10915
- type: "error",
10916
- name: "InvalidPayloadLength",
10917
- inputs: [
10918
- {
10919
- type: "uint256",
10920
- name: "received"
10921
- },
10922
- {
10923
- type: "uint256",
10924
- name: "expected"
10925
- }
10926
- ]
10927
- },
10928
- {
10929
- type: "error",
10930
- name: "InvalidPoolToken",
10931
- inputs: []
10932
- },
10933
- {
10934
- type: "error",
10935
- name: "InvalidProfitAmount",
10936
- inputs: []
10937
- },
10938
- {
10939
- type: "error",
10940
- name: "InvalidResponseVersion",
10941
- inputs: []
10942
- },
10943
- {
10944
- type: "error",
10945
- name: "InvalidSourceChain",
10946
- inputs: []
10947
- },
10948
- {
10949
- type: "error",
10950
- name: "NoChainResponse",
10951
- inputs: []
10952
- },
10953
- {
10954
- type: "error",
10955
- name: "NotAddressManager",
10956
- inputs: []
10957
- },
10958
- {
10959
- type: "error",
10960
- name: "NotCaseRespondent",
10961
- inputs: [
10962
- {
10963
- type: "uint256",
10964
- name: "caseId"
10965
- },
10966
- {
10967
- type: "address",
10968
- name: "respondent"
10969
- }
10970
- ]
10971
- },
10972
- {
10973
- type: "error",
10974
- name: "NotDependencyManager",
10975
- inputs: []
10976
- },
10977
- {
10978
- type: "error",
10979
- name: "NotInitializing",
10980
- inputs: []
10981
- },
10982
- {
10983
- type: "error",
10984
- name: "NotProxyAdmin",
10985
- inputs: []
10986
- },
10987
- {
10988
- type: "error",
10989
- name: "NumberOfResponsesMismatch",
10990
- inputs: []
10991
- },
10992
- {
10993
- type: "error",
10994
- name: "OnlyRelayer",
10995
- inputs: []
10996
- },
10997
- {
10998
- type: "error",
10999
- name: "PermissionDenied",
11000
- inputs: [
11001
- {
11002
- type: "address",
11003
- name: "caller"
11004
- },
11005
- {
11006
- type: "address",
11007
- name: "target"
11008
- }
11009
- ]
11010
- },
11011
- {
11012
- type: "error",
11013
- name: "RequestTypeMismatch",
11014
- inputs: []
11015
- },
11016
- {
11017
- type: "error",
11018
- name: "RiskCloseNotCompleted",
11019
- inputs: []
11020
- },
11021
- {
11022
- type: "error",
11023
- name: "SafeERC20FailedOperation",
11024
- inputs: [
11025
- {
11026
- type: "address",
11027
- name: "token"
11028
- }
11029
- ]
11030
- },
11031
- {
11032
- type: "error",
11033
- name: "SignatureExpired",
11034
- inputs: []
11035
- },
11036
- {
11037
- type: "error",
11038
- name: "UUPSUnauthorizedCallContext",
11039
- inputs: []
11040
- },
11041
- {
11042
- type: "error",
11043
- name: "UUPSUnsupportedProxiableUUID",
11044
- inputs: [
11045
- {
11046
- type: "bytes32",
11047
- name: "slot"
11048
- }
11049
- ]
11050
- },
11051
- {
11052
- type: "error",
11053
- name: "UnexpectedCaseState",
11054
- inputs: []
11055
- },
11056
- {
11057
- type: "error",
11058
- name: "UnexpectedCaseType",
11059
- inputs: []
11060
- },
11061
- {
11062
- type: "error",
11063
- name: "UnexpectedNumberOfResults",
11064
- inputs: []
11065
- },
11066
- {
11067
- type: "error",
11068
- name: "UnsupportedQueryType",
11069
- inputs: [
11070
- {
11071
- type: "uint8",
11072
- name: "received"
11073
- }
11074
- ]
11075
- },
11076
- {
11077
- type: "error",
11078
- name: "UntrustfulVoting",
11079
- inputs: []
11080
- },
11081
- {
11082
- type: "error",
11083
- name: "VerificationFailed",
11084
- inputs: []
11085
- },
11086
- {
11087
- type: "error",
11088
- name: "VersionMismatch",
11089
- inputs: []
11090
- },
11091
- {
11092
- type: "error",
11093
- name: "WrongQueryType",
11094
- inputs: [
11095
- {
11096
- type: "uint8",
11097
- name: "received"
11098
- },
11099
- {
11100
- type: "uint8",
11101
- name: "expected"
11102
- }
11103
- ]
11104
- },
11105
- {
11106
- type: "error",
11107
- name: "ZeroQueries",
11108
- inputs: []
11109
- },
11110
- {
11111
- type: "event",
11112
- anonymous: false,
11113
- name: "AppealCanceled",
11114
- inputs: [
11115
- {
11116
- type: "uint256",
11117
- name: "caseId",
11118
- indexed: false
11119
- },
11120
- {
11121
- type: "uint256",
11122
- name: "appealCaseId",
11123
- indexed: false
11124
- },
11125
- {
11126
- type: "address",
11127
- name: "complainant",
11128
- indexed: false
11129
- },
11130
- {
11131
- type: "bool",
11132
- name: "isMalicious",
11133
- indexed: false
11134
- }
11135
- ]
11136
- },
11137
- {
11138
- type: "event",
11139
- anonymous: false,
11140
- name: "AppealFiled",
11141
- inputs: [
11142
- {
11143
- type: "uint256",
11144
- name: "caseId",
11145
- indexed: false
11146
- },
11147
- {
11148
- type: "uint256",
11149
- name: "appealCaseId",
11150
- indexed: false
11151
- },
11152
- {
11153
- type: "address",
11154
- name: "respondent",
11155
- indexed: false
11156
- },
11157
- {
11158
- type: "address",
11159
- name: "appealToken",
11160
- indexed: false
11161
- },
11162
- {
11163
- type: "uint256",
11164
- name: "appealBond",
11165
- indexed: false
11166
- },
11167
- {
11168
- type: "uint64",
11169
- name: "appealDeadline",
11170
- indexed: false
11171
- }
11172
- ]
11173
- },
11174
- {
11175
- type: "event",
11176
- anonymous: false,
11177
- name: "AppealResolved",
11178
- inputs: [
11179
- {
11180
- type: "uint256",
11181
- name: "caseId",
11182
- indexed: false
11183
- },
11184
- {
11185
- type: "uint256",
11186
- name: "appealCaseId",
11187
- indexed: false
11188
- },
11189
- {
11190
- type: "uint8",
11191
- name: "resolution",
11192
- indexed: false
11193
- },
11194
- {
11195
- type: "address",
11196
- name: "complainant",
11197
- indexed: false
11198
- }
11199
- ]
11200
- },
11201
- {
11202
- type: "event",
11203
- anonymous: false,
11204
- name: "BondClaimed",
11205
- inputs: [
11206
- {
11207
- type: "uint256",
11208
- name: "caseId",
11209
- indexed: false
11210
- },
11211
- {
11212
- type: "address",
11213
- name: "user",
11214
- indexed: false
11215
- },
11216
- {
11217
- type: "address",
11218
- name: "token",
11219
- indexed: false
11220
- },
11221
- {
11222
- type: "uint256",
11223
- name: "amount",
11224
- indexed: false
11225
- }
11226
- ]
11227
- },
11228
- {
11229
- type: "event",
11230
- anonymous: false,
11231
- name: "CaseAppealsResolved",
11232
- inputs: [
11233
- {
11234
- type: "uint256",
11235
- name: "caseId",
11236
- indexed: false
11237
- }
11238
- ]
11239
- },
11240
- {
11241
- type: "event",
11242
- anonymous: false,
11243
- name: "CaseRiskClosed",
11244
- inputs: [
11245
- {
11246
- type: "uint256",
11247
- name: "caseId",
11248
- indexed: false
11249
- }
11250
- ]
11251
- },
11252
- {
11253
- type: "event",
11254
- anonymous: false,
11255
- name: "DisputeCanceled",
11256
- inputs: [
11257
- {
11258
- type: "uint256",
11259
- name: "caseId",
11260
- indexed: false
11261
- },
11262
- {
11263
- type: "address",
11264
- name: "complainant",
11265
- indexed: false
11266
- },
11267
- {
11268
- type: "bool",
11269
- name: "isMalicious",
11270
- indexed: false
11271
- }
11272
- ]
11273
- },
11274
- {
11275
- type: "event",
11276
- anonymous: false,
11277
- name: "DisputeConfigurationUpdated",
11278
- inputs: [
11279
- {
11280
- type: "tuple",
11281
- name: "newDisputeConfigration",
11282
- indexed: false,
11283
- components: [
11284
- {
11285
- type: "address",
11286
- name: "appealToken"
11287
- },
11288
- {
11289
- type: "uint64",
11290
- name: "disputeBondUsd"
11291
- },
11292
- {
11293
- type: "uint64",
11294
- name: "appealBondUsd"
11295
- },
11296
- {
11297
- type: "uint64",
11298
- name: "disputeThresholdUsd"
11299
- },
11300
- {
11301
- type: "uint64",
11302
- name: "caseDuration"
11303
- },
11304
- {
11305
- type: "uint64",
11306
- name: "voteDuration"
11307
- },
11308
- {
11309
- type: "uint64",
11310
- name: "resolveDuration"
11311
- },
11312
- {
11313
- type: "uint32",
11314
- name: "voteCountRate"
11315
- },
11316
- {
11317
- type: "uint32",
11318
- name: "effectiveVoteRate"
11319
- }
11320
- ]
11321
- }
11322
- ]
11323
- },
11324
- {
11325
- type: "event",
11326
- anonymous: false,
11327
- name: "DisputeFiled",
11328
- inputs: [
11329
- {
11330
- type: "uint256",
11331
- name: "caseId",
11332
- indexed: false
11333
- },
11334
- {
11335
- type: "bytes32",
11336
- name: "poolId",
11337
- indexed: false
11338
- },
11339
- {
11340
- type: "address",
11341
- name: "complainant",
11342
- indexed: false
11343
- },
11344
- {
11345
- type: "address",
11346
- name: "poolToken",
11347
- indexed: false
11348
- },
11349
- {
11350
- type: "uint256",
11351
- name: "disputeBond",
11352
- indexed: false
11353
- },
11354
- {
11355
- type: "uint64",
11356
- name: "caseDeadline",
11357
- indexed: false
11358
- }
11359
- ]
11360
- },
11361
- {
11362
- type: "event",
11363
- anonymous: false,
11364
- name: "DisputeResolved",
11365
- inputs: [
11366
- {
11367
- type: "uint256",
11368
- name: "caseId",
11369
- indexed: false
11370
- },
11371
- {
11372
- type: "uint8",
11373
- name: "resolution",
11374
- indexed: false
11375
- },
11376
- {
11377
- type: "uint64",
11378
- name: "appealDeadline",
11379
- indexed: false
11380
- }
11381
- ]
11382
- },
11383
- {
11384
- type: "event",
11385
- anonymous: false,
11386
- name: "ForfeitBondsClaimed",
11387
- inputs: [
11388
- {
11389
- type: "address",
11390
- name: "receiver",
11391
- indexed: false
11392
- },
11393
- {
11394
- type: "address",
11395
- name: "token",
11396
- indexed: false
11397
- },
11398
- {
11399
- type: "uint256",
11400
- name: "amount",
11401
- indexed: false
11402
- }
11403
- ]
11404
- },
11405
- {
11406
- type: "event",
11407
- anonymous: false,
11408
- name: "Initialized",
11409
- inputs: [
11410
- {
11411
- type: "uint64",
11412
- name: "version",
11413
- indexed: false
11414
- }
11415
- ]
11416
- },
11417
- {
11418
- type: "event",
11419
- anonymous: false,
11420
- name: "ReimbursementProcessed",
11421
- inputs: [
11422
- {
11423
- type: "uint256",
11424
- name: "caseId",
11425
- indexed: false
11426
- },
11427
- {
11428
- type: "tuple",
11429
- name: "reimbursementInfo",
11430
- indexed: false,
11431
- components: [
11432
- {
11433
- type: "bytes32",
11434
- name: "merkleRoot"
11435
- },
11436
- {
11437
- type: "address",
11438
- name: "baseToken"
11439
- },
11440
- {
11441
- type: "address",
11442
- name: "quoteToken"
11443
- },
11444
- {
11445
- type: "uint256",
11446
- name: "totalBaseAmount"
11447
- },
11448
- {
11449
- type: "uint256",
11450
- name: "totalQuoteAmount"
11451
- },
11452
- {
11453
- type: "uint256",
11454
- name: "claimedBaseAmount"
11455
- },
11456
- {
11457
- type: "uint256",
11458
- name: "claimedQuoteAmount"
11459
- },
11460
- {
11461
- type: "uint256",
11462
- name: "expireTime"
11463
- }
11464
- ]
11465
- }
11466
- ]
11467
- },
11468
- {
11469
- type: "event",
11470
- anonymous: false,
11471
- name: "Upgraded",
11472
- inputs: [
11473
- {
11474
- type: "address",
11475
- name: "implementation",
11476
- indexed: true
11477
- }
11478
- ]
11479
- },
11480
- {
11481
- type: "event",
11482
- anonymous: false,
11483
- name: "Voted",
11484
- inputs: [
11485
- {
11486
- type: "uint256",
11487
- name: "caseId",
11488
- indexed: false
11489
- },
11490
- {
11491
- type: "address",
11492
- name: "voter",
11493
- indexed: false
11494
- },
11495
- {
11496
- type: "uint8",
11497
- name: "voteOption",
11498
- indexed: false
11499
- }
11500
- ]
11501
- },
11502
- {
11503
- type: "event",
11504
- anonymous: false,
11505
- name: "VotingOpened",
11506
- inputs: [
11507
- {
11508
- type: "uint256",
11509
- name: "caseId",
11510
- indexed: false
11511
- },
11512
- {
11513
- type: "uint256",
11514
- name: "evidenceId",
11515
- indexed: false
11516
- },
11517
- {
11518
- type: "uint64",
11519
- name: "voteDeadline",
11520
- indexed: false
11521
- },
11522
- {
11523
- type: "address[]",
11524
- name: "respondents",
11525
- indexed: false
11526
- }
11527
- ]
11528
- },
11529
- {
11530
- type: "event",
11531
- anonymous: false,
11532
- name: "WormholeConfigurationUpdated",
11533
- inputs: [
11534
- {
11535
- type: "tuple",
11536
- name: "newWormholeConfiguration",
11537
- indexed: false,
11538
- components: [
11539
- {
11540
- type: "address",
11541
- name: "wormhole"
11542
- },
11543
- {
11544
- type: "address",
11545
- name: "staker"
11546
- },
11547
- {
11548
- type: "bytes4",
11549
- name: "selector"
11550
- }
11551
- ]
11552
- }
11553
- ]
11554
- },
11555
- {
11556
- type: "function",
11557
- name: "UPGRADE_INTERFACE_VERSION",
11558
- constant: true,
11559
- stateMutability: "view",
11560
- payable: false,
11561
- inputs: [],
11562
- outputs: [
11563
- {
11564
- type: "string"
11565
- }
11566
- ]
11567
- },
11568
- {
11569
- type: "function",
11570
- name: "appeal",
11571
- constant: false,
11572
- payable: false,
11573
- inputs: [
11574
- {
11575
- type: "uint256",
11576
- name: "caseId"
11577
- }
11578
- ],
11579
- outputs: []
11580
- },
11581
- {
11582
- type: "function",
11583
- name: "canRiskControlClose",
11584
- constant: true,
11585
- stateMutability: "view",
11586
- payable: false,
11587
- inputs: [
11588
- {
11589
- type: "uint256",
11590
- name: "caseId"
11591
- }
11592
- ],
11593
- outputs: [
11594
- {
11595
- type: "bool"
11596
- }
11597
- ]
11598
- },
11599
- {
11600
- type: "function",
11601
- name: "cancelAppeal",
11602
- constant: false,
11603
- payable: false,
11604
- inputs: [
11605
- {
11606
- type: "uint256",
11607
- name: "caseId"
11608
- },
11609
- {
11610
- type: "uint256",
11611
- name: "appealCaseId"
11612
- },
11613
- {
11614
- type: "bool",
11615
- name: "isMalicious"
11616
- }
11617
- ],
11618
- outputs: []
11619
- },
11620
- {
11621
- type: "function",
11622
- name: "cancelDispute",
11623
- constant: false,
11624
- payable: false,
11625
- inputs: [
11626
- {
11627
- type: "uint256",
11628
- name: "caseId"
11629
- },
11630
- {
11631
- type: "bool",
11632
- name: "isMalicious"
11633
- }
11634
- ],
11635
- outputs: []
11636
- },
11637
- {
11638
- type: "function",
11639
- name: "caseIdSequencer",
11640
- constant: true,
11641
- stateMutability: "view",
11642
- payable: false,
11643
- inputs: [],
11644
- outputs: [
11645
- {
11646
- type: "uint256"
11647
- }
11648
- ]
11649
- },
11650
- {
11651
- type: "function",
11652
- name: "claimBond",
11653
- constant: false,
11654
- payable: false,
11655
- inputs: [
11656
- {
11657
- type: "uint256",
11658
- name: "caseId"
11659
- }
11660
- ],
11661
- outputs: []
11662
- },
11663
- {
11664
- type: "function",
11665
- name: "claimForfeitBonds",
11666
- constant: false,
11667
- payable: false,
11668
- inputs: [
11669
- {
11670
- type: "address",
11671
- name: "receiver"
11672
- }
11673
- ],
11674
- outputs: []
11675
- },
11676
- {
11677
- type: "function",
11678
- name: "fileDispute",
11679
- constant: false,
11680
- stateMutability: "payable",
11681
- payable: true,
11682
- inputs: [
11683
- {
11684
- type: "tuple[]",
11685
- name: "prices",
11686
- components: [
11687
- {
11688
- type: "bytes32",
11689
- name: "poolId"
11690
- },
11691
- {
11692
- type: "uint8",
11693
- name: "oracleType"
11694
- },
11695
- {
11696
- type: "uint256",
11697
- name: "referencePrice"
11698
- },
11699
- {
11700
- type: "bytes",
11701
- name: "oracleUpdateData"
11702
- },
11703
- {
11704
- type: "uint64",
11705
- name: "publishTime"
11706
- }
11707
- ]
11708
- },
11709
- {
11710
- type: "bytes32",
11711
- name: "poolId"
11712
- },
11713
- {
11714
- type: "address",
11715
- name: "poolToken"
11716
- }
11717
- ],
11718
- outputs: []
11719
- },
11720
- {
11721
- type: "function",
11722
- name: "getAddressManager",
11723
- constant: true,
11724
- stateMutability: "view",
11725
- payable: false,
11726
- inputs: [],
11727
- outputs: [
11728
- {
11729
- type: "address"
11730
- }
11731
- ]
11732
- },
11733
- {
11734
- type: "function",
11735
- name: "getDependencyAddress",
11736
- constant: true,
11737
- stateMutability: "view",
11738
- payable: false,
11739
- inputs: [
11740
- {
11741
- type: "bytes32",
11742
- name: "identifier"
11743
- }
11744
- ],
11745
- outputs: [
11746
- {
11747
- type: "address"
11748
- }
11749
- ]
11750
- },
11751
- {
11752
- type: "function",
11753
- name: "getDisputeConfiguration",
11754
- constant: true,
11755
- stateMutability: "view",
11756
- payable: false,
11757
- inputs: [],
11758
- outputs: [
11759
- {
11760
- type: "tuple",
11761
- components: [
11762
- {
11763
- type: "address",
11764
- name: "appealToken"
11765
- },
11766
- {
11767
- type: "uint64",
11768
- name: "disputeBondUsd"
11769
- },
11770
- {
11771
- type: "uint64",
11772
- name: "appealBondUsd"
11773
- },
11774
- {
11775
- type: "uint64",
11776
- name: "disputeThresholdUsd"
11777
- },
11778
- {
11779
- type: "uint64",
11780
- name: "caseDuration"
11781
- },
11782
- {
11783
- type: "uint64",
11784
- name: "voteDuration"
11785
- },
11786
- {
11787
- type: "uint64",
11788
- name: "resolveDuration"
11789
- },
11790
- {
11791
- type: "uint32",
11792
- name: "voteCountRate"
11793
- },
11794
- {
11795
- type: "uint32",
11796
- name: "effectiveVoteRate"
11797
- }
11798
- ]
11799
- }
11800
- ]
11801
- },
11802
- {
11803
- type: "function",
11804
- name: "getImplementation",
11805
- constant: true,
11806
- stateMutability: "view",
11807
- payable: false,
11808
- inputs: [],
11809
- outputs: [
11810
- {
11811
- type: "address"
11812
- }
11813
- ]
11814
- },
11815
- {
11816
- type: "function",
11817
- name: "initialize",
11818
- constant: false,
11819
- payable: false,
11820
- inputs: [
11821
- {
11822
- type: "address",
11823
- name: "addressManager"
11824
- }
11825
- ],
11826
- outputs: []
11827
- },
11828
- {
11829
- type: "function",
11830
- name: "isCaseRespondents",
11831
- constant: true,
11832
- stateMutability: "view",
11833
- payable: false,
11834
- inputs: [
11835
- {
11836
- type: "uint256",
11837
- name: "caseId"
11838
- },
11839
- {
11840
- type: "address",
11841
- name: "account"
11842
- }
11843
- ],
11844
- outputs: [
11845
- {
11846
- type: "bool"
11847
- }
11848
- ]
11849
- },
11850
- {
11851
- type: "function",
11852
- name: "nonces",
11853
- constant: true,
11854
- stateMutability: "view",
11855
- payable: false,
11856
- inputs: [
11857
- {
11858
- type: "address",
11859
- name: "owner"
11860
- }
11861
- ],
11862
- outputs: [
11863
- {
11864
- type: "uint256"
11865
- }
11866
- ]
11867
- },
11868
- {
11869
- type: "function",
11870
- name: "openVoting",
11871
- constant: false,
11872
- payable: false,
11873
- inputs: [
11874
- {
11875
- type: "uint256",
11876
- name: "caseId"
11877
- },
11878
- {
11879
- type: "uint256",
11880
- name: "evidenceId"
11881
- },
11882
- {
11883
- type: "address[]",
11884
- name: "respondents"
11885
- }
11886
- ],
11887
- outputs: []
11888
- },
11889
- {
11890
- type: "function",
11891
- name: "processReimbursement",
11892
- constant: false,
11893
- payable: false,
11894
- inputs: [
11895
- {
11896
- type: "uint256",
11897
- name: "caseId"
11898
- },
11899
- {
11900
- type: "tuple",
11901
- name: "reimbursementInfo",
11902
- components: [
11903
- {
11904
- type: "bytes32",
11905
- name: "merkleRoot"
11906
- },
11907
- {
11908
- type: "address",
11909
- name: "baseToken"
11910
- },
11911
- {
11912
- type: "address",
11913
- name: "quoteToken"
11914
- },
11915
- {
11916
- type: "uint256",
11917
- name: "totalBaseAmount"
11918
- },
11919
- {
11920
- type: "uint256",
11921
- name: "totalQuoteAmount"
11922
- },
11923
- {
11924
- type: "uint256",
11925
- name: "claimedBaseAmount"
11926
- },
11927
- {
11928
- type: "uint256",
11929
- name: "claimedQuoteAmount"
11930
- },
11931
- {
11932
- type: "uint256",
11933
- name: "expireTime"
11934
- }
11935
- ]
11936
- },
11937
- {
11938
- type: "bytes32[]",
11939
- name: "zeroMerkleProof"
11940
- }
11941
- ],
11942
- outputs: []
11943
- },
11944
- {
11945
- type: "function",
11946
- name: "proxiableUUID",
11947
- constant: true,
11948
- stateMutability: "view",
11949
- payable: false,
11950
- inputs: [],
11951
- outputs: [
11952
- {
11953
- type: "bytes32"
11954
- }
11955
- ]
11956
- },
11957
- {
11958
- type: "function",
11959
- name: "resolveCaseAppeals",
11960
- constant: false,
11961
- payable: false,
11962
- inputs: [
11963
- {
11964
- type: "uint256",
11965
- name: "caseId"
11966
- },
11967
- {
11968
- type: "bytes",
11969
- name: "response"
11970
- },
11971
- {
11972
- type: "tuple[]",
11973
- name: "guardianSignatures",
11974
- components: [
11975
- {
11976
- type: "bytes32",
11977
- name: "r"
11978
- },
11979
- {
11980
- type: "bytes32",
11981
- name: "s"
11982
- },
11983
- {
11984
- type: "uint8",
11985
- name: "v"
11986
- },
11987
- {
11988
- type: "uint8",
11989
- name: "guardianIndex"
11990
- }
11991
- ]
11992
- }
11993
- ],
11994
- outputs: []
11995
- },
11996
- {
11997
- type: "function",
11998
- name: "resolveDispute",
11999
- constant: false,
12000
- payable: false,
12001
- inputs: [
12002
- {
12003
- type: "uint256",
12004
- name: "caseId"
12005
- },
12006
- {
12007
- type: "bytes",
12008
- name: "response"
12009
- },
12010
- {
12011
- type: "tuple[]",
12012
- name: "guardianSignatures",
12013
- components: [
12014
- {
12015
- type: "bytes32",
12016
- name: "r"
12017
- },
12018
- {
12019
- type: "bytes32",
12020
- name: "s"
12021
- },
12022
- {
12023
- type: "uint8",
12024
- name: "v"
12025
- },
12026
- {
12027
- type: "uint8",
12028
- name: "guardianIndex"
12029
- }
12030
- ]
12031
- }
12032
- ],
12033
- outputs: []
12034
- },
12035
- {
12036
- type: "function",
12037
- name: "updateDisputeConfiguration",
12038
- constant: false,
12039
- payable: false,
12040
- inputs: [
12041
- {
12042
- type: "tuple",
12043
- name: "disputeConfiguration",
12044
- components: [
12045
- {
12046
- type: "address",
12047
- name: "appealToken"
12048
- },
12049
- {
12050
- type: "uint64",
12051
- name: "disputeBondUsd"
12052
- },
12053
- {
12054
- type: "uint64",
12055
- name: "appealBondUsd"
12056
- },
12057
- {
12058
- type: "uint64",
12059
- name: "disputeThresholdUsd"
12060
- },
12061
- {
12062
- type: "uint64",
12063
- name: "caseDuration"
12064
- },
12065
- {
12066
- type: "uint64",
12067
- name: "voteDuration"
12068
- },
12069
- {
12070
- type: "uint64",
12071
- name: "resolveDuration"
12072
- },
12073
- {
12074
- type: "uint32",
12075
- name: "voteCountRate"
12076
- },
12077
- {
12078
- type: "uint32",
12079
- name: "effectiveVoteRate"
12080
- }
12081
- ]
12082
- }
12083
- ],
12084
- outputs: []
12085
- },
12086
- {
12087
- type: "function",
12088
- name: "updateWormholeConfiguration",
12089
- constant: false,
12090
- payable: false,
12091
- inputs: [
12092
- {
12093
- type: "tuple",
12094
- name: "wormholeConfiguration",
12095
- components: [
12096
- {
12097
- type: "address",
12098
- name: "wormhole"
12099
- },
12100
- {
12101
- type: "address",
12102
- name: "staker"
12103
- },
12104
- {
12105
- type: "bytes4",
12106
- name: "selector"
12107
- }
12108
- ]
12109
- }
12110
- ],
12111
- outputs: []
12112
- },
12113
- {
12114
- type: "function",
12115
- name: "upgradeTo",
12116
- constant: false,
12117
- stateMutability: "payable",
12118
- payable: true,
12119
- inputs: [
12120
- {
12121
- type: "address",
12122
- name: "newImplementation"
12123
- },
12124
- {
12125
- type: "bytes",
12126
- name: "data"
12127
- }
12128
- ],
12129
- outputs: []
12130
- },
12131
- {
12132
- type: "function",
12133
- name: "upgradeToAndCall",
12134
- constant: false,
12135
- stateMutability: "payable",
12136
- payable: true,
12137
- inputs: [
12138
- {
12139
- type: "address",
12140
- name: "newImplementation"
12141
- },
12142
- {
12143
- type: "bytes",
12144
- name: "data"
12145
- }
12146
- ],
12147
- outputs: []
12148
- },
12149
- {
12150
- type: "function",
12151
- name: "vote",
12152
- constant: false,
12153
- payable: false,
12154
- inputs: [
12155
- {
12156
- type: "uint256",
12157
- name: "caseId"
12158
- },
12159
- {
12160
- type: "address",
12161
- name: "validator"
12162
- },
12163
- {
12164
- type: "uint8",
12165
- name: "voteOption"
12166
- },
12167
- {
12168
- type: "uint256",
12169
- name: "deadline"
12170
- },
12171
- {
12172
- type: "uint8",
12173
- name: "v"
12174
- },
12175
- {
12176
- type: "bytes32",
12177
- name: "r"
12178
- },
12179
- {
12180
- type: "bytes32",
12181
- name: "s"
12182
- }
12183
- ],
12184
- outputs: []
12185
- }
12186
- ];
12187
-
12188
10285
  // src/web3/providers.ts
12189
10286
  var getTokenContract = async (chainId, tokenAddress) => {
12190
10287
  const provider = getJSONProvider(chainId);
12191
- return getContract(
12192
- tokenAddress,
12193
- IERC20Metadata_default,
12194
- provider
12195
- );
10288
+ return getContract(tokenAddress, IERC20Metadata_default, provider);
12196
10289
  };
12197
10290
  var getERC20Contract = async (chainId, tokenAddress) => {
12198
10291
  const provider = await getSignerProvider(chainId);
12199
- return getContract(
12200
- tokenAddress,
12201
- IERC20Metadata_default,
12202
- provider
12203
- );
10292
+ return getContract(tokenAddress, IERC20Metadata_default, provider);
12204
10293
  };
12205
10294
  var getAccount = async (chainId) => {
12206
10295
  const provider = await getSignerProvider(chainId);
@@ -12211,21 +10300,13 @@ var getLiquidityRouterContract = async (chainId) => {
12211
10300
  const addresses = address_default[chainId];
12212
10301
  const address = addresses.LIQUIDITY_ROUTER;
12213
10302
  const provider = await getSignerProvider(chainId);
12214
- return getContract(
12215
- address,
12216
- LiquidityRouter_default,
12217
- provider
12218
- );
10303
+ return getContract(address, LiquidityRouter_default, provider);
12219
10304
  };
12220
10305
  var getPoolManagerContract = async (chainId, type = 1 /* Signer */) => {
12221
10306
  const addresses = address_default[chainId];
12222
10307
  const address = addresses.POOL_MANAGER;
12223
10308
  const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
12224
- return getContract(
12225
- address,
12226
- PoolManager_default,
12227
- provider
12228
- );
10309
+ return getContract(address, PoolManager_default, provider);
12229
10310
  };
12230
10311
  var getQuotePoolContract = async (chainId, type = 0 /* JSON */) => {
12231
10312
  const addresses = address_default[chainId];
@@ -12262,21 +10343,13 @@ var getMarketManageContract = async (chainId, type = 0 /* JSON */) => {
12262
10343
  const address = addresses.MARKET_MANAGER;
12263
10344
  console.log(addresses.MARKET_MANAGER);
12264
10345
  const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
12265
- return getContract(
12266
- address,
12267
- MarketManager_default,
12268
- provider
12269
- );
10346
+ return getContract(address, MarketManager_default, provider);
12270
10347
  };
12271
10348
  var getDataProviderContract = async (chainId, type = 0 /* JSON */) => {
12272
10349
  const addresses = address_default[chainId];
12273
10350
  const address = addresses.DATA_PROVIDER;
12274
10351
  const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
12275
- return getContract(
12276
- address,
12277
- DataProvider_default,
12278
- provider
12279
- );
10352
+ return getContract(address, DataProvider_default, provider);
12280
10353
  };
12281
10354
  var getForwarderContract = async (chainId, type = 0 /* JSON */) => {
12282
10355
  const addresses = address_default[chainId];
@@ -12284,26 +10357,6 @@ var getForwarderContract = async (chainId, type = 0 /* JSON */) => {
12284
10357
  const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
12285
10358
  return getContract(address, Forwarder_default, provider);
12286
10359
  };
12287
- var getReimbursementContract = async (chainId, type = 0 /* JSON */) => {
12288
- const addresses = address_default[chainId];
12289
- const address = addresses.REIMBURSEMENT;
12290
- const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
12291
- return getContract(
12292
- address,
12293
- Reimbursement_default,
12294
- provider
12295
- );
12296
- };
12297
- var getDisputeCourtContract = async (chainId, type = 0 /* JSON */) => {
12298
- const addresses = address_default[chainId];
12299
- const address = addresses.DISPUTE_COURT;
12300
- const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
12301
- return getContract(
12302
- address,
12303
- DisputeCourt_default,
12304
- provider
12305
- );
12306
- };
12307
10360
 
12308
10361
  // src/config/error.ts
12309
10362
  import { ErrorType, ErrorDecoder } from "ethers-decode-error";
@@ -14907,9 +12960,7 @@ var ARB_BETA_SEPOLIA = {
14907
12960
  DATA_PROVIDER: "0x19dD80bF40Af2d891F270085D9B1C49730a5a6B0",
14908
12961
  ORACLE_RESERVE: "0x3e0d8fAd0a5245D0b2C9d893fE155397a307577C",
14909
12962
  FORWARDER: "0xf58CAEDf8A76331848ef51108ea102D920Dcf785",
14910
- TRADING_ROUTER: "0x0000000000000000000000000000000000000000",
14911
- REIMBURSEMENT: "0x0000000000000000000000000000000000000000",
14912
- DISPUTE_COURT: "0x0000000000000000000000000000000000000000"
12963
+ TRADING_ROUTER: "0x0000000000000000000000000000000000000000"
14913
12964
  };
14914
12965
 
14915
12966
  // src/config/address/LINEA_BETA_SEPOLIA.ts
@@ -14932,9 +12983,7 @@ var LINEA_BETA_SEPOLIA = {
14932
12983
  ORACLE_RESERVE: "0xB3D5a67223905FE73a0749e7A03525838063C54C",
14933
12984
  USDC: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",
14934
12985
  FORWARDER: "0x6C40462A4d45BA4119af59Fb9e41b8eaC9293962",
14935
- TRADING_ROUTER: "0x0000000000000000000000000000000000000000",
14936
- REIMBURSEMENT: "0x0000000000000000000000000000000000000000",
14937
- DISPUTE_COURT: "0x0000000000000000000000000000000000000000"
12986
+ TRADING_ROUTER: "0x0000000000000000000000000000000000000000"
14938
12987
  };
14939
12988
 
14940
12989
  // src/config/address/BSC_BETA_NET.ts
@@ -15040,10 +13089,10 @@ var Position = class {
15040
13089
  }
15041
13090
  const updateParams = {
15042
13091
  poolId,
13092
+ oracleType: poolOracleType,
15043
13093
  referencePrice: ethers5.parseUnits(priceData?.price ?? "0", 30),
15044
13094
  oracleUpdateData: priceData?.vaa ?? "0",
15045
- publishTime: priceData.publishTime,
15046
- oracleType: poolOracleType
13095
+ publishTime: priceData.publishTime
15047
13096
  };
15048
13097
  let needsApproval = false;
15049
13098
  if (Number(adjustAmount) > 0) {
@@ -20837,7 +18886,7 @@ var Utils = class {
20837
18886
  }
20838
18887
  return null;
20839
18888
  }
20840
- async getApproveQuoteAmount(account, chainId, tokenAddress, spenderAddress) {
18889
+ async getApproveQuoteAmount(address, chainId, quoteAddress, spenderAddress) {
20841
18890
  try {
20842
18891
  const erc20Abi = [
20843
18892
  "function allowance(address owner, address spender) external view returns (uint256)"
@@ -20845,11 +18894,11 @@ var Utils = class {
20845
18894
  const spender = spenderAddress ?? getContractAddressByChainId(chainId).Account;
20846
18895
  const provider = await getJSONProvider(chainId);
20847
18896
  const tokenContract = new ethers7.Contract(
20848
- tokenAddress,
18897
+ quoteAddress,
20849
18898
  erc20Abi,
20850
18899
  provider
20851
18900
  );
20852
- const allowance = await tokenContract.allowance(account, spender);
18901
+ const allowance = await tokenContract.allowance(address, spender);
20853
18902
  return {
20854
18903
  code: 0,
20855
18904
  data: allowance.toString()
@@ -20859,12 +18908,12 @@ var Utils = class {
20859
18908
  throw typeof error === "string" ? error : await getErrorTextFormError(error);
20860
18909
  }
20861
18910
  }
20862
- async needsApproval(account, chainId, tokenAddress, requiredAmount, spenderAddress) {
18911
+ async needsApproval(address, chainId, quoteAddress, requiredAmount, spenderAddress) {
20863
18912
  try {
20864
18913
  const currentAllowanceRes = await this.getApproveQuoteAmount(
20865
- account,
18914
+ address,
20866
18915
  chainId,
20867
- tokenAddress,
18916
+ quoteAddress,
20868
18917
  spenderAddress
20869
18918
  );
20870
18919
  const currentAllowance = currentAllowanceRes.data;
@@ -20956,7 +19005,9 @@ var Utils = class {
20956
19005
  provider
20957
19006
  );
20958
19007
  try {
20959
- const networkFee = await marketManagerContract.getExecutionFee(marketId);
19008
+ const networkFee = await marketManagerContract.getExecutionFee(
19009
+ marketId
19010
+ );
20960
19011
  return networkFee.toString();
20961
19012
  } catch (error) {
20962
19013
  this.logger.error("Error getting network fee:", error);
@@ -20970,24 +19021,15 @@ var Utils = class {
20970
19021
  return priceData;
20971
19022
  } catch (error) {
20972
19023
  this.logger.error("Error getting oracle price:", error);
20973
- throw error;
19024
+ return {
19025
+ price: "0",
19026
+ vaa: "",
19027
+ publishTime: 0,
19028
+ poolId: "",
19029
+ value: 0
19030
+ };
20974
19031
  }
20975
19032
  }
20976
- async buildUpdatePriceParams(poolId, chainId) {
20977
- const priceData = await this.getOraclePrice(poolId, chainId);
20978
- if (!priceData) throw new Error("Failed to get price data");
20979
- return [
20980
- {
20981
- poolId,
20982
- referencePrice: ethers7.parseUnits(priceData.price, 30),
20983
- oracleUpdateData: priceData.vaa,
20984
- publishTime: priceData.publishTime,
20985
- oracleType: priceData.oracleType,
20986
- value: priceData.value,
20987
- price: priceData.price
20988
- }
20989
- ];
20990
- }
20991
19033
  transferKlineResolutionToInterval(resolution) {
20992
19034
  switch (resolution) {
20993
19035
  case "1m":
@@ -21108,17 +19150,11 @@ var Utils = class {
21108
19150
  }
21109
19151
  return JSON.stringify(error);
21110
19152
  }
21111
- async getGasPriceByRatio() {
21112
- const chainId = this.configManager.getConfig().chainId;
19153
+ async getGasPriceByRatio(chainId) {
21113
19154
  return (await bigintTradingGasPriceWithRatio(chainId)).gasPrice;
21114
19155
  }
21115
- async getGasLimitByRatio(gasLimit) {
21116
- const chainId = this.configManager.getConfig().chainId;
21117
- const chainInfo = CHAIN_INFO[chainId];
21118
- return bigintTradingGasToRatioCalculator(
21119
- gasLimit,
21120
- chainInfo?.gasLimitRatio ?? 1.3
21121
- );
19156
+ async getGasLimitByRatio(chainId, gasLimit) {
19157
+ return bigintTradingGasToRatioCalculator(gasLimit, chainId);
21122
19158
  }
21123
19159
  };
21124
19160
 
@@ -21912,29 +19948,6 @@ var Account = class {
21912
19948
  }
21913
19949
  async getAvailableMarginBalance({ poolId, chainId, address }) {
21914
19950
  try {
21915
- const poolListRes = await this.client.api.getPoolList();
21916
- if (poolListRes.code !== 9200) {
21917
- throw new MyxSDKError(
21918
- "REQUEST_FAILED" /* RequestFailed */,
21919
- "Failed to get pool list"
21920
- );
21921
- }
21922
- const poolList = poolListRes.data;
21923
- const pool = poolList?.find((pool2) => pool2.poolId === poolId);
21924
- const orderRes = await this.client.order.getOrders(address);
21925
- if (orderRes.code !== 0) {
21926
- throw new MyxSDKError(
21927
- "REQUEST_FAILED" /* RequestFailed */,
21928
- "Failed to get orders"
21929
- );
21930
- }
21931
- const orders = orderRes.data;
21932
- const openOrders = orders?.filter((order) => order.poolId === poolId);
21933
- const used = openOrders?.reduce((acc, order) => {
21934
- const prev = BigInt(ethers8.parseUnits(acc, pool?.quoteDecimals ?? 6));
21935
- const curr = BigInt(ethers8.parseUnits(order.collateralAmount ?? "0", pool?.quoteDecimals ?? 6)) + prev;
21936
- return curr.toString();
21937
- }, "0");
21938
19951
  const marginAccountBalanceRes = await this.getAccountInfo(chainId, address, poolId);
21939
19952
  if (marginAccountBalanceRes.code !== 0) {
21940
19953
  throw new MyxSDKError(
@@ -21943,15 +19956,10 @@ var Account = class {
21943
19956
  );
21944
19957
  }
21945
19958
  const marginAccountBalance = marginAccountBalanceRes.data;
21946
- const usedMargin = BigInt(used ?? "0");
21947
19959
  const quoteProfit = BigInt(marginAccountBalance.quoteProfit ?? 0);
21948
19960
  const freeAmount = BigInt(marginAccountBalance?.freeMargin ?? 0);
21949
19961
  const accountMargin = freeAmount + quoteProfit;
21950
- if (accountMargin < usedMargin) {
21951
- return BigInt(0);
21952
- }
21953
- const availableAccountMarginBalance = accountMargin - usedMargin;
21954
- return availableAccountMarginBalance;
19962
+ return accountMargin;
21955
19963
  } catch (error) {
21956
19964
  throw new MyxSDKError(
21957
19965
  "REQUEST_FAILED" /* RequestFailed */,
@@ -22113,8 +20121,6 @@ var Account = class {
22113
20121
  };
22114
20122
  }
22115
20123
  }
22116
- async getCurrentEpoch() {
22117
- }
22118
20124
  async getAccountVipInfo(chainId, address) {
22119
20125
  const config = this.configManager.getConfig();
22120
20126
  const provider = await getJSONProvider(chainId);
@@ -22269,13 +20275,11 @@ function addQueryParams(rawQuery) {
22269
20275
  return queryString ? `?${queryString}` : "";
22270
20276
  }
22271
20277
 
22272
- // src/manager/api/request.ts
22273
- import { merge } from "lodash-es";
22274
- var Request = class {
22275
- constructor(configManager) {
22276
- this._preSigner = null;
22277
- this._preUserAddress = null;
20278
+ // src/manager/api/index.ts
20279
+ var Api = class {
20280
+ constructor(configManager, logger) {
22278
20281
  this.configManager = configManager;
20282
+ this.logger = logger;
22279
20283
  }
22280
20284
  getHost() {
22281
20285
  const { isTestnet, isBetaMode } = this.configManager.getConfig();
@@ -22287,78 +20291,148 @@ var Request = class {
22287
20291
  return "https://api.myx.finance";
22288
20292
  }
22289
20293
  }
22290
- async buildAuthParams() {
22291
- const config = this.configManager.getConfig();
22292
- if (!config.signer) throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */);
22293
- let userAddress = this._preUserAddress;
22294
- const accessToken = await this.configManager.getAccessToken() ?? "";
22295
- if (config.signer !== this._preSigner) {
22296
- userAddress = await config.signer.getAddress();
22297
- this._preUserAddress = userAddress;
22298
- this._preSigner = config.signer;
22299
- }
22300
- if (!userAddress) {
22301
- throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */);
22302
- }
22303
- return {
22304
- headers: {
22305
- myx_openapi_access_token: accessToken,
22306
- myx_openapi_account: userAddress
20294
+ async getTradeFlow({
20295
+ accessToken,
20296
+ address,
20297
+ ...params
20298
+ }) {
20299
+ return http.get(
20300
+ `${this.getHost()}/openapi/gateway/scan/trade/flow`,
20301
+ params,
20302
+ {
20303
+ headers: {
20304
+ myx_openapi_access_token: accessToken,
20305
+ myx_openapi_account: address
20306
+ }
22307
20307
  }
22308
- };
20308
+ );
22309
20309
  }
22310
- buildRequestPath(path) {
22311
- if (path.startsWith("http")) {
22312
- return path;
22313
- }
22314
- return this.getHost() + path;
20310
+ async getPoolSymbolAll() {
20311
+ return http.get(
20312
+ `${this.getHost()}/openapi/gateway/scan/pools`
20313
+ );
20314
+ }
20315
+ async fetchForwarderGetApi(params) {
20316
+ const rs = await http.get(
20317
+ `${this.getHost()}/v2/agent/forwarder/get${addQueryParams(params)}`
20318
+ );
20319
+ return rs;
22315
20320
  }
22316
- async get(url, params, { auth = false, ...options } = {}) {
22317
- const authOptions = auth ? await this.buildAuthParams() : {};
20321
+ async getPoolList() {
22318
20322
  return http.get(
22319
- this.buildRequestPath(url),
22320
- params,
22321
- merge(authOptions, options)
20323
+ `${this.getHost()}/openapi/gateway/scan/market/list`
22322
20324
  );
22323
20325
  }
22324
- async post(url, data, { auth = false, ...options } = {}) {
22325
- const authOptions = auth ? await this.buildAuthParams() : {};
20326
+ async forwarderTxApi(params, chainId) {
22326
20327
  return http.post(
22327
- this.buildRequestPath(url),
22328
- data,
22329
- merge(authOptions, options)
20328
+ `${this.getHost()}/v2/agent/forwarder/tx-v2`,
20329
+ params,
20330
+ {
20331
+ headers: {
20332
+ "myx-chain-id": chainId.toString()
20333
+ }
20334
+ }
22330
20335
  );
22331
20336
  }
22332
- async put(url, data, { auth = false, ...options } = {}) {
22333
- const authOptions = auth ? await this.buildAuthParams() : {};
22334
- return http.put(
22335
- this.buildRequestPath(url),
22336
- data,
22337
- merge(authOptions, options)
20337
+ async getOraclePrice(chainId, poolIds = []) {
20338
+ if (!!poolIds.length) {
20339
+ return http.get(
20340
+ `${this.getHost()}/openapi/gateway/quote/price/oracles`,
20341
+ {
20342
+ chainId,
20343
+ poolIds: poolIds.join(",")
20344
+ }
20345
+ );
20346
+ }
20347
+ throw new Error("Invalid pool id");
20348
+ }
20349
+ async getPoolDetail(chainId, poolId) {
20350
+ return await http.get(
20351
+ `${this.getHost()}/openapi/gateway/scan/market/info?chainId=${chainId}&poolId=${poolId}`
22338
20352
  );
22339
20353
  }
22340
- async delete(url, { auth = false, ...options } = {}) {
22341
- const authOptions = auth ? await this.buildAuthParams() : {};
22342
- return http.delete(
22343
- this.buildRequestPath(url),
22344
- merge(authOptions, options)
20354
+ async getPoolLevelConfig({
20355
+ poolId,
20356
+ chainId
20357
+ }) {
20358
+ return http.get(
20359
+ `${this.getHost()}/openapi/gateway/risk/market_pool/level_config${addQueryParams({
20360
+ poolId,
20361
+ chainId
20362
+ })}`
22345
20363
  );
22346
20364
  }
22347
- };
22348
-
22349
- // src/manager/api/index.ts
22350
- var Api = class extends Request {
22351
- constructor(configManager, logger) {
22352
- super(configManager);
22353
- this.logger = logger;
20365
+ async getPositions(accessToken, address) {
20366
+ return await http.get(
20367
+ `${this.getHost()}/openapi/gateway/scan/position/open`,
20368
+ void 0,
20369
+ {
20370
+ headers: {
20371
+ myx_openapi_access_token: accessToken,
20372
+ myx_openapi_account: address
20373
+ }
20374
+ }
20375
+ );
22354
20376
  }
22355
- async getTradeFlow({
22356
- accessToken,
22357
- address,
22358
- ...params
22359
- }) {
20377
+ async getOrders(accessToken, address) {
20378
+ return await http.get(
20379
+ `${this.getHost()}/openapi/gateway/scan/order/open`,
20380
+ void 0,
20381
+ {
20382
+ headers: {
20383
+ myx_openapi_access_token: accessToken,
20384
+ myx_openapi_account: address
20385
+ }
20386
+ }
20387
+ );
20388
+ }
20389
+ async getPoolOpenOrders(accessToken, address, chainId) {
20390
+ return await http.get(
20391
+ `${this.getHost()}/openapi/gateway/scan/market/pool-order/open?chainId=${chainId}`,
20392
+ void 0,
20393
+ {
20394
+ headers: {
20395
+ myx_openapi_access_token: accessToken,
20396
+ myx_openapi_account: address
20397
+ }
20398
+ }
20399
+ );
20400
+ }
20401
+ async getKlineData({ chainId, poolId, endTime, limit, interval }) {
22360
20402
  return http.get(
22361
- `${this.getHost()}/openapi/gateway/scan/trade/flow`,
20403
+ `${this.getHost()}/openapi/gateway/quote/candles`,
20404
+ {
20405
+ chainId,
20406
+ poolId,
20407
+ endTime,
20408
+ limit,
20409
+ interval
20410
+ }
20411
+ );
20412
+ }
20413
+ async getKlineLatestBar(params) {
20414
+ return http.get(
20415
+ `${this.getHost()}/openapi/gateway/quote/candle/latest`,
20416
+ params
20417
+ );
20418
+ }
20419
+ async getTickerData({ chainId, poolIds }) {
20420
+ return http.get(
20421
+ `${this.getHost()}/openapi/gateway/quote/candle/tickers`,
20422
+ {
20423
+ chainId,
20424
+ poolIds: poolIds.join(",")
20425
+ }
20426
+ );
20427
+ }
20428
+ async getAllTickers() {
20429
+ return http.get(
20430
+ `${this.getHost()}/v2/mx-gateway/quote/candle/all_tickers`
20431
+ );
20432
+ }
20433
+ async searchMarketAuth({ accessToken, address, ...params }) {
20434
+ return http.get(
20435
+ `${this.getHost()}/openapi/gateway/scan/market/ac-search`,
22362
20436
  params,
22363
20437
  {
22364
20438
  headers: {
@@ -22368,416 +20442,550 @@ var Api = class extends Request {
22368
20442
  }
22369
20443
  );
22370
20444
  }
22371
- async getPoolSymbolAll() {
20445
+ async searchMarket({ ...params }) {
22372
20446
  return http.get(
22373
- `${this.getHost()}/openapi/gateway/scan/pools`
20447
+ `${this.getHost()}/openapi/gateway/scan/market/search`,
20448
+ params
22374
20449
  );
22375
20450
  }
22376
- async fetchForwarderGetApi(params) {
22377
- const rs = await http.get(
22378
- `${this.getHost()}/v2/agent/forwarder/get${addQueryParams(params)}`
20451
+ async addFavorite({ accessToken, address, ...params }) {
20452
+ return http.get(
20453
+ `${this.getHost()}/openapi/gateway/scan/market/add-favorites`,
20454
+ params,
20455
+ {
20456
+ headers: {
20457
+ myx_openapi_access_token: accessToken,
20458
+ myx_openapi_account: address
20459
+ }
20460
+ }
22379
20461
  );
22380
- return rs;
22381
20462
  }
22382
- async getPoolList() {
20463
+ async removeFavorite({ accessToken, address, ...params }) {
20464
+ return http.get(
20465
+ `${this.getHost()}/openapi/gateway/scan/market/cancel-favorites`,
20466
+ params,
20467
+ {
20468
+ headers: {
20469
+ myx_openapi_access_token: accessToken,
20470
+ myx_openapi_account: address
20471
+ }
20472
+ }
20473
+ );
20474
+ }
20475
+ async getFavoritesList({ accessToken, address, ...params }) {
20476
+ return http.get(
20477
+ `${this.getHost()}/openapi/gateway/scan/market/favorites`,
20478
+ params,
20479
+ {
20480
+ headers: {
20481
+ myx_openapi_access_token: accessToken,
20482
+ myx_openapi_account: address
20483
+ }
20484
+ }
20485
+ );
20486
+ }
20487
+ async getBaseDetail({ ...params }) {
20488
+ return http.get(
20489
+ `${this.getHost()}/openapi/gateway/scan/market/base-details`,
20490
+ params
20491
+ );
20492
+ }
20493
+ async getMarketDetail({ ...params }) {
20494
+ return http.get(
20495
+ `${this.getHost()}/openapi/gateway/scan/market/detail`,
20496
+ params
20497
+ );
20498
+ }
20499
+ async getHistoryOrders({
20500
+ accessToken,
20501
+ address,
20502
+ ...params
20503
+ }) {
22383
20504
  return http.get(
22384
- `${this.getHost()}/openapi/gateway/scan/market/list`
22385
- );
22386
- }
22387
- async forwarderTxApi(params, chainId) {
22388
- return http.post(
22389
- `${this.getHost()}/v2/agent/forwarder/tx-v2`,
20505
+ `${this.getHost()}/openapi/gateway/scan/order/closed`,
22390
20506
  params,
22391
20507
  {
22392
20508
  headers: {
22393
- "myx-chain-id": chainId.toString()
20509
+ myx_openapi_account: address,
20510
+ myx_openapi_access_token: accessToken
22394
20511
  }
22395
20512
  }
22396
20513
  );
22397
20514
  }
22398
- async getOraclePrice(chainId, poolIds = []) {
22399
- if (!!poolIds.length) {
22400
- return http.get(`${this.getHost()}/openapi/gateway/quote/price/oracles`, {
22401
- chainId,
22402
- poolIds: poolIds.join(",")
22403
- });
22404
- }
22405
- throw new Error("Invalid pool id");
22406
- }
22407
- async getPoolDetail(chainId, poolId) {
22408
- return await http.get(
22409
- `${this.getHost()}/openapi/gateway/scan/market/info?chainId=${chainId}&poolId=${poolId}`
22410
- );
22411
- }
22412
- async getPoolLevelConfig({ poolId, chainId }) {
20515
+ async getPositionHistory({
20516
+ accessToken,
20517
+ address,
20518
+ ...params
20519
+ }) {
22413
20520
  return http.get(
22414
- `${this.getHost()}/openapi/gateway/risk/market_pool/level_config${addQueryParams(
22415
- {
22416
- poolId,
22417
- chainId
22418
- }
22419
- )}`
22420
- );
22421
- }
22422
- async getPositions(accessToken, address) {
22423
- return await http.get(
22424
- `${this.getHost()}/openapi/gateway/scan/position/open`,
22425
- void 0,
20521
+ `${this.getHost()}/openapi/gateway/scan/position/closed`,
20522
+ params,
22426
20523
  {
22427
20524
  headers: {
22428
- myx_openapi_access_token: accessToken,
22429
- myx_openapi_account: address
20525
+ myx_openapi_account: address,
20526
+ myx_openapi_access_token: accessToken
22430
20527
  }
22431
20528
  }
22432
20529
  );
22433
20530
  }
22434
- async getOrders(accessToken, address) {
22435
- return await http.get(
22436
- `${this.getHost()}/openapi/gateway/scan/order/open`,
22437
- void 0,
20531
+ async getMarketList() {
20532
+ return http.get(
20533
+ `${this.getHost()}/openapi/gateway/scan/market`
20534
+ );
20535
+ }
20536
+ async getAccountVipInfo({ address, accessToken, chainId, deadline, nonce }) {
20537
+ return http.get(
20538
+ `${this.getHost()}/openapi/gateway/vip/trade_config`,
20539
+ { chainId, deadline, nonce },
22438
20540
  {
22439
20541
  headers: {
22440
- myx_openapi_access_token: accessToken,
22441
- myx_openapi_account: address
20542
+ myx_openapi_account: address,
20543
+ myx_openapi_access_token: accessToken
22442
20544
  }
22443
20545
  }
22444
20546
  );
22445
20547
  }
22446
- async getPoolOpenOrders(accessToken, address, chainId) {
22447
- return await http.get(
22448
- `${this.getHost()}/openapi/gateway/scan/market/pool-order/open?chainId=${chainId}`,
22449
- void 0,
20548
+ async getCurrentEpoch({ address, accessToken, broker }) {
20549
+ return http.get(
20550
+ `${this.getHost()}/openapi/gateway/scan/get-current-epoch`,
20551
+ { broker },
22450
20552
  {
22451
20553
  headers: {
22452
- myx_openapi_access_token: accessToken,
22453
- myx_openapi_account: address
20554
+ myx_openapi_account: address,
20555
+ myx_openapi_access_token: accessToken
22454
20556
  }
22455
20557
  }
22456
20558
  );
22457
20559
  }
22458
- async getKlineData({
22459
- chainId,
22460
- poolId,
22461
- endTime,
22462
- limit,
22463
- interval
22464
- }) {
22465
- return http.get(
22466
- `${this.getHost()}/openapi/gateway/quote/candles`,
20560
+ };
20561
+
20562
+ // src/manager/seamless/index.ts
20563
+ import CryptoJS from "crypto-js";
20564
+ import { toUtf8Bytes, keccak256, hexlify, ethers as ethers9, isHexString, getBytes, ZeroAddress as ZeroAddress2 } from "ethers";
20565
+ import dayjs4 from "dayjs";
20566
+
20567
+ // src/utils/index.ts
20568
+ var getEIP712Domain = async (contract) => {
20569
+ try {
20570
+ const eip712Domain = await contract.eip712Domain();
20571
+ console.log("eip712Domain-->", eip712Domain.name);
20572
+ console.log("eip712Domain.version-->", eip712Domain.version);
20573
+ return {
20574
+ name: eip712Domain.name,
20575
+ version: eip712Domain.version,
20576
+ chainId: BigInt(eip712Domain.chainId),
20577
+ // 确保 chainId 是ForwarderGetStatus bigint 类型
20578
+ verifyingContract: eip712Domain.verifyingContract
20579
+ };
20580
+ } catch (error) {
20581
+ throw new Error(`Error fetching EIP712 domain: ${error}`);
20582
+ }
20583
+ };
20584
+
20585
+ // src/manager/seamless/index.ts
20586
+ import { splitSignature } from "@ethersproject/bytes";
20587
+
20588
+ // src/abi/TradingRouter.json
20589
+ var TradingRouter_default = [
20590
+ {
20591
+ type: "error",
20592
+ name: "AddressEmptyCode",
20593
+ inputs: [
20594
+ {
20595
+ type: "address",
20596
+ name: "target"
20597
+ }
20598
+ ]
20599
+ },
20600
+ {
20601
+ type: "error",
20602
+ name: "DesignatedTokenMismatch",
20603
+ inputs: [
20604
+ {
20605
+ type: "address",
20606
+ name: "collectToken"
20607
+ },
20608
+ {
20609
+ type: "address",
20610
+ name: "designatedToken"
20611
+ }
20612
+ ]
20613
+ },
20614
+ {
20615
+ type: "error",
20616
+ name: "ERC1967InvalidImplementation",
20617
+ inputs: [
20618
+ {
20619
+ type: "address",
20620
+ name: "implementation"
20621
+ }
20622
+ ]
20623
+ },
20624
+ {
20625
+ type: "error",
20626
+ name: "ERC1967NonPayable",
20627
+ inputs: []
20628
+ },
20629
+ {
20630
+ type: "error",
20631
+ name: "FailedCall",
20632
+ inputs: []
20633
+ },
20634
+ {
20635
+ type: "error",
20636
+ name: "InvalidInitialization",
20637
+ inputs: []
20638
+ },
20639
+ {
20640
+ type: "error",
20641
+ name: "NotActiveBroker",
20642
+ inputs: [
20643
+ {
20644
+ type: "address",
20645
+ name: "broker"
20646
+ }
20647
+ ]
20648
+ },
20649
+ {
20650
+ type: "error",
20651
+ name: "NotAddressManager",
20652
+ inputs: []
20653
+ },
20654
+ {
20655
+ type: "error",
20656
+ name: "NotDependencyManager",
20657
+ inputs: []
20658
+ },
20659
+ {
20660
+ type: "error",
20661
+ name: "NotForwardAllowedTarget",
20662
+ inputs: [
20663
+ {
20664
+ type: "address",
20665
+ name: "from"
20666
+ }
20667
+ ]
20668
+ },
20669
+ {
20670
+ type: "error",
20671
+ name: "NotInitializing",
20672
+ inputs: []
20673
+ },
20674
+ {
20675
+ type: "error",
20676
+ name: "NotProxyAdmin",
20677
+ inputs: []
20678
+ },
20679
+ {
20680
+ type: "error",
20681
+ name: "PermissionDenied",
20682
+ inputs: [
20683
+ {
20684
+ type: "address",
20685
+ name: "caller"
20686
+ },
20687
+ {
20688
+ type: "address",
20689
+ name: "target"
20690
+ }
20691
+ ]
20692
+ },
20693
+ {
20694
+ type: "error",
20695
+ name: "ReentrancyGuardReentrantCall",
20696
+ inputs: []
20697
+ },
20698
+ {
20699
+ type: "error",
20700
+ name: "SafeERC20FailedOperation",
20701
+ inputs: [
20702
+ {
20703
+ type: "address",
20704
+ name: "token"
20705
+ }
20706
+ ]
20707
+ },
20708
+ {
20709
+ type: "error",
20710
+ name: "UUPSUnauthorizedCallContext",
20711
+ inputs: []
20712
+ },
20713
+ {
20714
+ type: "error",
20715
+ name: "UUPSUnsupportedProxiableUUID",
20716
+ inputs: [
20717
+ {
20718
+ type: "bytes32",
20719
+ name: "slot"
20720
+ }
20721
+ ]
20722
+ },
20723
+ {
20724
+ type: "event",
20725
+ anonymous: false,
20726
+ name: "Initialized",
20727
+ inputs: [
20728
+ {
20729
+ type: "uint64",
20730
+ name: "version",
20731
+ indexed: false
20732
+ }
20733
+ ]
20734
+ },
20735
+ {
20736
+ type: "event",
20737
+ anonymous: false,
20738
+ name: "Upgraded",
20739
+ inputs: [
20740
+ {
20741
+ type: "address",
20742
+ name: "implementation",
20743
+ indexed: true
20744
+ }
20745
+ ]
20746
+ },
20747
+ {
20748
+ type: "function",
20749
+ name: "UPGRADE_INTERFACE_VERSION",
20750
+ constant: true,
20751
+ stateMutability: "view",
20752
+ payable: false,
20753
+ inputs: [],
20754
+ outputs: [
22467
20755
  {
22468
- chainId,
22469
- poolId,
22470
- endTime,
22471
- limit,
22472
- interval
20756
+ type: "string"
22473
20757
  }
22474
- );
22475
- }
22476
- async getKlineLatestBar(params) {
22477
- return http.get(
22478
- `${this.getHost()}/openapi/gateway/quote/candle/latest`,
22479
- params
22480
- );
22481
- }
22482
- async getTickerData({ chainId, poolIds }) {
22483
- return http.get(
22484
- `${this.getHost()}/openapi/gateway/quote/candle/tickers`,
20758
+ ]
20759
+ },
20760
+ {
20761
+ type: "function",
20762
+ name: "__ERC2771ContextUpgradeable_init",
20763
+ constant: false,
20764
+ payable: false,
20765
+ inputs: [
22485
20766
  {
22486
- chainId,
22487
- poolIds: poolIds.join(",")
20767
+ type: "address",
20768
+ name: "trustedForwarder_"
22488
20769
  }
22489
- );
22490
- }
22491
- async getAllTickers() {
22492
- return http.get(
22493
- `${this.getHost()}/v2/mx-gateway/quote/candle/all_tickers`
22494
- );
22495
- }
22496
- async searchMarketAuth({
22497
- accessToken,
22498
- address,
22499
- ...params
22500
- }) {
22501
- return http.get(
22502
- `${this.getHost()}/openapi/gateway/scan/market/ac-search`,
22503
- params,
20770
+ ],
20771
+ outputs: []
20772
+ },
20773
+ {
20774
+ type: "function",
20775
+ name: "collectExecutionFee",
20776
+ constant: false,
20777
+ payable: false,
20778
+ inputs: [
22504
20779
  {
22505
- headers: {
22506
- myx_openapi_access_token: accessToken,
22507
- myx_openapi_account: address
22508
- }
20780
+ type: "uint8",
20781
+ name: "source"
20782
+ },
20783
+ {
20784
+ type: "bytes",
20785
+ name: "data"
22509
20786
  }
22510
- );
22511
- }
22512
- async searchMarket({ ...params }) {
22513
- return http.get(
22514
- `${this.getHost()}/openapi/gateway/scan/market/search`,
22515
- params
22516
- );
22517
- }
22518
- async addFavorite({
22519
- accessToken,
22520
- address,
22521
- ...params
22522
- }) {
22523
- return http.get(
22524
- `${this.getHost()}/openapi/gateway/scan/market/add-favorites`,
22525
- params,
20787
+ ],
20788
+ outputs: []
20789
+ },
20790
+ {
20791
+ type: "function",
20792
+ name: "collectForwardFeeIfNecessary",
20793
+ constant: false,
20794
+ payable: false,
20795
+ inputs: [
22526
20796
  {
22527
- headers: {
22528
- myx_openapi_access_token: accessToken,
22529
- myx_openapi_account: address
22530
- }
20797
+ type: "uint8",
20798
+ name: "source"
20799
+ },
20800
+ {
20801
+ type: "bytes",
20802
+ name: "data"
22531
20803
  }
22532
- );
22533
- }
22534
- async removeFavorite({
22535
- accessToken,
22536
- address,
22537
- ...params
22538
- }) {
22539
- return http.get(
22540
- `${this.getHost()}/openapi/gateway/scan/market/cancel-favorites`,
22541
- params,
20804
+ ],
20805
+ outputs: []
20806
+ },
20807
+ {
20808
+ type: "function",
20809
+ name: "depositFor",
20810
+ constant: false,
20811
+ payable: false,
20812
+ inputs: [
22542
20813
  {
22543
- headers: {
22544
- myx_openapi_access_token: accessToken,
22545
- myx_openapi_account: address
22546
- }
20814
+ type: "address",
20815
+ name: "user"
20816
+ },
20817
+ {
20818
+ type: "address",
20819
+ name: "token"
20820
+ },
20821
+ {
20822
+ type: "uint256",
20823
+ name: "amount"
22547
20824
  }
22548
- );
22549
- }
22550
- async getFavoritesList({
22551
- accessToken,
22552
- address,
22553
- ...params
22554
- }) {
22555
- return http.get(
22556
- `${this.getHost()}/openapi/gateway/scan/market/favorites`,
22557
- params,
20825
+ ],
20826
+ outputs: []
20827
+ },
20828
+ {
20829
+ type: "function",
20830
+ name: "depositToAccount",
20831
+ constant: false,
20832
+ payable: false,
20833
+ inputs: [
22558
20834
  {
22559
- headers: {
22560
- myx_openapi_access_token: accessToken,
22561
- myx_openapi_account: address
22562
- }
20835
+ type: "address",
20836
+ name: "recipient"
20837
+ },
20838
+ {
20839
+ type: "address",
20840
+ name: "token"
20841
+ },
20842
+ {
20843
+ type: "uint256",
20844
+ name: "amount"
22563
20845
  }
22564
- );
22565
- }
22566
- async getBaseDetail({ ...params }) {
22567
- return http.get(
22568
- `${this.getHost()}/openapi/gateway/scan/market/base-details`,
22569
- params
22570
- );
22571
- }
22572
- async getMarketDetail({ ...params }) {
22573
- return http.get(
22574
- `${this.getHost()}/openapi/gateway/scan/market/detail`,
22575
- params
22576
- );
22577
- }
22578
- async getHistoryOrders({
22579
- accessToken,
22580
- address,
22581
- ...params
22582
- }) {
22583
- return http.get(
22584
- `${this.getHost()}/openapi/gateway/scan/order/closed`,
22585
- params,
20846
+ ],
20847
+ outputs: []
20848
+ },
20849
+ {
20850
+ type: "function",
20851
+ name: "getAddressManager",
20852
+ constant: true,
20853
+ stateMutability: "view",
20854
+ payable: false,
20855
+ inputs: [],
20856
+ outputs: [
22586
20857
  {
22587
- headers: {
22588
- myx_openapi_account: address,
22589
- myx_openapi_access_token: accessToken
22590
- }
20858
+ type: "address"
22591
20859
  }
22592
- );
22593
- }
22594
- async getPositionHistory({
22595
- accessToken,
22596
- address,
22597
- ...params
22598
- }) {
22599
- return http.get(
22600
- `${this.getHost()}/openapi/gateway/scan/position/closed`,
22601
- params,
20860
+ ]
20861
+ },
20862
+ {
20863
+ type: "function",
20864
+ name: "getDependencyAddress",
20865
+ constant: true,
20866
+ stateMutability: "view",
20867
+ payable: false,
20868
+ inputs: [
22602
20869
  {
22603
- headers: {
22604
- myx_openapi_account: address,
22605
- myx_openapi_access_token: accessToken
22606
- }
20870
+ type: "bytes32",
20871
+ name: "identifier"
22607
20872
  }
22608
- );
22609
- }
22610
- async getMarketList() {
22611
- return http.get(
22612
- `${this.getHost()}/openapi/gateway/scan/market`
22613
- );
22614
- }
22615
- async getAccountVipInfo({
22616
- address,
22617
- accessToken,
22618
- chainId,
22619
- deadline,
22620
- nonce
22621
- }) {
22622
- return http.get(
22623
- `${this.getHost()}/openapi/gateway/vip/trade_config`,
22624
- { chainId, deadline, nonce },
20873
+ ],
20874
+ outputs: [
22625
20875
  {
22626
- headers: {
22627
- myx_openapi_account: address,
22628
- myx_openapi_access_token: accessToken
22629
- }
20876
+ type: "address"
22630
20877
  }
22631
- );
22632
- }
22633
- /**
22634
- * appeal module start ------>
22635
- */
22636
- async getAppealList(params) {
22637
- return this.get(
22638
- "/openapi/gateway/scan/dispute/list",
22639
- params,
20878
+ ]
20879
+ },
20880
+ {
20881
+ type: "function",
20882
+ name: "getImplementation",
20883
+ constant: true,
20884
+ stateMutability: "view",
20885
+ payable: false,
20886
+ inputs: [],
20887
+ outputs: [
22640
20888
  {
22641
- auth: true
20889
+ type: "address"
22642
20890
  }
22643
- );
22644
- }
22645
- async getAppealDetail(params) {
22646
- return this.get(
22647
- "/openapi/gateway/scan/dispute/details",
22648
- params,
20891
+ ]
20892
+ },
20893
+ {
20894
+ type: "function",
20895
+ name: "initialize",
20896
+ constant: false,
20897
+ payable: false,
20898
+ inputs: [
22649
20899
  {
22650
- auth: true
20900
+ type: "address",
20901
+ name: "addressManager"
22651
20902
  }
22652
- );
22653
- }
22654
- async uploadAppealEvidence(params) {
22655
- return this.get(
22656
- "/openapi/gateway/scan/dispute/upload/evidence",
22657
- params,
20903
+ ],
20904
+ outputs: []
20905
+ },
20906
+ {
20907
+ type: "function",
20908
+ name: "isTrustedForwarder",
20909
+ constant: true,
20910
+ stateMutability: "view",
20911
+ payable: false,
20912
+ inputs: [
22658
20913
  {
22659
- auth: true
20914
+ type: "address",
20915
+ name: "forwarder"
22660
20916
  }
22661
- );
22662
- }
22663
- async getAppealReconsiderationList(params) {
22664
- return this.get(
22665
- "/openapi/gateway/scan/dispute/appeal/list",
22666
- params,
20917
+ ],
20918
+ outputs: [
22667
20919
  {
22668
- auth: true
20920
+ type: "bool"
22669
20921
  }
22670
- );
22671
- }
22672
- async getAppealReconsiderationDetail(params) {
22673
- return this.get(
22674
- "/openapi/gateway/scan/appeal/details",
22675
- params,
20922
+ ]
20923
+ },
20924
+ {
20925
+ type: "function",
20926
+ name: "proxiableUUID",
20927
+ constant: true,
20928
+ stateMutability: "view",
20929
+ payable: false,
20930
+ inputs: [],
20931
+ outputs: [
22676
20932
  {
22677
- auth: true
20933
+ type: "bytes32"
22678
20934
  }
22679
- );
22680
- }
22681
- async getAppealReimbursementList(params) {
22682
- return this.get(
22683
- "/openapi/gateway/scan/reimbursement/list",
22684
- params,
20935
+ ]
20936
+ },
20937
+ {
20938
+ type: "function",
20939
+ name: "trustedForwarder",
20940
+ constant: true,
20941
+ stateMutability: "view",
20942
+ payable: false,
20943
+ inputs: [],
20944
+ outputs: [
22685
20945
  {
22686
- auth: true
20946
+ type: "address"
22687
20947
  }
22688
- );
22689
- }
22690
- async getAppealNodeVoteList(params) {
22691
- return this.get(
22692
- "/openapi/gateway/scan/node/vote-list",
22693
- params
22694
- );
22695
- }
22696
- async getAppealNodeVoteDetails(params) {
22697
- return this.get(
22698
- "/openapi/gateway/scan/node/vote-details",
22699
- params
22700
- );
22701
- }
22702
- async getIsVoteNode(params) {
22703
- return this.get(
22704
- "/openapi/gateway/scan/node/vote-node-check",
22705
- params
22706
- );
22707
- }
22708
- async postVoteSignature(params) {
22709
- return this.get(
22710
- `/openapi/gateway/scan/node/vote`,
22711
- params,
20948
+ ]
20949
+ },
20950
+ {
20951
+ type: "function",
20952
+ name: "upgradeTo",
20953
+ constant: false,
20954
+ stateMutability: "payable",
20955
+ payable: true,
20956
+ inputs: [
22712
20957
  {
22713
- auth: true
22714
- }
22715
- );
22716
- }
22717
- async getPedingVoteCount() {
22718
- return this.get(
22719
- "/openapi/gateway/scan/node/pending-vote-total",
22720
- {},
20958
+ type: "address",
20959
+ name: "newImplementation"
20960
+ },
22721
20961
  {
22722
- auth: true
20962
+ type: "bytes",
20963
+ name: "data"
22723
20964
  }
22724
- );
22725
- }
22726
- async getMyAppealCount() {
22727
- return this.get(
22728
- "/openapi/gateway/scan/processing-total",
22729
- {},
20965
+ ],
20966
+ outputs: []
20967
+ },
20968
+ {
20969
+ type: "function",
20970
+ name: "upgradeToAndCall",
20971
+ constant: false,
20972
+ stateMutability: "payable",
20973
+ payable: true,
20974
+ inputs: [
22730
20975
  {
22731
- auth: true
22732
- }
22733
- );
22734
- }
22735
- /**
22736
- * appeal module end ------>
22737
- */
22738
- async getCurrentEpoch({
22739
- address,
22740
- accessToken,
22741
- broker
22742
- }) {
22743
- return http.get(
22744
- `${this.getHost()}/openapi/gateway/scan/get-current-epoch`,
22745
- { broker },
20976
+ type: "address",
20977
+ name: "newImplementation"
20978
+ },
22746
20979
  {
22747
- headers: {
22748
- myx_openapi_account: address,
22749
- myx_openapi_access_token: accessToken
22750
- }
20980
+ type: "bytes",
20981
+ name: "data"
22751
20982
  }
22752
- );
22753
- }
22754
- };
22755
-
22756
- // src/manager/seamless/index.ts
22757
- import CryptoJS from "crypto-js";
22758
- import { toUtf8Bytes, keccak256, hexlify, ethers as ethers9, isHexString, getBytes, ZeroAddress as ZeroAddress2 } from "ethers";
22759
- import dayjs4 from "dayjs";
22760
-
22761
- // src/utils/index.ts
22762
- var getEIP712Domain = async (contract) => {
22763
- try {
22764
- const eip712Domain = await contract.eip712Domain();
22765
- console.log("eip712Domain-->", eip712Domain.name);
22766
- console.log("eip712Domain.version-->", eip712Domain.version);
22767
- return {
22768
- name: eip712Domain.name,
22769
- version: eip712Domain.version,
22770
- chainId: BigInt(eip712Domain.chainId),
22771
- // 确保 chainId 是ForwarderGetStatus bigint 类型
22772
- verifyingContract: eip712Domain.verifyingContract
22773
- };
22774
- } catch (error) {
22775
- throw new Error(`Error fetching EIP712 domain: ${error}`);
20983
+ ],
20984
+ outputs: []
22776
20985
  }
22777
- };
20986
+ ];
22778
20987
 
22779
20988
  // src/manager/seamless/index.ts
22780
- import { splitSignature } from "@ethersproject/bytes";
22781
20989
  var contractTypes = {
22782
20990
  ForwardRequest: [
22783
20991
  { name: "from", type: "address" },
@@ -22865,8 +21073,11 @@ var Seamless = class {
22865
21073
  }
22866
21074
  const contractAddress = getContractAddressByChainId(chainId);
22867
21075
  const masterAddress = await config.signer.getAddress();
22868
- const forwarderContract = await getForwarderContract(chainId);
22869
- const forwarderAddress = forwarderContract.target;
21076
+ const tradingRouterContract = new ethers9.Contract(
21077
+ contractAddress.TRADING_ROUTER,
21078
+ TradingRouter_default,
21079
+ config.signer
21080
+ );
22870
21081
  const erc20Contract = new ethers9.Contract(
22871
21082
  contractAddress.ERC20,
22872
21083
  ERC20Token_default,
@@ -22874,49 +21085,27 @@ var Seamless = class {
22874
21085
  );
22875
21086
  try {
22876
21087
  const nonces = await erc20Contract.nonces(masterAddress);
22877
- const forwarderSignPermit = await signPermit(
21088
+ const tradingRouterSignPermit = await signPermit(
22878
21089
  config.signer,
22879
- // 使用 signer 而不是 provider
22880
- erc20Contract,
21090
+ tradingRouterContract,
22881
21091
  masterAddress,
22882
- forwarderAddress,
21092
+ contractAddress.TRADING_ROUTER,
22883
21093
  ethers9.MaxUint256.toString(),
22884
21094
  nonces.toString(),
22885
21095
  deadline.toString()
22886
21096
  );
22887
- const accountSignPermit = await signPermit(
22888
- config.signer,
22889
- // 使用 signer 而不是 provider
22890
- erc20Contract,
22891
- masterAddress,
22892
- contractAddress.Account,
22893
- ethers9.MaxUint256.toString(),
22894
- (nonces + BigInt(1)).toString(),
22895
- deadline.toString()
22896
- );
22897
- const forwarderPermitParams = {
22898
- token: erc20Contract.target,
22899
- owner: masterAddress,
22900
- spender: forwarderAddress,
22901
- value: ethers9.MaxUint256,
22902
- deadline,
22903
- v: forwarderSignPermit.v,
22904
- r: forwarderSignPermit.r,
22905
- s: forwarderSignPermit.s
22906
- };
22907
- const accountPermitParams = {
22908
- token: erc20Contract.target,
21097
+ const tradingRouterPermitParams = {
21098
+ token: contractAddress.ERC20,
22909
21099
  owner: masterAddress,
22910
- spender: contractAddress.Account,
22911
- value: ethers9.MaxUint256,
22912
- deadline,
22913
- v: accountSignPermit.v,
22914
- r: accountSignPermit.r,
22915
- s: accountSignPermit.s
21100
+ spender: contractAddress.TRADING_ROUTER,
21101
+ value: ethers9.MaxUint256.toString(),
21102
+ deadline: deadline.toString(),
21103
+ v: tradingRouterSignPermit.v,
21104
+ r: tradingRouterSignPermit.r,
21105
+ s: tradingRouterSignPermit.s
22916
21106
  };
22917
- return [forwarderPermitParams, accountPermitParams];
21107
+ return [tradingRouterPermitParams];
22918
21108
  } catch (error) {
22919
- this.logger.error("error-->", error);
22920
21109
  throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
22921
21110
  }
22922
21111
  }
@@ -22947,7 +21136,8 @@ var Seamless = class {
22947
21136
  deadline,
22948
21137
  data
22949
21138
  });
22950
- const txRs = await this.api.forwarderTxApi({ from, to, value, gas, nonce, data, deadline, signature }, chainId);
21139
+ const forwardFeeToken = executeAddressByChainId(chainId);
21140
+ const txRs = await this.api.forwarderTxApi({ from, to, value, gas, nonce, data, deadline, signature, forwardFeeToken }, chainId);
22951
21141
  return txRs;
22952
21142
  }
22953
21143
  async authorizeSeamlessAccount({ approve: approve2, seamlessAddress, chainId }) {
@@ -23183,212 +21373,6 @@ var BaseMyxClient = class {
23183
21373
  }
23184
21374
  };
23185
21375
 
23186
- // src/manager/appeal/index.ts
23187
- var Appeal = class extends BaseMyxClient {
23188
- constructor(client2) {
23189
- super(client2);
23190
- }
23191
- async getDisputeCourtContract() {
23192
- const contract = await getDisputeCourtContract(this.config.chainId);
23193
- return this.connectContract(contract);
23194
- }
23195
- async getReimbursementContract() {
23196
- const contract = await getReimbursementContract(this.config.chainId);
23197
- return this.connectContract(contract);
23198
- }
23199
- /**
23200
- * submit appeal
23201
- * @param poolId - the pool id
23202
- * @param poolToken - the pool token
23203
- * @returns the transaction receipt
23204
- */
23205
- async submitAppeal(poolId, lpToken, lpAmount) {
23206
- const account = await this.config.signer?.getAddress() ?? "";
23207
- const needApprove = await this.client.utils.needsApproval(
23208
- account,
23209
- this.config.chainId,
23210
- lpToken,
23211
- lpAmount,
23212
- this.getAddressConfig().DISPUTE_COURT
23213
- );
23214
- this.client.logger.debug("need-approve", needApprove);
23215
- if (needApprove) {
23216
- await this.client.utils.approveAuthorization({
23217
- chainId: this.config.chainId,
23218
- quoteAddress: lpToken,
23219
- spenderAddress: this.getAddressConfig().DISPUTE_COURT
23220
- });
23221
- }
23222
- const contract = await this.getDisputeCourtContract();
23223
- const prices = await this.client.utils.buildUpdatePriceParams(
23224
- poolId,
23225
- this.config.chainId
23226
- );
23227
- const value = BigInt(prices[0].value.toString() || "1");
23228
- const _gasLimit = await contract.fileDispute.estimateGas(
23229
- prices,
23230
- poolId,
23231
- lpToken,
23232
- {
23233
- value
23234
- }
23235
- );
23236
- this.client.logger.debug("_gasLimit", _gasLimit);
23237
- const gasLimit = await this.client.utils.getGasLimitByRatio(_gasLimit);
23238
- const gasPrice = await this.client.utils.getGasPriceByRatio();
23239
- this.client.logger.debug("txParams", {
23240
- gasLimit,
23241
- gasPrice,
23242
- value
23243
- });
23244
- const tx = await contract.fileDispute(prices, poolId, lpToken, {
23245
- value,
23246
- gasLimit,
23247
- gasPrice
23248
- });
23249
- const receipt = await tx.wait();
23250
- return receipt;
23251
- }
23252
- /**
23253
- * vote for appeal
23254
- * @param caseId - the case id
23255
- * @param isFor - true if for the appeal, false if against the appeal
23256
- * @returns the transaction receipt
23257
- */
23258
- async voteForAppeal({
23259
- caseId,
23260
- validator,
23261
- isFor,
23262
- deadline,
23263
- v,
23264
- r,
23265
- s
23266
- }) {
23267
- const contract = await this.getDisputeCourtContract();
23268
- const _gasLimit = await contract.vote.estimateGas(
23269
- caseId,
23270
- validator,
23271
- isFor ? 1 : 0,
23272
- deadline,
23273
- v,
23274
- r,
23275
- s
23276
- );
23277
- const gasLimit = await this.client.utils.getGasLimitByRatio(_gasLimit);
23278
- const gasPrice = await this.client.utils.getGasPriceByRatio();
23279
- const tx = await contract.vote(
23280
- caseId,
23281
- validator,
23282
- isFor ? 1 : 0,
23283
- deadline,
23284
- v,
23285
- r,
23286
- s,
23287
- {
23288
- gasLimit,
23289
- gasPrice
23290
- }
23291
- );
23292
- const receipt = await tx.wait();
23293
- return receipt;
23294
- }
23295
- /**
23296
- * claim appeal margin
23297
- * @param caseId - the case id
23298
- * @returns the transaction receipt
23299
- */
23300
- async claimAppealMargin(caseId) {
23301
- const contract = await this.getDisputeCourtContract();
23302
- const _gasLimit = await contract.claimBond.estimateGas(caseId);
23303
- const gasLimit = await this.client.utils.getGasLimitByRatio(_gasLimit);
23304
- const gasPrice = await this.client.utils.getGasPriceByRatio();
23305
- const tx = await contract.claimBond(caseId, {
23306
- gasLimit,
23307
- gasPrice
23308
- });
23309
- const receipt = await tx.wait();
23310
- return receipt;
23311
- }
23312
- /**
23313
- * claim reimbursement
23314
- * @param caseId - the case id
23315
- * @param baseAmount - the base amount
23316
- * @param quoteAmount - the quote amount
23317
- * @param merkleProof - the merkle proof
23318
- * @returns the transaction receipt
23319
- */
23320
- async claimReimbursement(caseId, baseAmount, quoteAmount, merkleProof) {
23321
- const contract = await this.getReimbursementContract();
23322
- const _gasLimit = await contract.claimReimbursement.estimateGas(
23323
- caseId,
23324
- baseAmount,
23325
- quoteAmount,
23326
- merkleProof
23327
- );
23328
- const gasLimit = await this.client.utils.getGasLimitByRatio(_gasLimit);
23329
- const gasPrice = await this.client.utils.getGasPriceByRatio();
23330
- const tx = await contract.claimReimbursement(
23331
- caseId,
23332
- baseAmount,
23333
- quoteAmount,
23334
- merkleProof,
23335
- {
23336
- gasLimit,
23337
- gasPrice
23338
- }
23339
- );
23340
- const receipt = await tx.wait();
23341
- return receipt;
23342
- }
23343
- /**
23344
- * get dispute configuration
23345
- */
23346
- async getDisputeConfiguration() {
23347
- const contract = await this.getDisputeCourtContract();
23348
- const configuration = await contract.getDisputeConfiguration();
23349
- return configuration;
23350
- }
23351
- /**
23352
- * http api
23353
- */
23354
- async getAppealList(params) {
23355
- return this.client.api.getAppealList(params);
23356
- }
23357
- async getAppealDetail(params) {
23358
- return this.client.api.getAppealDetail(params);
23359
- }
23360
- async uploadAppealEvidence(params) {
23361
- return this.client.api.uploadAppealEvidence(params);
23362
- }
23363
- async getAppealReconsiderationList(params) {
23364
- return this.client.api.getAppealReconsiderationList(params);
23365
- }
23366
- async getAppealReconsiderationDetail(params) {
23367
- return this.client.api.getAppealReconsiderationDetail(params);
23368
- }
23369
- async getAppealReimbursementList(params) {
23370
- return this.client.api.getAppealReimbursementList(params);
23371
- }
23372
- async getAppealNodeVoteList(params) {
23373
- return this.client.api.getAppealNodeVoteList(params);
23374
- }
23375
- async getAppealNodeVoteDetail(params) {
23376
- return this.client.api.getAppealNodeVoteDetails(params);
23377
- }
23378
- async getIsVoteNode(params) {
23379
- return this.client.api.getIsVoteNode(params);
23380
- }
23381
- async postVoteSignature(params) {
23382
- return this.client.api.postVoteSignature(params);
23383
- }
23384
- async getPedingVoteCount() {
23385
- return this.client.api.getPedingVoteCount();
23386
- }
23387
- async getMyAppealCount() {
23388
- return this.client.api.getMyAppealCount();
23389
- }
23390
- };
23391
-
23392
21376
  // src/manager/referrals/index.tsx
23393
21377
  var Referrals = class extends BaseMyxClient {
23394
21378
  constructor(client2) {
@@ -23401,8 +21385,13 @@ var Referrals = class extends BaseMyxClient {
23401
21385
  const _gasLimit = await brokerContract.claimRebate.estimateGas(
23402
21386
  tokenAddress
23403
21387
  );
23404
- const gasLimit = await this.client.utils.getGasLimitByRatio(_gasLimit);
23405
- const gasPrice = await this.client.utils.getGasPriceByRatio();
21388
+ const gasLimit = await this.client.utils.getGasLimitByRatio(
21389
+ this.config.chainId,
21390
+ _gasLimit
21391
+ );
21392
+ const gasPrice = await this.client.utils.getGasPriceByRatio(
21393
+ this.config.chainId
21394
+ );
23406
21395
  const tx = await brokerContract.claimRebate(tokenAddress, {
23407
21396
  gasPrice,
23408
21397
  gasLimit
@@ -23412,73 +21401,6 @@ var Referrals = class extends BaseMyxClient {
23412
21401
  }
23413
21402
  };
23414
21403
 
23415
- // src/manager/api/appeal-type.ts
23416
- var AppealType = /* @__PURE__ */ ((AppealType2) => {
23417
- AppealType2[AppealType2["UnderReview"] = 1] = "UnderReview";
23418
- AppealType2[AppealType2["InitialVote"] = 2] = "InitialVote";
23419
- AppealType2[AppealType2["PublicNotice"] = 3] = "PublicNotice";
23420
- AppealType2[AppealType2["UnderReconsideration"] = 4] = "UnderReconsideration";
23421
- AppealType2[AppealType2["Won"] = 5] = "Won";
23422
- AppealType2[AppealType2["Failed"] = 6] = "Failed";
23423
- AppealType2[AppealType2["PlatformRuling"] = 7] = "PlatformRuling";
23424
- AppealType2[AppealType2["PlatformRevoked"] = 8] = "PlatformRevoked";
23425
- return AppealType2;
23426
- })(AppealType || {});
23427
- var AppealReconsiderationType = /* @__PURE__ */ ((AppealReconsiderationType2) => {
23428
- AppealReconsiderationType2[AppealReconsiderationType2["InitialVoting"] = 1] = "InitialVoting";
23429
- AppealReconsiderationType2[AppealReconsiderationType2["PublicNotice"] = 2] = "PublicNotice";
23430
- AppealReconsiderationType2[AppealReconsiderationType2["UnderReconsideration"] = 3] = "UnderReconsideration";
23431
- AppealReconsiderationType2[AppealReconsiderationType2["Won"] = 4] = "Won";
23432
- AppealReconsiderationType2[AppealReconsiderationType2["Failed"] = 5] = "Failed";
23433
- AppealReconsiderationType2[AppealReconsiderationType2["PlatformRuling"] = 6] = "PlatformRuling";
23434
- AppealReconsiderationType2[AppealReconsiderationType2["PlatformRevoked"] = 7] = "PlatformRevoked";
23435
- AppealReconsiderationType2[AppealReconsiderationType2["ReconsiderationVoting"] = 8] = "ReconsiderationVoting";
23436
- return AppealReconsiderationType2;
23437
- })(AppealReconsiderationType || {});
23438
- var AppealStage = /* @__PURE__ */ ((AppealStage2) => {
23439
- AppealStage2[AppealStage2["UnderReview"] = 1] = "UnderReview";
23440
- AppealStage2[AppealStage2["PublicNotice"] = 2] = "PublicNotice";
23441
- AppealStage2[AppealStage2["UnderReconsideration"] = 3] = "UnderReconsideration";
23442
- AppealStage2[AppealStage2["Completed"] = 4] = "Completed";
23443
- return AppealStage2;
23444
- })(AppealStage || {});
23445
- var NodeTypeEnum = /* @__PURE__ */ ((NodeTypeEnum2) => {
23446
- NodeTypeEnum2[NodeTypeEnum2["ElectionNode"] = 0] = "ElectionNode";
23447
- NodeTypeEnum2[NodeTypeEnum2["OfficialNode"] = 1] = "OfficialNode";
23448
- return NodeTypeEnum2;
23449
- })(NodeTypeEnum || {});
23450
- var VoteTypeEnum = /* @__PURE__ */ ((VoteTypeEnum2) => {
23451
- VoteTypeEnum2[VoteTypeEnum2["Reject"] = 0] = "Reject";
23452
- VoteTypeEnum2[VoteTypeEnum2["Support"] = 1] = "Support";
23453
- return VoteTypeEnum2;
23454
- })(VoteTypeEnum || {});
23455
- var AppealClaimStatusEnum = /* @__PURE__ */ ((AppealClaimStatusEnum2) => {
23456
- AppealClaimStatusEnum2[AppealClaimStatusEnum2["UnClaimed"] = 0] = "UnClaimed";
23457
- AppealClaimStatusEnum2[AppealClaimStatusEnum2["Claimed"] = 1] = "Claimed";
23458
- return AppealClaimStatusEnum2;
23459
- })(AppealClaimStatusEnum || {});
23460
- var AppealNodeVotedStateEnum = /* @__PURE__ */ ((AppealNodeVotedStateEnum2) => {
23461
- AppealNodeVotedStateEnum2[AppealNodeVotedStateEnum2["NotVoted"] = 0] = "NotVoted";
23462
- AppealNodeVotedStateEnum2[AppealNodeVotedStateEnum2["Voted"] = 1] = "Voted";
23463
- return AppealNodeVotedStateEnum2;
23464
- })(AppealNodeVotedStateEnum || {});
23465
- var AppealCaseTypeEnum = /* @__PURE__ */ ((AppealCaseTypeEnum2) => {
23466
- AppealCaseTypeEnum2[AppealCaseTypeEnum2["Appeal"] = 1] = "Appeal";
23467
- AppealCaseTypeEnum2[AppealCaseTypeEnum2["Reconsideration"] = 2] = "Reconsideration";
23468
- return AppealCaseTypeEnum2;
23469
- })(AppealCaseTypeEnum || {});
23470
- var AppealNodeStateEnum = /* @__PURE__ */ ((AppealNodeStateEnum2) => {
23471
- AppealNodeStateEnum2[AppealNodeStateEnum2["NoVote"] = 0] = "NoVote";
23472
- AppealNodeStateEnum2[AppealNodeStateEnum2["Supported"] = 1] = "Supported";
23473
- AppealNodeStateEnum2[AppealNodeStateEnum2["Rejected"] = 2] = "Rejected";
23474
- return AppealNodeStateEnum2;
23475
- })(AppealNodeStateEnum || {});
23476
- var IsVoteNodeEnum = /* @__PURE__ */ ((IsVoteNodeEnum2) => {
23477
- IsVoteNodeEnum2[IsVoteNodeEnum2["Yes"] = 1] = "Yes";
23478
- IsVoteNodeEnum2[IsVoteNodeEnum2["No"] = 0] = "No";
23479
- return IsVoteNodeEnum2;
23480
- })(IsVoteNodeEnum || {});
23481
-
23482
21404
  // src/manager/index.ts
23483
21405
  var MyxClient = class {
23484
21406
  /**
@@ -23528,7 +21450,6 @@ var MyxClient = class {
23528
21450
  this.api
23529
21451
  );
23530
21452
  this.subscription = new SubScription(this.configManager, this.logger);
23531
- this.appeal = new Appeal(this);
23532
21453
  this.referrals = new Referrals(this);
23533
21454
  }
23534
21455
  /**
@@ -23555,13 +21476,6 @@ var MyxClient = class {
23555
21476
  }
23556
21477
  };
23557
21478
  export {
23558
- AppealCaseTypeEnum,
23559
- AppealClaimStatusEnum,
23560
- AppealNodeStateEnum,
23561
- AppealNodeVotedStateEnum,
23562
- AppealReconsiderationType,
23563
- AppealStage,
23564
- AppealType,
23565
21479
  COMMON_LP_AMOUNT_DECIMALS,
23566
21480
  COMMON_PRICE_DECIMALS,
23567
21481
  ChainId,
@@ -23572,13 +21486,11 @@ export {
23572
21486
  ExecTypeEnum,
23573
21487
  ForwarderGetStatus,
23574
21488
  HttpKlineIntervalEnum,
23575
- IsVoteNodeEnum,
23576
21489
  MarketCapType,
23577
21490
  MarketPoolState,
23578
21491
  MarketType,
23579
21492
  MxSDK,
23580
21493
  MyxClient,
23581
- NodeTypeEnum,
23582
21494
  OperationEnum,
23583
21495
  OperationType,
23584
21496
  OracleType,
@@ -23593,7 +21505,6 @@ export {
23593
21505
  TradeFlowTypeEnum,
23594
21506
  TriggerType2 as TriggerType,
23595
21507
  TriggerTypeEnum,
23596
- VoteTypeEnum,
23597
21508
  approve,
23598
21509
  base_exports as base,
23599
21510
  bigintAmountSlipperCalculator,