@drift-labs/sdk 2.35.1-beta.5 → 2.35.1-beta.6

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.35.1-beta.5
1
+ 2.35.1-beta.6
package/lib/user.js CHANGED
@@ -709,6 +709,13 @@ class User {
709
709
  .div(numericConstants_1.MARGIN_PRECISION);
710
710
  if (includeOpenOrders) {
711
711
  baseAssetValue = baseAssetValue.add(new _1.BN(perpPosition.openOrders).mul(numericConstants_1.OPEN_ORDER_MARGIN_REQUIREMENT));
712
+ if (perpPosition.lpShares.gt(numericConstants_1.ZERO)) {
713
+ baseAssetValue = baseAssetValue.add(_1.BN.max(numericConstants_1.QUOTE_PRECISION, valuationPrice
714
+ .mul(market.amm.orderStepSize)
715
+ .mul(numericConstants_1.QUOTE_PRECISION)
716
+ .div(numericConstants_1.AMM_RESERVE_PRECISION)
717
+ .div(numericConstants_1.PRICE_PRECISION)));
718
+ }
712
719
  }
713
720
  }
714
721
  return totalPerpValue.add(baseAssetValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.35.1-beta.5",
3
+ "version": "2.35.1-beta.6",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
package/src/user.ts CHANGED
@@ -1290,6 +1290,19 @@ export class User {
1290
1290
  baseAssetValue = baseAssetValue.add(
1291
1291
  new BN(perpPosition.openOrders).mul(OPEN_ORDER_MARGIN_REQUIREMENT)
1292
1292
  );
1293
+
1294
+ if (perpPosition.lpShares.gt(ZERO)) {
1295
+ baseAssetValue = baseAssetValue.add(
1296
+ BN.max(
1297
+ QUOTE_PRECISION,
1298
+ valuationPrice
1299
+ .mul(market.amm.orderStepSize)
1300
+ .mul(QUOTE_PRECISION)
1301
+ .div(AMM_RESERVE_PRECISION)
1302
+ .div(PRICE_PRECISION)
1303
+ )
1304
+ );
1305
+ }
1293
1306
  }
1294
1307
  }
1295
1308