@myx-trade/sdk 0.1.174 → 0.1.176
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 +4 -10
- package/dist/index.mjs +4 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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.
|
|
1824
|
+
version: "0.1.176",
|
|
1825
1825
|
private: false,
|
|
1826
1826
|
publishConfig: {
|
|
1827
1827
|
access: "public"
|
|
@@ -14209,9 +14209,8 @@ var Position = class {
|
|
|
14209
14209
|
}
|
|
14210
14210
|
const authorized = this.configManager.getConfig().seamlessAccount?.authorized;
|
|
14211
14211
|
const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
|
|
14212
|
-
const networkFee = await this.utils.getNetworkFee(quoteToken, chainId);
|
|
14213
14212
|
let depositAmount = BigInt(0);
|
|
14214
|
-
const used = BigInt(
|
|
14213
|
+
const used = BigInt(adjustAmount) > 0 ? BigInt(adjustAmount) : 0n;
|
|
14215
14214
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId, chainId, address });
|
|
14216
14215
|
let diff = BigInt(0);
|
|
14217
14216
|
if (availableAccountMarginBalance < used) {
|
|
@@ -14389,10 +14388,10 @@ var Order = class {
|
|
|
14389
14388
|
params.chainId
|
|
14390
14389
|
);
|
|
14391
14390
|
let totalNetWorkFee = BigInt(networkFee);
|
|
14392
|
-
if (params.tpSize) {
|
|
14391
|
+
if (params.tpSize && BigInt(params.tpSize) > 0) {
|
|
14393
14392
|
totalNetWorkFee += BigInt(networkFee);
|
|
14394
14393
|
}
|
|
14395
|
-
if (params.slSize) {
|
|
14394
|
+
if (params.slSize && BigInt(params.slSize) > 0) {
|
|
14396
14395
|
totalNetWorkFee += BigInt(networkFee);
|
|
14397
14396
|
}
|
|
14398
14397
|
const needsApproval = await this.utils.needsApproval(
|
|
@@ -14402,21 +14401,16 @@ var Order = class {
|
|
|
14402
14401
|
);
|
|
14403
14402
|
const totalCollateralAmount = BigInt(params.collateralAmount) + BigInt(tradingFee);
|
|
14404
14403
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
|
|
14405
|
-
this.logger.info("createIncreaseOrder availableAccountMarginBalance-->", availableAccountMarginBalance);
|
|
14406
14404
|
const needAmount = totalCollateralAmount + totalNetWorkFee;
|
|
14407
|
-
this.logger.info("createIncreaseOrder needAmount-->", needAmount);
|
|
14408
14405
|
let depositAmount = BigInt(0);
|
|
14409
14406
|
const diff = needAmount - availableAccountMarginBalance;
|
|
14410
|
-
this.logger.info("createIncreaseOrder diff-->", diff);
|
|
14411
14407
|
if (diff > BigInt(0)) {
|
|
14412
14408
|
depositAmount = diff;
|
|
14413
14409
|
}
|
|
14414
|
-
this.logger.info("createIncreaseOrder depositAmount-->", depositAmount);
|
|
14415
14410
|
const depositData = {
|
|
14416
14411
|
token: params.executionFeeToken,
|
|
14417
14412
|
amount: depositAmount.toString()
|
|
14418
14413
|
};
|
|
14419
|
-
this.logger.info("createIncreaseOrder depositData-->", depositData);
|
|
14420
14414
|
const data = {
|
|
14421
14415
|
user: params.address,
|
|
14422
14416
|
poolId: params.poolId,
|
package/dist/index.mjs
CHANGED
|
@@ -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.
|
|
1734
|
+
version: "0.1.176",
|
|
1735
1735
|
private: false,
|
|
1736
1736
|
publishConfig: {
|
|
1737
1737
|
access: "public"
|
|
@@ -14119,9 +14119,8 @@ var Position = class {
|
|
|
14119
14119
|
}
|
|
14120
14120
|
const authorized = this.configManager.getConfig().seamlessAccount?.authorized;
|
|
14121
14121
|
const seamlessWallet = this.configManager.getConfig().seamlessAccount?.wallet;
|
|
14122
|
-
const networkFee = await this.utils.getNetworkFee(quoteToken, chainId);
|
|
14123
14122
|
let depositAmount = BigInt(0);
|
|
14124
|
-
const used = BigInt(
|
|
14123
|
+
const used = BigInt(adjustAmount) > 0 ? BigInt(adjustAmount) : 0n;
|
|
14125
14124
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId, chainId, address });
|
|
14126
14125
|
let diff = BigInt(0);
|
|
14127
14126
|
if (availableAccountMarginBalance < used) {
|
|
@@ -14299,10 +14298,10 @@ var Order = class {
|
|
|
14299
14298
|
params.chainId
|
|
14300
14299
|
);
|
|
14301
14300
|
let totalNetWorkFee = BigInt(networkFee);
|
|
14302
|
-
if (params.tpSize) {
|
|
14301
|
+
if (params.tpSize && BigInt(params.tpSize) > 0) {
|
|
14303
14302
|
totalNetWorkFee += BigInt(networkFee);
|
|
14304
14303
|
}
|
|
14305
|
-
if (params.slSize) {
|
|
14304
|
+
if (params.slSize && BigInt(params.slSize) > 0) {
|
|
14306
14305
|
totalNetWorkFee += BigInt(networkFee);
|
|
14307
14306
|
}
|
|
14308
14307
|
const needsApproval = await this.utils.needsApproval(
|
|
@@ -14312,21 +14311,16 @@ var Order = class {
|
|
|
14312
14311
|
);
|
|
14313
14312
|
const totalCollateralAmount = BigInt(params.collateralAmount) + BigInt(tradingFee);
|
|
14314
14313
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
|
|
14315
|
-
this.logger.info("createIncreaseOrder availableAccountMarginBalance-->", availableAccountMarginBalance);
|
|
14316
14314
|
const needAmount = totalCollateralAmount + totalNetWorkFee;
|
|
14317
|
-
this.logger.info("createIncreaseOrder needAmount-->", needAmount);
|
|
14318
14315
|
let depositAmount = BigInt(0);
|
|
14319
14316
|
const diff = needAmount - availableAccountMarginBalance;
|
|
14320
|
-
this.logger.info("createIncreaseOrder diff-->", diff);
|
|
14321
14317
|
if (diff > BigInt(0)) {
|
|
14322
14318
|
depositAmount = diff;
|
|
14323
14319
|
}
|
|
14324
|
-
this.logger.info("createIncreaseOrder depositAmount-->", depositAmount);
|
|
14325
14320
|
const depositData = {
|
|
14326
14321
|
token: params.executionFeeToken,
|
|
14327
14322
|
amount: depositAmount.toString()
|
|
14328
14323
|
};
|
|
14329
|
-
this.logger.info("createIncreaseOrder depositData-->", depositData);
|
|
14330
14324
|
const data = {
|
|
14331
14325
|
user: params.address,
|
|
14332
14326
|
poolId: params.poolId,
|