@drift-labs/sdk 2.55.0-beta.1 → 2.55.0-beta.2

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.55.0-beta.1
1
+ 2.55.0-beta.2
package/lib/user.js CHANGED
@@ -488,7 +488,7 @@ class User {
488
488
  */
489
489
  getUnrealizedPNL(withFunding, marketIndex, withWeightMarginCategory, strict = false) {
490
490
  return this.getActivePerpPositions()
491
- .filter((pos) => (marketIndex ? pos.marketIndex === marketIndex : true))
491
+ .filter((pos) => marketIndex !== undefined ? pos.marketIndex === marketIndex : true)
492
492
  .reduce((unrealizedPnl, perpPosition) => {
493
493
  const market = this.driftClient.getPerpMarketAccount(perpPosition.marketIndex);
494
494
  const oraclePriceData = this.getOracleDataForPerpMarket(market.marketIndex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.55.0-beta.1",
3
+ "version": "2.55.0-beta.2",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
package/src/user.ts CHANGED
@@ -766,7 +766,9 @@ export class User {
766
766
  strict = false
767
767
  ): BN {
768
768
  return this.getActivePerpPositions()
769
- .filter((pos) => (marketIndex ? pos.marketIndex === marketIndex : true))
769
+ .filter((pos) =>
770
+ marketIndex !== undefined ? pos.marketIndex === marketIndex : true
771
+ )
770
772
  .reduce((unrealizedPnl, perpPosition) => {
771
773
  const market = this.driftClient.getPerpMarketAccount(
772
774
  perpPosition.marketIndex