@myx-trade/sdk 0.1.245-beta.1 → 0.1.245-beta.2

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 CHANGED
@@ -1845,7 +1845,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
1845
1845
  // package.json
1846
1846
  var package_default = {
1847
1847
  name: "@myx-trade/sdk",
1848
- version: "0.1.245-beta.1",
1848
+ version: "0.1.245-beta.2",
1849
1849
  private: false,
1850
1850
  publishConfig: {
1851
1851
  access: "public"
@@ -5269,6 +5269,16 @@ var Broker_default = [
5269
5269
  payable: false,
5270
5270
  inputs: []
5271
5271
  },
5272
+ {
5273
+ type: "error",
5274
+ name: "AddressEmptyCode",
5275
+ inputs: [
5276
+ {
5277
+ type: "address",
5278
+ name: "target"
5279
+ }
5280
+ ]
5281
+ },
5272
5282
  {
5273
5283
  type: "error",
5274
5284
  name: "ECDSAInvalidSignature",
@@ -5294,11 +5304,31 @@ var Broker_default = [
5294
5304
  }
5295
5305
  ]
5296
5306
  },
5307
+ {
5308
+ type: "error",
5309
+ name: "ERC1967InvalidImplementation",
5310
+ inputs: [
5311
+ {
5312
+ type: "address",
5313
+ name: "implementation"
5314
+ }
5315
+ ]
5316
+ },
5317
+ {
5318
+ type: "error",
5319
+ name: "ERC1967NonPayable",
5320
+ inputs: []
5321
+ },
5297
5322
  {
5298
5323
  type: "error",
5299
5324
  name: "ExpiredFeeData",
5300
5325
  inputs: []
5301
5326
  },
5327
+ {
5328
+ type: "error",
5329
+ name: "FailedCall",
5330
+ inputs: []
5331
+ },
5302
5332
  {
5303
5333
  type: "error",
5304
5334
  name: "InvalidFeeRate",
@@ -5359,6 +5389,11 @@ var Broker_default = [
5359
5389
  name: "NotPositionOwner",
5360
5390
  inputs: []
5361
5391
  },
5392
+ {
5393
+ type: "error",
5394
+ name: "NotProxyAdmin",
5395
+ inputs: []
5396
+ },
5362
5397
  {
5363
5398
  type: "error",
5364
5399
  name: "OwnableInvalidOwner",
@@ -5408,6 +5443,21 @@ var Broker_default = [
5408
5443
  }
5409
5444
  ]
5410
5445
  },
5446
+ {
5447
+ type: "error",
5448
+ name: "UUPSUnauthorizedCallContext",
5449
+ inputs: []
5450
+ },
5451
+ {
5452
+ type: "error",
5453
+ name: "UUPSUnsupportedProxiableUUID",
5454
+ inputs: [
5455
+ {
5456
+ type: "bytes32",
5457
+ name: "slot"
5458
+ }
5459
+ ]
5460
+ },
5411
5461
  {
5412
5462
  type: "error",
5413
5463
  name: "UnsupportedAssetClass",
@@ -5536,6 +5586,40 @@ var Broker_default = [
5536
5586
  }
5537
5587
  ]
5538
5588
  },
5589
+ {
5590
+ type: "event",
5591
+ anonymous: false,
5592
+ name: "Upgraded",
5593
+ inputs: [
5594
+ {
5595
+ type: "address",
5596
+ name: "implementation",
5597
+ indexed: true
5598
+ }
5599
+ ]
5600
+ },
5601
+ {
5602
+ type: "event",
5603
+ anonymous: false,
5604
+ name: "UserFeeDataReset",
5605
+ inputs: [
5606
+ {
5607
+ type: "address",
5608
+ name: "broker",
5609
+ indexed: false
5610
+ },
5611
+ {
5612
+ type: "address",
5613
+ name: "signer",
5614
+ indexed: false
5615
+ },
5616
+ {
5617
+ type: "uint256",
5618
+ name: "epoch",
5619
+ indexed: false
5620
+ }
5621
+ ]
5622
+ },
5539
5623
  {
5540
5624
  type: "event",
5541
5625
  anonymous: false,
@@ -5556,6 +5640,11 @@ var Broker_default = [
5556
5640
  name: "user",
5557
5641
  indexed: false
5558
5642
  },
5643
+ {
5644
+ type: "uint256",
5645
+ name: "epoch",
5646
+ indexed: false
5647
+ },
5559
5648
  {
5560
5649
  type: "uint8",
5561
5650
  name: "tier",
@@ -5591,6 +5680,19 @@ var Broker_default = [
5591
5680
  }
5592
5681
  ]
5593
5682
  },
5683
+ {
5684
+ type: "function",
5685
+ name: "UPGRADE_INTERFACE_VERSION",
5686
+ constant: true,
5687
+ stateMutability: "view",
5688
+ payable: false,
5689
+ inputs: [],
5690
+ outputs: [
5691
+ {
5692
+ type: "string"
5693
+ }
5694
+ ]
5695
+ },
5594
5696
  {
5595
5697
  type: "function",
5596
5698
  name: "__ERC2771ContextUpgradeable_init",
@@ -5669,37 +5771,6 @@ var Broker_default = [
5669
5771
  }
5670
5772
  ]
5671
5773
  },
5672
- {
5673
- type: "function",
5674
- name: "adjustCollateral",
5675
- constant: false,
5676
- payable: false,
5677
- inputs: [
5678
- {
5679
- type: "tuple",
5680
- name: "depositParams",
5681
- components: [
5682
- {
5683
- type: "address",
5684
- name: "token"
5685
- },
5686
- {
5687
- type: "uint256",
5688
- name: "amount"
5689
- }
5690
- ]
5691
- },
5692
- {
5693
- type: "bytes32",
5694
- name: "positionId"
5695
- },
5696
- {
5697
- type: "int256",
5698
- name: "adjustAmount"
5699
- }
5700
- ],
5701
- outputs: []
5702
- },
5703
5774
  {
5704
5775
  type: "function",
5705
5776
  name: "batchSetSpecialFeeTiers",
@@ -5828,6 +5899,32 @@ var Broker_default = [
5828
5899
  ],
5829
5900
  outputs: []
5830
5901
  },
5902
+ {
5903
+ type: "function",
5904
+ name: "currentFeeDataEpoch",
5905
+ constant: true,
5906
+ stateMutability: "view",
5907
+ payable: false,
5908
+ inputs: [],
5909
+ outputs: [
5910
+ {
5911
+ type: "uint256"
5912
+ }
5913
+ ]
5914
+ },
5915
+ {
5916
+ type: "function",
5917
+ name: "domainSeparatorV4",
5918
+ constant: true,
5919
+ stateMutability: "view",
5920
+ payable: false,
5921
+ inputs: [],
5922
+ outputs: [
5923
+ {
5924
+ type: "bytes32"
5925
+ }
5926
+ ]
5927
+ },
5831
5928
  {
5832
5929
  type: "function",
5833
5930
  name: "eip712Domain",
@@ -5926,6 +6023,19 @@ var Broker_default = [
5926
6023
  }
5927
6024
  ]
