@myx-trade/sdk 0.1.148 → 0.1.154

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
@@ -1398,6 +1398,9 @@ declare class Utils {
1398
1398
  longSize: bigint;
1399
1399
  shortSize: bigint;
1400
1400
  poolEntryPrice: bigint;
1401
+ }, [bigint, bigint] & {
1402
+ windowCaps: bigint;
1403
+ openInterest: bigint;
1401
1404
  }] & {
1402
1405
  basePool: [string, bigint, bigint, bigint] & {
1403
1406
  poolToken: string;
@@ -1428,6 +1431,10 @@ declare class Utils {
1428
1431
  shortSize: bigint;
1429
1432
  poolEntryPrice: bigint;
1430
1433
  };
1434
+ liquidityInfo: [bigint, bigint] & {
1435
+ windowCaps: bigint;
1436
+ openInterest: bigint;
1437
+ };
1431
1438
  };
1432
1439
  message?: undefined;
1433
1440
  } | {
@@ -1798,7 +1805,7 @@ declare class Order {
1798
1805
  timestamp?: undefined;
1799
1806
  receipt?: undefined;
1800
1807
  }>;
1801
- createDecreaseOrder(params: PlaceOrderParams, tradingFee: string): Promise<{
1808
+ createDecreaseOrder(params: PlaceOrderParams): Promise<{
1802
1809
  code: number;
1803
1810
  message: string;
1804
1811
  data: ApiResponse<any>;
package/dist/index.d.ts CHANGED
@@ -1398,6 +1398,9 @@ declare class Utils {
1398
1398
  longSize: bigint;
1399
1399
  shortSize: bigint;
1400
1400
  poolEntryPrice: bigint;
1401
+ }, [bigint, bigint] & {
1402
+ windowCaps: bigint;
1403
+ openInterest: bigint;
1401
1404
  }] & {
1402
1405
  basePool: [string, bigint, bigint, bigint] & {
1403
1406
  poolToken: string;
@@ -1428,6 +1431,10 @@ declare class Utils {
1428
1431
  shortSize: bigint;
1429
1432
  poolEntryPrice: bigint;
1430
1433
  };
1434
+ liquidityInfo: [bigint, bigint] & {
1435
+ windowCaps: bigint;
1436
+ openInterest: bigint;
1437
+ };
1431
1438
  };
1432
1439
  message?: undefined;
1433
1440
  } | {
@@ -1798,7 +1805,7 @@ declare class Order {
1798
1805
  timestamp?: undefined;
1799
1806
  receipt?: undefined;
1800
1807
  }>;
1801
- createDecreaseOrder(params: PlaceOrderParams, tradingFee: string): Promise<{
1808
+ createDecreaseOrder(params: PlaceOrderParams): Promise<{
1802
1809
  code: number;
1803
1810
  message: string;
1804
1811
  data: ApiResponse<any>;
package/dist/index.js CHANGED
@@ -1466,7 +1466,7 @@ var ARB_TEST_SEPOLIA = {
1466
1466
  // MYXOracle
1467
1467
  EIP7702Delegation: "0xd501b6bb41fc34c1258Bab0Da1E0d74F332D2017",
1468
1468
  MARKET_MANAGER: "0xcAD7731b889B788d96D8F63273EcE9Fdd806a8f5",
1469
- DATA_PROVIDER: "0x40b9C96F947Fab73A181008C2795f560b51AAe26",
1469
+ DATA_PROVIDER: "0xf28692b400b2735DeB8660960f4099C288d44140",
1470
1470
  ORACLE_RESERVE: "0x03407bFdBd6f4778c9908390b7e9703B84FA029f",
1471
1471
  FORWARDER: "0x5DC38C8f032D3801fb09dd3DF5c5F203b1382172"
1472
1472
  };
@@ -1487,7 +1487,7 @@ var LINEA_SEPOLIA = {
1487
1487
  // MYXOracle
1488
1488
  EIP7702Delegation: "0x97a51EAC31BbE0eE0eE732098D3332618919b6FB",
1489
1489
  MARKET_MANAGER: "0x056a018E5c88f7A4d309813F988c8CC755719B91",
1490
- DATA_PROVIDER: "0x4975639Ea5657609Da3EB004662630c24Cd54Db1",
1490
+ DATA_PROVIDER: "0xC7A0aa87031d53A63b33e8CABa4D688b57036A3D",
1491
1491
  ORACLE_RESERVE: "0x7b146cbf83558B65fDB3b780A0A644B28Cd73fF4",
1492
1492
  USDC: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",
1493
1493
  FORWARDER: "0x62335ea59444111D582df5DEbcB6cf29e831927F"
@@ -1821,7 +1821,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
1821
1821
  // package.json
1822
1822
  var package_default = {
1823
1823
  name: "@myx-trade/sdk",
1824
- version: "0.1.148",
1824
+ version: "0.1.154",
1825
1825
  private: false,
1826
1826
  publishConfig: {
1827
1827
  access: "public"
@@ -9602,10 +9602,6 @@ var DataProvider_default = [
9602
9602
  type: "tuple",
9603
9603
  name: "accountInfo",
9604
9604
  components: [
9605
- {
9606
- type: "uint256",
9607
- name: "availableMargin"
9608
- },
9609
9605
  {
9610
9606
  type: "uint256",
9611
9607
  name: "freeMargin"
@@ -14685,19 +14681,9 @@ var Order = class {
14685
14681
  };
14686
14682
  }
14687
14683
  }
14688
- async createDecreaseOrder(params, tradingFee) {
14684
+ async createDecreaseOrder(params) {
14689
14685
  try {
14690
14686
  const config = this.configManager.getConfig();
14691
- const networkFee = await this.utils.getNetworkFee(
14692
- params.executionFeeToken,
14693
- params.chainId
14694
- );
14695
- let depositAmount = BigInt(0);
14696
- const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
14697
- const needAmount = BigInt(tradingFee) + BigInt(networkFee);
14698
- if (availableAccountMarginBalance < needAmount) {
14699
- depositAmount = needAmount - availableAccountMarginBalance;
14700
- }
14701
14687
  const data = {
14702
14688
  user: params.address,
14703
14689
  poolId: params.poolId,
@@ -14719,27 +14705,11 @@ var Order = class {
14719
14705
  };
14720
14706
  const depositData = {
14721
14707
  token: params.executionFeeToken,
14722
- amount: depositAmount.toString()
14708
+ amount: "0"
14723
14709
  };
14724
- const needsApproval = await this.utils.needsApproval(
14725
- params.chainId,
14726
- params.executionFeeToken,
14727
- depositAmount.toString()
14728
- );
14729
14710
  const authorized = this.configManager.getConfig().seamlessAccount?.authorized;
14730
14711
  const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
14731
14712
  if (config.seamlessMode && authorized && seamlessWallet) {
14732
- if (needsApproval) {
14733
- const approvalResult = await this.utils.approveAuthorization({
14734
- chainId: params.chainId,
14735
- quoteAddress: params.executionFeeToken,
14736
- amount: import_ethers24.ethers.MaxUint256.toString(),
14737
- signer: seamlessWallet
14738
- });
14739
- if (approvalResult.code !== 0) {
14740
- throw new Error(approvalResult.message);
14741
- }
14742
- }
14743
14713
  const isEnoughGas = await this.utils.checkSeamlessGas(params.address);
14744
14714
  if (!isEnoughGas) {
14745
14715
  throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
@@ -14788,17 +14758,6 @@ var Order = class {
14788
14758
  params.chainId,
14789
14759
  this.configManager.getConfig().brokerAddress
14790
14760
  );
14791
- if (needsApproval) {
14792
- const approvalResult = await this.utils.approveAuthorization({
14793
- chainId: params.chainId,
14794
- quoteAddress: params.executionFeeToken,
14795
- amount: import_ethers24.ethers.MaxUint256.toString()
14796
- });
14797
- if (approvalResult.code !== 0) {
14798
- throw new Error(approvalResult.message);
14799
- }
14800
- }
14801
- console.log("depositData-->", depositData);
14802
14761
  console.log("data-->", data);
14803
14762
  let transaction;
14804
14763
  if (!params.positionId) {
package/dist/index.mjs CHANGED
@@ -1370,7 +1370,7 @@ var ARB_TEST_SEPOLIA = {
1370
1370
  // MYXOracle
1371
1371
  EIP7702Delegation: "0xd501b6bb41fc34c1258Bab0Da1E0d74F332D2017",
1372
1372
  MARKET_MANAGER: "0xcAD7731b889B788d96D8F63273EcE9Fdd806a8f5",
1373
- DATA_PROVIDER: "0x40b9C96F947Fab73A181008C2795f560b51AAe26",
1373
+ DATA_PROVIDER: "0xf28692b400b2735DeB8660960f4099C288d44140",
1374
1374
  ORACLE_RESERVE: "0x03407bFdBd6f4778c9908390b7e9703B84FA029f",
1375
1375
  FORWARDER: "0x5DC38C8f032D3801fb09dd3DF5c5F203b1382172"
1376
1376
  };
@@ -1391,7 +1391,7 @@ var LINEA_SEPOLIA = {
1391
1391
  // MYXOracle
1392
1392
  EIP7702Delegation: "0x97a51EAC31BbE0eE0eE732098D3332618919b6FB",
1393
1393
  MARKET_MANAGER: "0x056a018E5c88f7A4d309813F988c8CC755719B91",
1394
- DATA_PROVIDER: "0x4975639Ea5657609Da3EB004662630c24Cd54Db1",
1394
+ DATA_PROVIDER: "0xC7A0aa87031d53A63b33e8CABa4D688b57036A3D",
1395
1395
  ORACLE_RESERVE: "0x7b146cbf83558B65fDB3b780A0A644B28Cd73fF4",
1396
1396
  USDC: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",
1397
1397
  FORWARDER: "0x62335ea59444111D582df5DEbcB6cf29e831927F"
@@ -1731,7 +1731,7 @@ var RotationProvider = class extends BaseProvider {
1731
1731
  // package.json
1732
1732
  var package_default = {
1733
1733
  name: "@myx-trade/sdk",
1734
- version: "0.1.148",
1734
+ version: "0.1.154",
1735
1735
  private: false,
1736
1736
  publishConfig: {
1737
1737
  access: "public"
@@ -9512,10 +9512,6 @@ var DataProvider_default = [
9512
9512
  type: "tuple",
9513
9513
  name: "accountInfo",
9514
9514
  components: [
9515
- {
9516
- type: "uint256",
9517
- name: "availableMargin"
9518
- },
9519
9515
  {
9520
9516
  type: "uint256",
9521
9517
  name: "freeMargin"
@@ -14595,19 +14591,9 @@ var Order = class {
14595
14591
  };
14596
14592
  }
14597
14593
  }
14598
- async createDecreaseOrder(params, tradingFee) {
14594
+ async createDecreaseOrder(params) {
14599
14595
  try {
14600
14596
  const config = this.configManager.getConfig();
14601
- const networkFee = await this.utils.getNetworkFee(
14602
- params.executionFeeToken,
14603
- params.chainId
14604
- );
14605
- let depositAmount = BigInt(0);
14606
- const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
14607
- const needAmount = BigInt(tradingFee) + BigInt(networkFee);
14608
- if (availableAccountMarginBalance < needAmount) {
14609
- depositAmount = needAmount - availableAccountMarginBalance;
14610
- }
14611
14597
  const data = {
14612
14598
  user: params.address,
14613
14599
  poolId: params.poolId,
@@ -14629,27 +14615,11 @@ var Order = class {
14629
14615
  };
14630
14616
  const depositData = {
14631
14617
  token: params.executionFeeToken,
14632
- amount: depositAmount.toString()
14618
+ amount: "0"
14633
14619
  };
14634
- const needsApproval = await this.utils.needsApproval(
14635
- params.chainId,
14636
- params.executionFeeToken,
14637
- depositAmount.toString()
14638
- );
14639
14620
  const authorized = this.configManager.getConfig().seamlessAccount?.authorized;
14640
14621
  const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
14641
14622
  if (config.seamlessMode && authorized && seamlessWallet) {
14642
- if (needsApproval) {
14643
- const approvalResult = await this.utils.approveAuthorization({
14644
- chainId: params.chainId,
14645
- quoteAddress: params.executionFeeToken,
14646
- amount: ethers6.MaxUint256.toString(),
14647
- signer: seamlessWallet
14648
- });
14649
- if (approvalResult.code !== 0) {
14650
- throw new Error(approvalResult.message);
14651
- }
14652
- }
14653
14623
  const isEnoughGas = await this.utils.checkSeamlessGas(params.address);
14654
14624
  if (!isEnoughGas) {
14655
14625
  throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient relay fee");
@@ -14698,17 +14668,6 @@ var Order = class {
14698
14668
  params.chainId,
14699
14669
  this.configManager.getConfig().brokerAddress
14700
14670
  );
14701
- if (needsApproval) {
14702
- const approvalResult = await this.utils.approveAuthorization({
14703
- chainId: params.chainId,
14704
- quoteAddress: params.executionFeeToken,
14705
- amount: ethers6.MaxUint256.toString()
14706
- });
14707
- if (approvalResult.code !== 0) {
14708
- throw new Error(approvalResult.message);
14709
- }
14710
- }
14711
- console.log("depositData-->", depositData);
14712
14671
  console.log("data-->", data);
14713
14672
  let transaction;
14714
14673
  if (!params.positionId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myx-trade/sdk",
3
- "version": "0.1.148",
3
+ "version": "0.1.154",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"