@myx-trade/sdk 0.1.141 → 0.1.142
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 +3 -13
- package/dist/index.mjs +3 -13
- 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.142",
|
|
1825
1825
|
private: false,
|
|
1826
1826
|
publishConfig: {
|
|
1827
1827
|
access: "public"
|
|
@@ -12712,7 +12712,6 @@ var getPoolInfo2 = async (chainId, poolId, marketPrice = 0n) => {
|
|
|
12712
12712
|
poolEntryPrice: request.oi.poolEntryPrice
|
|
12713
12713
|
}
|
|
12714
12714
|
};
|
|
12715
|
-
console.log(info);
|
|
12716
12715
|
return info;
|
|
12717
12716
|
} catch (error) {
|
|
12718
12717
|
console.error(error);
|
|
@@ -13271,13 +13270,10 @@ var MyxWebSocketClient = class {
|
|
|
13271
13270
|
*/
|
|
13272
13271
|
subscribe(subscription, callback) {
|
|
13273
13272
|
const subscriptionList = Array.isArray(subscription) ? subscription : [subscription];
|
|
13274
|
-
console.log("sinscribes:", subscriptionList);
|
|
13275
|
-
this.logger.debug("subscriptionList:", subscriptionList);
|
|
13276
13273
|
const newSubscriptionIds = [];
|
|
13277
13274
|
const processedIds = /* @__PURE__ */ new Set();
|
|
13278
13275
|
subscriptionList.forEach((subscriptionItem) => {
|
|
13279
13276
|
const subscriptionId = generateListenerId(subscriptionItem);
|
|
13280
|
-
this.logger.debug("subscriptionId:", subscriptionId);
|
|
13281
13277
|
if (processedIds.has(subscriptionId)) {
|
|
13282
13278
|
return;
|
|
13283
13279
|
}
|
|
@@ -13285,9 +13281,6 @@ var MyxWebSocketClient = class {
|
|
|
13285
13281
|
if (this.subscriptions.has(subscriptionId)) {
|
|
13286
13282
|
const existingSubscription = this.subscriptions.get(subscriptionId);
|
|
13287
13283
|
existingSubscription.callbacks.add(callback);
|
|
13288
|
-
this.logger.debug(
|
|
13289
|
-
`add callback to existing subscription: ${subscriptionId}`
|
|
13290
|
-
);
|
|
13291
13284
|
} else {
|
|
13292
13285
|
const subscriptionObj = {
|
|
13293
13286
|
id: subscriptionId,
|
|
@@ -13590,7 +13583,6 @@ var SubScription = class {
|
|
|
13590
13583
|
* tickers subscription methods
|
|
13591
13584
|
*/
|
|
13592
13585
|
subscribeTickers(globalIds, callback) {
|
|
13593
|
-
this.logger.debug(`subscribe tickers ${globalIds}`);
|
|
13594
13586
|
const globalIdsList = Array.isArray(globalIds) ? globalIds : [globalIds];
|
|
13595
13587
|
this.wsClient.subscribe(
|
|
13596
13588
|
globalIdsList.map((globalId) => ({
|
|
@@ -13601,7 +13593,6 @@ var SubScription = class {
|
|
|
13601
13593
|
);
|
|
13602
13594
|
}
|
|
13603
13595
|
unsubscribeTickers(globalIds, callback) {
|
|
13604
|
-
this.logger.debug(`unsubscribe tickers ${globalIds}`);
|
|
13605
13596
|
const globalIdsList = Array.isArray(globalIds) ? globalIds : [globalIds];
|
|
13606
13597
|
this.wsClient.unsubscribe(
|
|
13607
13598
|
globalIdsList.map((globalId) => ({
|
|
@@ -14306,6 +14297,7 @@ var Order = class {
|
|
|
14306
14297
|
params.executionFeeToken,
|
|
14307
14298
|
params.collateralAmount
|
|
14308
14299
|
);
|
|
14300
|
+
const totalCollateralAmount = BigInt(params.collateralAmount) + BigInt(tradingFee);
|
|
14309
14301
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
|
|
14310
14302
|
const needAmount = BigInt(tradingFee) + BigInt(params.collateralAmount) + totalNetWorkFee;
|
|
14311
14303
|
let depositAmount = BigInt(0);
|
|
@@ -14324,7 +14316,7 @@ var Order = class {
|
|
|
14324
14316
|
triggerType: params.triggerType,
|
|
14325
14317
|
operation: OperationType.INCREASE,
|
|
14326
14318
|
direction: params.direction,
|
|
14327
|
-
collateralAmount:
|
|
14319
|
+
collateralAmount: totalCollateralAmount.toString(),
|
|
14328
14320
|
size: params.size,
|
|
14329
14321
|
price: params.price,
|
|
14330
14322
|
timeInForce: TIME_IN_FORCE,
|
|
@@ -21429,10 +21421,8 @@ var Seamless = class {
|
|
|
21429
21421
|
r: brokerSignPermit.r,
|
|
21430
21422
|
s: brokerSignPermit.s
|
|
21431
21423
|
};
|
|
21432
|
-
console.log("brokerSeamlessUSDPermitParams-->", brokerSeamlessUSDPermitParams);
|
|
21433
21424
|
return [brokerSeamlessUSDPermitParams];
|
|
21434
21425
|
} catch (error) {
|
|
21435
|
-
this.logger.error("getUSDPermitParams error-->", error);
|
|
21436
21426
|
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
|
|
21437
21427
|
}
|
|
21438
21428
|
}
|
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.142",
|
|
1735
1735
|
private: false,
|
|
1736
1736
|
publishConfig: {
|
|
1737
1737
|
access: "public"
|
|
@@ -12622,7 +12622,6 @@ var getPoolInfo2 = async (chainId, poolId, marketPrice = 0n) => {
|
|
|
12622
12622
|
poolEntryPrice: request.oi.poolEntryPrice
|
|
12623
12623
|
}
|
|
12624
12624
|
};
|
|
12625
|
-
console.log(info);
|
|
12626
12625
|
return info;
|
|
12627
12626
|
} catch (error) {
|
|
12628
12627
|
console.error(error);
|
|
@@ -13181,13 +13180,10 @@ var MyxWebSocketClient = class {
|
|
|
13181
13180
|
*/
|
|
13182
13181
|
subscribe(subscription, callback) {
|
|
13183
13182
|
const subscriptionList = Array.isArray(subscription) ? subscription : [subscription];
|
|
13184
|
-
console.log("sinscribes:", subscriptionList);
|
|
13185
|
-
this.logger.debug("subscriptionList:", subscriptionList);
|
|
13186
13183
|
const newSubscriptionIds = [];
|
|
13187
13184
|
const processedIds = /* @__PURE__ */ new Set();
|
|
13188
13185
|
subscriptionList.forEach((subscriptionItem) => {
|
|
13189
13186
|
const subscriptionId = generateListenerId(subscriptionItem);
|
|
13190
|
-
this.logger.debug("subscriptionId:", subscriptionId);
|
|
13191
13187
|
if (processedIds.has(subscriptionId)) {
|
|
13192
13188
|
return;
|
|
13193
13189
|
}
|
|
@@ -13195,9 +13191,6 @@ var MyxWebSocketClient = class {
|
|
|
13195
13191
|
if (this.subscriptions.has(subscriptionId)) {
|
|
13196
13192
|
const existingSubscription = this.subscriptions.get(subscriptionId);
|
|
13197
13193
|
existingSubscription.callbacks.add(callback);
|
|
13198
|
-
this.logger.debug(
|
|
13199
|
-
`add callback to existing subscription: ${subscriptionId}`
|
|
13200
|
-
);
|
|
13201
13194
|
} else {
|
|
13202
13195
|
const subscriptionObj = {
|
|
13203
13196
|
id: subscriptionId,
|
|
@@ -13500,7 +13493,6 @@ var SubScription = class {
|
|
|
13500
13493
|
* tickers subscription methods
|
|
13501
13494
|
*/
|
|
13502
13495
|
subscribeTickers(globalIds, callback) {
|
|
13503
|
-
this.logger.debug(`subscribe tickers ${globalIds}`);
|
|
13504
13496
|
const globalIdsList = Array.isArray(globalIds) ? globalIds : [globalIds];
|
|
13505
13497
|
this.wsClient.subscribe(
|
|
13506
13498
|
globalIdsList.map((globalId) => ({
|
|
@@ -13511,7 +13503,6 @@ var SubScription = class {
|
|
|
13511
13503
|
);
|
|
13512
13504
|
}
|
|
13513
13505
|
unsubscribeTickers(globalIds, callback) {
|
|
13514
|
-
this.logger.debug(`unsubscribe tickers ${globalIds}`);
|
|
13515
13506
|
const globalIdsList = Array.isArray(globalIds) ? globalIds : [globalIds];
|
|
13516
13507
|
this.wsClient.unsubscribe(
|
|
13517
13508
|
globalIdsList.map((globalId) => ({
|
|
@@ -14216,6 +14207,7 @@ var Order = class {
|
|
|
14216
14207
|
params.executionFeeToken,
|
|
14217
14208
|
params.collateralAmount
|
|
14218
14209
|
);
|
|
14210
|
+
const totalCollateralAmount = BigInt(params.collateralAmount) + BigInt(tradingFee);
|
|
14219
14211
|
const availableAccountMarginBalance = await this.account.getAvailableMarginBalance({ poolId: params.poolId, chainId: params.chainId, address: params.address });
|
|
14220
14212
|
const needAmount = BigInt(tradingFee) + BigInt(params.collateralAmount) + totalNetWorkFee;
|
|
14221
14213
|
let depositAmount = BigInt(0);
|
|
@@ -14234,7 +14226,7 @@ var Order = class {
|
|
|
14234
14226
|
triggerType: params.triggerType,
|
|
14235
14227
|
operation: OperationType.INCREASE,
|
|
14236
14228
|
direction: params.direction,
|
|
14237
|
-
collateralAmount:
|
|
14229
|
+
collateralAmount: totalCollateralAmount.toString(),
|
|
14238
14230
|
size: params.size,
|
|
14239
14231
|
price: params.price,
|
|
14240
14232
|
timeInForce: TIME_IN_FORCE,
|
|
@@ -21339,10 +21331,8 @@ var Seamless = class {
|
|
|
21339
21331
|
r: brokerSignPermit.r,
|
|
21340
21332
|
s: brokerSignPermit.s
|
|
21341
21333
|
};
|
|
21342
|
-
console.log("brokerSeamlessUSDPermitParams-->", brokerSeamlessUSDPermitParams);
|
|
21343
21334
|
return [brokerSeamlessUSDPermitParams];
|
|
21344
21335
|
} catch (error) {
|
|
21345
|
-
this.logger.error("getUSDPermitParams error-->", error);
|
|
21346
21336
|
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
|
|
21347
21337
|
}
|
|
21348
21338
|
}
|