@drift-labs/sdk 2.0.5 → 2.0.7

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.
@@ -186,6 +186,9 @@ function mustBeTriggered(order) {
186
186
  }
187
187
  exports.mustBeTriggered = mustBeTriggered;
188
188
  function isTriggered(order) {
189
- return (0, types_1.isOneOfVariant)(order.orderType, ['triggeredAbove', 'triggeredBelow']);
189
+ return (0, types_1.isOneOfVariant)(order.triggerCondition, [
190
+ 'triggeredAbove',
191
+ 'triggeredBelow',
192
+ ]);
190
193
  }
191
194
  exports.isTriggered = isTriggered;
package/lib/user.js CHANGED
@@ -602,7 +602,7 @@ class User {
602
602
  return totalAssetValue.mul(numericConstants_1.TEN_THOUSAND).div(totalLiabilityValue);
603
603
  }
604
604
  canBeLiquidated() {
605
- const totalCollateral = this.getTotalCollateral();
605
+ const totalCollateral = this.getTotalCollateral('Maintenance');
606
606
  // if user being liq'd, can continue to be liq'd until total collateral above the margin requirement plus buffer
607
607
  let liquidationBuffer = undefined;
608
608
  const isBeingLiquidated = (0, types_1.isVariant)(this.getUserAccount().status, 'beingLiquidated');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -292,5 +292,8 @@ export function mustBeTriggered(order: Order): boolean {
292
292
  }
293
293
 
294
294
  export function isTriggered(order: Order): boolean {
295
- return isOneOfVariant(order.orderType, ['triggeredAbove', 'triggeredBelow']);
295
+ return isOneOfVariant(order.triggerCondition, [
296
+ 'triggeredAbove',
297
+ 'triggeredBelow',
298
+ ]);
296
299
  }
package/src/user.ts CHANGED
@@ -1021,7 +1021,7 @@ export class User {
1021
1021
  }
1022
1022
 
1023
1023
  public canBeLiquidated(): boolean {
1024
- const totalCollateral = this.getTotalCollateral();
1024
+ const totalCollateral = this.getTotalCollateral('Maintenance');
1025
1025
 
1026
1026
  // if user being liq'd, can continue to be liq'd until total collateral above the margin requirement plus buffer
1027
1027
  let liquidationBuffer = undefined;