@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 +1 -1
- package/lib/user.js +1 -1
- package/package.json +1 -1
- package/src/user.ts +3 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.55.0-beta.
|
|
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) =>
|
|
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
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) =>
|
|
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
|