@drift-labs/sdk 2.82.0-beta.11 → 2.82.0-beta.13
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/VERSION +1 -1
- package/lib/accounts/webSocketAccountSubscriber.js +1 -1
- package/lib/dlob/DLOB.js +2 -2
- package/lib/math/orders.d.ts +1 -1
- package/lib/math/orders.js +2 -2
- package/lib/types.d.ts +2 -1
- package/lib/types.js +1 -0
- package/package.json +1 -1
- package/src/accounts/webSocketAccountSubscriber.ts +1 -1
- package/src/dlob/DLOB.ts +2 -2
- package/src/math/orders.ts +3 -2
- package/src/types.ts +1 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.82.0-beta.
|
|
1
|
+
2.82.0-beta.13
|
package/lib/dlob/DLOB.js
CHANGED
|
@@ -528,7 +528,7 @@ class DLOB {
|
|
|
528
528
|
];
|
|
529
529
|
for (const bidGenerator of bidGenerators) {
|
|
530
530
|
for (const bid of bidGenerator) {
|
|
531
|
-
if ((0, __1.isOrderExpired)(bid.order, ts, true)) {
|
|
531
|
+
if ((0, __1.isOrderExpired)(bid.order, ts, true, 25)) {
|
|
532
532
|
nodesToFill.push({
|
|
533
533
|
node: bid,
|
|
534
534
|
makerNodes: [],
|
|
@@ -538,7 +538,7 @@ class DLOB {
|
|
|
538
538
|
}
|
|
539
539
|
for (const askGenerator of askGenerators) {
|
|
540
540
|
for (const ask of askGenerator) {
|
|
541
|
-
if ((0, __1.isOrderExpired)(ask.order, ts, true)) {
|
|
541
|
+
if ((0, __1.isOrderExpired)(ask.order, ts, true, 25)) {
|
|
542
542
|
nodesToFill.push({
|
|
543
543
|
node: ask,
|
|
544
544
|
makerNodes: [],
|
package/lib/math/orders.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare function hasAuctionPrice(order: Order, slot: number): boolean;
|
|
|
14
14
|
export declare function isFillableByVAMM(order: Order, market: PerpMarketAccount, oraclePriceData: OraclePriceData, slot: number, ts: number, minAuctionDuration: number): boolean;
|
|
15
15
|
export declare function calculateBaseAssetAmountForAmmToFulfill(order: Order, market: PerpMarketAccount, oraclePriceData: OraclePriceData, slot: number): BN;
|
|
16
16
|
export declare function calculateBaseAssetAmountToFillUpToLimitPrice(order: Order, amm: AMM, limitPrice: BN, oraclePriceData: OraclePriceData): BN;
|
|
17
|
-
export declare function isOrderExpired(order: Order, ts: number, enforceBuffer?: boolean): boolean;
|
|
17
|
+
export declare function isOrderExpired(order: Order, ts: number, enforceBuffer?: boolean, bufferSeconds?: number): boolean;
|
|
18
18
|
export declare function isMarketOrder(order: Order): boolean;
|
|
19
19
|
export declare function isLimitOrder(order: Order): boolean;
|
|
20
20
|
export declare function mustBeTriggered(order: Order): boolean;
|
package/lib/math/orders.js
CHANGED
|
@@ -168,7 +168,7 @@ function isSameDirection(firstDirection, secondDirection) {
|
|
|
168
168
|
return (((0, types_1.isVariant)(firstDirection, 'long') && (0, types_1.isVariant)(secondDirection, 'long')) ||
|
|
169
169
|
((0, types_1.isVariant)(firstDirection, 'short') && (0, types_1.isVariant)(secondDirection, 'short')));
|
|
170
170
|
}
|
|
171
|
-
function isOrderExpired(order, ts, enforceBuffer = false) {
|
|
171
|
+
function isOrderExpired(order, ts, enforceBuffer = false, bufferSeconds = 15) {
|
|
172
172
|
if (mustBeTriggered(order) ||
|
|
173
173
|
!(0, types_1.isVariant)(order.status, 'open') ||
|
|
174
174
|
order.maxTs.eq(numericConstants_1.ZERO)) {
|
|
@@ -176,7 +176,7 @@ function isOrderExpired(order, ts, enforceBuffer = false) {
|
|
|
176
176
|
}
|
|
177
177
|
let maxTs;
|
|
178
178
|
if (enforceBuffer && isLimitOrder(order)) {
|
|
179
|
-
maxTs = order.maxTs.addn(
|
|
179
|
+
maxTs = order.maxTs.addn(bufferSeconds);
|
|
180
180
|
}
|
|
181
181
|
else {
|
|
182
182
|
maxTs = order.maxTs;
|
package/lib/types.d.ts
CHANGED
package/lib/types.js
CHANGED
|
@@ -34,6 +34,7 @@ var PerpOperation;
|
|
|
34
34
|
PerpOperation[PerpOperation["FILL"] = 4] = "FILL";
|
|
35
35
|
PerpOperation[PerpOperation["SETTLE_PNL"] = 8] = "SETTLE_PNL";
|
|
36
36
|
PerpOperation[PerpOperation["SETTLE_PNL_WITH_POSITION"] = 16] = "SETTLE_PNL_WITH_POSITION";
|
|
37
|
+
PerpOperation[PerpOperation["LIQUIDATION"] = 32] = "LIQUIDATION";
|
|
37
38
|
})(PerpOperation = exports.PerpOperation || (exports.PerpOperation = {}));
|
|
38
39
|
var SpotOperation;
|
|
39
40
|
(function (SpotOperation) {
|
package/package.json
CHANGED
|
@@ -183,7 +183,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
unsubscribe(onResub = false): Promise<void> {
|
|
186
|
-
if (!onResub) {
|
|
186
|
+
if (!onResub && this.resubOpts) {
|
|
187
187
|
this.resubOpts.resubTimeoutMs = undefined;
|
|
188
188
|
}
|
|
189
189
|
this.isUnsubscribing = true;
|
package/src/dlob/DLOB.ts
CHANGED
|
@@ -985,7 +985,7 @@ export class DLOB {
|
|
|
985
985
|
|
|
986
986
|
for (const bidGenerator of bidGenerators) {
|
|
987
987
|
for (const bid of bidGenerator) {
|
|
988
|
-
if (isOrderExpired(bid.order, ts, true)) {
|
|
988
|
+
if (isOrderExpired(bid.order, ts, true, 25)) {
|
|
989
989
|
nodesToFill.push({
|
|
990
990
|
node: bid,
|
|
991
991
|
makerNodes: [],
|
|
@@ -996,7 +996,7 @@ export class DLOB {
|
|
|
996
996
|
|
|
997
997
|
for (const askGenerator of askGenerators) {
|
|
998
998
|
for (const ask of askGenerator) {
|
|
999
|
-
if (isOrderExpired(ask.order, ts, true)) {
|
|
999
|
+
if (isOrderExpired(ask.order, ts, true, 25)) {
|
|
1000
1000
|
nodesToFill.push({
|
|
1001
1001
|
node: ask,
|
|
1002
1002
|
makerNodes: [],
|
package/src/math/orders.ts
CHANGED
|
@@ -287,7 +287,8 @@ function isSameDirection(
|
|
|
287
287
|
export function isOrderExpired(
|
|
288
288
|
order: Order,
|
|
289
289
|
ts: number,
|
|
290
|
-
enforceBuffer = false
|
|
290
|
+
enforceBuffer = false,
|
|
291
|
+
bufferSeconds = 15
|
|
291
292
|
): boolean {
|
|
292
293
|
if (
|
|
293
294
|
mustBeTriggered(order) ||
|
|
@@ -299,7 +300,7 @@ export function isOrderExpired(
|
|
|
299
300
|
|
|
300
301
|
let maxTs;
|
|
301
302
|
if (enforceBuffer && isLimitOrder(order)) {
|
|
302
|
-
maxTs = order.maxTs.addn(
|
|
303
|
+
maxTs = order.maxTs.addn(bufferSeconds);
|
|
303
304
|
} else {
|
|
304
305
|
maxTs = order.maxTs;
|
|
305
306
|
}
|