5928
6025
  },
6026
+ {
6027
+ type: "function",
6028
+ name: "getImplementation",
6029
+ constant: true,
6030
+ stateMutability: "view",
6031
+ payable: false,
6032
+ inputs: [],
6033
+ outputs: [
6034
+ {
6035
+ type: "address"
6036
+ }
6037
+ ]
6038
+ },
5929
6039
  {
5930
6040
  type: "function",
5931
6041
  name: "getSpecialFeeTier",
@@ -5957,6 +6067,55 @@ var Broker_default = [
5957
6067
  }
5958
6068
  ]
5959
6069
  },
6070
+ {
6071
+ type: "function",
6072
+ name: "getUserFeeDataDigest",
6073
+ constant: true,
6074
+ stateMutability: "view",
6075
+ payable: false,
6076
+ inputs: [
6077
+ {
6078
+ type: "address",
6079
+ name: "user"
6080
+ },
6081
+ {
6082
+ type: "uint64",
6083
+ name: "nonce"
6084
+ },
6085
+ {
6086
+ type: "uint64",
6087
+ name: "deadline"
6088
+ },
6089
+ {
6090
+ type: "tuple",
6091
+ name: "feeData",
6092
+ components: [
6093
+ {
6094
+ type: "uint8",
6095
+ name: "tier"
6096
+ },
6097
+ {
6098
+ type: "address",
6099
+ name: "referrer"
6100
+ },
6101
+ {
6102
+ type: "uint32",
6103
+ name: "totalReferralRebatePct"
6104
+ },
6105
+ {
6106
+ type: "uint32",
6107
+ name: "referrerRebatePct"
6108
+ }
6109
+ ]
6110
+ }
6111
+ ],
6112
+ outputs: [
6113
+ {
6114
+ type: "bytes32",
6115
+ name: "digest"
6116
+ }
6117
+ ]
6118
+ },
5960
6119
  {
5961
6120
  type: "function",
5962
6121
  name: "getUserFeeRate",
@@ -6555,6 +6714,19 @@ var Broker_default = [
6555
6714
  ],
6556
6715
  outputs: []
6557
6716
  },
