@drift-labs/sdk 2.97.0-beta.2 → 2.97.0-beta.20

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/README.md CHANGED
@@ -19,13 +19,20 @@ npm i @drift-labs/sdk
19
19
 
20
20
  ## Getting Started
21
21
 
22
- Documentation:
22
+ *Start here if you're integrating with Drift!*
23
23
 
24
- - [API docs](https://drift-labs.github.io/v2-teacher/)
24
+ - [Drift v2-teacher + API Docs](https://drift-labs.github.io/v2-teacher/)
25
+ - Docs and examples for using the SDK in Typescript and Python
26
+ - Useful concepts and examples when integrating Drift
27
+ - Docs for Drift's "Data API"
25
28
  - [Typescript API docs](https://drift-labs.github.io/protocol-v2/sdk/)
26
- - [overview docs](https://docs.drift.trade/)
29
+ - JSDoc automated documentation for the Drift v2 Typescript SDK
30
+ - [Drift docs](https://docs.drift.trade/)
31
+ - Comprehensive universal docs for Drift
27
32
 
28
- The below is a light overview of using solana and drift's typescript sdk, but not as comprehensive as the [API docs](https://drift-labs.github.io/v2-teacher/).
33
+ ---
34
+
35
+ The below is a light overview of using Solana and Drift's typescript sdk. If you want comprehensive docs with examples of how to integrate with Drift you should use the [v2-teacher docs](https://drift-labs.github.io/v2-teacher/).
29
36
 
30
37
  ### Setting up a wallet for your program
31
38
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.97.0-beta.2
1
+ 2.97.0-beta.20
@@ -26,3 +26,4 @@ export declare function getProtocolIfSharesTransferConfigPublicKey(programId: Pu
26
26
  export declare function getPrelaunchOraclePublicKey(programId: PublicKey, marketIndex: number): PublicKey;
27
27
  export declare function getPythPullOraclePublicKey(progarmId: PublicKey, feedId: Uint8Array): PublicKey;
28
28
  export declare function getTokenProgramForSpotMarket(spotMarketAccount: SpotMarketAccount): PublicKey;
29
+ export declare function getHighLeverageModeConfigPublicKey(programId: PublicKey): PublicKey;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getTokenProgramForSpotMarket = exports.getPythPullOraclePublicKey = exports.getPrelaunchOraclePublicKey = exports.getProtocolIfSharesTransferConfigPublicKey = exports.getReferrerNamePublicKeySync = exports.getOpenbookV2FulfillmentConfigPublicKey = exports.getPhoenixFulfillmentConfigPublicKey = exports.getSerumFulfillmentConfigPublicKey = exports.getSerumSignerPublicKey = exports.getSerumOpenOrdersPublicKey = exports.getDriftSignerPublicKey = exports.getInsuranceFundStakeAccountPublicKey = exports.getInsuranceFundVaultPublicKey = exports.getSpotMarketVaultPublicKey = exports.getSpotMarketPublicKeySync = exports.getSpotMarketPublicKey = exports.getPerpMarketPublicKeySync = exports.getPerpMarketPublicKey = exports.getUserStatsAccountPublicKey = exports.getUserAccountPublicKeySync = exports.getUserAccountPublicKey = exports.getUserAccountPublicKeyAndNonce = exports.getDriftStateAccountPublicKey = exports.getDriftStateAccountPublicKeyAndNonce = void 0;
26
+ exports.getHighLeverageModeConfigPublicKey = exports.getTokenProgramForSpotMarket = exports.getPythPullOraclePublicKey = exports.getPrelaunchOraclePublicKey = exports.getProtocolIfSharesTransferConfigPublicKey = exports.getReferrerNamePublicKeySync = exports.getOpenbookV2FulfillmentConfigPublicKey = exports.getPhoenixFulfillmentConfigPublicKey = exports.getSerumFulfillmentConfigPublicKey = exports.getSerumSignerPublicKey = exports.getSerumOpenOrdersPublicKey = exports.getDriftSignerPublicKey = exports.getInsuranceFundStakeAccountPublicKey = exports.getInsuranceFundVaultPublicKey = exports.getSpotMarketVaultPublicKey = exports.getSpotMarketPublicKeySync = exports.getSpotMarketPublicKey = exports.getPerpMarketPublicKeySync = exports.getPerpMarketPublicKey = exports.getUserStatsAccountPublicKey = exports.getUserAccountPublicKeySync = exports.getUserAccountPublicKey = exports.getUserAccountPublicKeyAndNonce = exports.getDriftStateAccountPublicKey = exports.getDriftStateAccountPublicKeyAndNonce = void 0;
27
27
  const web3_js_1 = require("@solana/web3.js");
28
28
  const anchor = __importStar(require("@coral-xyz/anchor"));
29
29
  const spl_token_1 = require("@solana/spl-token");
@@ -180,3 +180,7 @@ function getTokenProgramForSpotMarket(spotMarketAccount) {
180
180
  return spl_token_1.TOKEN_PROGRAM_ID;
181
181
  }
182
182
  exports.getTokenProgramForSpotMarket = getTokenProgramForSpotMarket;
183
+ function getHighLeverageModeConfigPublicKey(programId) {
184
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(anchor.utils.bytes.utf8.encode('high_leverage_mode_config'))], programId)[0];
185
+ }
186
+ exports.getHighLeverageModeConfigPublicKey = getHighLeverageModeConfigPublicKey;
@@ -55,6 +55,8 @@ export declare class AdminClient extends DriftClient {
55
55
  getUpdatePerpMarketTargetBaseAssetAmountPerLpIx(perpMarketIndex: number, targetBaseAssetAmountPerLP: number): Promise<TransactionInstruction>;
56
56
  updatePerpMarketMarginRatio(perpMarketIndex: number, marginRatioInitial: number, marginRatioMaintenance: number): Promise<TransactionSignature>;
57
57
  getUpdatePerpMarketMarginRatioIx(perpMarketIndex: number, marginRatioInitial: number, marginRatioMaintenance: number): Promise<TransactionInstruction>;
58
+ updatePerpMarketHighLeverageMarginRatio(perpMarketIndex: number, marginRatioInitial: number, marginRatioMaintenance: number): Promise<TransactionSignature>;
59
+ getUpdatePerpMarketHighLeverageMarginRatioIx(perpMarketIndex: number, marginRatioInitial: number, marginRatioMaintenance: number): Promise<TransactionInstruction>;
58
60
  updatePerpMarketImfFactor(perpMarketIndex: number, imfFactor: number, unrealizedPnlImfFactor: number): Promise<TransactionSignature>;
59
61
  getUpdatePerpMarketImfFactorIx(perpMarketIndex: number, imfFactor: number, unrealizedPnlImfFactor: number): Promise<TransactionInstruction>;
60
62
  updatePerpMarketBaseSpread(perpMarketIndex: number, baseSpread: number): Promise<TransactionSignature>;
@@ -193,4 +195,8 @@ export declare class AdminClient extends DriftClient {
193
195
  getInitUserFuelIx(user: PublicKey, authority: PublicKey, fuelBonusDeposits?: number, fuelBonusBorrows?: number, fuelBonusTaker?: number, fuelBonusMaker?: number, fuelBonusInsurance?: number): Promise<TransactionInstruction>;
194
196
  initializePythPullOracle(feedId: string): Promise<TransactionSignature>;
195
197
  getInitializePythPullOracleIx(feedId: string): Promise<TransactionInstruction>;
198
+ initializeHighLeverageModeConfig(maxUsers: number): Promise<TransactionSignature>;
199
+ getInitializeHighLeverageModeConfigIx(maxUsers: number): Promise<TransactionInstruction>;
200
+ updateUpdateHighLeverageModeConfig(maxUsers: number, reduceOnly: boolean): Promise<TransactionSignature>;
201
+ getUpdateHighLeverageModeConfigIx(maxUsers: number, reduceOnly: boolean): Promise<TransactionInstruction>;
196
202
  }
@@ -561,6 +561,23 @@ class AdminClient extends driftClient_1.DriftClient {
561
561
  },
562
562
  });
563
563
  }
564
+ async updatePerpMarketHighLeverageMarginRatio(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
565
+ const updatePerpMarketHighLeverageMarginRatioIx = await this.getUpdatePerpMarketHighLeverageMarginRatioIx(perpMarketIndex, marginRatioInitial, marginRatioMaintenance);
566
+ const tx = await this.buildTransaction(updatePerpMarketHighLeverageMarginRatioIx);
567
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
568
+ return txSig;
569
+ }
570
+ async getUpdatePerpMarketHighLeverageMarginRatioIx(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
571
+ return await this.program.instruction.updatePerpMarketHighLeverageMarginRatio(marginRatioInitial, marginRatioMaintenance, {
572
+ accounts: {
573
+ admin: this.isSubscribed
574
+ ? this.getStateAccount().admin
575
+ : this.wallet.publicKey,
576
+ state: await this.getStatePublicKey(),
577
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
578
+ },
579
+ });
580
+ }
564
581
  async updatePerpMarketImfFactor(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
565
582
  const updatePerpMarketImfFactorIx = await this.getUpdatePerpMarketImfFactorIx(perpMarketIndex, imfFactor, unrealizedPnlImfFactor);
566
583
  const tx = await this.buildTransaction(updatePerpMarketImfFactorIx);
@@ -1769,5 +1786,41 @@ class AdminClient extends driftClient_1.DriftClient {
1769
1786
  },
1770
1787
  });
1771
1788
  }
