@nightlylabs/dex-sdk 0.3.19 → 0.3.21
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.cjs +7 -10
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -24410,9 +24410,6 @@ var Client = class _Client {
|
|
|
24410
24410
|
const decodedMsg = JSON.parse(data);
|
|
24411
24411
|
const topic = getTopicFromMessage(decodedMsg);
|
|
24412
24412
|
const callback = this._subscriptions.get(topic);
|
|
24413
|
-
if (decodedMsg.type === "Liquidation" || decodedMsg.type === "PartialLiquidation" || decodedMsg.type === "GlobalLiquidation" || decodedMsg.type === "GlobalPartialLiquidation") {
|
|
24414
|
-
console.log("[SDK] Liquidation event received:", decodedMsg.type, "topic:", topic, "hasCallback:", !!callback, "subscriptionKeys:", [...this._subscriptions.keys()]);
|
|
24415
|
-
}
|
|
24416
24413
|
if (callback) {
|
|
24417
24414
|
callback(decodedMsg);
|
|
24418
24415
|
}
|
|
@@ -24477,9 +24474,9 @@ var Client = class _Client {
|
|
|
24477
24474
|
type: "SubscribeOracle",
|
|
24478
24475
|
content: { id: getRandomId() }
|
|
24479
24476
|
};
|
|
24480
|
-
await this.sendWsMessage(command);
|
|
24481
24477
|
const topic = getTopicFromCommand(command);
|
|
24482
24478
|
this._subscriptions.set(topic, callback);
|
|
24479
|
+
await this.sendWsMessage(command);
|
|
24483
24480
|
return this.unsubscribeIndexPricesUpdates;
|
|
24484
24481
|
}
|
|
24485
24482
|
async unsubscribeIndexPricesUpdates() {
|
|
@@ -24496,9 +24493,9 @@ var Client = class _Client {
|
|
|
24496
24493
|
type: "SubscribeBorrowLend",
|
|
24497
24494
|
content: { id: getRandomId() }
|
|
24498
24495
|
};
|
|
24499
|
-
await this.sendWsMessage(command);
|
|
24500
24496
|
const topic = getTopicFromCommand(command);
|
|
24501
24497
|
this._subscriptions.set(topic, callback);
|
|
24498
|
+
await this.sendWsMessage(command);
|
|
24502
24499
|
return this.unsubscribeIndexPricesUpdates;
|
|
24503
24500
|
}
|
|
24504
24501
|
async unsubscribeBorrowLendingUpdates() {
|
|
@@ -24515,9 +24512,9 @@ var Client = class _Client {
|
|
|
24515
24512
|
type: "SubscribeBoxes",
|
|
24516
24513
|
content: { id: getRandomId() }
|
|
24517
24514
|
};
|
|
24518
|
-
await this.sendWsMessage(command);
|
|
24519
24515
|
const topic = getTopicFromCommand(command);
|
|
24520
24516
|
this._subscriptions.set(topic, callback);
|
|
24517
|
+
await this.sendWsMessage(command);
|
|
24521
24518
|
return this.unsubscribeBoxOpeningUpdates;
|
|
24522
24519
|
}
|
|
24523
24520
|
async unsubscribeBoxOpeningUpdates() {
|
|
@@ -24534,9 +24531,9 @@ var Client = class _Client {
|
|
|
24534
24531
|
type: "SubscribeLiquidations",
|
|
24535
24532
|
content: { id: getRandomId() }
|
|
24536
24533
|
};
|
|
24537
|
-
await this.sendWsMessage(command);
|
|
24538
24534
|
const topic = getTopicFromCommand(command);
|
|
24539
24535
|
this._subscriptions.set(topic, callback);
|
|
24536
|
+
await this.sendWsMessage(command);
|
|
24540
24537
|
return this.unsubscribeLiquidationUpdates;
|
|
24541
24538
|
}
|
|
24542
24539
|
async unsubscribeLiquidationUpdates() {
|
|
@@ -24553,9 +24550,9 @@ var Client = class _Client {
|
|
|
24553
24550
|
type: "SubscribeUser",
|
|
24554
24551
|
content: { id: getRandomId(), userId }
|
|
24555
24552
|
};
|
|
24556
|
-
await this.sendWsMessage(command);
|
|
24557
24553
|
const topic = getTopicFromCommand(command);
|
|
24558
24554
|
this._subscriptions.set(topic, callback);
|
|
24555
|
+
await this.sendWsMessage(command);
|
|
24559
24556
|
return () => this.unsubscribeUserUpdates(userId);
|
|
24560
24557
|
}
|
|
24561
24558
|
async unsubscribeUserUpdates(userId) {
|
|
@@ -24572,9 +24569,9 @@ var Client = class _Client {
|
|
|
24572
24569
|
type: "SubscribePerpMarket",
|
|
24573
24570
|
content: { id: getRandomId(), market }
|
|
24574
24571
|
};
|
|
24575
|
-
await this.sendWsMessage(command);
|
|
24576
24572
|
const topic = getTopicFromCommand(command);
|
|
24577
24573
|
this._subscriptions.set(topic, callback);
|
|
24574
|
+
await this.sendWsMessage(command);
|
|
24578
24575
|
return () => this.unsubscribePerpMarketUpdates(market);
|
|
24579
24576
|
}
|
|
24580
24577
|
async unsubscribePerpMarketUpdates(market) {
|
|
@@ -24591,9 +24588,9 @@ var Client = class _Client {
|
|
|
24591
24588
|
type: "SubscribeSpotMarket",
|
|
24592
24589
|
content: { id: getRandomId(), market }
|
|
24593
24590
|
};
|
|
24594
|
-
await this.sendWsMessage(command);
|
|
24595
24591
|
const topic = getTopicFromCommand(command);
|
|
24596
24592
|
this._subscriptions.set(topic, callback);
|
|
24593
|
+
await this.sendWsMessage(command);
|
|
24597
24594
|
return () => this.unsubscribeSpotMarketUpdates(market);
|
|
24598
24595
|
}
|
|
24599
24596
|
async unsubscribeSpotMarketUpdates(market) {
|
package/dist/index.d.cts
CHANGED
|
@@ -4420,12 +4420,14 @@ interface HistoricalLiquidatedBorrow {
|
|
|
4420
4420
|
token: string;
|
|
4421
4421
|
shares: string;
|
|
4422
4422
|
liqPenaltyInUsd: string;
|
|
4423
|
+
historicalSharePrice: string;
|
|
4423
4424
|
}
|
|
4424
4425
|
interface HistoricalLiquidatedLend {
|
|
4425
4426
|
token: string;
|
|
4426
4427
|
shares: string;
|
|
4427
4428
|
debtReductionInUsd: string;
|
|
4428
4429
|
liqPenaltyInUsd: string;
|
|
4430
|
+
historicalSharePrice: string;
|
|
4429
4431
|
}
|
|
4430
4432
|
interface HistoricalLiquidatedCollateral {
|
|
4431
4433
|
token: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -4420,12 +4420,14 @@ interface HistoricalLiquidatedBorrow {
|
|
|
4420
4420
|
token: string;
|
|
4421
4421
|
shares: string;
|
|
4422
4422
|
liqPenaltyInUsd: string;
|
|
4423
|
+
historicalSharePrice: string;
|
|
4423
4424
|
}
|
|
4424
4425
|
interface HistoricalLiquidatedLend {
|
|
4425
4426
|
token: string;
|
|
4426
4427
|
shares: string;
|
|
4427
4428
|
debtReductionInUsd: string;
|
|
4428
4429
|
liqPenaltyInUsd: string;
|
|
4430
|
+
historicalSharePrice: string;
|
|
4429
4431
|
}
|
|
4430
4432
|
interface HistoricalLiquidatedCollateral {
|
|
4431
4433
|
token: string;
|
package/dist/index.js
CHANGED
|
@@ -24358,9 +24358,6 @@ var Client = class _Client {
|
|
|
24358
24358
|
const decodedMsg = JSON.parse(data);
|
|
24359
24359
|
const topic = getTopicFromMessage(decodedMsg);
|
|
24360
24360
|
const callback = this._subscriptions.get(topic);
|
|
24361
|
-
if (decodedMsg.type === "Liquidation" || decodedMsg.type === "PartialLiquidation" || decodedMsg.type === "GlobalLiquidation" || decodedMsg.type === "GlobalPartialLiquidation") {
|
|
24362
|
-
console.log("[SDK] Liquidation event received:", decodedMsg.type, "topic:", topic, "hasCallback:", !!callback, "subscriptionKeys:", [...this._subscriptions.keys()]);
|
|
24363
|
-
}
|
|
24364
24361
|
if (callback) {
|
|
24365
24362
|
callback(decodedMsg);
|
|
24366
24363
|
}
|
|
@@ -24425,9 +24422,9 @@ var Client = class _Client {
|
|
|
24425
24422
|
type: "SubscribeOracle",
|
|
24426
24423
|
content: { id: getRandomId() }
|
|
24427
24424
|
};
|
|
24428
|
-
await this.sendWsMessage(command);
|
|
24429
24425
|
const topic = getTopicFromCommand(command);
|
|
24430
24426
|
this._subscriptions.set(topic, callback);
|
|
24427
|
+
await this.sendWsMessage(command);
|
|
24431
24428
|
return this.unsubscribeIndexPricesUpdates;
|
|
24432
24429
|
}
|
|
24433
24430
|
async unsubscribeIndexPricesUpdates() {
|
|
@@ -24444,9 +24441,9 @@ var Client = class _Client {
|
|
|
24444
24441
|
type: "SubscribeBorrowLend",
|
|
24445
24442
|
content: { id: getRandomId() }
|
|
24446
24443
|
};
|
|
24447
|
-
await this.sendWsMessage(command);
|
|
24448
24444
|
const topic = getTopicFromCommand(command);
|
|
24449
24445
|
this._subscriptions.set(topic, callback);
|
|
24446
|
+
await this.sendWsMessage(command);
|
|
24450
24447
|
return this.unsubscribeIndexPricesUpdates;
|
|
24451
24448
|
}
|
|
24452
24449
|
async unsubscribeBorrowLendingUpdates() {
|
|
@@ -24463,9 +24460,9 @@ var Client = class _Client {
|
|
|
24463
24460
|
type: "SubscribeBoxes",
|
|
24464
24461
|
content: { id: getRandomId() }
|
|
24465
24462
|
};
|
|
24466
|
-
await this.sendWsMessage(command);
|
|
24467
24463
|
const topic = getTopicFromCommand(command);
|
|
24468
24464
|
this._subscriptions.set(topic, callback);
|
|
24465
|
+
await this.sendWsMessage(command);
|
|
24469
24466
|
return this.unsubscribeBoxOpeningUpdates;
|
|
24470
24467
|
}
|
|
24471
24468
|
async unsubscribeBoxOpeningUpdates() {
|
|
@@ -24482,9 +24479,9 @@ var Client = class _Client {
|
|
|
24482
24479
|
type: "SubscribeLiquidations",
|
|
24483
24480
|
content: { id: getRandomId() }
|
|
24484
24481
|
};
|
|
24485
|
-
await this.sendWsMessage(command);
|
|
24486
24482
|
const topic = getTopicFromCommand(command);
|
|
24487
24483
|
this._subscriptions.set(topic, callback);
|
|
24484
|
+
await this.sendWsMessage(command);
|
|
24488
24485
|
return this.unsubscribeLiquidationUpdates;
|
|
24489
24486
|
}
|
|
24490
24487
|
async unsubscribeLiquidationUpdates() {
|
|
@@ -24501,9 +24498,9 @@ var Client = class _Client {
|
|
|
24501
24498
|
type: "SubscribeUser",
|
|
24502
24499
|
content: { id: getRandomId(), userId }
|
|
24503
24500
|
};
|
|
24504
|
-
await this.sendWsMessage(command);
|
|
24505
24501
|
const topic = getTopicFromCommand(command);
|
|
24506
24502
|
this._subscriptions.set(topic, callback);
|
|
24503
|
+
await this.sendWsMessage(command);
|
|
24507
24504
|
return () => this.unsubscribeUserUpdates(userId);
|
|
24508
24505
|
}
|
|
24509
24506
|
async unsubscribeUserUpdates(userId) {
|
|
@@ -24520,9 +24517,9 @@ var Client = class _Client {
|
|
|
24520
24517
|
type: "SubscribePerpMarket",
|
|
24521
24518
|
content: { id: getRandomId(), market }
|
|
24522
24519
|
};
|
|
24523
|
-
await this.sendWsMessage(command);
|
|
24524
24520
|
const topic = getTopicFromCommand(command);
|
|
24525
24521
|
this._subscriptions.set(topic, callback);
|
|
24522
|
+
await this.sendWsMessage(command);
|
|
24526
24523
|
return () => this.unsubscribePerpMarketUpdates(market);
|
|
24527
24524
|
}
|
|
24528
24525
|
async unsubscribePerpMarketUpdates(market) {
|
|
@@ -24539,9 +24536,9 @@ var Client = class _Client {
|
|
|
24539
24536
|
type: "SubscribeSpotMarket",
|
|
24540
24537
|
content: { id: getRandomId(), market }
|
|
24541
24538
|
};
|
|
24542
|
-
await this.sendWsMessage(command);
|
|
24543
24539
|
const topic = getTopicFromCommand(command);
|
|
24544
24540
|
this._subscriptions.set(topic, callback);
|
|
24541
|
+
await this.sendWsMessage(command);
|
|
24545
24542
|
return () => this.unsubscribeSpotMarketUpdates(market);
|
|
24546
24543
|
}
|
|
24547
24544
|
async unsubscribeSpotMarketUpdates(market) {
|