@drift-labs/sdk 2.11.0-beta.0 → 2.11.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.11.0-beta.0",
2
+ "version": "2.11.0-beta.1",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -6190,7 +6190,12 @@
6190
6190
  ]
6191
6191
  },
6192
6192
  {
6193
- "name": "Match"
6193
+ "name": "Match",
6194
+ "fields": [
6195
+ {
6196
+ "defined": "usize"
6197
+ }
6198
+ ]
6194
6199
  }
6195
6200
  ]
6196
6201
  }
package/lib/user.js CHANGED
@@ -701,6 +701,9 @@ class User {
701
701
  */
702
702
  spotLiquidationPrice(spotPosition) {
703
703
  const currentSpotPosition = this.getSpotPosition(spotPosition.marketIndex);
704
+ if (!currentSpotPosition) {
705
+ return new _1.BN(-1);
706
+ }
704
707
  const mtc = this.getTotalCollateral('Maintenance');
705
708
  const mmr = this.getMaintenanceMarginRequirement();
706
709
  const deltaValueToLiq = mtc.sub(mmr); // QUOTE_PRECISION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.11.0-beta.0",
3
+ "version": "2.11.0-beta.1",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.11.0-beta.0",
2
+ "version": "2.11.0-beta.1",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -6190,7 +6190,12 @@
6190
6190
  ]
6191
6191
  },
6192
6192
  {
6193
- "name": "Match"
6193
+ "name": "Match",
6194
+ "fields": [
6195
+ {
6196
+ "defined": "usize"
6197
+ }
6198
+ ]
6194
6199
  }
6195
6200
  ]
6196
6201
  }
package/src/user.ts CHANGED
@@ -1173,6 +1173,10 @@ export class User {
1173
1173
  ): BN {
1174
1174
  const currentSpotPosition = this.getSpotPosition(spotPosition.marketIndex);
1175
1175
 
1176
+ if (!currentSpotPosition) {
1177
+ return new BN(-1);
1178
+ }
1179
+
1176
1180
  const mtc = this.getTotalCollateral('Maintenance');
1177
1181
  const mmr = this.getMaintenanceMarginRequirement();
1178
1182