@drift-labs/sdk 2.38.1-beta.10 → 2.38.1-beta.11

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.38.1-beta.10
1
+ 2.38.1-beta.11
@@ -167,7 +167,7 @@ function calculateLiabilityWeight(size, spotMarket, marginCategory) {
167
167
  liabilityWeight = (0, margin_1.calculateSizePremiumLiabilityWeight)(sizeInAmmReservePrecision, new anchor_1.BN(spotMarket.imfFactor), new anchor_1.BN(spotMarket.maintenanceLiabilityWeight), numericConstants_1.SPOT_MARKET_WEIGHT_PRECISION);
168
168
  break;
169
169
  default:
170
- liabilityWeight = spotMarket.initialLiabilityWeight;
170
+ liabilityWeight = new anchor_1.BN(spotMarket.initialLiabilityWeight);
171
171
  break;
172
172
  }
173
173
  return liabilityWeight;
package/lib/user.js CHANGED
@@ -577,7 +577,7 @@ class User {
577
577
  continue;
578
578
  }
579
579
  }
580
- const { tokenAmount: worstCaseTokenAmount, ordersValue: worstCaseQuoteTokenAmount, } = (0, spotPosition_1.getWorstCaseTokenAmounts)(spotPosition, spotMarketAccount, strictOraclePrice, marginCategory);
580
+ const { tokenAmount: worstCaseTokenAmount, ordersValue: worstCaseQuoteTokenAmount, } = (0, spotPosition_1.getWorstCaseTokenAmounts)(spotPosition, spotMarketAccount, strictOraclePrice, marginCategory !== null && marginCategory !== void 0 ? marginCategory : 'Initial');
581
581
  if (worstCaseTokenAmount.gt(numericConstants_1.ZERO) && countForBase) {
582
582
  const baseAssetValue = this.getSpotAssetValue(worstCaseTokenAmount, strictOraclePrice, spotMarketAccount, marginCategory);
583
583
  totalAssetValue = totalAssetValue.add(baseAssetValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.38.1-beta.10",
3
+ "version": "2.38.1-beta.11",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -255,7 +255,7 @@ export function calculateLiabilityWeight(
255
255
  );
256
256
  break;
257
257
  default:
258
- liabilityWeight = spotMarket.initialLiabilityWeight;
258
+ liabilityWeight = new BN(spotMarket.initialLiabilityWeight);
259
259
  break;
260
260
  }
261
261
 
package/src/user.ts CHANGED
@@ -967,7 +967,7 @@ export class User {
967
967
  spotPosition,
968
968
  spotMarketAccount,
969
969
  strictOraclePrice,
970
- marginCategory
970
+ marginCategory ?? 'Initial'
971
971
  );
972
972
 
973
973
  if (worstCaseTokenAmount.gt(ZERO) && countForBase) {