@myx-trade/sdk 0.1.167 → 0.1.168
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 +1 -7
- package/dist/index.mjs +1 -7
- 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.168",
|
|
1825
1825
|
private: false,
|
|
1826
1826
|
publishConfig: {
|
|
1827
1827
|
access: "public"
|
|
@@ -14373,7 +14373,6 @@ var Order = class {
|
|
|
14373
14373
|
params.collateralAmount
|
|
14374
14374
|
);
|
|
14375
14375
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
|
|
14376
|
-
this.logger.info("availableAccountMarginBalance-->", availableAccountMarginBalance.toString());
|
|
14377
14376
|
const totalCollateralAmount = BigInt(params.collateralAmount) + BigInt(tradingFee);
|
|
14378
14377
|
const needAmount = BigInt(tradingFee) + BigInt(params.collateralAmount) + totalNetWorkFee;
|
|
14379
14378
|
let depositAmount = BigInt(0);
|
|
@@ -21115,7 +21114,6 @@ var Account = class {
|
|
|
21115
21114
|
const curr = BigInt(import_ethers26.ethers.parseUnits(order.collateralAmount ?? "0", pool?.quoteDecimals ?? 6)) + prev;
|
|
21116
21115
|
return curr.toString();
|
|
21117
21116
|
}, "0");
|
|
21118
|
-
this.logger.info("used-->", used);
|
|
21119
21117
|
const marginAccountBalanceRes = await this.getAccountInfo(chainId, address, poolId);
|
|
21120
21118
|
if (marginAccountBalanceRes.code !== 0) {
|
|
21121
21119
|
throw new MyxSDKError(
|
|
@@ -21123,15 +21121,11 @@ var Account = class {
|
|
|
21123
21121
|
"Failed to get account info"
|
|
21124
21122
|
);
|
|
21125
21123
|
}
|
|
21126
|
-
this.logger.info("marginAccountBalanceRes-->", marginAccountBalanceRes);
|
|
21127
21124
|
const marginAccountBalance = marginAccountBalanceRes.data;
|
|
21128
21125
|
const usedMargin = BigInt(used ?? "0");
|
|
21129
21126
|
const quoteProfit = BigInt(marginAccountBalance.quoteProfit ?? 0);
|
|
21130
21127
|
const freeAmount = BigInt(marginAccountBalance?.freeMargin ?? 0);
|
|
21131
|
-
this.logger.info("freeAmount-->", freeAmount.toString());
|
|
21132
|
-
this.logger.info("quoteProfit-->", quoteProfit.toString());
|
|
21133
21128
|
const accountMargin = freeAmount + quoteProfit;
|
|
21134
|
-
this.logger.info("accountMargin-->", accountMargin.toString());
|
|
21135
21129
|
if (accountMargin < usedMargin) {
|
|
21136
21130
|
return BigInt(0);
|
|
21137
21131
|
}
|
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.168",
|
|
1735
1735
|
private: false,
|
|
1736
1736
|
publishConfig: {
|
|
1737
1737
|
access: "public"
|
|
@@ -14283,7 +14283,6 @@ var Order = class {
|
|
|
14283
14283
|
params.collateralAmount
|
|
14284
14284
|
);
|
|
14285
14285
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
|
|
14286
|
-
this.logger.info("availableAccountMarginBalance-->", availableAccountMarginBalance.toString());
|
|
14287
14286
|
const totalCollateralAmount = BigInt(params.collateralAmount) + BigInt(tradingFee);
|
|
14288
14287
|
const needAmount = BigInt(tradingFee) + BigInt(params.collateralAmount) + totalNetWorkFee;
|
|
14289
14288
|
let depositAmount = BigInt(0);
|
|
@@ -21025,7 +21024,6 @@ var Account = class {
|
|
|
21025
21024
|
const curr = BigInt(ethers8.parseUnits(order.collateralAmount ?? "0", pool?.quoteDecimals ?? 6)) + prev;
|
|
21026
21025
|
return curr.toString();
|
|
21027
21026
|
}, "0");
|
|
21028
|
-
this.logger.info("used-->", used);
|
|
21029
21027
|
const marginAccountBalanceRes = await this.getAccountInfo(chainId, address, poolId);
|
|
21030
21028
|
if (marginAccountBalanceRes.code !== 0) {
|
|
21031
21029
|
throw new MyxSDKError(
|
|
@@ -21033,15 +21031,11 @@ var Account = class {
|
|
|
21033
21031
|
"Failed to get account info"
|
|
21034
21032
|
);
|
|
21035
21033
|
}
|
|
21036
|
-
this.logger.info("marginAccountBalanceRes-->", marginAccountBalanceRes);
|
|
21037
21034
|
const marginAccountBalance = marginAccountBalanceRes.data;
|
|
21038
21035
|
const usedMargin = BigInt(used ?? "0");
|
|
21039
21036
|
const quoteProfit = BigInt(marginAccountBalance.quoteProfit ?? 0);
|
|
21040
21037
|
const freeAmount = BigInt(marginAccountBalance?.freeMargin ?? 0);
|
|
21041
|
-
this.logger.info("freeAmount-->", freeAmount.toString());
|
|
21042
|
-
this.logger.info("quoteProfit-->", quoteProfit.toString());
|
|
21043
21038
|
const accountMargin = freeAmount + quoteProfit;
|
|
21044
|
-
this.logger.info("accountMargin-->", accountMargin.toString());
|
|
21045
21039
|
if (accountMargin < usedMargin) {
|
|
21046
21040
|
return BigInt(0);
|
|
21047
21041
|
}
|