@drift-labs/sdk 2.160.0-beta.2 → 2.160.0-beta.4

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.
Files changed (36) hide show
  1. package/VERSION +1 -1
  2. package/bun.lock +1 -0
  3. package/lib/browser/accounts/grpcProgramAccountSubscriber.js +1 -1
  4. package/lib/browser/adminClient.d.ts +2 -0
  5. package/lib/browser/adminClient.js +17 -0
  6. package/lib/browser/idl/drift.json +163 -117
  7. package/lib/browser/math/exchangeStatus.d.ts +3 -1
  8. package/lib/browser/math/exchangeStatus.js +9 -1
  9. package/lib/browser/types.d.ts +4 -0
  10. package/lib/browser/types.js +6 -2
  11. package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
  12. package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
  13. package/lib/node/accounts/grpcProgramAccountSubscriber.js +1 -1
  14. package/lib/node/adminClient.d.ts +2 -0
  15. package/lib/node/adminClient.d.ts.map +1 -1
  16. package/lib/node/adminClient.js +17 -0
  17. package/lib/node/idl/drift.json +163 -117
  18. package/lib/node/isomorphic/grpc.d.ts +1 -2
  19. package/lib/node/isomorphic/grpc.node.d.ts +1 -2
  20. package/lib/node/isomorphic/grpc.node.d.ts.map +1 -1
  21. package/lib/node/math/exchangeStatus.d.ts +3 -1
  22. package/lib/node/math/exchangeStatus.d.ts.map +1 -1
  23. package/lib/node/math/exchangeStatus.js +9 -1
  24. package/lib/node/types.d.ts +4 -0
  25. package/lib/node/types.d.ts.map +1 -1
  26. package/lib/node/types.js +6 -2
  27. package/package.json +1 -2
  28. package/src/accounts/grpcAccountSubscriber.ts +1 -1
  29. package/src/accounts/grpcMultiAccountSubscriber.ts +1 -1
  30. package/src/accounts/grpcProgramAccountSubscriber.ts +2 -2
  31. package/src/adminClient.ts +28 -0
  32. package/src/idl/drift.json +163 -117
  33. package/src/isomorphic/grpc.node.ts +5 -2
  34. package/src/math/exchangeStatus.ts +15 -0
  35. package/src/types.ts +5 -0
  36. package/tests/dlob/helpers.ts +3 -0
@@ -3,8 +3,11 @@ import type {
3
3
  SubscribeRequest,
4
4
  SubscribeUpdate,
5
5
  } from '@triton-one/yellowstone-grpc';
6
- import { CommitmentLevel } from '@triton-one/yellowstone-grpc';
7
- import type { ClientDuplexStream, ChannelOptions } from '@grpc/grpc-js';
6
+ import {
7
+ CommitmentLevel,
8
+ ClientDuplexStream,
9
+ ChannelOptions,
10
+ } from '@triton-one/yellowstone-grpc';
8
11
 
9
12
  // Re-export types for helius-laserstream (these are type-only imports so they don't cause runtime errors)
10
13
  export type {
@@ -12,6 +12,7 @@ import {
12
12
  StateAccount,
13
13
  isVariant,
14
14
  InsuranceFundOperation,
15
+ MarketConfigFlag,
15
16
  } from '../types';
16
17
  import { BN } from '@coral-xyz/anchor';
17
18
 
@@ -119,3 +120,17 @@ export function isAmmDrawdownPause(market: PerpMarketAccount): boolean {
119
120
 
120
121
  return false;
121
122
  }
123
+
124
+ export function isMarketConfigFlagSet(
125
+ marketConfig: number,
126
+ flag: MarketConfigFlag
127
+ ): boolean {
128
+ return (marketConfig & flag) > 0;
129
+ }
130
+
131
+ export function isFormulaicKUpdateDisabled(market: PerpMarketAccount): boolean {
132
+ return isMarketConfigFlagSet(
133
+ market.marketConfig,
134
+ MarketConfigFlag.DISABLE_FORMULAIC_K_UPDATE
135
+ );
136
+ }
package/src/types.ts CHANGED
@@ -86,6 +86,10 @@ export enum UserStatsPausedOperation {
86
86
  AMM_ATOMIC_RISK_INCREASING_FILL = 4,
87
87
  }
88
88
 
89
+ export enum MarketConfigFlag {
90
+ DISABLE_FORMULAIC_K_UPDATE = 1,
91
+ }
92
+
89
93
  export class MarginMode {
90
94
  static readonly DEFAULT = { default: {} };
91
95
  static readonly HIGH_LEVERAGE = { highLeverage: {} };
@@ -911,6 +915,7 @@ export type PerpMarketAccount = {
911
915
  lpExchangeFeeExcluscionScalar: number;
912
916
  lpStatus: number;
913
917
  lpPausedOperations: number;
918
+ marketConfig: number;
914
919
  };
915
920
 
916
921
  export type HistoricalOracleData = {
@@ -209,6 +209,7 @@ export const mockPerpMarkets: Array<PerpMarketAccount> = [
209
209
  lpExchangeFeeExcluscionScalar: 0,
210
210
  lpStatus: 0,
211
211
  lpPausedOperations: 0,
212
+ marketConfig: 0,
212
213
  },
213
214
  {
214
215
  status: MarketStatus.INITIALIZED,
@@ -261,6 +262,7 @@ export const mockPerpMarkets: Array<PerpMarketAccount> = [
261
262
  lpExchangeFeeExcluscionScalar: 0,
262
263
  lpStatus: 0,
263
264
  lpPausedOperations: 0,
265
+ marketConfig: 0,
264
266
  },
265
267
  {
266
268
  status: MarketStatus.INITIALIZED,
@@ -313,6 +315,7 @@ export const mockPerpMarkets: Array<PerpMarketAccount> = [
313
315
  lpExchangeFeeExcluscionScalar: 0,
314
316
  lpStatus: 0,
315
317
  lpPausedOperations: 0,
318
+ marketConfig: 0,
316
319
  },
317
320
  ];
318
321