6717
+ {
6718
+ type: "function",
6719
+ name: "proxiableUUID",
6720
+ constant: true,
6721
+ stateMutability: "view",
6722
+ payable: false,
6723
+ inputs: [],
6724
+ outputs: [
6725
+ {
6726
+ type: "bytes32"
6727
+ }
6728
+ ]
6729
+ },
6558
6730
  {
6559
6731
  type: "function",
6560
6732
  name: "renounceOwnership",
@@ -6563,6 +6735,14 @@ var Broker_default = [
6563
6735
  inputs: [],
6564
6736
  outputs: []
6565
6737
  },
6738
+ {
6739
+ type: "function",
6740
+ name: "resetAllUserFeeData",
6741
+ constant: false,
6742
+ payable: false,
6743
+ inputs: [],
6744
+ outputs: []
6745
+ },
6566
6746
  {
6567
6747
  type: "function",
6568
6748
  name: "setSigner",
@@ -6811,56 +6991,21 @@ var Broker_default = [
6811
6991
  },
6812
6992
  {
6813
6993
  type: "function",
6814
- name: "updateFeeTiers",
6994
+ name: "updateOrder",
6815
6995
  constant: false,
6816
6996
  payable: false,
6817
6997
  inputs: [
6818
6998
  {
6819
- type: "uint8",
6820
- name: "assetClass"
6821
- },
6822
- {
6823
- type: "uint8",
6824
- name: "riskTier"
6825
- },
6826
- {
6827
- type: "uint8[]",
6828
- name: "feeTiers"
6829
- },
6830
- {
6831
- type: "tuple[]",
6832
- name: "feeRates",
6999
+ type: "tuple",
7000
+ name: "depositParams",
6833
7001
  components: [
6834
7002
  {
6835
- type: "uint32",
6836
- name: "takerFeeRate"
7003
+ type: "address",
7004
+ name: "token"
6837
7005
  },
6838
7006
  {
6839
- type: "uint32",
6840
- name: "makerFeeRate"
6841
- }
6842
- ]
6843
- }
6844
- ],
6845
- outputs: []
6846
- },
6847
- {
6848
- type: "function",
6849
- name: "updateOrder",
6850
- constant: false,
6851
- payable: false,
6852
- inputs: [
6853
- {
6854
- type: "tuple",
6855
- name: "depositParams",
6856
- components: [
6857
- {
6858
- type: "address",
6859
- name: "token"
6860
- },
6861
- {
6862
- type: "uint256",
6863
- name: "amount"
7007
+ type: "uint256",
7008
+ name: "amount"
6864
7009
  }
6865
7010
  ]
6866
7011
  },
@@ -6965,6 +7110,77 @@ var Broker_default = [
6965
7110
  ],
6966
7111
  outputs: []
6967
7112
  },
7113
+ {
7114
+ type: "function",
7115
+ name: "updateUserFeeData",
7116
+ constant: false,
7117
+ payable: false,
7118
+ inputs: [
7119
+ {
7120
+ type: "address",
7121
+ name: "user"
7122
+ },
7123
+ {
7124
+ type: "tuple",
7125
+ name: "feeData",
7126
+ components: [
7127
+ {
7128
+ type: "uint8",
7129
+ name: "tier"
7130
+ },
7131
+ {
7132
+ type: "address",
7133
+ name: "referrer"
7134
+ },
7135
+ {
7136
+ type: "uint32",
7137
+ name: "totalReferralRebatePct"
7138
+ },
7139
+ {
7140
+ type: "uint32",
7141
+ name: "referrerRebatePct"
7142
+ }
7143
+ ]
7144
+ }
7145
+ ],
7146
+ outputs: []
7147
+ },
7148
+ {
7149
+ type: "function",
7150
+ name: "upgradeTo",
7151
+ constant: false,
7152
+ stateMutability: "payable",
7153
+ payable: true,
7154
+ inputs: [
7155
+ {
7156
+ type: "address",
7157
+ name: "newImplementation"
7158
+ },
7159
+ {
7160
+ type: "bytes",
7161
+ name: "data"
7162
+ }
7163
+ ],
7164
+ outputs: []
7165
+ },
7166
+ {
7167
+ type: "function",
7168
+ name: "upgradeToAndCall",
7169
+ constant: false,
7170
+ stateMutability: "payable",
7171
+ payable: true,
7172
+ inputs: [
7173
+ {
7174
+ type: "address",
7175
+ name: "newImplementation"
7176
+ },
7177
+ {
7178
+ type: "bytes",
7179
+ name: "data"
7180
+ }
7181
+ ],
7182
+ outputs: []
7183
+ },
6968
7184
  {
6969
7185
  type: "function",
6970
7186
  name: "userFeeData",
@@ -6972,6 +7188,10 @@ var Broker_default = [
6972
7188
  stateMutability: "view",
6973
7189
  payable: false,
6974
7190
  inputs: [
7191
+ {
7192
+ type: "uint256",
7193
+ name: "userFeeDataEpoch"
7194
+ },
6975
7195
  {
6976
7196
  type: "address",
6977
7197
  name: "user"
@@ -7036,1099 +7256,7 @@ var Broker_default = [
7036
7256
  type: "uint256",
7037
7257
  name: "rebateAmount"
7038
7258
  }
7039
- ]
7040
- }
7041
- ];
7042
-
7043
- // src/abi/OrderManager.json
7044
- var OrderManager_default = [
7045
- {
7046
- type: "error",
7047
- name: "AddressEmptyCode",
7048
- inputs: [
7049
- {
7050
- type: "address",
7051
- name: "target"
7052
- }
7053
- ]
7054
- },
7055
- {
7056
- type: "error",
7057
- name: "ERC1967InvalidImplementation",
7058
- inputs: [
7059
- {
7060
- type: "address",
7061
- name: "implementation"
7062
- }
7063
- ]
7064
- },
7065
- {
7066
- type: "error",
7067
- name: "ERC1967NonPayable",
7068
- inputs: []
7069
- },
7070
- {
7071
- type: "error",
7072
- name: "ExceedOrderSize",
7073
- inputs: [
7074
- {
7075
- type: "uint256",
7076
- name: "size"
7077
- }
7078
- ]
7079
- },
7080
- {
7081
- type: "error",
7082
- name: "ExecutionFeeNotSupport",
7083
- inputs: [
7084
- {
7085
- type: "address",
7086
- name: "token"
7087
- }
7088
- ]
7089
- },
7090
- {
7091
- type: "error",
7092
- name: "FailedCall",
7093
- inputs: []
7094
- },
7095
- {
7096
- type: "error",
7097
- name: "InsufficientCollateral",
7098
- inputs: [
7099
- {
7100
- type: "uint256",
7101
- name: "required"
7102
- },
7103
- {
7104
- type: "uint256",
7105
- name: "available"
7106
- }
7107
- ]
7108
- },
7109
- {
7110
- type: "error",
7111
- name: "InvalidInitialization",
7112
- inputs: []
7113
- },
7114
- {
7115
- type: "error",
7116
- name: "InvalidParameter",
7117
- inputs: []
7118
- },
7119
- {
7120
- type: "error",
7121
- name: "NotActiveBroker",
7122
- inputs: [
7123
- {
7124
- type: "address",
7125
- name: "broker"
7126
- }
7127
- ]
7128
- },
7129
- {
7130
- type: "error",
7131
- name: "NotAddressManager",
7132
- inputs: []
7133
- },
7134
- {
7135
- type: "error",
7136
- name: "NotDependencyManager",
7137
- inputs: []
7138
- },
7139
- {
7140
- type: "error",
7141
- name: "NotInitializing",
7142
- inputs: []
7143
- },
7144
- {
7145
- type: "error",
7146
- name: "NotOrderOwner",
7147
- inputs: []
7148
- },
7149
- {
7150
- type: "error",
7151
- name: "NotPositionOwner",
7152
- inputs: []
7153
- },
7154
- {
7155
- type: "error",
7156
- name: "NotProxyAdmin",
7157
- inputs: []
7158
- },
7159
- {
7160
- type: "error",
7161
- name: "OrderNotExist",
7162
- inputs: [
7163
- {
7164
- type: "uint256",
7165
- name: "orderId"
7166
- }
7167
- ]
7168
- },
7169
- {
7170
- type: "error",
7171
- name: "PermissionDenied",
7172
- inputs: [
7173
- {
7174
- type: "address",
7175
- name: "caller"
7176
- },
7177
- {
7178
- type: "address",
7179
- name: "target"
7180
- }
7181
- ]
7182
- },
7183
- {
7184
- type: "error",
7185
- name: "PoolNotActive",
7186
- inputs: [
7187
- {
7188
- type: "bytes32",
7189
- name: "poolId"
7190
- }
7191
- ]
7192
- },
7193
- {
7194
- type: "error",
7195
- name: "SafeERC20FailedOperation",
7196
- inputs: [
7197
- {
7198
- type: "address",
7199
- name: "token"
7200
- }
7201
- ]
7202
- },
7203
- {
7204
- type: "error",
7205
- name: "UUPSUnauthorizedCallContext",
7206
- inputs: []
7207
- },
7208
- {
7209
- type: "error",
7210
- name: "UUPSUnsupportedProxiableUUID",
7211
- inputs: [
7212
- {
7213
- type: "bytes32",
7214
- name: "slot"
7215
- }
7216
- ]
7217
- },
7218
- {
7219
- type: "event",
7220
- anonymous: false,
7221
- name: "ExecutionFeeUpdated",
7222
- inputs: [
7223
- {
7224
- type: "address",
7225
- name: "token",
7226
- indexed: false
7227
- },
7228
- {
7229
- type: "uint256",
7230
- name: "value",
7231
- indexed: false
7232
- },
7233
- {
7234
- type: "bool",
7235
- name: "isActive",
7236
- indexed: false
7237
- }
7238
- ]
7239
- },
7240
- {
7241
- type: "event",
7242
- anonymous: false,
7243
- name: "Initialized",
7244
- inputs: [
7245
- {
7246
- type: "uint64",
7247
- name: "version",
7248
- indexed: false
7249
- }
7250
- ]
7251
- },
7252
- {
7253
- type: "event",
7254
- anonymous: false,
7255
- name: "Upgraded",
7256
- inputs: [
7257
- {
7258
- type: "address",
7259
- name: "implementation",
7260
- indexed: true
7261
- }
7262
- ]
7263
- },
7264
- {
7265
- type: "function",
7266
- name: "UPGRADE_INTERFACE_VERSION",
7267
- constant: true,
7268
- stateMutability: "view",
7269
- payable: false,
7270
- inputs: [],
7271
- outputs: [
7272
- {
7273
- type: "string"
7274
- }
7275
- ]
7276
- },
7277
- {
7278
- type: "function",
7279
- name: "cancelOrder",
7280
- constant: false,
7281
- payable: false,
7282
- inputs: [
7283
- {
7284
- type: "uint256",
7285
- name: "orderId"
7286
- }
7287
- ],
7288
- outputs: []
7289
- },
7290
- {
7291
- type: "function",
7292
- name: "cancelOrders",
7293
- constant: false,
7294
- payable: false,
7295
- inputs: [
7296
- {
7297
- type: "uint256[]",
7298
- name: "orderIds"
7299
- }
7300
- ],
7301
- outputs: []
7302
- },
7303
- {
7304
- type: "function",
7305
- name: "fillOrder",
7306
- constant: false,
7307
- payable: false,
7308
- inputs: [
7309
- {
7310
- type: "tuple",
7311
- name: "params",
7312
- components: [
7313
- {
7314
- type: "uint256",
7315
- name: "orderId"
7316
- },
7317
- {
7318
- type: "bytes32",
7319
- name: "positionId"
7320
- },
7321
- {
7322
- type: "address",
7323
- name: "keeper"
7324
- },
7325
- {
7326
- type: "uint256",
7327
- name: "fillSize"
7328
- },
7329
- {
7330
- type: "uint256",
7331
- name: "fillPrice"
7332
- },
7333
- {
7334
- type: "int256",
7335
- name: "realizedPnl"
7336
- },
7337
- {
7338
- type: "int256",
7339
- name: "tradingFee"
7340
- },
7341
- {
7342
- type: "int256",
7343
- name: "fundingFee"
7344
- },
7345
- {
7346
- type: "bool",
7347
- name: "forceClose"
7348
- }
7349
- ]
7350
- }
7351
- ],
7352
- outputs: [
7353
- {
7354
- type: "uint256",
7355
- name: "tpOrderId"
7356
- },
7357
- {
7358
- type: "uint256",
7359
- name: "slOrderId"
7360
- }
7361
- ]
7362
- },
7363
- {
7364
- type: "function",
7365
- name: "getAddressManager",
7366
- constant: true,
7367
- stateMutability: "view",
7368
- payable: false,
7369
- inputs: [],
7370
- outputs: [
7371
- {
7372
- type: "address"
7373
- }
7374
- ]
7375
- },
7376
- {
7377
- type: "function",
7378
- name: "getDependencyAddress",
7379
- constant: true,
7380
- stateMutability: "view",
7381
- payable: false,
7382
- inputs: [
7383
- {
7384
- type: "bytes32",
7385
- name: "identifier"
7386
- }
7387
- ],
7388
- outputs: [
7389
- {
7390
- type: "address"
7391
- }
7392
- ]
7393
- },
7394
- {
7395
- type: "function",
7396
- name: "getExecutionFee",
7397
- constant: true,
7398
- stateMutability: "view",
7399
- payable: false,
7400
- inputs: [
7401
- {
7402
- type: "address",
7403
- name: "token"
7404
- }
7405
- ],
7406
- outputs: [
7407
- {
7408
- type: "uint256"
7409
- }
7410
- ]
7411
- },
7412
- {
7413
- type: "function",
7414
- name: "getImplementation",
7415
- constant: true,
7416
- stateMutability: "view",
7417
- payable: false,
7418
- inputs: [],
7419
- outputs: [
7420
- {
7421
- type: "address"
7422
- }
7423
- ]
7424
- },
7425
- {
7426
- type: "function",
7427
- name: "getOrder",
7428
- constant: true,
7429
- stateMutability: "view",
7430
- payable: false,
7431
- inputs: [
7432
- {
7433
- type: "uint256",
7434
- name: "orderId"
7435
- }
7436
- ],
7437
- outputs: [
7438
- {
7439
- type: "tuple",
7440
- components: [
7441
- {
7442
- type: "bytes32",
7443
- name: "poolId"
7444
- },
7445
- {
7446
- type: "bytes32",
7447
- name: "positionId"
7448
- },
7449
- {
7450
- type: "uint256",
7451
- name: "collateralAmount"
7452
- },
7453
- {
7454
- type: "uint256",
7455
- name: "size"
7456
- },
7457
- {
7458
- type: "uint256",
7459
- name: "price"
7460
- },
7461
- {
7462
- type: "uint256",
7463
- name: "filledSize"
7464
- },
7465
- {
7466
- type: "address",
7467
- name: "user"
7468
- },
7469
- {
7470
- type: "uint8",
7471
- name: "orderType"
7472
- },
7473
- {
7474
- type: "uint8",
7475
- name: "triggerType"
7476
- },
7477
- {
7478
- type: "uint8",
7479
- name: "operation"
7480
- },
7481
- {
7482
- type: "uint8",
7483
- name: "direction"
7484
- },
7485
- {
7486
- type: "uint8",
7487
- name: "timeInForce"
7488
- },
7489
- {
7490
- type: "uint16",
7491
- name: "slippagePct"
7492
- },
7493
- {
7494
- type: "bool",
7495
- name: "postOnly"
7496
- },
7497
- {
7498
- type: "uint64",
7499
- name: "createdAt"
7500
- },
7501
- {
7502
- type: "address",
7503
- name: "broker"
7504
- }
7505
- ]
7506
- }
7507
- ]
7508
- },
7509
- {
7510
- type: "function",
7511
- name: "getOrderExecutionFee",
7512
- constant: true,
7513
- stateMutability: "view",
7514
- payable: false,
7515
- inputs: [
7516
- {
7517
- type: "uint256",
7518
- name: "orderId"
7519
- }
7520
- ],
7521
- outputs: [
7522
- {
7523
- type: "uint256"
7524
- }
7525
- ]
7526
- },
7527
- {
7528
- type: "function",
7529
- name: "getOrderTPSL",
7530
- constant: true,
7531
- stateMutability: "view",
7532
- payable: false,
7533
- inputs: [
7534
- {
7535
- type: "uint256",
7536
- name: "orderId"
7537
- }
7538
- ],
7539
- outputs: [
7540
- {
7541
- type: "tuple",
7542
- components: [
7543
- {
7544
- type: "uint256",
7545
- name: "tpSize"
7546
- },
7547
- {
7548
- type: "uint256",
7549
- name: "tpPrice"
7550
- },
7551
- {
7552
- type: "uint256",
7553
- name: "tpExecutionFee"
7554
- },
7555
- {
7556
- type: "uint256",
7557
- name: "slSize"
7558
- },
7559
- {
7560
- type: "uint256",
7561
- name: "slPrice"
7562
- },
7563
- {
7564
- type: "uint256",
7565
- name: "slExecutionFee"
7566
- }
7567
- ]
7568
- }
7569
- ]
7570
- },
7571
- {
7572
- type: "function",
7573
- name: "getOrderWithTPSL",
7574
- constant: true,
7575
- stateMutability: "view",
7576
- payable: false,
7577
- inputs: [
7578
- {
7579
- type: "uint256",
7580
- name: "orderId"
7581
- }
7582
- ],
7583
- outputs: [
7584
- {
7585
- type: "tuple",
7586
- components: [
7587
- {
7588
- type: "bytes32",
7589
- name: "poolId"
7590
- },
7591
- {
7592
- type: "bytes32",
7593
- name: "positionId"
7594
- },
7595
- {
7596
- type: "uint256",
7597
- name: "collateralAmount"
7598
- },
7599
- {
7600
- type: "uint256",
7601
- name: "size"
7602
- },
7603
- {
7604
- type: "uint256",
7605
- name: "price"
7606
- },
7607
- {
7608
- type: "uint256",
7609
- name: "filledSize"
7610
- },
7611
- {
7612
- type: "address",
7613
- name: "user"
7614
- },
7615
- {
7616
- type: "uint8",
7617
- name: "orderType"
7618
- },
7619
- {
7620
- type: "uint8",
7621
- name: "triggerType"
7622
- },
7623
- {
7624
- type: "uint8",
7625
- name: "operation"
7626
- },
7627
- {
7628
- type: "uint8",
7629
- name: "direction"
7630
- },
7631
- {
7632
- type: "uint8",
7633
- name: "timeInForce"
7634
- },
7635
- {
7636
- type: "uint16",
7637
- name: "slippagePct"
7638
- },
7639
- {
7640
- type: "bool",
7641
- name: "postOnly"
7642
- },
7643
- {
7644
- type: "uint64",
7645
- name: "createdAt"
7646
- },
7647
- {
7648
- type: "address",
7649
- name: "broker"
7650
- }
7651
- ]
7652
- },
7653
- {
7654
- type: "tuple",
7655
- components: [
7656
- {
7657
- type: "uint256",
7658
- name: "tpSize"
7659
- },
7660
- {
7661
- type: "uint256",
7662
- name: "tpPrice"
7663
- },
7664
- {
7665
- type: "uint256",
7666
- name: "tpExecutionFee"
7667
- },
7668
- {
7669
- type: "uint256",
7670
- name: "slSize"
7671
- },
7672
- {
7673
- type: "uint256",
7674
- name: "slPrice"
7675
- },
7676
- {
7677
- type: "uint256",
7678
- name: "slExecutionFee"
7679
- }
7680
- ]
7681
- }
7682
- ]
7683
- },
7684
- {
7685
- type: "function",
7686
- name: "initialize",
7687
- constant: false,
7688
- payable: false,
7689
- inputs: [
7690
- {
7691
- type: "address",
7692
- name: "addressManager"
7693
- }
7694
- ],
7695
- outputs: []
7696
- },
7697
- {
7698
- type: "function",
7699
- name: "isAllOrderOwner",
7700
- constant: true,
7701
- stateMutability: "view",
7702
- payable: false,
7703
- inputs: [
7704
- {
7705
- type: "uint256[]",
7706
- name: "orderIds"
7707
- },
7708
- {
7709
- type: "address",
7710
- name: "user"
7711
- }
7712
- ],
7713
- outputs: [
7714
- {
7715
- type: "bool"
7716
- }
7717
- ]
7718
- },
7719
- {
7720
- type: "function",
7721
- name: "isOrderOwner",
7722
- constant: true,
7723
- stateMutability: "view",
7724
- payable: false,
7725
- inputs: [
7726
- {
7727
- type: "uint256",
7728
- name: "orderId"
7729
- },
7730
- {
7731
- type: "address",
7732
- name: "user"
7733
- }
7734
- ],
7735
- outputs: [
7736
- {
7737
- type: "bool"
7738
- }
7739
- ]
7740
- },
7741
- {
7742
- type: "function",
7743
- name: "placeOrderWithPosition",
7744
- constant: false,
7745
- payable: false,
7746
- inputs: [
7747
- {
7748
- type: "bytes32",
7749
- name: "positionId"
7750
- },
7751
- {
7752
- type: "tuple",
7753
- name: "params",
7754
- components: [
7755
- {
7756
- type: "address",
7757
- name: "user"
7758
- },
7759
- {
7760
- type: "bytes32",
7761
- name: "poolId"
7762
- },
7763
- {
7764
- type: "uint8",
7765
- name: "orderType"
7766
- },
7767
- {
7768
- type: "uint8",
7769
- name: "triggerType"
7770
- },
7771
- {
7772
- type: "uint8",
7773
- name: "operation"
7774
- },
7775
- {
7776
- type: "uint8",
7777
- name: "direction"
7778
- },
7779
- {
7780
- type: "uint256",
7781
- name: "collateralAmount"
7782
- },
7783
- {
7784
- type: "uint256",
7785
- name: "size"
7786
- },
7787
- {
7788
- type: "uint256",
7789
- name: "price"
7790
- },
7791
- {
7792
- type: "uint8",
7793
- name: "timeInForce"
7794
- },
7795
- {
7796
- type: "bool",
7797
- name: "postOnly"
7798
- },
7799
- {
7800
- type: "uint16",
7801
- name: "slippagePct"
7802
- },
7803
- {
7804
- type: "uint16",
7805
- name: "leverage"
7806
- },
7807
- {
7808
- type: "uint256",
7809
- name: "tpSize"
7810
- },
7811
- {
7812
- type: "uint256",
7813
- name: "tpPrice"
7814
- },
7815
- {
7816
- type: "uint256",
7817
- name: "slSize"
7818
- },
7819
- {
7820
- type: "uint256",
7821
- name: "slPrice"
7822
- }
7823
- ]
7824
- }
7825
- ],
7826
- outputs: [
7827
- {
7828
- type: "uint256",
7829
- name: "orderId"
7830
- }
7831
- ]
7832
- },
7833
- {
7834
- type: "function",
7835
- name: "placeOrderWithSalt",
7836
- constant: false,
7837
- payable: false,
7838
- inputs: [
7839
- {
7840
- type: "uint64",
7841
- name: "userPositionSalt"
7842
- },
7843
- {
7844
- type: "tuple",
7845
- name: "params",
7846
- components: [
7847
- {
7848
- type: "address",
7849
- name: "user"
7850
- },
7851
- {
7852
- type: "bytes32",
7853
- name: "poolId"
7854
- },
7855
- {
7856
- type: "uint8",
7857
- name: "orderType"
7858
- },
7859
- {
7860
- type: "uint8",
7861
- name: "triggerType"
7862
- },
7863
- {
7864
- type: "uint8",
7865
- name: "operation"
7866
- },
7867
- {
7868
- type: "uint8",
7869
- name: "direction"
7870
- },
7871
- {
7872
- type: "uint256",
7873
- name: "collateralAmount"
7874
- },
7875
- {
7876
- type: "uint256",
7877
- name: "size"
7878
- },
7879
- {
7880
- type: "uint256",
7881
- name: "price"
7882
- },
7883
- {
7884
- type: "uint8",
7885
- name: "timeInForce"
7886
- },
7887
- {
7888
- type: "bool",
7889
- name: "postOnly"
7890
- },
7891
- {
7892
- type: "uint16",
7893
- name: "slippagePct"
7894
- },
7895
- {
7896
- type: "uint16",
7897
- name: "leverage"
7898
- },
7899
- {
7900
- type: "uint256",
7901
- name: "tpSize"
7902
- },
7903
- {
7904
- type: "uint256",
7905
- name: "tpPrice"
7906
- },
7907
- {
7908
- type: "uint256",
7909
- name: "slSize"
7910
- },
7911
- {
7912
- type: "uint256",
7913
- name: "slPrice"
7914
- }
7915
- ]
7916
- }
7917
- ],
7918
- outputs: [
7919
- {
7920
- type: "uint256",
7921
- name: "orderId"
7922
- }
7923
- ]
7924
- },
7925
- {
7926
- type: "function",
7927
- name: "proxiableUUID",
7928
- constant: true,
7929
- stateMutability: "view",
7930
- payable: false,
7931
- inputs: [],
7932
- outputs: [
7933
- {
7934
- type: "bytes32"
7935
- }
7936
- ]
7937
- },
7938
- {
7939
- type: "function",
7940
- name: "removePositionOrders",
7941
- constant: false,
7942
- payable: false,
7943
- inputs: [
7944
- {
7945
- type: "bytes32",
7946
- name: "positionId"
7947
- }
7948
- ],
7949
- outputs: []
7950
- },
7951
- {
7952
- type: "function",
7953
- name: "saveAutoDecreaseOrder",
7954
- constant: false,
7955
- payable: false,
7956
- inputs: [
7957
- {
7958
- type: "address",
7959
- name: "user"
7960
- },
7961
- {
7962
- type: "bytes32",
7963
- name: "poolId"
7964
- },
7965
- {
7966
- type: "bytes32",
7967
- name: "positionId"
7968
- },
7969
- {
7970
- type: "uint256",
7971
- name: "size"
7972
- },
7973
- {
7974
- type: "uint256",
7975
- name: "price"
7976
- },
7977
- {
7978
- type: "uint8",
7979
- name: "direction"
7980
- },
7981
- {
7982
- type: "address",
7983
- name: "broker"
7984
- }
7985
- ],
7986
- outputs: [
7987
- {
7988
- type: "uint256",
7989
- name: "orderId"
7990
- }
7991
- ]
7992
- },
7993
- {
7994
- type: "function",
7995
- name: "setExecutionFee",
7996
- constant: false,
7997
- payable: false,
7998
- inputs: [
7999
- {
8000
- type: "address",
8001
- name: "token"
8002
- },
8003
- {
8004
- type: "uint256",
8005
- name: "value"
8006
- },
8007
- {
8008
- type: "bool",
8009
- name: "isActive"
8010
- }
8011
- ],
8012
- outputs: []
8013
- },
8014
- {
8015
- type: "function",
8016
- name: "uncompleteOrder",
8017
- constant: false,
8018
- payable: false,
8019
- inputs: [
8020
- {
8021
- type: "uint256",
8022
- name: "orderId"
8023
- },
8024
- {
8025
- type: "string",
8026
- name: "remark"
8027
- }
8028
- ],
8029
- outputs: []
8030
- },
8031
- {
8032
- type: "function",
8033
- name: "uncompleteOrders",
8034
- constant: false,
8035
- payable: false,
8036
- inputs: [
8037
- {
8038
- type: "uint256[]",
8039
- name: "orderIds"
8040
- },
8041
- {
8042
- type: "string",
8043
- name: "remark"
8044
- }
8045
- ],
8046
- outputs: []
8047
- },
8048
- {
8049
- type: "function",
8050
- name: "updateOrder",
8051
- constant: false,
8052
- payable: false,
8053
- inputs: [
8054
- {
8055
- type: "tuple",
8056
- name: "params",
8057
- components: [
8058
- {
8059
- type: "uint256",
8060
- name: "orderId"
8061
- },
8062
- {
8063
- type: "uint256",
8064
- name: "size"
8065
- },
8066
- {
8067
- type: "uint256",
8068
- name: "price"
8069
- },
8070
- {
8071
- type: "tuple",
8072
- name: "tpsl",
8073
- components: [
8074
- {
8075
- type: "uint256",
8076
- name: "tpSize"
8077
- },
8078
- {
8079
- type: "uint256",
8080
- name: "tpPrice"
8081
- },
8082
- {
8083
- type: "uint256",
8084
- name: "slSize"
8085
- },
8086
- {
8087
- type: "uint256",
8088
- name: "slPrice"
8089
- }
8090
- ]
8091
- }
8092
- ]
8093
- }
8094
- ],
8095
- outputs: []
8096
- },
8097
- {
8098
- type: "function",
8099
- name: "upgradeTo",
8100
- constant: false,
8101
- stateMutability: "payable",
8102
- payable: true,
8103
- inputs: [
8104
- {
8105
- type: "address",
8106
- name: "newImplementation"
8107
- },
8108
- {
8109
- type: "bytes",
8110
- name: "data"
8111
- }
8112
- ],
8113
- outputs: []
8114
- },
8115
- {
8116
- type: "function",
8117
- name: "upgradeToAndCall",
8118
- constant: false,
8119
- stateMutability: "payable",
8120
- payable: true,
8121
- inputs: [
8122
- {
8123
- type: "address",
8124
- name: "newImplementation"
8125
- },
8126
- {
8127
- type: "bytes",
8128
- name: "data"
8129
- }
8130
- ],
8131
- outputs: []
7259
+ ]
8132
7260
  }
8133
7261
  ];
8134
7262
 
@@ -8703,6 +7831,11 @@ var MarketManager_default = [
8703
7831
  name: "MarketAlreadyExisted",
8704
7832
  inputs: []
8705
7833
  },
7834
+ {
7835
+ type: "error",
7836
+ name: "MarketNotExisted",
7837
+ inputs: []
7838
+ },
8706
7839
  {
8707
7840
  type: "error",
8708
7841
  name: "NotAddressManager",
@@ -8752,6 +7885,50 @@ var MarketManager_default = [
8752
7885
  }
8753
7886
  ]
8754
7887
  },
7888
+ {
7889
+ type: "event",
7890
+ anonymous: false,
7891
+ name: "ExecutionFeeUpdated",
7892
+ inputs: [
7893
+ {
7894
+ type: "bytes32",
7895
+ name: "marketId",
7896
+ indexed: false
7897
+ },
7898
+ {
7899
+ type: "uint256",
7900
+ name: "oldExecutionFee",
7901
+ indexed: false
7902
+ },
7903
+ {
7904
+ type: "uint256",
7905
+ name: "newExecutionFee",
7906
+ indexed: false
7907
+ }
7908
+ ]
7909
+ },
7910
+ {
7911
+ type: "event",
7912
+ anonymous: false,
7913
+ name: "ForwardFeeUpdated",
7914
+ inputs: [
7915
+ {
7916
+ type: "bytes32",
7917
+ name: "marketId",
7918
+ indexed: false
7919
+ },
7920
+ {
7921
+ type: "uint256",
7922
+ name: "oldForwardFee",
7923
+ indexed: false
7924
+ },
7925
+ {
7926
+ type: "uint256",
7927
+ name: "newForwardFee",
7928
+ indexed: false
7929
+ }
7930
+ ]
7931
+ },
8755
7932
  {
8756
7933
  type: "event",
8757
7934
  anonymous: false,
@@ -8764,6 +7941,50 @@ var MarketManager_default = [
8764
7941
  }
8765
7942
  ]
8766
7943
  },
7944
+ {
7945
+ type: "event",
7946
+ anonymous: false,
7947
+ name: "MaxExecutionFeeUpdated",
7948
+ inputs: [
7949
+ {
7950
+ type: "bytes32",
7951
+ name: "marketId",
7952
+ indexed: false
7953
+ },
7954
+ {
7955
+ type: "uint256",
7956
+ name: "oldMaxExecutionFee",
7957
+ indexed: false
7958
+ },
7959
+ {
7960
+ type: "uint256",
7961
+ name: "newMaxExecutionFee",
7962
+ indexed: false
7963
+ }
7964
+ ]
7965
+ },
7966
+ {
7967
+ type: "event",
7968
+ anonymous: false,
7969
+ name: "MaxForwardFeeUpdated",
7970
+ inputs: [
7971
+ {
7972
+ type: "bytes32",
7973
+ name: "marketId",
7974
+ indexed: false
7975
+ },
7976
+ {
7977
+ type: "uint256",
7978
+ name: "oldMaxForwardFee",
7979
+ indexed: false
7980
+ },
7981
+ {
7982
+ type: "uint256",
7983
+ name: "newMaxForwardFee",
7984
+ indexed: false
7985
+ }
7986
+ ]
7987
+ },
8767
7988
  {
8768
7989
  type: "event",
8769
7990
  anonymous: false,
@@ -8826,6 +8047,22 @@ var MarketManager_default = [
8826
8047
  {
8827
8048
  type: "uint128",
8828
8049
  name: "poolPrimeThreshold"
8050
+ },
8051
+ {
8052
+ type: "uint128",
8053
+ name: "executionFee"
8054
+ },
8055
+ {
8056
+ type: "uint128",
8057
+ name: "maxExecutionFee"
8058
+ },
8059
+ {
8060
+ type: "uint128",
8061
+ name: "forwardFee"
8062
+ },
8063
+ {
8064
+ type: "uint128",
8065
+ name: "maxForwardFee"
8829
8066
  }
8830
8067
  ]
8831
8068
  }
@@ -8863,6 +8100,78 @@ var MarketManager_default = [
8863
8100
  }
8864
8101
  ]