1789
+ async initializeHighLeverageModeConfig(maxUsers) {
1790
+ const initializeHighLeverageModeConfigIx = await this.getInitializeHighLeverageModeConfigIx(maxUsers);
1791
+ const tx = await this.buildTransaction(initializeHighLeverageModeConfigIx);
1792
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1793
+ return txSig;
1794
+ }
1795
+ async getInitializeHighLeverageModeConfigIx(maxUsers) {
1796
+ return await this.program.instruction.initializeHighLeverageModeConfig(maxUsers, {
1797
+ accounts: {
1798
+ admin: this.isSubscribed
1799
+ ? this.getStateAccount().admin
1800
+ : this.wallet.publicKey,
1801
+ state: await this.getStatePublicKey(),
1802
+ rent: web3_js_1.SYSVAR_RENT_PUBKEY,
1803
+ systemProgram: anchor.web3.SystemProgram.programId,
1804
+ highLeverageModeConfig: (0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId),
1805
+ },
1806
+ });
1807
+ }
1808
+ async updateUpdateHighLeverageModeConfig(maxUsers, reduceOnly) {
1809
+ const updateHighLeverageModeConfigIx = await this.getUpdateHighLeverageModeConfigIx(maxUsers, reduceOnly);
1810
+ const tx = await this.buildTransaction(updateHighLeverageModeConfigIx);
1811
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1812
+ return txSig;
1813
+ }
1814
+ async getUpdateHighLeverageModeConfigIx(maxUsers, reduceOnly) {
1815
+ return await this.program.instruction.updateHighLeverageModeConfig(maxUsers, reduceOnly, {
1816
+ accounts: {
1817
+ admin: this.isSubscribed
1818
+ ? this.getStateAccount().admin
1819
+ : this.wallet.publicKey,
1820
+ state: await this.getStatePublicKey(),
1821
+ highLeverageModeConfig: (0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId),
1822
+ },
1823
+ });
1824
+ }
1772
1825
  }
