@myx-trade/sdk 0.1.47 → 0.1.49

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.d.mts CHANGED
@@ -890,8 +890,7 @@ declare namespace index$1 {
890
890
  export { index$1_claimQuotePoolRebate as claimQuotePoolRebate, index$1_claimQuotePoolRebates as claimQuotePoolRebates, index$1_deposit as deposit, index$1_getLpPrice as getLpPrice, index$1_getRewards as getRewards, index$1_transfer as transfer, index$1_withdraw as withdraw };
891
891
  }
892
892
 
893
- declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, string, bigint, bigint, bigint, bigint, bigint] & {
894
- marketId: string;
893
+ declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint] & {
895
894
  quoteToken: string;
896
895
  baseReserveRatio: bigint;
897
896
  quoteReserveRatio: bigint;
package/dist/index.d.ts CHANGED
@@ -890,8 +890,7 @@ declare namespace index$1 {
890
890
  export { index$1_claimQuotePoolRebate as claimQuotePoolRebate, index$1_claimQuotePoolRebates as claimQuotePoolRebates, index$1_deposit as deposit, index$1_getLpPrice as getLpPrice, index$1_getRewards as getRewards, index$1_transfer as transfer, index$1_withdraw as withdraw };
891
891
  }
892
892
 
893
- declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, string, bigint, bigint, bigint, bigint, bigint] & {
894
- marketId: string;
893
+ declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint] & {
895
894
  quoteToken: string;
896
895
  baseReserveRatio: bigint;
897
896
  quoteReserveRatio: bigint;
package/dist/index.js CHANGED
@@ -1836,7 +1836,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
1836
1836
  // package.json
1837
1837
  var package_default = {
1838
1838
  name: "@myx-trade/sdk",
1839
- version: "0.1.47",
1839
+ version: "0.1.49",
1840
1840
  private: false,
1841
1841
  publishConfig: {
1842
1842
  access: "public"
@@ -9064,11 +9064,21 @@ var MarketManager_default = [
9064
9064
  name: "InvalidInitialization",
9065
9065
  inputs: []
9066
9066
  },
9067
+ {
9068
+ type: "error",
9069
+ name: "InvalidParameter",
9070
+ inputs: []
9071
+ },
9067
9072
  {
9068
9073
  type: "error",
9069
9074
  name: "InvalidQuoteTokenAddress",
9070
9075
  inputs: []
9071
9076
  },
9077
+ {
9078
+ type: "error",
9079
+ name: "InvalidRatioParams",
9080
+ inputs: []
9081
+ },
9072
9082
  {
9073
9083
  type: "error",
9074
9084
  name: "MarketAlreadyExisted",
@@ -9171,8 +9181,8 @@ var MarketManager_default = [
9171
9181
  name: "params",
9172
9182
  components: [
9173
9183
  {
9174
- type: "string",
9175
- name: "chainName"
9184
+ type: "uint64",
9185
+ name: "chainId"
9176
9186
  },
9177
9187
  {
9178
9188
  type: "address",
@@ -9187,11 +9197,11 @@ var MarketManager_default = [
9187
9197
  name: "quoteReserveRatio"
9188
9198
  },
9189
9199
  {
9190
- type: "uint128",
9200
+ type: "uint64",
9191
9201
  name: "oracleFeeUsd"
9192
9202
  },
9193
9203
  {
9194
- type: "uint128",
9204
+ type: "uint64",
9195
9205
  name: "oracleRefundFeeUsd"
9196
9206
  },
9197
9207
  {
@@ -9234,24 +9244,6 @@ var MarketManager_default = [
9234
9244
  }
9235
9245
  ]
9236
9246
  },
9237
- {
9238
- type: "function",
9239
- name: "getDependencyIdentifier",
9240
- constant: true,
9241
- stateMutability: "view",
9242
- payable: false,
9243
- inputs: [
9244
- {
9245
- type: "address",
9246
- name: "contractAddress"
9247
- }
9248
- ],
9249
- outputs: [
9250
- {
9251
- type: "bytes32"
9252
- }
9253
- ]
9254
- },
9255
9247
  {
9256
9248
  type: "function",
9257
9249
  name: "getImplementation",
@@ -9281,10 +9273,6 @@ var MarketManager_default = [
9281
9273
  {
9282
9274
  type: "tuple",
9283
9275
  components: [
9284
- {
9285
- type: "bytes32",
9286
- name: "marketId"
9287
- },
9288
9276
  {
9289
9277
  type: "address",
9290
9278
  name: "quoteToken"
@@ -9298,11 +9286,11 @@ var MarketManager_default = [
9298
9286
  name: "quoteReserveRatio"
9299
9287
  },
9300
9288
  {
9301
- type: "uint128",
9289
+ type: "uint64",
9302
9290
  name: "oracleFeeUsd"
9303
9291
  },
9304
9292
  {
9305
- type: "uint128",
9293
+ type: "uint64",
9306
9294
  name: "oracleRefundFeeUsd"
9307
9295
  },
9308
9296
  {
@@ -9388,49 +9376,6 @@ var MarketManager_default = [
9388
9376
  }
9389
9377
  ]
9390
9378
  },
9391
- {
9392
- type: "function",
9393
- name: "registerDependencies",
9394
- constant: false,
9395
- payable: false,
9396
- inputs: [
9397
- {
9398
- type: "bytes32[]",
9399
- name: "identifiers"
9400
- }
9401
- ],
9402
- outputs: []
9403
- },
9404
- {
9405
- type: "function",
9406
- name: "unregisterDependencies",
9407
- constant: false,
9408
- payable: false,
9409
- inputs: [
9410
- {
9411
- type: "bytes32[]",
9412
- name: "identifiers"
9413
- }
9414
- ],
9415
- outputs: []
9416
- },
9417
- {
9418
- type: "function",
9419
- name: "update",
9420
- constant: false,
9421
- payable: false,
9422
- inputs: [
9423
- {
9424
- type: "bytes32",
9425
- name: "identifier"
9426
- },
9427
- {
9428
- type: "address",
9429
- name: "newAddress"
9430
- }
9431
- ],
9432
- outputs: []
9433
- },
9434
9379
  {
9435
9380
  type: "function",
9436
9381
  name: "upgradeTo",
@@ -10154,6 +10099,7 @@ var getPoolTokenContract = async (chainId, lpTokenAddress, type = 0 /* JSON */)
10154
10099
  var getMarketManageContract = async (chainId, type = 0 /* JSON */) => {
10155
10100
  const addresses = address_default[chainId];
10156
10101
  const address = addresses.MARKET_MANAGER;
10102
+ console.log(addresses.MARKET_MANAGER);
10157
10103
  const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
10158
10104
  return getContract(address, MarketManager_default, provider);
10159
10105
  };
@@ -10504,7 +10450,7 @@ var COMMON_LP_AMOUNT_DECIMALS = 18;
10504
10450
 
10505
10451
  // src/common/tradingGas.ts
10506
10452
  var bigintTradingGasToRatioCalculator = (gas, ratio) => {
10507
- return gas * (0, import_ethers6.parseUnits)(ratio.toString(), COMMON_CONFIG_DECIMALS) / BigInt(10 ** COMMON_CONFIG_DECIMALS);
10453
+ return BigInt(gas) * (0, import_ethers6.parseUnits)(ratio.toString(), COMMON_CONFIG_DECIMALS) / BigInt(10 ** COMMON_CONFIG_DECIMALS);
10508
10454
  };
10509
10455
  var bigintTradingGasPriceWithRatio = async (chainId) => {
10510
10456
  try {
@@ -10514,7 +10460,7 @@ var bigintTradingGasPriceWithRatio = async (chainId) => {
10514
10460
  if (!gasPrice) {
10515
10461
  throw new Error("Network Error");
10516
10462
  }
10517
- const gasPriceWithRatio = bigintTradingGasToRatioCalculator(gasPrice, chainInfo.gasPriceRatio);
10463
+ const gasPriceWithRatio = bigintTradingGasToRatioCalculator(BigInt(gasPrice), chainInfo.gasPriceRatio);
10518
10464
  return {
10519
10465
  gasPrice: gasPriceWithRatio
10520
10466
  };
@@ -11591,6 +11537,7 @@ var getMarket = async (chainId, marketId) => {
11591
11537
  if (!marketId) return;
11592
11538
  const contract = await getMarketManageContract(chainId);
11593
11539
  const request = await contract.getMarket(marketId);
11540
+ console.log("MarketManage.getMarket request", request);
11594
11541
  return request;
11595
11542
  } catch (error) {
11596
11543
  console.error(error);
package/dist/index.mjs CHANGED
@@ -1751,7 +1751,7 @@ var RotationProvider = class extends BaseProvider {
1751
1751
  // package.json
1752
1752
  var package_default = {
1753
1753
  name: "@myx-trade/sdk",
1754
- version: "0.1.47",
1754
+ version: "0.1.49",
1755
1755
  private: false,
1756
1756
  publishConfig: {
1757
1757
  access: "public"
@@ -8979,11 +8979,21 @@ var MarketManager_default = [
8979
8979
  name: "InvalidInitialization",
8980
8980
  inputs: []
8981
8981
  },
8982
+ {
8983
+ type: "error",
8984
+ name: "InvalidParameter",
8985
+ inputs: []
8986
+ },
8982
8987
  {
8983
8988
  type: "error",
8984
8989
  name: "InvalidQuoteTokenAddress",
8985
8990
  inputs: []
8986
8991
  },
8992
+ {
8993
+ type: "error",
8994
+ name: "InvalidRatioParams",
8995
+ inputs: []
8996
+ },
8987
8997
  {
8988
8998
  type: "error",
8989
8999
  name: "MarketAlreadyExisted",
@@ -9086,8 +9096,8 @@ var MarketManager_default = [
9086
9096
  name: "params",
9087
9097
  components: [
9088
9098
  {
9089
- type: "string",
9090
- name: "chainName"
9099
+ type: "uint64",
9100
+ name: "chainId"
9091
9101
  },
9092
9102
  {
9093
9103
  type: "address",
@@ -9102,11 +9112,11 @@ var MarketManager_default = [
9102
9112
  name: "quoteReserveRatio"
9103
9113
  },
9104
9114
  {
9105
- type: "uint128",
9115
+ type: "uint64",
9106
9116
  name: "oracleFeeUsd"
9107
9117
  },
9108
9118
  {
9109
- type: "uint128",
9119
+ type: "uint64",
9110
9120
  name: "oracleRefundFeeUsd"
9111
9121
  },
9112
9122
  {
@@ -9149,24 +9159,6 @@ var MarketManager_default = [
9149
9159
  }
9150
9160
  ]
9151
9161
  },
9152
- {
9153
- type: "function",
9154
- name: "getDependencyIdentifier",
9155
- constant: true,
9156
- stateMutability: "view",
9157
- payable: false,
9158
- inputs: [
9159
- {
9160
- type: "address",
9161
- name: "contractAddress"
9162
- }
9163
- ],
9164
- outputs: [
9165
- {
9166
- type: "bytes32"
9167
- }
9168
- ]
9169
- },
9170
9162
  {
9171
9163
  type: "function",
9172
9164
  name: "getImplementation",
@@ -9196,10 +9188,6 @@ var MarketManager_default = [
9196
9188
  {
9197
9189
  type: "tuple",
9198
9190
  components: [
9199
- {
9200
- type: "bytes32",
9201
- name: "marketId"
9202
- },
9203
9191
  {
9204
9192
  type: "address",
9205
9193
  name: "quoteToken"
@@ -9213,11 +9201,11 @@ var MarketManager_default = [
9213
9201
  name: "quoteReserveRatio"
9214
9202
  },
9215
9203
  {
9216
- type: "uint128",
9204
+ type: "uint64",
9217
9205
  name: "oracleFeeUsd"
9218
9206
  },
9219
9207
  {
9220
- type: "uint128",
9208
+ type: "uint64",
9221
9209
  name: "oracleRefundFeeUsd"
9222
9210
  },
9223
9211
  {
@@ -9303,49 +9291,6 @@ var MarketManager_default = [
9303
9291
  }
9304
9292
  ]
9305
9293
  },
9306
- {
9307
- type: "function",
9308
- name: "registerDependencies",
9309
- constant: false,
9310
- payable: false,
9311
- inputs: [
9312
- {
9313
- type: "bytes32[]",
9314
- name: "identifiers"
9315
- }
9316
- ],
9317
- outputs: []
9318
- },
9319
- {
9320
- type: "function",
9321
- name: "unregisterDependencies",
9322
- constant: false,
9323
- payable: false,
9324
- inputs: [
9325
- {
9326
- type: "bytes32[]",
9327
- name: "identifiers"
9328
- }
9329
- ],
9330
- outputs: []
9331
- },
9332
- {
9333
- type: "function",
9334
- name: "update",
9335
- constant: false,
9336
- payable: false,
9337
- inputs: [
9338
- {
9339
- type: "bytes32",
9340
- name: "identifier"
9341
- },
9342
- {
9343
- type: "address",
9344
- name: "newAddress"
9345
- }
9346
- ],
9347
- outputs: []
9348
- },
9349
9294
  {
9350
9295
  type: "function",
9351
9296
  name: "upgradeTo",
@@ -10069,6 +10014,7 @@ var getPoolTokenContract = async (chainId, lpTokenAddress, type = 0 /* JSON */)
10069
10014
  var getMarketManageContract = async (chainId, type = 0 /* JSON */) => {
10070
10015
  const addresses = address_default[chainId];
10071
10016
  const address = addresses.MARKET_MANAGER;
10017
+ console.log(addresses.MARKET_MANAGER);
10072
10018
  const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
10073
10019
  return getContract(address, MarketManager_default, provider);
10074
10020
  };
@@ -10419,7 +10365,7 @@ var COMMON_LP_AMOUNT_DECIMALS = 18;
10419
10365
 
10420
10366
  // src/common/tradingGas.ts
10421
10367
  var bigintTradingGasToRatioCalculator = (gas, ratio) => {
10422
- return gas * parseUnits3(ratio.toString(), COMMON_CONFIG_DECIMALS) / BigInt(10 ** COMMON_CONFIG_DECIMALS);
10368
+ return BigInt(gas) * parseUnits3(ratio.toString(), COMMON_CONFIG_DECIMALS) / BigInt(10 ** COMMON_CONFIG_DECIMALS);
10423
10369
  };
10424
10370
  var bigintTradingGasPriceWithRatio = async (chainId) => {
10425
10371
  try {
@@ -10429,7 +10375,7 @@ var bigintTradingGasPriceWithRatio = async (chainId) => {
10429
10375
  if (!gasPrice) {
10430
10376
  throw new Error("Network Error");
10431
10377
  }
10432
- const gasPriceWithRatio = bigintTradingGasToRatioCalculator(gasPrice, chainInfo.gasPriceRatio);
10378
+ const gasPriceWithRatio = bigintTradingGasToRatioCalculator(BigInt(gasPrice), chainInfo.gasPriceRatio);
10433
10379
  return {
10434
10380
  gasPrice: gasPriceWithRatio
10435
10381
  };
@@ -11506,6 +11452,7 @@ var getMarket = async (chainId, marketId) => {
11506
11452
  if (!marketId) return;
11507
11453
  const contract = await getMarketManageContract(chainId);
11508
11454
  const request = await contract.getMarket(marketId);
11455
+ console.log("MarketManage.getMarket request", request);
11509
11456
  return request;
11510
11457
  } catch (error) {
11511
11458
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myx-trade/sdk",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"