@drift-labs/sdk 2.82.0-beta.14 → 2.82.0-beta.16

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.82.0-beta.14
1
+ 2.82.0-beta.16
@@ -1,6 +1,6 @@
1
- import { PerpMarketAccount, PerpOperation, SpotMarketAccount, SpotOperation, StateAccount } from '../types';
1
+ import { PerpMarketAccount, PerpOperation, SpotMarketAccount, SpotOperation, StateAccount, InsuranceFundOperation } from '../types';
2
2
  export declare function exchangePaused(state: StateAccount): boolean;
3
3
  export declare function fillPaused(state: StateAccount, market: PerpMarketAccount | SpotMarketAccount): boolean;
4
4
  export declare function ammPaused(state: StateAccount, market: PerpMarketAccount | SpotMarketAccount): boolean;
5
- export declare function isOperationPaused(pausedOperations: number, operation: PerpOperation | SpotOperation): boolean;
5
+ export declare function isOperationPaused(pausedOperations: number, operation: PerpOperation | SpotOperation | InsuranceFundOperation): boolean;
6
6
  export declare function isAmmDrawdownPause(market: PerpMarketAccount): boolean;
package/lib/types.d.ts CHANGED
@@ -52,7 +52,14 @@ export declare enum PerpOperation {
52
52
  export declare enum SpotOperation {
53
53
  UPDATE_CUMULATIVE_INTEREST = 1,
54
54
  FILL = 2,
55
- WITHDRAW = 4
55
+ WITHDRAW = 4,
56
+ LIQUIDATION = 8
57
+ }
58
+ export declare enum InsuranceFundOperation {
59
+ INIT = 1,
60
+ ADD = 2,
61
+ REQUEST_REMOVE = 4,
62
+ REMOVE = 8
56
63
  }
57
64
  export declare enum UserStatus {
58
65
  BEING_LIQUIDATED = 1,
@@ -779,6 +786,7 @@ export type SpotMarketAccount = {
779
786
  flashLoanInitialTokenAmount: BN;
780
787
  ordersEnabled: boolean;
781
788
  pausedOperations: number;
789
+ ifPausedOperations: number;
782
790
  };
783
791
  export type PoolBalance = {
784
792
  scaledBalance: BN;
package/lib/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapReduceOnly = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PostOnlyParams = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.UserStatus = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.ExchangeStatus = void 0;
3
+ exports.SwapReduceOnly = exports.DefaultOrderParams = exports.ModifyOrderPolicy = exports.PostOnlyParams = exports.LiquidationType = exports.LPAction = exports.TradeSide = exports.getVariant = exports.isOneOfVariant = exports.isVariant = exports.StakeAction = exports.SpotFulfillmentConfigStatus = exports.SettlePnlExplanation = exports.DepositExplanation = exports.SpotFulfillmentStatus = exports.SpotFulfillmentType = exports.OrderTriggerCondition = exports.OrderActionExplanation = exports.OrderAction = exports.OrderStatus = exports.MarketType = exports.OrderType = exports.OracleSource = exports.DepositDirection = exports.PositionDirection = exports.SpotBalanceType = exports.SwapDirection = exports.AssetTier = exports.ContractTier = exports.ContractType = exports.UserStatus = exports.InsuranceFundOperation = exports.SpotOperation = exports.PerpOperation = exports.MarketStatus = exports.ExchangeStatus = void 0;
4
4
  const _1 = require(".");
5
5
  // # Utility Types / Enums / Constants
6
6
  var ExchangeStatus;
@@ -41,7 +41,15 @@ var SpotOperation;
41
41
  SpotOperation[SpotOperation["UPDATE_CUMULATIVE_INTEREST"] = 1] = "UPDATE_CUMULATIVE_INTEREST";
42
42
  SpotOperation[SpotOperation["FILL"] = 2] = "FILL";
43
43
  SpotOperation[SpotOperation["WITHDRAW"] = 4] = "WITHDRAW";
44
+ SpotOperation[SpotOperation["LIQUIDATION"] = 8] = "LIQUIDATION";
44
45
  })(SpotOperation = exports.SpotOperation || (exports.SpotOperation = {}));
46
+ var InsuranceFundOperation;
47
+ (function (InsuranceFundOperation) {
48
+ InsuranceFundOperation[InsuranceFundOperation["INIT"] = 1] = "INIT";
49
+ InsuranceFundOperation[InsuranceFundOperation["ADD"] = 2] = "ADD";
50
+ InsuranceFundOperation[InsuranceFundOperation["REQUEST_REMOVE"] = 4] = "REQUEST_REMOVE";
51
+ InsuranceFundOperation[InsuranceFundOperation["REMOVE"] = 8] = "REMOVE";
52
+ })(InsuranceFundOperation = exports.InsuranceFundOperation || (exports.InsuranceFundOperation = {}));
45
53
  var UserStatus;
46
54
  (function (UserStatus) {
47
55
  UserStatus[UserStatus["BEING_LIQUIDATED"] = 1] = "BEING_LIQUIDATED";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.82.0-beta.14",
3
+ "version": "2.82.0-beta.16",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -11,6 +11,7 @@ import {
11
11
  SpotOperation,
12
12
  StateAccount,
13
13
  isVariant,
14
+ InsuranceFundOperation,
14
15
  } from '../types';
15
16
  import { BN } from '@coral-xyz/anchor';
16
17
 
@@ -65,7 +66,7 @@ export function ammPaused(
65
66
 
66
67
  export function isOperationPaused(
67
68
  pausedOperations: number,
68
- operation: PerpOperation | SpotOperation
69
+ operation: PerpOperation | SpotOperation | InsuranceFundOperation
69
70
  ): boolean {
70
71
  return (pausedOperations & operation) > 0;
71
72
  }
package/src/types.ts CHANGED
@@ -40,6 +40,14 @@ export enum SpotOperation {
40
40
  UPDATE_CUMULATIVE_INTEREST = 1,
41
41
  FILL = 2,
42
42
  WITHDRAW = 4,
43
+ LIQUIDATION = 8,
44
+ }
45
+
46
+ export enum InsuranceFundOperation {
47
+ INIT = 1,
48
+ ADD = 2,
49
+ REQUEST_REMOVE = 4,
50
+ REMOVE = 8,
43
51
  }
44
52
 
45
53
  export enum UserStatus {
@@ -707,6 +715,8 @@ export type SpotMarketAccount = {
707
715
  ordersEnabled: boolean;
708
716
 
709
717
  pausedOperations: number;
718
+
719
+ ifPausedOperations: number;
710
720
  };
711
721
 
712
722
  export type PoolBalance = {