@myx-trade/sdk 0.1.246 → 0.1.248
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.js +180 -536
- package/dist/index.mjs +180 -536
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1851,7 +1851,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1851
1851
|
// package.json
|
|
1852
1852
|
var package_default = {
|
|
1853
1853
|
name: "@myx-trade/sdk",
|
|
1854
|
-
version: "0.1.
|
|
1854
|
+
version: "0.1.248",
|
|
1855
1855
|
private: false,
|
|
1856
1856
|
publishConfig: {
|
|
1857
1857
|
access: "public"
|
|
@@ -8522,6 +8522,10 @@ var DataProvider_default = [
|
|
|
8522
8522
|
type: "uint256",
|
|
8523
8523
|
name: "quoteProfit"
|
|
8524
8524
|
},
|
|
8525
|
+
{
|
|
8526
|
+
type: "uint256",
|
|
8527
|
+
name: "reservedAmount"
|
|
8528
|
+
},
|
|
8525
8529
|
{
|
|
8526
8530
|
type: "uint64",
|
|
8527
8531
|
name: "releaseTime"
|
|
@@ -8576,8 +8580,8 @@ var DataProvider_default = [
|
|
|
8576
8580
|
name: "assetClasses"
|
|
8577
8581
|
},
|
|
8578
8582
|
{
|
|
8579
|
-
type: "uint8[]
|
|
8580
|
-
name: "
|
|
8583
|
+
type: "uint8[]",
|
|
8584
|
+
name: "riskTiers"
|
|
8581
8585
|
},
|
|
8582
8586
|
{
|
|
8583
8587
|
type: "bool",
|
|
@@ -9091,6 +9095,33 @@ var DataProvider_default = [
|
|
|
9091
9095
|
}
|
|
9092
9096
|
]
|
|
9093
9097
|
},
|
|
9098
|
+
{
|
|
9099
|
+
type: "function",
|
|
9100
|
+
name: "getSumProfitLock",
|
|
9101
|
+
constant: true,
|
|
9102
|
+
stateMutability: "view",
|
|
9103
|
+
payable: false,
|
|
9104
|
+
inputs: [
|
|
9105
|
+
{
|
|
9106
|
+
type: "bytes32",
|
|
9107
|
+
name: "poolId"
|
|
9108
|
+
},
|
|
9109
|
+
{
|
|
9110
|
+
type: "address[]",
|
|
9111
|
+
name: "respondents"
|
|
9112
|
+
}
|
|
9113
|
+
],
|
|
9114
|
+
outputs: [
|
|
9115
|
+
{
|
|
9116
|
+
type: "uint256",
|
|
9117
|
+
name: "baseAmount"
|
|
9118
|
+
},
|
|
9119
|
+
{
|
|
9120
|
+
type: "uint256",
|
|
9121
|
+
name: "quoteAmount"
|
|
9122
|
+
}
|
|
9123
|
+
]
|
|
9124
|
+
},
|
|
9094
9125
|
{
|
|
9095
9126
|
type: "function",
|
|
9096
9127
|
name: "getUserPositionInfos",
|
|
@@ -9326,6 +9357,24 @@ var Forwarder_default = [
|
|
|
9326
9357
|
name: "InvalidInitialization",
|
|
9327
9358
|
inputs: []
|
|
9328
9359
|
},
|
|
9360
|
+
{
|
|
9361
|
+
type: "error",
|
|
9362
|
+
name: "MismatchExecuteFee",
|
|
9363
|
+
inputs: [
|
|
9364
|
+
{
|
|
9365
|
+
type: "uint256",
|
|
9366
|
+
name: "balanceBefore"
|
|
9367
|
+
},
|
|
9368
|
+
{
|
|
9369
|
+
type: "uint256",
|
|
9370
|
+
name: "balanceAfter"
|
|
9371
|
+
},
|
|
9372
|
+
{
|
|
9373
|
+
type: "uint256",
|
|
9374
|
+
name: "expected"
|
|
9375
|
+
}
|
|
9376
|
+
]
|
|
9377
|
+
},
|
|
9329
9378
|
{
|
|
9330
9379
|
type: "error",
|
|
9331
9380
|
name: "MismatchedSender",
|
|
@@ -9402,13 +9451,8 @@ var Forwarder_default = [
|
|
|
9402
9451
|
},
|
|
9403
9452
|
{
|
|
9404
9453
|
type: "error",
|
|
9405
|
-
name: "
|
|
9406
|
-
inputs: [
|
|
9407
|
-
{
|
|
9408
|
-
type: "address",
|
|
9409
|
-
name: "token"
|
|
9410
|
-
}
|
|
9411
|
-
]
|
|
9454
|
+
name: "RemoveRelayerFailed",
|
|
9455
|
+
inputs: []
|
|
9412
9456
|
},
|
|
9413
9457
|
{
|
|
9414
9458
|
type: "error",
|
|
@@ -9437,6 +9481,28 @@ var Forwarder_default = [
|
|
|
9437
9481
|
}
|
|
9438
9482
|
]
|
|
9439
9483
|
},
|
|
9484
|
+
{
|
|
9485
|
+
type: "event",
|
|
9486
|
+
anonymous: false,
|
|
9487
|
+
name: "ChargeForwardFee",
|
|
9488
|
+
inputs: [
|
|
9489
|
+
{
|
|
9490
|
+
type: "address",
|
|
9491
|
+
name: "account",
|
|
9492
|
+
indexed: false
|
|
9493
|
+
},
|
|
9494
|
+
{
|
|
9495
|
+
type: "address",
|
|
9496
|
+
name: "feeToken",
|
|
9497
|
+
indexed: false
|
|
9498
|
+
},
|
|
9499
|
+
{
|
|
9500
|
+
type: "uint256",
|
|
9501
|
+
name: "relayFee",
|
|
9502
|
+
indexed: false
|
|
9503
|
+
}
|
|
9504
|
+
]
|
|
9505
|
+
},
|
|
9440
9506
|
{
|
|
9441
9507
|
type: "event",
|
|
9442
9508
|
anonymous: false,
|
|
@@ -9543,7 +9609,7 @@ var Forwarder_default = [
|
|
|
9543
9609
|
{
|
|
9544
9610
|
type: "event",
|
|
9545
9611
|
anonymous: false,
|
|
9546
|
-
name: "
|
|
9612
|
+
name: "UpdateAcquiescentFeeToken",
|
|
9547
9613
|
inputs: [
|
|
9548
9614
|
{
|
|
9549
9615
|
type: "address",
|
|
@@ -9551,13 +9617,13 @@ var Forwarder_default = [
|
|
|
9551
9617
|
indexed: false
|
|
9552
9618
|
},
|
|
9553
9619
|
{
|
|
9554
|
-
type: "
|
|
9555
|
-
name: "
|
|
9620
|
+
type: "address",
|
|
9621
|
+
name: "oldRelayGas",
|
|
9556
9622
|
indexed: false
|
|
9557
9623
|
},
|
|
9558
9624
|
{
|
|
9559
|
-
type: "
|
|
9560
|
-
name: "
|
|
9625
|
+
type: "address",
|
|
9626
|
+
name: "newRelayGas",
|
|
9561
9627
|
indexed: false
|
|
9562
9628
|
}
|
|
9563
9629
|
]
|
|
@@ -9565,7 +9631,7 @@ var Forwarder_default = [
|
|
|
9565
9631
|
{
|
|
9566
9632
|
type: "event",
|
|
9567
9633
|
anonymous: false,
|
|
9568
|
-
name: "
|
|
9634
|
+
name: "UpdateEquilibriumGas",
|
|
9569
9635
|
inputs: [
|
|
9570
9636
|
{
|
|
9571
9637
|
type: "address",
|
|
@@ -9574,22 +9640,34 @@ var Forwarder_default = [
|
|
|
9574
9640
|
},
|
|
9575
9641
|
{
|
|
9576
9642
|
type: "uint256",
|
|
9577
|
-
name: "
|
|
9643
|
+
name: "oldRelayGas",
|
|
9578
9644
|
indexed: false
|
|
9579
9645
|
},
|
|
9580
9646
|
{
|
|
9581
9647
|
type: "uint256",
|
|
9582
|
-
name: "
|
|
9648
|
+
name: "newRelayGas",
|
|
9649
|
+
indexed: false
|
|
9650
|
+
}
|
|
9651
|
+
]
|
|
9652
|
+
},
|
|
9653
|
+
{
|
|
9654
|
+
type: "event",
|
|
9655
|
+
anonymous: false,
|
|
9656
|
+
name: "UpdateMaxRelayFee",
|
|
9657
|
+
inputs: [
|
|
9658
|
+
{
|
|
9659
|
+
type: "address",
|
|
9660
|
+
name: "sender",
|
|
9583
9661
|
indexed: false
|
|
9584
9662
|
},
|
|
9585
9663
|
{
|
|
9586
9664
|
type: "uint256",
|
|
9587
|
-
name: "
|
|
9665
|
+
name: "oldMaxRelayFee",
|
|
9588
9666
|
indexed: false
|
|
9589
9667
|
},
|
|
9590
9668
|
{
|
|
9591
9669
|
type: "uint256",
|
|
9592
|
-
name: "
|
|
9670
|
+
name: "newMaxRelayFee",
|
|
9593
9671
|
indexed: false
|
|
9594
9672
|
}
|
|
9595
9673
|
]
|
|
@@ -9652,6 +9730,10 @@ var Forwarder_default = [
|
|
|
9652
9730
|
stateMutability: "payable",
|
|
9653
9731
|
payable: true,
|
|
9654
9732
|
inputs: [
|
|
9733
|
+
{
|
|
9734
|
+
type: "address",
|
|
9735
|
+
name: "forwardFeeToken"
|
|
9736
|
+
},
|
|
9655
9737
|
{
|
|
9656
9738
|
type: "tuple[]",
|
|
9657
9739
|
name: "bundleParams",
|
|
@@ -9727,6 +9809,19 @@ var Forwarder_default = [
|
|
|
9727
9809
|
}
|
|
9728
9810
|
]
|
|
9729
9811
|
},
|
|
9812
|
+
{
|
|
9813
|
+
type: "function",
|
|
9814
|
+
name: "equilibriumGas",
|
|
9815
|
+
constant: true,
|
|
9816
|
+
stateMutability: "view",
|
|
9817
|
+
payable: false,
|
|
9818
|
+
inputs: [],
|
|
9819
|
+
outputs: [
|
|
9820
|
+
{
|
|
9821
|
+
type: "uint256"
|
|
9822
|
+
}
|
|
9823
|
+
]
|
|
9824
|
+
},
|
|
9730
9825
|
{
|
|
9731
9826
|
type: "function",
|
|
9732
9827
|
name: "execute",
|
|
@@ -9767,6 +9862,10 @@ var Forwarder_default = [
|
|
|
9767
9862
|
name: "signature"
|
|
9768
9863
|
}
|
|
9769
9864
|
]
|
|
9865
|
+
},
|
|
9866
|
+
{
|
|
9867
|
+
type: "address",
|
|
9868
|
+
name: "masterAccount"
|
|
9770
9869
|
}
|
|
9771
9870
|
],
|
|
9772
9871
|
outputs: []
|
|
@@ -9812,6 +9911,10 @@ var Forwarder_default = [
|
|
|
9812
9911
|
}
|
|
9813
9912
|
]
|
|
9814
9913
|
},
|
|
9914
|
+
{
|
|
9915
|
+
type: "address",
|
|
9916
|
+
name: "masterAccount"
|
|
9917
|
+
},
|
|
9815
9918
|
{
|
|
9816
9919
|
type: "address",
|
|
9817
9920
|
name: "refundReceiver"
|
|
@@ -9826,6 +9929,10 @@ var Forwarder_default = [
|
|
|
9826
9929
|
stateMutability: "payable",
|
|
9827
9930
|
payable: true,
|
|
9828
9931
|
inputs: [
|
|
9932
|
+
{
|
|
9933
|
+
type: "address",
|
|
9934
|
+
name: "forwardFeeToken"
|
|
9935
|
+
},
|
|
9829
9936
|
{
|
|
9830
9937
|
type: "tuple",
|
|
9831
9938
|
name: "params",
|
|
@@ -9865,16 +9972,11 @@ var Forwarder_default = [
|
|
|
9865
9972
|
},
|
|
9866
9973
|
{
|
|
9867
9974
|
type: "function",
|
|
9868
|
-
name: "
|
|
9869
|
-
constant:
|
|
9870
|
-
stateMutability: "view",
|
|
9975
|
+
name: "exitForwardMode",
|
|
9976
|
+
constant: false,
|
|
9871
9977
|
payable: false,
|
|
9872
9978
|
inputs: [],
|
|
9873
|
-
outputs: [
|
|
9874
|
-
{
|
|
9875
|
-
type: "address"
|
|
9876
|
-
}
|
|
9877
|
-
]
|
|
9979
|
+
outputs: []
|
|
9878
9980
|
},
|
|
9879
9981
|
{
|
|
9880
9982
|
type: "function",
|
|
@@ -9922,7 +10024,7 @@ var Forwarder_default = [
|
|
|
9922
10024
|
},
|
|
9923
10025
|
{
|
|
9924
10026
|
type: "function",
|
|
9925
|
-
name: "
|
|
10027
|
+
name: "getDesignatedToken",
|
|
9926
10028
|
constant: true,
|
|
9927
10029
|
stateMutability: "view",
|
|
9928
10030
|
payable: false,
|
|
@@ -9935,71 +10037,58 @@ var Forwarder_default = [
|
|
|
9935
10037
|
},
|
|
9936
10038
|
{
|
|
9937
10039
|
type: "function",
|
|
9938
|
-
name: "
|
|
10040
|
+
name: "getEquilibriumGas",
|
|
9939
10041
|
constant: true,
|
|
9940
10042
|
stateMutability: "view",
|
|
9941
10043
|
payable: false,
|
|
9942
10044
|
inputs: [],
|
|
9943
10045
|
outputs: [
|
|
9944
10046
|
{
|
|
9945
|
-
type: "
|
|
10047
|
+
type: "uint256"
|
|
9946
10048
|
}
|
|
9947
10049
|
]
|
|
9948
10050
|
},
|
|
9949
10051
|
{
|
|
9950
10052
|
type: "function",
|
|
9951
|
-
name: "
|
|
10053
|
+
name: "getImplementation",
|
|
9952
10054
|
constant: true,
|
|
9953
10055
|
stateMutability: "view",
|
|
9954
10056
|
payable: false,
|
|
9955
10057
|
inputs: [],
|
|
9956
10058
|
outputs: [
|
|
9957
10059
|
{
|
|
9958
|
-
type: "
|
|
10060
|
+
type: "address"
|
|
9959
10061
|
}
|
|
9960
10062
|
]
|
|
9961
10063
|
},
|
|
9962
10064
|
{
|
|
9963
10065
|
type: "function",
|
|
9964
|
-
name: "
|
|
10066
|
+
name: "getUserRelayers",
|
|
9965
10067
|
constant: true,
|
|
9966
10068
|
stateMutability: "view",
|
|
9967
10069
|
payable: false,
|
|
9968
|
-
inputs: [
|
|
9969
|
-
outputs: [
|
|
10070
|
+
inputs: [
|
|
9970
10071
|
{
|
|
9971
|
-
type: "
|
|
10072
|
+
type: "address",
|
|
10073
|
+
name: "account"
|
|
9972
10074
|
}
|
|
9973
|
-
]
|
|
9974
|
-
},
|
|
9975
|
-
{
|
|
9976
|
-
type: "function",
|
|
9977
|
-
name: "getRelayGas",
|
|
9978
|
-
constant: true,
|
|
9979
|
-
stateMutability: "view",
|
|
9980
|
-
payable: false,
|
|
9981
|
-
inputs: [],
|
|
10075
|
+
],
|
|
9982
10076
|
outputs: [
|
|
9983
10077
|
{
|
|
9984
|
-
type: "
|
|
10078
|
+
type: "address[]"
|
|
9985
10079
|
}
|
|
9986
10080
|
]
|
|
9987
10081
|
},
|
|
9988
10082
|
{
|
|
9989
10083
|
type: "function",
|
|
9990
|
-
name: "
|
|
10084
|
+
name: "inForwardMode",
|
|
9991
10085
|
constant: true,
|
|
9992
10086
|
stateMutability: "view",
|
|
9993
10087
|
payable: false,
|
|
9994
|
-
inputs: [
|
|
9995
|
-
{
|
|
9996
|
-
type: "address",
|
|
9997
|
-
name: "account"
|
|
9998
|
-
}
|
|
9999
|
-
],
|
|
10088
|
+
inputs: [],
|
|
10000
10089
|
outputs: [
|
|
10001
10090
|
{
|
|
10002
|
-
type: "
|
|
10091
|
+
type: "bool"
|
|
10003
10092
|
}
|
|
10004
10093
|
]
|
|
10005
10094
|
},
|
|
@@ -10013,35 +10102,23 @@ var Forwarder_default = [
|
|
|
10013
10102
|
type: "address",
|
|
10014
10103
|
name: "addressManager"
|
|
10015
10104
|
},
|
|
10016
|
-
{
|
|
10017
|
-
type: "address",
|
|
10018
|
-
name: "_feeToken"
|
|
10019
|
-
},
|
|
10020
|
-
{
|
|
10021
|
-
type: "uint256",
|
|
10022
|
-
name: "_relayFee"
|
|
10023
|
-
},
|
|
10024
10105
|
{
|
|
10025
10106
|
type: "uint256",
|
|
10026
|
-
name: "
|
|
10027
|
-
},
|
|
10028
|
-
{
|
|
10029
|
-
type: "uint256",
|
|
10030
|
-
name: "_maxRelayFee"
|
|
10107
|
+
name: "_equilibriumGas"
|
|
10031
10108
|
}
|
|
10032
10109
|
],
|
|
10033
10110
|
outputs: []
|
|
10034
10111
|
},
|
|
10035
10112
|
{
|
|
10036
10113
|
type: "function",
|
|
10037
|
-
name: "
|
|
10114
|
+
name: "isAllowedTargets",
|
|
10038
10115
|
constant: true,
|
|
10039
10116
|
stateMutability: "view",
|
|
10040
10117
|
payable: false,
|
|
10041
10118
|
inputs: [
|
|
10042
10119
|
{
|
|
10043
10120
|
type: "address",
|
|
10044
|
-
name: "
|
|
10121
|
+
name: "contractAddr"
|
|
10045
10122
|
}
|
|
10046
10123
|
],
|
|
10047
10124
|
outputs: [
|
|
@@ -10052,18 +10129,14 @@ var Forwarder_default = [
|
|
|
10052
10129
|
},
|
|
10053
10130
|
{
|
|
10054
10131
|
type: "function",
|
|
10055
|
-
name: "
|
|
10132
|
+
name: "isTrustedForwarder",
|
|
10056
10133
|
constant: true,
|
|
10057
10134
|
stateMutability: "view",
|
|
10058
10135
|
payable: false,
|
|
10059
10136
|
inputs: [
|
|
10060
10137
|
{
|
|
10061
10138
|
type: "address",
|
|
10062
|
-
name: "
|
|
10063
|
-
},
|
|
10064
|
-
{
|
|
10065
|
-
type: "address",
|
|
10066
|
-
name: "relayer"
|
|
10139
|
+
name: "forwarder"
|
|
10067
10140
|
}
|
|
10068
10141
|
],
|
|
10069
10142
|
outputs: [
|
|
@@ -10074,14 +10147,23 @@ var Forwarder_default = [
|
|
|
10074
10147
|
},
|
|
10075
10148
|
{
|
|
10076
10149
|
type: "function",
|
|
10077
|
-
name: "
|
|
10150
|
+
name: "isUserRelayerEnabled",
|
|
10078
10151
|
constant: true,
|
|
10079
10152
|
stateMutability: "view",
|
|
10080
10153
|
payable: false,
|
|
10081
|
-
inputs: [
|
|
10154
|
+
inputs: [
|
|
10155
|
+
{
|
|
10156
|
+
type: "address",
|
|
10157
|
+
name: "account"
|
|
10158
|
+
},
|
|
10159
|
+
{
|
|
10160
|
+
type: "address",
|
|
10161
|
+
name: "relayer"
|
|
10162
|
+
}
|
|
10163
|
+
],
|
|
10082
10164
|
outputs: [
|
|
10083
10165
|
{
|
|
10084
|
-
type: "
|
|
10166
|
+
type: "bool"
|
|
10085
10167
|
}
|
|
10086
10168
|
]
|
|
10087
10169
|
},
|
|
@@ -10190,32 +10272,6 @@ var Forwarder_default = [
|
|
|
10190
10272
|
}
|
|
10191
10273
|
]
|
|
10192
10274
|
},
|
|
10193
|
-
{
|
|
10194
|
-
type: "function",
|
|
10195
|
-
name: "relayFee",
|
|
10196
|
-
constant: true,
|
|
10197
|
-
stateMutability: "view",
|
|
10198
|
-
payable: false,
|
|
10199
|
-
inputs: [],
|
|
10200
|
-
outputs: [
|
|
10201
|
-
{
|
|
10202
|
-
type: "uint256"
|
|
10203
|
-
}
|
|
10204
|
-
]
|
|
10205
|
-
},
|
|
10206
|
-
{
|
|
10207
|
-
type: "function",
|
|
10208
|
-
name: "relayGas",
|
|
10209
|
-
constant: true,
|
|
10210
|
-
stateMutability: "view",
|
|
10211
|
-
payable: false,
|
|
10212
|
-
inputs: [],
|
|
10213
|
-
outputs: [
|
|
10214
|
-
{
|
|
10215
|
-
type: "uint256"
|
|
10216
|
-
}
|
|
10217
|
-
]
|
|
10218
|
-
},
|
|
10219
10275
|
{
|
|
10220
10276
|
type: "function",
|
|
10221
10277
|
name: "removeAllowedTarget",
|
|
@@ -10244,30 +10300,13 @@ var Forwarder_default = [
|
|
|
10244
10300
|
},
|
|
10245
10301
|
{
|
|
10246
10302
|
type: "function",
|
|
10247
|
-
name: "
|
|
10248
|
-
constant: false,
|
|
10249
|
-
payable: false,
|
|
10250
|
-
inputs: [
|
|
10251
|
-
{
|
|
10252
|
-
type: "uint256",
|
|
10253
|
-
name: "_maxRelayFee"
|
|
10254
|
-
}
|
|
10255
|
-
],
|
|
10256
|
-
outputs: []
|
|
10257
|
-
},
|
|
10258
|
-
{
|
|
10259
|
-
type: "function",
|
|
10260
|
-
name: "updateRelayInfo",
|
|
10303
|
+
name: "updateEquilibriumGas",
|
|
10261
10304
|
constant: false,
|
|
10262
10305
|
payable: false,
|
|
10263
10306
|
inputs: [
|
|
10264
10307
|
{
|
|
10265
10308
|
type: "uint256",
|
|
10266
|
-
name: "
|
|
10267
|
-
},
|
|
10268
|
-
{
|
|
10269
|
-
type: "uint256",
|
|
10270
|
-
name: "_relayGas"
|
|
10309
|
+
name: "_equilibriumGas"
|
|
10271
10310
|
}
|
|
10272
10311
|
],
|
|
10273
10312
|
outputs: []
|
|
@@ -19151,9 +19190,14 @@ var Utils = class {
|
|
|
19151
19190
|
}
|
|
19152
19191
|
}
|
|
19153
19192
|
async checkSeamlessGas(userAddress, chainId) {
|
|
19154
|
-
const forwarderContract = await getForwarderContract(chainId);
|
|
19155
|
-
const relayFee = await forwarderContract.getRelayFee();
|
|
19156
19193
|
const provider = await getJSONProvider(chainId);
|
|
19194
|
+
const marketManagerContract = new import_ethers25.ethers.Contract(
|
|
19195
|
+
getContractAddressByChainId(chainId).MARKET_MANAGER,
|
|
19196
|
+
MarketManager_default,
|
|
19197
|
+
provider
|
|
19198
|
+
);
|
|
19199
|
+
const forwardFeeToken = executeAddressByChainId(chainId);
|
|
19200
|
+
const relayFee = await marketManagerContract.getRelayFee(forwardFeeToken);
|
|
19157
19201
|
const contractAddress = getContractAddressByChainId(chainId);
|
|
19158
19202
|
const erc20Contract = new import_ethers25.ethers.Contract(
|
|
19159
19203
|
contractAddress.ERC20,
|
|
@@ -20660,408 +20704,6 @@ var getEIP712Domain = async (contract) => {
|
|
|
20660
20704
|
|
|
20661
20705
|
// src/manager/seamless/index.ts
|
|
20662
20706
|
var import_bytes = require("@ethersproject/bytes");
|
|
20663
|
-
|
|
20664
|
-
// src/abi/TradingRouter.json
|
|
20665
|
-
var TradingRouter_default = [
|
|
20666
|
-
{
|
|
20667
|
-
type: "error",
|
|
20668
|
-
name: "AddressEmptyCode",
|
|
20669
|
-
inputs: [
|
|
20670
|
-
{
|
|
20671
|
-
type: "address",
|
|
20672
|
-
name: "target"
|
|
20673
|
-
}
|
|
20674
|
-
]
|
|
20675
|
-
},
|
|
20676
|
-
{
|
|
20677
|
-
type: "error",
|
|
20678
|
-
name: "DesignatedTokenMismatch",
|
|
20679
|
-
inputs: [
|
|
20680
|
-
{
|
|
20681
|
-
type: "address",
|
|
20682
|
-
name: "collectToken"
|
|
20683
|
-
},
|
|
20684
|
-
{
|
|
20685
|
-
type: "address",
|
|
20686
|
-
name: "designatedToken"
|
|
20687
|
-
}
|
|
20688
|
-
]
|
|
20689
|
-
},
|
|
20690
|
-
{
|
|
20691
|
-
type: "error",
|
|
20692
|
-
name: "ERC1967InvalidImplementation",
|
|
20693
|
-
inputs: [
|
|
20694
|
-
{
|
|
20695
|
-
type: "address",
|
|
20696
|
-
name: "implementation"
|
|
20697
|
-
}
|
|
20698
|
-
]
|
|
20699
|
-
},
|
|
20700
|
-
{
|
|
20701
|
-
type: "error",
|
|
20702
|
-
name: "ERC1967NonPayable",
|
|
20703
|
-
inputs: []
|
|
20704
|
-
},
|
|
20705
|
-
{
|
|
20706
|
-
type: "error",
|
|
20707
|
-
name: "FailedCall",
|
|
20708
|
-
inputs: []
|
|
20709
|
-
},
|
|
20710
|
-
{
|
|
20711
|
-
type: "error",
|
|
20712
|
-
name: "InvalidInitialization",
|
|
20713
|
-
inputs: []
|
|
20714
|
-
},
|
|
20715
|
-
{
|
|
20716
|
-
type: "error",
|
|
20717
|
-
name: "NotActiveBroker",
|
|
20718
|
-
inputs: [
|
|
20719
|
-
{
|
|
20720
|
-
type: "address",
|
|
20721
|
-
name: "broker"
|
|
20722
|
-
}
|
|
20723
|
-
]
|
|
20724
|
-
},
|
|
20725
|
-
{
|
|
20726
|
-
type: "error",
|
|
20727
|
-
name: "NotAddressManager",
|
|
20728
|
-
inputs: []
|
|
20729
|
-
},
|
|
20730
|
-
{
|
|
20731
|
-
type: "error",
|
|
20732
|
-
name: "NotDependencyManager",
|
|
20733
|
-
inputs: []
|
|
20734
|
-
},
|
|
20735
|
-
{
|
|
20736
|
-
type: "error",
|
|
20737
|
-
name: "NotForwardAllowedTarget",
|
|
20738
|
-
inputs: [
|
|
20739
|
-
{
|
|
20740
|
-
type: "address",
|
|
20741
|
-
name: "from"
|
|
20742
|
-
}
|
|
20743
|
-
]
|
|
20744
|
-
},
|
|
20745
|
-
{
|
|
20746
|
-
type: "error",
|
|
20747
|
-
name: "NotInitializing",
|
|
20748
|
-
inputs: []
|
|
20749
|
-
},
|
|
20750
|
-
{
|
|
20751
|
-
type: "error",
|
|
20752
|
-
name: "NotProxyAdmin",
|
|
20753
|
-
inputs: []
|
|
20754
|
-
},
|
|
20755
|
-
{
|
|
20756
|
-
type: "error",
|
|
20757
|
-
name: "PermissionDenied",
|
|
20758
|
-
inputs: [
|
|
20759
|
-
{
|
|
20760
|
-
type: "address",
|
|
20761
|
-
name: "caller"
|
|
20762
|
-
},
|
|
20763
|
-
{
|
|
20764
|
-
type: "address",
|
|
20765
|
-
name: "target"
|
|
20766
|
-
}
|
|
20767
|
-
]
|
|
20768
|
-
},
|
|
20769
|
-
{
|
|
20770
|
-
type: "error",
|
|
20771
|
-
name: "ReentrancyGuardReentrantCall",
|
|
20772
|
-
inputs: []
|
|
20773
|
-
},
|
|
20774
|
-
{
|
|
20775
|
-
type: "error",
|
|
20776
|
-
name: "SafeERC20FailedOperation",
|
|
20777
|
-
inputs: [
|
|
20778
|
-
{
|
|
20779
|
-
type: "address",
|
|
20780
|
-
name: "token"
|
|
20781
|
-
}
|
|
20782
|
-
]
|
|
20783
|
-
},
|
|
20784
|
-
{
|
|
20785
|
-
type: "error",
|
|
20786
|
-
name: "UUPSUnauthorizedCallContext",
|
|
20787
|
-
inputs: []
|
|
20788
|
-
},
|
|
20789
|
-
{
|
|
20790
|
-
type: "error",
|
|
20791
|
-
name: "UUPSUnsupportedProxiableUUID",
|
|
20792
|
-
inputs: [
|
|
20793
|
-
{
|
|
20794
|
-
type: "bytes32",
|
|
20795
|
-
name: "slot"
|
|
20796
|
-
}
|
|
20797
|
-
]
|
|
20798
|
-
},
|
|
20799
|
-
{
|
|
20800
|
-
type: "event",
|
|
20801
|
-
anonymous: false,
|
|
20802
|
-
name: "Initialized",
|
|
20803
|
-
inputs: [
|
|
20804
|
-
{
|
|
20805
|
-
type: "uint64",
|
|
20806
|
-
name: "version",
|
|
20807
|
-
indexed: false
|
|
20808
|
-
}
|
|
20809
|
-
]
|
|
20810
|
-
},
|
|
20811
|
-
{
|
|
20812
|
-
type: "event",
|
|
20813
|
-
anonymous: false,
|
|
20814
|
-
name: "Upgraded",
|
|
20815
|
-
inputs: [
|
|
20816
|
-
{
|
|
20817
|
-
type: "address",
|
|
20818
|
-
name: "implementation",
|
|
20819
|
-
indexed: true
|
|
20820
|
-
}
|
|
20821
|
-
]
|
|
20822
|
-
},
|
|
20823
|
-
{
|
|
20824
|
-
type: "function",
|
|
20825
|
-
name: "UPGRADE_INTERFACE_VERSION",
|
|
20826
|
-
constant: true,
|
|
20827
|
-
stateMutability: "view",
|
|
20828
|
-
payable: false,
|
|
20829
|
-
inputs: [],
|
|
20830
|
-
outputs: [
|
|
20831
|
-
{
|
|
20832
|
-
type: "string"
|
|
20833
|
-
}
|
|
20834
|
-
]
|
|
20835
|
-
},
|
|
20836
|
-
{
|
|
20837
|
-
type: "function",
|
|
20838
|
-
name: "__ERC2771ContextUpgradeable_init",
|
|
20839
|
-
constant: false,
|
|
20840
|
-
payable: false,
|
|
20841
|
-
inputs: [
|
|
20842
|
-
{
|
|
20843
|
-
type: "address",
|
|
20844
|
-
name: "trustedForwarder_"
|
|
20845
|
-
}
|
|
20846
|
-
],
|
|
20847
|
-
outputs: []
|
|
20848
|
-
},
|
|
20849
|
-
{
|
|
20850
|
-
type: "function",
|
|
20851
|
-
name: "collectExecutionFee",
|
|
20852
|
-
constant: false,
|
|
20853
|
-
payable: false,
|
|
20854
|
-
inputs: [
|
|
20855
|
-
{
|
|
20856
|
-
type: "uint8",
|
|
20857
|
-
name: "source"
|
|
20858
|
-
},
|
|
20859
|
-
{
|
|
20860
|
-
type: "bytes",
|
|
20861
|
-
name: "data"
|
|
20862
|
-
}
|
|
20863
|
-
],
|
|
20864
|
-
outputs: []
|
|
20865
|
-
},
|
|
20866
|
-
{
|
|
20867
|
-
type: "function",
|
|
20868
|
-
name: "collectForwardFeeIfNecessary",
|
|
20869
|
-
constant: false,
|
|
20870
|
-
payable: false,
|
|
20871
|
-
inputs: [
|
|
20872
|
-
{
|
|
20873
|
-
type: "uint8",
|
|
20874
|
-
name: "source"
|
|
20875
|
-
},
|
|
20876
|
-
{
|
|
20877
|
-
type: "bytes",
|
|
20878
|
-
name: "data"
|
|
20879
|
-
}
|
|
20880
|
-
],
|
|
20881
|
-
outputs: []
|
|
20882
|
-
},
|
|
20883
|
-
{
|
|
20884
|
-
type: "function",
|
|
20885
|
-
name: "depositFor",
|
|
20886
|
-
constant: false,
|
|
20887
|
-
payable: false,
|
|
20888
|
-
inputs: [
|
|
20889
|
-
{
|
|
20890
|
-
type: "address",
|
|
20891
|
-
name: "user"
|
|
20892
|
-
},
|
|
20893
|
-
{
|
|
20894
|
-
type: "address",
|
|
20895
|
-
name: "token"
|
|
20896
|
-
},
|
|
20897
|
-
{
|
|
20898
|
-
type: "uint256",
|
|
20899
|
-
name: "amount"
|
|
20900
|
-
}
|
|
20901
|
-
],
|
|
20902
|
-
outputs: []
|
|
20903
|
-
},
|
|
20904
|
-
{
|
|
20905
|
-
type: "function",
|
|
20906
|
-
name: "depositToAccount",
|
|
20907
|
-
constant: false,
|
|
20908
|
-
payable: false,
|
|
20909
|
-
inputs: [
|
|
20910
|
-
{
|
|
20911
|
-
type: "address",
|
|
20912
|
-
name: "recipient"
|
|
20913
|
-
},
|
|
20914
|
-
{
|
|
20915
|
-
type: "address",
|
|
20916
|
-
name: "token"
|
|
20917
|
-
},
|
|
20918
|
-
{
|
|
20919
|
-
type: "uint256",
|
|
20920
|
-
name: "amount"
|
|
20921
|
-
}
|
|
20922
|
-
],
|
|
20923
|
-
outputs: []
|
|
20924
|
-
},
|
|
20925
|
-
{
|
|
20926
|
-
type: "function",
|
|
20927
|
-
name: "getAddressManager",
|
|
20928
|
-
constant: true,
|
|
20929
|
-
stateMutability: "view",
|
|
20930
|
-
payable: false,
|
|
20931
|
-
inputs: [],
|
|
20932
|
-
outputs: [
|
|
20933
|
-
{
|
|
20934
|
-
type: "address"
|
|
20935
|
-
}
|
|
20936
|
-
]
|
|
20937
|
-
},
|
|
20938
|
-
{
|
|
20939
|
-
type: "function",
|
|
20940
|
-
name: "getDependencyAddress",
|
|
20941
|
-
constant: true,
|
|
20942
|
-
stateMutability: "view",
|
|
20943
|
-
payable: false,
|
|
20944
|
-
inputs: [
|
|
20945
|
-
{
|
|
20946
|
-
type: "bytes32",
|
|
20947
|
-
name: "identifier"
|
|
20948
|
-
}
|
|
20949
|
-
],
|
|
20950
|
-
outputs: [
|
|
20951
|
-
{
|
|
20952
|
-
type: "address"
|
|
20953
|
-
}
|
|
20954
|
-
]
|
|
20955
|
-
},
|
|
20956
|
-
{
|
|
20957
|
-
type: "function",
|
|
20958
|
-
name: "getImplementation",
|
|
20959
|
-
constant: true,
|
|
20960
|
-
stateMutability: "view",
|
|
20961
|
-
payable: false,
|
|
20962
|
-
inputs: [],
|
|
20963
|
-
outputs: [
|
|
20964
|
-
{
|
|
20965
|
-
type: "address"
|
|
20966
|
-
}
|
|
20967
|
-
]
|
|
20968
|
-
},
|
|
20969
|
-
{
|
|
20970
|
-
type: "function",
|
|
20971
|
-
name: "initialize",
|
|
20972
|
-
constant: false,
|
|
20973
|
-
payable: false,
|
|
20974
|
-
inputs: [
|
|
20975
|
-
{
|
|
20976
|
-
type: "address",
|
|
20977
|
-
name: "addressManager"
|
|
20978
|
-
}
|
|
20979
|
-
],
|
|
20980
|
-
outputs: []
|
|
20981
|
-
},
|
|
20982
|
-
{
|
|
20983
|
-
type: "function",
|
|
20984
|
-
name: "isTrustedForwarder",
|
|
20985
|
-
constant: true,
|
|
20986
|
-
stateMutability: "view",
|
|
20987
|
-
payable: false,
|
|
20988
|
-
inputs: [
|
|
20989
|
-
{
|
|
20990
|
-
type: "address",
|
|
20991
|
-
name: "forwarder"
|
|
20992
|
-
}
|
|
20993
|
-
],
|
|
20994
|
-
outputs: [
|
|
20995
|
-
{
|
|
20996
|
-
type: "bool"
|
|
20997
|
-
}
|
|
20998
|
-
]
|
|
20999
|
-
},
|
|
21000
|
-
{
|
|
21001
|
-
type: "function",
|
|
21002
|
-
name: "proxiableUUID",
|
|
21003
|
-
constant: true,
|
|
21004
|
-
stateMutability: "view",
|
|
21005
|
-
payable: false,
|
|
21006
|
-
inputs: [],
|
|
21007
|
-
outputs: [
|
|
21008
|
-
{
|
|
21009
|
-
type: "bytes32"
|
|
21010
|
-
}
|
|
21011
|
-
]
|
|
21012
|
-
},
|
|
21013
|
-
{
|
|
21014
|
-
type: "function",
|
|
21015
|
-
name: "trustedForwarder",
|
|
21016
|
-
constant: true,
|
|
21017
|
-
stateMutability: "view",
|
|
21018
|
-
payable: false,
|
|
21019
|
-
inputs: [],
|
|
21020
|
-
outputs: [
|
|
21021
|
-
{
|
|
21022
|
-
type: "address"
|
|
21023
|
-
}
|
|
21024
|
-
]
|
|
21025
|
-
},
|
|
21026
|
-
{
|
|
21027
|
-
type: "function",
|
|
21028
|
-
name: "upgradeTo",
|
|
21029
|
-
constant: false,
|
|
21030
|
-
stateMutability: "payable",
|
|
21031
|
-
payable: true,
|
|
21032
|
-
inputs: [
|
|
21033
|
-
{
|
|
21034
|
-
type: "address",
|
|
21035
|
-
name: "newImplementation"
|
|
21036
|
-
},
|
|
21037
|
-
{
|
|
21038
|
-
type: "bytes",
|
|
21039
|
-
name: "data"
|
|
21040
|
-
}
|
|
21041
|
-
],
|
|
21042
|
-
outputs: []
|
|
21043
|
-
},
|
|
21044
|
-
{
|
|
21045
|
-
type: "function",
|
|
21046
|
-
name: "upgradeToAndCall",
|
|
21047
|
-
constant: false,
|
|
21048
|
-
stateMutability: "payable",
|
|
21049
|
-
payable: true,
|
|
21050
|
-
inputs: [
|
|
21051
|
-
{
|
|
21052
|
-
type: "address",
|
|
21053
|
-
name: "newImplementation"
|
|
21054
|
-
},
|
|
21055
|
-
{
|
|
21056
|
-
type: "bytes",
|
|
21057
|
-
name: "data"
|
|
21058
|
-
}
|
|
21059
|
-
],
|
|
21060
|
-
outputs: []
|
|
21061
|
-
}
|
|
21062
|
-
];
|
|
21063
|
-
|
|
21064
|
-
// src/manager/seamless/index.ts
|
|
21065
20707
|
var contractTypes = {
|
|
21066
20708
|
ForwardRequest: [
|
|
21067
20709
|
{ name: "from", type: "address" },
|
|
@@ -21149,11 +20791,6 @@ var Seamless = class {
|
|
|
21149
20791
|
}
|
|
21150
20792
|
const contractAddress = getContractAddressByChainId(chainId);
|
|
21151
20793
|
const masterAddress = await config.signer.getAddress();
|
|
21152
|
-
const tradingRouterContract = new import_ethers27.ethers.Contract(
|
|
21153
|
-
contractAddress.TRADING_ROUTER,
|
|
21154
|
-
TradingRouter_default,
|
|
21155
|
-
config.signer
|
|
21156
|
-
);
|
|
21157
20794
|
const erc20Contract = new import_ethers27.ethers.Contract(
|
|
21158
20795
|
contractAddress.ERC20,
|
|
21159
20796
|
ERC20Token_default,
|
|
@@ -21163,7 +20800,7 @@ var Seamless = class {
|
|
|
21163
20800
|
const nonces = await erc20Contract.nonces(masterAddress);
|
|
21164
20801
|
const tradingRouterSignPermit = await signPermit(
|
|
21165
20802
|
config.signer,
|
|
21166
|
-
|
|
20803
|
+
erc20Contract,
|
|
21167
20804
|
masterAddress,
|
|
21168
20805
|
contractAddress.TRADING_ROUTER,
|
|
21169
20806
|
import_ethers27.ethers.MaxUint256.toString(),
|
|
@@ -21182,6 +20819,7 @@ var Seamless = class {
|
|
|
21182
20819
|
};
|
|
21183
20820
|
return [tradingRouterPermitParams];
|
|
21184
20821
|
} catch (error) {
|
|
20822
|
+
console.log("error-->", error);
|
|
21185
20823
|
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
|
|
21186
20824
|
}
|
|
21187
20825
|
}
|
|
@@ -21219,11 +20857,17 @@ var Seamless = class {
|
|
|
21219
20857
|
async authorizeSeamlessAccount({ approve: approve2, seamlessAddress, chainId }) {
|
|
21220
20858
|
const config = this.configManager.getConfig();
|
|
21221
20859
|
const masterAddress = await config.signer?.getAddress() ?? "";
|
|
20860
|
+
const provider = await getSignerProvider(chainId);
|
|
21222
20861
|
if (approve2) {
|
|
21223
20862
|
const balanceRes = await this.account.getWalletQuoteTokenBalance(chainId, masterAddress);
|
|
21224
20863
|
const balance = balanceRes.data;
|
|
21225
|
-
const
|
|
21226
|
-
|
|
20864
|
+
const marketManagerContract = new import_ethers27.ethers.Contract(
|
|
20865
|
+
getContractAddressByChainId(chainId).MARKET_MANAGER,
|
|
20866
|
+
MarketManager_default,
|
|
20867
|
+
provider
|
|
20868
|
+
);
|
|
20869
|
+
const forwardFeeToken = executeAddressByChainId(chainId);
|
|
20870
|
+
const pledgeFee = await marketManagerContract.getForwardFeeByToken(forwardFeeToken);
|
|
21227
20871
|
const gasFee = BigInt(pledgeFee) * BigInt(FORWARD_PLEDGE_FEE_RADIO);
|
|
21228
20872
|
if (gasFee > 0 && gasFee > BigInt(balance)) {
|
|
21229
20873
|
throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient balance");
|