1773
1826
  exports.AdminClient = AdminClient;
package/lib/config.d.ts CHANGED
@@ -43,7 +43,7 @@ export declare const initialize: (props: {
43
43
  env: DriftEnv;
44
44
  overrideEnv?: Partial<DriftConfig>;
45
45
  }) => DriftConfig;
46
- export declare function getMarketsAndOraclesForSubscription(env: DriftEnv): {
46
+ export declare function getMarketsAndOraclesForSubscription(env: DriftEnv, perpMarkets?: PerpMarketConfig[], spotMarkets?: SpotMarketConfig[]): {
47
47
  perpMarketIndexes: number[];
48
48
  spotMarketIndexes: number[];
49
49
  oracleInfos: OracleInfo[];
package/lib/config.js CHANGED
@@ -66,18 +66,20 @@ const initialize = (props) => {
66
66
  return currentConfig;
67
67
  };
68
68
  exports.initialize = initialize;
69
- function getMarketsAndOraclesForSubscription(env) {
69
+ function getMarketsAndOraclesForSubscription(env, perpMarkets, spotMarkets) {
70
+ const perpMarketsToUse = (perpMarkets === null || perpMarkets === void 0 ? void 0 : perpMarkets.length) > 0 ? perpMarkets : perpMarkets_1.PerpMarkets[env];
71
+ const spotMarketsToUse = (spotMarkets === null || spotMarkets === void 0 ? void 0 : spotMarkets.length) > 0 ? spotMarkets : spotMarkets_1.SpotMarkets[env];
70
72
  const perpMarketIndexes = [];
71
73
  const spotMarketIndexes = [];
72
74
  const oracleInfos = new Map();
73
- for (const market of perpMarkets_1.PerpMarkets[env]) {
75
+ for (const market of perpMarketsToUse) {
74
76
  perpMarketIndexes.push(market.marketIndex);
75
77
  oracleInfos.set(market.oracle.toString(), {
76
78
  publicKey: market.oracle,
77
79
  source: market.oracleSource,
78
80
  });
79
81
  }
80
- for (const spotMarket of spotMarkets_1.SpotMarkets[env]) {
82
+ for (const spotMarket of spotMarketsToUse) {
81
83
  spotMarketIndexes.push(spotMarket.marketIndex);
82
84
  oracleInfos.set(spotMarket.oracle.toString(), {
83
85
  publicKey: spotMarket.oracle,
@@ -659,9 +659,9 @@ exports.MainnetPerpMarkets = [
659
659
  symbol: 'CLOUD-PERP',
660
660
  baseAssetSymbol: 'CLOUD',
661
661
  marketIndex: 31,
662
- oracle: new web3_js_1.PublicKey('4FG7UyPkszGvcSVCCKaLSZsArGjyxitwhJeQhYu2bFTS'),
662
+ oracle: new web3_js_1.PublicKey('FNFejcXENaPgKaCTfstew9vSSvdQPnXjGTkJjUnnYvHU'),
663
663
  launchTs: 1717597648000,
664
- oracleSource: __1.OracleSource.SWITCHBOARD,
664
+ oracleSource: __1.OracleSource.SWITCHBOARD_ON_DEMAND,
665
665
  },
666
666
  {
667
667
  fullName: 'IO',
@@ -820,6 +820,47 @@ exports.MainnetPerpMarkets = [
820
820
  launchTs: 1727965864000,
821
821
  oracleSource: __1.OracleSource.Prelaunch,
822
822
  },
823
+ {
824
+ fullName: 'DeBridge',
825
+ category: ['Bridge'],
826
+ symbol: 'DBR-PERP',
827
+ baseAssetSymbol: 'DBR',
828
+ marketIndex: 47,
829
+ oracle: new web3_js_1.PublicKey('53j4mz7cQV7mAZekKbV3n2L4bY7jY6eXdgaTkWDLYxq4'),
830
+ launchTs: 1728574493000,
831
+ oracleSource: __1.OracleSource.PYTH_PULL,
832
+ pythFeedId: '0xf788488fe2df341b10a498e0a789f03209c0938d9ed04bc521f8224748d6d236',
833
+ },
834
+ {
835
+ fullName: 'WLF-5B-1W',
836
+ category: ['Prediction'],
837
+ symbol: 'WLF-5B-1W-BET',
838
+ baseAssetSymbol: 'WLF-5B-1W',
839
+ marketIndex: 48,
840
+ oracle: new web3_js_1.PublicKey('7LpRfPaWR7cQqN7CMkCmZjEQpWyqso5LGuKCvDXH5ZAr'),
841
+ launchTs: 1728574493000,
842
+ oracleSource: __1.OracleSource.Prelaunch,
843
+ },
844
+ {
845
+ fullName: 'VRSTPN-WIN-F1-24-DRVRS-CHMP',
846
+ category: ['Prediction', 'Sport'],
847
+ symbol: 'VRSTPN-WIN-F1-24-DRVRS-CHMP-BET',
848
+ baseAssetSymbol: 'VRSTPN-WIN-F1-24-DRVRS-CHMP',
849
+ marketIndex: 49,
850
+ oracle: new web3_js_1.PublicKey('E36rvXEwysWeiToXCpWfHVADd8bzzyR4w83ZSSwxAxqG'),
851
+ launchTs: 1729209600000,
852
+ oracleSource: __1.OracleSource.Prelaunch,
853
+ },
854
+ {
855
+ fullName: 'LNDO-WIN-F1-24-US-GP',
856
+ category: ['Prediction', 'Sport'],
857
+ symbol: 'LNDO-WIN-F1-24-US-GP-BET',
858
+ baseAssetSymbol: 'LNDO-WIN-F1-24-US-GP',
859
+ marketIndex: 50,
860
+ oracle: new web3_js_1.PublicKey('6AVy1y9SnJECnosQaiK2uY1kcT4ZEBf1F4DMvhxgvhUo'),
861
+ launchTs: 1729209600000,
862
+ oracleSource: __1.OracleSource.Prelaunch,
863
+ },
823
864
  ];
824
865
  exports.PerpMarkets = {
825
866
  devnet: exports.DevnetPerpMarkets,
@@ -297,8 +297,8 @@ exports.MainnetSpotMarkets = [
297
297
  {
298
298
  symbol: 'CLOUD',
299
299
  marketIndex: 21,
300
- oracle: new web3_js_1.PublicKey('4FG7UyPkszGvcSVCCKaLSZsArGjyxitwhJeQhYu2bFTS'),
301
- oracleSource: __1.OracleSource.SWITCHBOARD,
300
+ oracle: new web3_js_1.PublicKey('FNFejcXENaPgKaCTfstew9vSSvdQPnXjGTkJjUnnYvHU'),
301
+ oracleSource: __1.OracleSource.SWITCHBOARD_ON_DEMAND,
302
302
  mint: new web3_js_1.PublicKey('CLoUDKc4Ane7HeQcPpE3YHnznRxhMimJ4MyaUqyHFzAu'),
303
303
  precision: new __1.BN(10).pow(numericConstants_1.NINE),
304
304
  precisionExp: numericConstants_1.NINE,
@@ -296,6 +296,15 @@ function decodeUser(buffer) {
296
296
  offset += 1;
297
297
  const hasOpenAuction = buffer.readUInt8(offset) === 1;
298
298
  offset += 1;
299
+ let marginMode;
300
+ const marginModeNum = buffer.readUInt8(offset);
301
+ if (marginModeNum === 0) {
302
+ marginMode = __1.MarginMode.DEFAULT;
303
+ }
304
+ else {
305
+ marginMode = __1.MarginMode.HIGH_LEVERAGE;
306
+ }
307
+ offset += 1;
299
308
  // @ts-ignore
300
309
  return {
301
310
  authority,
@@ -324,6 +333,7 @@ function decodeUser(buffer) {
324
333
  hasOpenOrder,
325
334
  openAuctions,
326
335
  hasOpenAuction,
336
+ marginMode,
327
337
  };
328
338
  }
329
339
  exports.decodeUser = decodeUser;
@@ -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';
@@ -491,6 +491,8 @@ export declare class DriftClient {
491
491
  getForceCancelOrdersIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
492
492
  updateUserIdle(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
493
493
  getUpdateUserIdleIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
494
+ updateUserFuelBonus(userAccountPublicKey: PublicKey, user: UserAccount, userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
495
+ getUpdateUserFuelBonusIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, userAuthority: PublicKey): Promise<TransactionInstruction>;
494
496
  updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
495
497
  getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
496
498
  placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
@@ -787,6 +789,11 @@ export declare class DriftClient {
787
789
  getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, numSignatures?: number): Promise<TransactionInstruction | undefined>;
788
790
  postSwitchboardOnDemandUpdate(feed: PublicKey, numSignatures?: number): Promise<TransactionSignature>;
789
791
  private getBuildEncodedVaaIxs;
792
+ enableUserHighLeverageMode(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
793
+ getEnableHighLeverageModeIx(subAccountId: number): Promise<anchor.web3.TransactionInstruction>;
794
+ disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
795
+ getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<anchor.web3.TransactionInstruction>;
796
+ fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
790
797
  private handleSignedTransaction;
791
798
  private handlePreSignedTransaction;
792
799
  private isVersionedTransaction;
@@ -2712,6 +2712,25 @@ class DriftClient {
2712
2712
  remainingAccounts,
2713
2713
  });
2714
2714
  }
2715
+ async updateUserFuelBonus(userAccountPublicKey, user, userAuthority, txParams) {
2716
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserFuelBonusIx(userAccountPublicKey, user, userAuthority), txParams), [], this.opts);
2717
+ return txSig;
2718
+ }
2719
+ async getUpdateUserFuelBonusIx(userAccountPublicKey, userAccount, userAuthority) {
2720
+ const userStatsAccountPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAuthority);
2721
+ const remainingAccounts = this.getRemainingAccounts({
2722
+ userAccounts: [userAccount],
2723
+ });
2724
+ return await this.program.instruction.updateUserFuelBonus({
2725
+ accounts: {
2726
+ state: await this.getStatePublicKey(),
2727
+ user: userAccountPublicKey,
2728
+ userStats: userStatsAccountPublicKey,
2729
+ authority: this.wallet.publicKey,
2730
+ },
2731
+ remainingAccounts,
2732
+ });
2733
+ }
2715
2734
  async updateUserOpenOrdersCount(userAccountPublicKey, user, txParams, fillerPublicKey) {
2716
2735
  const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserOpenOrdersCountIx(userAccountPublicKey, user, fillerPublicKey), txParams), [], this.opts);
2717
2736
  return txSig;
@@ -3432,7 +3451,10 @@ class DriftClient {
3432
3451
  const liquidator = await this.getUserAccountPublicKey(liquidatorSubAccountId);
3433
3452
  const liquidatorStatsPublicKey = this.getUserStatsAccountPublicKey();
3434
3453
  const remainingAccounts = this.getRemainingAccounts({
3435
- userAccounts: [this.getUserAccount(liquidatorSubAccountId), userAccount],
3454
+ userAccounts: [
3455
+ userAccount,
3456
+ ...makerInfos.map((makerInfo) => makerInfo.makerUserAccount),
3457
+ ],
3436
3458
  useMarketLastSlotCache: true,
3437
3459
  writablePerpMarketIndexes: [marketIndex],
3438
3460
  });
@@ -4235,6 +4257,50 @@ class DriftClient {
4235
4257
  .instruction());
4236
4258
  return [postIxs, encodedVaaKeypair];
4237
4259
  }
4260
+ async enableUserHighLeverageMode(subAccountId, txParams) {
4261
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getEnableHighLeverageModeIx(subAccountId), txParams), [], this.opts);
4262
+ return txSig;
4263
+ }
4264
+ async getEnableHighLeverageModeIx(subAccountId) {
4265
+ const remainingAccounts = this.getRemainingAccounts({
4266
+ userAccounts: [this.getUserAccount(subAccountId)],
4267
+ });
4268
+ const ix = await this.program.instruction.enableUserHighLeverageMode(subAccountId, {
4269
+ accounts: {
4270
+ state: await this.getStatePublicKey(),
4271
+ user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId),
4272
+ authority: this.wallet.publicKey,
4273
+ highLeverageModeConfig: (0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId),
4274
+ },
4275
+ remainingAccounts,
4276
+ });
4277
+ return ix;
4278
+ }
4279
+ async disableUserHighLeverageMode(user, userAccount, txParams) {
4280
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getDisableHighLeverageModeIx(user, userAccount), txParams), [], this.opts);
4281
+ return txSig;
4282
+ }
4283
+ async getDisableHighLeverageModeIx(user, userAccount) {
4284
+ const remainingAccounts = userAccount
4285
+ ? this.getRemainingAccounts({
4286
+ userAccounts: [userAccount],
4287
+ })
4288
+ : undefined;
4289
+ const ix = await this.program.instruction.disableUserHighLeverageMode({
4290
+ accounts: {
4291
+ state: await this.getStatePublicKey(),
4292
+ user,
4293
+ authority: this.wallet.publicKey,
4294
+ highLeverageModeConfig: (0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId),
4295
+ },
4296
+ remainingAccounts,
4297
+ });
4298
+ return ix;
4299
+ }
4300
+ async fetchHighLeverageModeConfig() {
4301
+ const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
4302
+ return config;
4303
+ }
4238
4304
  handleSignedTransaction(signedTxs) {
4239
4305
  if (this.enableMetricsEvents && this.metricsEventEmitter) {
4240
4306
  this.metricsEventEmitter.emit('txSigned', signedTxs);