@drift-labs/sdk 2.113.0-beta.0 → 2.113.0-beta.1

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 CHANGED
@@ -1 +1 @@
1
- 2.113.0-beta.0
1
+ 2.113.0-beta.1
@@ -121,7 +121,7 @@ function decodeUser(buffer) {
121
121
  const orders = [];
122
122
  for (let i = 0; i < 32; i++) {
123
123
  // skip order if it's not open
124
- if (buffer.readUint8(offset + 82) === 0) {
124
+ if (buffer.readUint8(offset + 82) !== 1) {
125
125
  offset += 96;
126
126
  continue;
127
127
  }
@@ -73,7 +73,7 @@ class DLOB {
73
73
  }
74
74
  insertOrder(order, userAccount, slot, isUserProtectedMaker, onInsert) {
75
75
  var _a;
76
- if ((0, __1.isVariant)(order.status, 'init')) {
76
+ if (!(0, __1.isVariant)(order.status, 'open')) {
77
77
  return;
78
78
  }
79
79
  if (!(0, __1.isOneOfVariant)(order.orderType, SUPPORTED_ORDER_TYPES)) {
@@ -145,7 +145,7 @@ class DLOB {
145
145
  }
146
146
  delete(order, userAccount, slot, isUserProtectedMaker, onDelete) {
147
147
  var _a;
148
- if ((0, __1.isVariant)(order.status, 'init')) {
148
+ if (!(0, __1.isVariant)(order.status, 'open')) {
149
149
  return;
150
150
  }
151
151
  this.updateRestingLimitOrders(slot);
@@ -20,7 +20,7 @@ class NodeList {
20
20
  this.nodeMap.clear();
21
21
  }
22
22
  insert(order, marketType, userAccount, isProtectedMaker, applyProtectedMakerOffset) {
23
- if ((0, __1.isVariant)(order.status, 'init')) {
23
+ if (!(0, __1.isVariant)(order.status, 'open')) {
24
24
  return;
25
25
  }
26
26
  const newNode = (0, DLOBNode_1.createNode)(this.nodeType, order, userAccount, isProtectedMaker, applyProtectedMakerOffset);
@@ -7,7 +7,7 @@ const anchor_1 = require("@coral-xyz/anchor");
7
7
  const auction_1 = require("./auction");
8
8
  const amm_1 = require("./amm");
9
9
  function isOrderRiskIncreasing(user, order) {
10
- if ((0, types_1.isVariant)(order.status, 'init')) {
10
+ if (!(0, types_1.isVariant)(order.status, 'open')) {
11
11
  return false;
12
12
  }
13
13
  const position = user.getPerpPosition(order.marketIndex) ||
@@ -34,7 +34,7 @@ function isOrderRiskIncreasing(user, order) {
34
34
  }
35
35
  exports.isOrderRiskIncreasing = isOrderRiskIncreasing;
36
36
  function isOrderRiskIncreasingInSameDirection(user, order) {
37
- if ((0, types_1.isVariant)(order.status, 'init')) {
37
+ if (!(0, types_1.isVariant)(order.status, 'open')) {
38
38
  return false;
39
39
  }
40
40
  const position = user.getPerpPosition(order.marketIndex) ||
@@ -56,7 +56,7 @@ function isOrderRiskIncreasingInSameDirection(user, order) {
56
56
  }
57
57
  exports.isOrderRiskIncreasingInSameDirection = isOrderRiskIncreasingInSameDirection;
58
58
  function isOrderReduceOnly(user, order) {
59
- if ((0, types_1.isVariant)(order.status, 'init')) {
59
+ if (!(0, types_1.isVariant)(order.status, 'open')) {
60
60
  return false;
61
61
  }
62
62
  const position = user.getPerpPosition(order.marketIndex) ||
@@ -264,6 +264,12 @@ export declare class OrderStatus {
264
264
  static readonly OPEN: {
265
265
  open: {};
266
266
  };
267
+ static readonly FILLED: {
268
+ filled: {};
269
+ };
270
+ static readonly CANCELED: {
271
+ canceled: {};
272
+ };
267
273
  }
268
274
  export declare class OrderAction {
269
275
  static readonly PLACE: {
@@ -164,6 +164,8 @@ class OrderStatus {
164
164
  exports.OrderStatus = OrderStatus;
165
165
  OrderStatus.INIT = { init: {} };
166
166
  OrderStatus.OPEN = { open: {} };
167
+ OrderStatus.FILLED = { filled: {} };
168
+ OrderStatus.CANCELED = { canceled: {} };
167
169
  class OrderAction {
168
170
  }
169
171
  exports.OrderAction = OrderAction;
@@ -2003,7 +2003,7 @@ class User {
2003
2003
  }
2004
2004
  }
2005
2005
  for (const order of userAccount.orders) {
2006
- if (!(0, types_1.isVariant)(order.status, 'init')) {
2006
+ if ((0, types_1.isVariant)(order.status, 'open')) {
2007
2007
  return false;
2008
2008
  }
2009
2009
  }
@@ -121,7 +121,7 @@ function decodeUser(buffer) {
121
121
  const orders = [];
122
122
  for (let i = 0; i < 32; i++) {
123
123
  // skip order if it's not open
124
- if (buffer.readUint8(offset + 82) === 0) {
124
+ if (buffer.readUint8(offset + 82) !== 1) {
125
125
  offset += 96;
126
126
  continue;
127
127
  }
@@ -73,7 +73,7 @@ class DLOB {
73
73
  }
74
74
  insertOrder(order, userAccount, slot, isUserProtectedMaker, onInsert) {
75
75
  var _a;
76
- if ((0, __1.isVariant)(order.status, 'init')) {
76
+ if (!(0, __1.isVariant)(order.status, 'open')) {
77
77
  return;
78
78
  }
79
79
  if (!(0, __1.isOneOfVariant)(order.orderType, SUPPORTED_ORDER_TYPES)) {
@@ -145,7 +145,7 @@ class DLOB {
145
145
  }
146
146
  delete(order, userAccount, slot, isUserProtectedMaker, onDelete) {
147
147
  var _a;
148
- if ((0, __1.isVariant)(order.status, 'init')) {
148
+ if (!(0, __1.isVariant)(order.status, 'open')) {
149
149
  return;
150
150
  }
151
151
  this.updateRestingLimitOrders(slot);
@@ -20,7 +20,7 @@ class NodeList {
20
20
  this.nodeMap.clear();
21
21
  }
22
22
  insert(order, marketType, userAccount, isProtectedMaker, applyProtectedMakerOffset) {
23
- if ((0, __1.isVariant)(order.status, 'init')) {
23
+ if (!(0, __1.isVariant)(order.status, 'open')) {
24
24
  return;
25
25
  }
26
26
  const newNode = (0, DLOBNode_1.createNode)(this.nodeType, order, userAccount, isProtectedMaker, applyProtectedMakerOffset);
@@ -7,7 +7,7 @@ const anchor_1 = require("@coral-xyz/anchor");
7
7
  const auction_1 = require("./auction");
8
8
  const amm_1 = require("./amm");
9
9
  function isOrderRiskIncreasing(user, order) {
10
- if ((0, types_1.isVariant)(order.status, 'init')) {
10
+ if (!(0, types_1.isVariant)(order.status, 'open')) {
11
11
  return false;
12
12
  }
13
13
  const position = user.getPerpPosition(order.marketIndex) ||
@@ -34,7 +34,7 @@ function isOrderRiskIncreasing(user, order) {
34
34
  }
35
35
  exports.isOrderRiskIncreasing = isOrderRiskIncreasing;
36
36
  function isOrderRiskIncreasingInSameDirection(user, order) {
37
- if ((0, types_1.isVariant)(order.status, 'init')) {
37
+ if (!(0, types_1.isVariant)(order.status, 'open')) {
38
38
  return false;
39
39
  }
40
40
  const position = user.getPerpPosition(order.marketIndex) ||
@@ -56,7 +56,7 @@ function isOrderRiskIncreasingInSameDirection(user, order) {
56
56
  }
57
57
  exports.isOrderRiskIncreasingInSameDirection = isOrderRiskIncreasingInSameDirection;
58
58
  function isOrderReduceOnly(user, order) {
59
- if ((0, types_1.isVariant)(order.status, 'init')) {
59
+ if (!(0, types_1.isVariant)(order.status, 'open')) {
60
60
  return false;
61
61
  }
62
62
  const position = user.getPerpPosition(order.marketIndex) ||
@@ -264,6 +264,12 @@ export declare class OrderStatus {
264
264
  static readonly OPEN: {
265
265
  open: {};
266
266
  };
267
+ static readonly FILLED: {
268
+ filled: {};
269
+ };
270
+ static readonly CANCELED: {
271
+ canceled: {};
272
+ };
267
273
  }
268
274
  export declare class OrderAction {
269
275
  static readonly PLACE: {
package/lib/node/types.js CHANGED
@@ -164,6 +164,8 @@ class OrderStatus {
164
164
  exports.OrderStatus = OrderStatus;
165
165
  OrderStatus.INIT = { init: {} };
166
166
  OrderStatus.OPEN = { open: {} };
167
+ OrderStatus.FILLED = { filled: {} };
168
+ OrderStatus.CANCELED = { canceled: {} };
167
169
  class OrderAction {
168
170
  }
169
171
  exports.OrderAction = OrderAction;
package/lib/node/user.js CHANGED
@@ -2003,7 +2003,7 @@ class User {
2003
2003
  }
2004
2004
  }
2005
2005
  for (const order of userAccount.orders) {
2006
- if (!(0, types_1.isVariant)(order.status, 'init')) {
2006
+ if ((0, types_1.isVariant)(order.status, 'open')) {
2007
2007
  return false;
2008
2008
  }
2009
2009
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.113.0-beta.0",
3
+ "version": "2.113.0-beta.1",
4
4
  "main": "lib/node/index.js",
5
5
  "types": "lib/node/index.d.ts",
6
6
  "browser": "./lib/browser/index.js",
@@ -139,7 +139,7 @@ export function decodeUser(buffer: Buffer): UserAccount {
139
139
  const orders: Order[] = [];
140
140
  for (let i = 0; i < 32; i++) {
141
141
  // skip order if it's not open
142
- if (buffer.readUint8(offset + 82) === 0) {
142
+ if (buffer.readUint8(offset + 82) !== 1) {
143
143
  offset += 96;
144
144
  continue;
145
145
  }
package/src/dlob/DLOB.ts CHANGED
@@ -188,7 +188,7 @@ export class DLOB {
188
188
  isUserProtectedMaker: boolean,
189
189
  onInsert?: OrderBookCallback
190
190
  ): void {
191
- if (isVariant(order.status, 'init')) {
191
+ if (!isVariant(order.status, 'open')) {
192
192
  return;
193
193
  }
194
194
 
@@ -290,7 +290,7 @@ export class DLOB {
290
290
  isUserProtectedMaker: boolean,
291
291
  onDelete?: OrderBookCallback
292
292
  ): void {
293
- if (isVariant(order.status, 'init')) {
293
+ if (!isVariant(order.status, 'open')) {
294
294
  return;
295
295
  }
296
296
 
@@ -39,7 +39,7 @@ export class NodeList<NodeType extends keyof DLOBNodeMap>
39
39
  isProtectedMaker: boolean,
40
40
  applyProtectedMakerOffset: boolean
41
41
  ): void {
42
- if (isVariant(order.status, 'init')) {
42
+ if (!isVariant(order.status, 'open')) {
43
43
  return;
44
44
  }
45
45
 
@@ -22,7 +22,7 @@ import {
22
22
  } from './amm';
23
23
 
24
24
  export function isOrderRiskIncreasing(user: User, order: Order): boolean {
25
- if (isVariant(order.status, 'init')) {
25
+ if (!isVariant(order.status, 'open')) {
26
26
  return false;
27
27
  }
28
28
 
@@ -63,7 +63,7 @@ export function isOrderRiskIncreasingInSameDirection(
63
63
  user: User,
64
64
  order: Order
65
65
  ): boolean {
66
- if (isVariant(order.status, 'init')) {
66
+ if (!isVariant(order.status, 'open')) {
67
67
  return false;
68
68
  }
69
69
 
@@ -93,7 +93,7 @@ export function isOrderRiskIncreasingInSameDirection(
93
93
  }
94
94
 
95
95
  export function isOrderReduceOnly(user: User, order: Order): boolean {
96
- if (isVariant(order.status, 'init')) {
96
+ if (!isVariant(order.status, 'open')) {
97
97
  return false;
98
98
  }
99
99
 
package/src/types.ts CHANGED
@@ -174,6 +174,8 @@ export class MarketType {
174
174
  export class OrderStatus {
175
175
  static readonly INIT = { init: {} };
176
176
  static readonly OPEN = { open: {} };
177
+ static readonly FILLED = { filled: {} };
178
+ static readonly CANCELED = { canceled: {} };
177
179
  }
178
180
 
179
181
  export class OrderAction {
package/src/user.ts CHANGED
@@ -3766,7 +3766,7 @@ export class User {
3766
3766
  }
3767
3767
 
3768
3768
  for (const order of userAccount.orders) {
3769
- if (!isVariant(order.status, 'init')) {
3769
+ if (isVariant(order.status, 'open')) {
3770
3770
  return false;
3771
3771
  }
3772
3772
  }