8865
8102
  },
8103
+ {
8104
+ type: "function",
8105
+ name: "getExecutionFee",
8106
+ constant: true,
8107
+ stateMutability: "view",
8108
+ payable: false,
8109
+ inputs: [
8110
+ {
8111
+ type: "bytes32",
8112
+ name: "marketId"
8113
+ }
8114
+ ],
8115
+ outputs: [
8116
+ {
8117
+ type: "uint256"
8118
+ }
8119
+ ]
8120
+ },
8121
+ {
8122
+ type: "function",
8123
+ name: "getExecutionFeeByToken",
8124
+ constant: true,
8125
+ stateMutability: "view",
8126
+ payable: false,
8127
+ inputs: [
8128
+ {
8129
+ type: "address",
8130
+ name: "quoteToken"
8131
+ }
8132
+ ],
8133
+ outputs: [
8134
+ {
8135
+ type: "uint256"
8136
+ }
8137
+ ]
8138
+ },
8139
+ {
8140
+ type: "function",
8141
+ name: "getForwardFee",
8142
+ constant: true,
8143
+ stateMutability: "view",
8144
+ payable: false,
8145
+ inputs: [
8146
+ {
8147
+ type: "bytes32",
8148
+ name: "marketId"
8149
+ }
8150
+ ],
8151
+ outputs: [
8152
+ {
8153
+ type: "uint256"
8154
+ }
8155
+ ]
8156
+ },
8157
+ {
8158
+ type: "function",
8159
+ name: "getForwardFeeByToken",
8160
+ constant: true,
8161
+ stateMutability: "view",
8162
+ payable: false,
8163
+ inputs: [
8164
+ {
8165
+ type: "address",
8166
+ name: "quoteToken"
8167
+ }
8168
+ ],
8169
+ outputs: [
8170
+ {
8171
+ type: "uint256"
8172
+ }
8173
+ ]
8174
+ },
8866
8175
  {
8867
8176
  type: "function",
8868
8177
  name: "getImplementation",
@@ -8915,6 +8224,22 @@ var MarketManager_default = [
8915
8224
  {
8916
8225
  type: "uint128",
8917
8226
  name: "poolPrimeThreshold"
8227
+ },
8228
+ {
8229
+ type: "uint128",
8230
+ name: "executionFee"
8231
+ },
8232
+ {
8233
+ type: "uint128",
8234
+ name: "maxExecutionFee"
8235
+ },
8236
+ {
8237
+ type: "uint128",
8238
+ name: "forwardFee"
8239
+ },
8240
+ {
8241
+ type: "uint128",
8242
+ name: "maxForwardFee"
8918
8243
  }
8919
8244
  ]
8920
8245
  }
