@drift-labs/sdk 2.97.0-beta.12 → 2.97.0-beta.13

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.97.0-beta.12
1
+ 2.97.0-beta.13
@@ -4,7 +4,7 @@
4
4
  import * as anchor from '@coral-xyz/anchor';
5
5
  import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
6
6
  import { Idl as Idl30, Program as Program30 } from '@coral-xyz/anchor-30';
7
- import { DriftClientMetricsEvents, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SwiftOrderParamsMessage, SwiftServerMessage, TakerInfo, TxParams, UserAccount, UserStatsAccount } from './types';
7
+ import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SwiftOrderParamsMessage, SwiftServerMessage, TakerInfo, TxParams, UserAccount, UserStatsAccount } from './types';
8
8
  import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
9
9
  import { TokenFaucet } from './tokenFaucet';
10
10
  import { EventEmitter } from 'events';
@@ -793,6 +793,7 @@ export declare class DriftClient {
793
793
  getEnableHighLeverageModeIx(subAccountId: number): Promise<anchor.web3.TransactionInstruction>;
794
794
  disableUserHighLeverageMode(user: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
795
795
  getDisableHighLeverageModeIx(user: PublicKey): Promise<anchor.web3.TransactionInstruction>;
796
+ fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
796
797
  private handleSignedTransaction;
797
798
  private handlePreSignedTransaction;
798
799
  private isVersionedTransaction;
@@ -4284,6 +4284,10 @@ class DriftClient {
4284
4284
  });
4285
4285
  return ix;
4286
4286
  }
4287
+ async fetchHighLeverageModeConfig() {
4288
+ const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
4289
+ return config;
4290
+ }
4287
4291
  handleSignedTransaction(signedTxs) {
4288
4292
  if (this.enableMetricsEvents && this.metricsEventEmitter) {
4289
4293
  this.metricsEventEmitter.emit('txSigned', signedTxs);
package/lib/types.d.ts CHANGED
@@ -1319,4 +1319,9 @@ export type SignedTxData = {
1319
1319
  lastValidBlockHeight?: number;
1320
1320
  blockHash: string;
1321
1321
  };
1322
+ export type HighLeverageModeConfig = {
1323
+ maxUsers: number;
1324
+ currentUsers: number;
1325
+ reduceOnly: boolean;
1326
+ };
1322
1327
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.97.0-beta.12",
3
+ "version": "2.97.0-beta.13",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -19,6 +19,7 @@ import {
19
19
  } from '@solana/spl-token';
20
20
  import {
21
21
  DriftClientMetricsEvents,
22
+ HighLeverageModeConfig,
22
23
  isVariant,
23
24
  IWallet,
24
25
  MakerInfo,
@@ -8170,6 +8171,13 @@ export class DriftClient {
8170
8171
  return ix;
8171
8172
  }
8172
8173
 
8174
+ public async fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig> {
8175
+ const config = await this.program.account.highLeverageModeConfig.fetch(
8176
+ getHighLeverageModeConfigPublicKey(this.program.programId)
8177
+ );
8178
+ return config as HighLeverageModeConfig;
8179
+ }
8180
+
8173
8181
  private handleSignedTransaction(signedTxs: SignedTxData[]) {
8174
8182
  if (this.enableMetricsEvents && this.metricsEventEmitter) {
8175
8183
  this.metricsEventEmitter.emit('txSigned', signedTxs);
package/src/types.ts CHANGED
@@ -1310,3 +1310,9 @@ export type SignedTxData = {
1310
1310
  lastValidBlockHeight?: number;
1311
1311
  blockHash: string;
1312
1312
  };
1313
+
1314
+ export type HighLeverageModeConfig = {
1315
+ maxUsers: number;
1316
+ currentUsers: number;
1317
+ reduceOnly: boolean;
1318
+ };