@drift-labs/sdk 2.61.0-beta.4 → 2.61.0-beta.5

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.61.0-beta.4
1
+ 2.61.0-beta.5
package/lib/user.d.ts CHANGED
@@ -4,7 +4,7 @@ import { PublicKey } from '@solana/web3.js';
4
4
  import { EventEmitter } from 'events';
5
5
  import StrictEventEmitter from 'strict-event-emitter-types';
6
6
  import { DriftClient } from './driftClient';
7
- import { HealthComponents, MarginCategory, Order, PerpMarketAccount, PerpPosition, SpotPosition, UserAccount } from './types';
7
+ import { HealthComponents, MarginCategory, Order, PerpMarketAccount, PerpPosition, SpotPosition, UserAccount, UserStatus } from './types';
8
8
  import { DataAndSlot, UserAccountEvents, UserAccountSubscriber } from './accounts/types';
9
9
  import { BN, MarketType, PositionDirection, SpotMarketAccount } from '.';
10
10
  import { OraclePriceData } from './oracles/types';
@@ -230,6 +230,7 @@ export declare class User {
230
230
  totalCollateral: BN;
231
231
  };
232
232
  isBeingLiquidated(): boolean;
233
+ hasStatus(status: UserStatus): boolean;
233
234
  isBankrupt(): boolean;
234
235
  /**
235
236
  * Checks if any user position cumulative funding differs from respective market cumulative funding
package/lib/user.js CHANGED
@@ -1011,6 +1011,9 @@ class User {
1011
1011
  (types_1.UserStatus.BEING_LIQUIDATED | types_1.UserStatus.BANKRUPT)) >
1012
1012
  0);
1013
1013
  }
1014
+ hasStatus(status) {
1015
+ return (this.getUserAccount().status & status) > 0;
1016
+ }
1014
1017
  isBankrupt() {
1015
1018
  return (this.getUserAccount().status & types_1.UserStatus.BANKRUPT) > 0;
1016
1019
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.61.0-beta.4",
3
+ "version": "2.61.0-beta.5",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
package/src/user.ts CHANGED
@@ -1850,6 +1850,10 @@ export class User {
1850
1850
  );
1851
1851
  }
1852
1852
 
1853
+ public hasStatus(status: UserStatus): boolean {
1854
+ return (this.getUserAccount().status & status) > 0;
1855
+ }
1856
+
1853
1857
  public isBankrupt(): boolean {
1854
1858
  return (this.getUserAccount().status & UserStatus.BANKRUPT) > 0;
1855
1859
  }