@@ -8995,6 +8320,74 @@ var MarketManager_default = [
8995
8320
  }
8996
8321
  ]
8997
8322
  },
8323
+ {
8324
+ type: "function",
8325
+ name: "updateExecutionFee",
8326
+ constant: false,
8327
+ payable: false,
8328
+ inputs: [
8329
+ {
8330
+ type: "bytes32",
8331
+ name: "marketId"
8332
+ },
8333
+ {
8334
+ type: "uint128",
8335
+ name: "_executionFee"
8336
+ }
8337
+ ],
8338
+ outputs: []
8339
+ },
8340
+ {
8341
+ type: "function",
8342
+ name: "updateForwardFee",
8343
+ constant: false,
8344
+ payable: false,
8345
+ inputs: [
8346
+ {
8347
+ type: "bytes32",
8348
+ name: "marketId"
8349
+ },
8350
+ {
8351
+ type: "uint128",
8352
+ name: "_forwardFee"
8353
+ }
8354
+ ],
8355
+ outputs: []
8356
+ },
8357
+ {
8358
+ type: "function",
8359
+ name: "updateMaxExecutionFee",
8360
+ constant: false,
8361
+ payable: false,
8362
+ inputs: [
8363
+ {
8364
+ type: "bytes32",
8365
+ name: "marketId"
8366
+ },
8367
+ {
8368
+ type: "uint128",
8369
+ name: "_maxExecutionFee"
8370
+ }
8371
+ ],
8372
+ outputs: []
8373
+ },
8374
+ {
8375
+ type: "function",
8376
+ name: "updateMaxForwardFee",
8377
+ constant: false,
8378
+ payable: false,
8379
+ inputs: [
8380
+ {
8381
+ type: "bytes32",
8382
+ name: "marketId"
8383
+ },
8384
+ {
8385
+ type: "uint128",
8386
+ name: "_maxForwardFee"
8387
+ }
8388
+ ],
8389
+ outputs: []
8390
+ },
8998
8391
  {
8999
8392
  type: "function",
9000
8393
  name: "upgradeTo",
@@ -15917,11 +15310,11 @@ var Order = class {
15917
15310
  this.account = account;
15918
15311
  this.api = api;
15919
15312
  }
15920
- async createIncreaseOrder(params, tradingFee) {
15313
+ async createIncreaseOrder(params, tradingFee, marketId) {
15921
15314
  try {
15922
15315
  const config = this.configManager.getConfig();
15923
15316
  const networkFee = await this.utils.getNetworkFee(
15924
- params.executionFeeToken,
15317
+ marketId,
15925
15318
  params.chainId
15926
15319
  );
15927
15320
  let totalNetWorkFee = BigInt(networkFee);
@@ -16091,10 +15484,9 @@ var Order = class {
16091
15484
  };
16092
15485
  }
16093
15486
  }
16094
- async closeAllPositions(chainId, params, tradingFee) {
15487
+ async closeAllPositions(chainId, params) {
16095
15488
  try {
16096
15489
  const config = this.configManager.getConfig();
16097
- const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params[0].poolId, chainId, address: params[0].address });
16098
15490
  const depositData = {
16099
15491
  token: "0x0000000000000000000000000000000000000000",
16100
15492
  amount: "0"
@@ -16728,9 +16120,9 @@ var Order = class {
16728
16120
  };
16729
16121
  }
16730
16122
  }
16731
- async updateOrderTpSl(params, quoteAddress, chainId, address) {
16123
+ async updateOrderTpSl(params, quoteAddress, chainId, address, marketId) {
16732
16124
  const config = this.configManager.getConfig();
16733
- const networkFee = await this.utils.getNetworkFee(quoteAddress, chainId);
16125
+ const networkFee = await this.utils.getNetworkFee(marketId, chainId);
16734
16126
  const data = {
16735
16127
  orderId: params.orderId,
16736
16128
  size: params.size,
@@ -21631,17 +21023,17 @@ var Utils = class {
21631
21023
  };
21632
21024
  }
21633
21025
  }
21634
- async getNetworkFee(quoteAddress, chainId) {
21635
- const orderManagerAddress = getContractAddressByChainId(chainId).ORDER_MANAGER;
21026
+ async getNetworkFee(marketId, chainId) {
21027
+ const marketManagerAddress = getContractAddressByChainId(chainId).MARKET_MANAGER;
21636
21028
  const provider = await getJSONProvider(chainId);
21637
- const orderManagerContract = new import_ethers25.ethers.Contract(
21638
- orderManagerAddress,
21639
- OrderManager_default,
21029
+ const marketManagerContract = new import_ethers25.ethers.Contract(
21030
+ marketManagerAddress,
21031
+ MarketManager_default,
21640
21032
  provider
21641
21033
  );
21642
21034
  try {
21643
- const networkFee = await orderManagerContract.getExecutionFee(
21644
- quoteAddress
21035
+ const networkFee = await marketManagerContract.getExecutionFee(
21036
+ marketId
21645
21037
  );
21646
21038
  return networkFee.toString();
21647
21039
  } catch (error) {
@@ -22738,7 +22130,6 @@ var Account = class {
22738
22130
  data: functionHash,
22739
22131
  nonce: nonce.toString()
22740
22132
  };
22741
- this.logger.info("deposit forward tx params --->", forwardTxParams);
22742
22133
  const rs2 = await this.client.seamless.forwarderTx(forwardTxParams, chainId, seamlessWallet);
22743
22134
  return {
22744
22135
  code: 0,
@@ -22796,6 +22187,8 @@ var Account = class {
22796
22187
  };
22797
22188
  }
22798
22189
  }
22190
+ async getCurrentEpoch() {
22191
+ }
22799
22192
  async getAccountVipInfo(chainId, address) {
22800
22193
  const config = this.configManager.getConfig();
22801
22194
  const provider = await getJSONProvider(chainId);
@@ -22806,14 +22199,17 @@ var Account = class {
22806
22199
  );
22807
22200
  const latestBlock = await provider.getBlock("latest");
22808
22201
  const deadline = (latestBlock?.timestamp ?? (0, import_dayjs3.default)().unix()) + 60 * 5;
22809
- this.logger.info("deadline-->", deadline);
22202
+ const accessToken = await this.configManager.getAccessToken() ?? "";
22810
22203
  try {
22811
- this.logger.info("brokerContract-->", config.brokerAddress);
22812
- this.logger.info("address-->", address);
22813
- const accountVipInfo = await brokerContract.userFeeData(address);
22814
- this.logger.info("accountVipInfo-->", accountVipInfo);
22204
+ const currentEpoch = await this.client.api.getCurrentEpoch({ address, accessToken, broker: config.brokerAddress });
22205
+ if (currentEpoch.code !== 9200) {
22206
+ throw new MyxSDKError(
22207
+ "REQUEST_FAILED" /* RequestFailed */,
22208
+ currentEpoch.msg ?? "Failed to get current epoch"
22209
+ );
22210
+ }
22211
+ const accountVipInfo = await brokerContract.userFeeData(currentEpoch?.data ?? 0, address);
22815
22212
  const nonce = await brokerContract.userNonces(address);
22816
- this.logger.info("nonce-->", nonce);
22817
22213
  return {
22818
22214
  code: 0,
22819
22215
  data: { ...accountVipInfo, nonce: nonce.toString(), deadline }
@@ -23380,6 +22776,22 @@ var Api = class extends Request {
23380
22776
  /**
23381
22777
  * appeal module end ------>
23382
22778
  */
22779
+ async getCurrentEpoch({
22780
+ address,
22781
+ accessToken,
22782
+ broker
22783
+ }) {
22784
+ return http.get(
22785
+ `${this.getHost()}/openapi/gateway/scan/get-current-epoch`,
22786
+ { broker },
22787
+ {
22788
+ headers: {
22789
+ myx_openapi_account: address,
22790
+ myx_openapi_access_token: accessToken
22791
+ }
22792
+ }
22793
+ );
22794
+ }
23383
22795
  };
23384
22796
 
23385
22797
  // src/manager/seamless/index.ts