@drift-labs/sdk 2.84.0-beta.5 → 2.84.0-beta.7

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.
@@ -44,6 +44,7 @@ import {
44
44
  SwapReduceOnly,
45
45
  SettlePnlMode,
46
46
  SignedTxData,
47
+ MappedRecord,
47
48
  } from './types';
48
49
  import * as anchor from '@coral-xyz/anchor';
49
50
  import driftIDL from './idl/drift.json';
@@ -523,6 +524,15 @@ export class DriftClient {
523
524
  )) as SerumV3FulfillmentConfigAccount;
524
525
  }
525
526
 
527
+ public async getSerumV3FulfillmentConfigs(): Promise<
528
+ SerumV3FulfillmentConfigAccount[]
529
+ > {
530
+ const accounts = await this.program.account.serumV3FulfillmentConfig.all();
531
+ return accounts.map(
532
+ (account) => account.account
533
+ ) as SerumV3FulfillmentConfigAccount[];
534
+ }
535
+
526
536
  public async getPhoenixV1FulfillmentConfig(
527
537
  phoenixMarket: PublicKey
528
538
  ): Promise<PhoenixV1FulfillmentConfigAccount> {
@@ -535,6 +545,16 @@ export class DriftClient {
535
545
  )) as PhoenixV1FulfillmentConfigAccount;
536
546
  }
537
547
 
548
+ public async getPhoenixV1FulfillmentConfigs(): Promise<
549
+ PhoenixV1FulfillmentConfigAccount[]
550
+ > {
551
+ const accounts =
552
+ await this.program.account.phoenixV1FulfillmentConfig.all();
553
+ return accounts.map(
554
+ (account) => account.account
555
+ ) as PhoenixV1FulfillmentConfigAccount[];
556
+ }
557
+
538
558
  public async fetchMarketLookupTableAccount(): Promise<AddressLookupTableAccount> {
539
559
  if (this.lookupTableAccount) return this.lookupTableAccount;
540
560
 
@@ -2762,18 +2782,7 @@ export class DriftClient {
2762
2782
  return txSig;
2763
2783
  }
2764
2784
 
2765
- /**
2766
- * Sends a market order and returns a signed tx which can fill the order against the vamm, which the caller can use to fill their own order if required.
2767
- * @param orderParams
2768
- * @param userAccountPublicKey
2769
- * @param userAccount
2770
- * @param makerInfo
2771
- * @param txParams
2772
- * @param bracketOrdersParams
2773
- * @param cancelExistingOrders - Builds and returns an extra transaciton to cancel the existing orders in the same perp market. Intended use is to auto-cancel TP/SL orders when closing a position. Ignored if orderParams.marketType is not MarketType.PERP
2774
- * @returns
2775
- */
2776
- public async sendMarketOrderAndGetSignedFillTx(
2785
+ public async prepareMarketOrderTxs(
2777
2786
  orderParams: OptionalOrderParams,
2778
2787
  userAccountPublicKey: PublicKey,
2779
2788
  userAccount: UserAccount,
@@ -2784,86 +2793,128 @@ export class DriftClient {
2784
2793
  cancelExistingOrders?: boolean,
2785
2794
  settlePnl?: boolean
2786
2795
  ): Promise<{
2787
- txSig: TransactionSignature;
2788
- signedFillTx?: Transaction;
2789
- signedCancelExistingOrdersTx?: Transaction;
2790
- signedSettlePnlTx?: Transaction;
2796
+ cancelExistingOrdersTx?: Transaction | VersionedTransaction;
2797
+ settlePnlTx?: Transaction | VersionedTransaction;
2798
+ fillTx?: Transaction | VersionedTransaction;
2799
+ marketOrderTx: Transaction | VersionedTransaction;
2791
2800
  }> {
2801
+ type TxKeys =
2802
+ | 'cancelExistingOrdersTx'
2803
+ | 'settlePnlTx'
2804
+ | 'fillTx'
2805
+ | 'marketOrderTx';
2806
+
2792
2807
  const marketIndex = orderParams.marketIndex;
2793
2808
  const orderId = userAccount.nextOrderId;
2794
2809
 
2795
- const ordersIx = await this.getPlaceOrdersIx(
2810
+ const ixPromisesForTxs: Record<TxKeys, Promise<TransactionInstruction>> = {
2811
+ cancelExistingOrdersTx: undefined,
2812
+ settlePnlTx: undefined,
2813
+ fillTx: undefined,
2814
+ marketOrderTx: undefined,
2815
+ };
2816
+
2817
+ const txKeys = Object.keys(ixPromisesForTxs);
2818
+
2819
+ ixPromisesForTxs.marketOrderTx = this.getPlaceOrdersIx(
2796
2820
  [orderParams, ...bracketOrdersParams],
2797
2821
  userAccount.subAccountId
2798
2822
  );
2799
2823
 
2800
- const ixsToSign: { key: string; ix: TransactionInstruction }[] = [];
2801
-
2802
- const keys = {
2803
- signedCancelExistingOrdersTx: 'signedCancelExistingOrdersTx',
2804
- signedSettlePnlTx: 'signedSettlePnlTx',
2805
- signedFillTx: 'signedFillTx',
2806
- signedMarketOrderTx: 'signedMarketOrderTx',
2807
- };
2808
-
2809
2824
  /* Cancel open orders in market if requested */
2810
-
2811
2825
  if (cancelExistingOrders && isVariant(orderParams.marketType, 'perp')) {
2812
- ixsToSign.push({
2813
- key: keys.signedCancelExistingOrdersTx,
2814
- ix: await this.getCancelOrdersIx(
2815
- orderParams.marketType,
2816
- orderParams.marketIndex,
2817
- null,
2818
- userAccount.subAccountId
2819
- ),
2820
- });
2826
+ ixPromisesForTxs.cancelExistingOrdersTx = this.getCancelOrdersIx(
2827
+ orderParams.marketType,
2828
+ orderParams.marketIndex,
2829
+ null,
2830
+ userAccount.subAccountId
2831
+ );
2821
2832
  }
2822
2833
 
2823
2834
  /* Settle PnL after fill if requested */
2824
2835
  if (settlePnl && isVariant(orderParams.marketType, 'perp')) {
2825
- ixsToSign.push({
2826
- key: keys.signedSettlePnlTx,
2827
- ix: await this.settlePNLIx(
2828
- userAccountPublicKey,
2829
- userAccount,
2830
- marketIndex
2831
- ),
2832
- });
2836
+ ixPromisesForTxs.settlePnlTx = this.settlePNLIx(
2837
+ userAccountPublicKey,
2838
+ userAccount,
2839
+ marketIndex
2840
+ );
2833
2841
  }
2834
2842
 
2835
2843
  // use versioned transactions if there is a lookup table account and wallet is compatible
2836
2844
  if (this.txVersion === 0) {
2837
- ixsToSign.push({
2838
- key: keys.signedFillTx,
2839
- ix: await this.getFillPerpOrderIx(
2840
- userAccountPublicKey,
2841
- userAccount,
2842
- {
2843
- orderId,
2844
- marketIndex,
2845
- },
2846
- makerInfo,
2847
- referrerInfo,
2848
- userAccount.subAccountId
2849
- ),
2850
- });
2845
+ ixPromisesForTxs.fillTx = this.getFillPerpOrderIx(
2846
+ userAccountPublicKey,
2847
+ userAccount,
2848
+ {
2849
+ orderId,
2850
+ marketIndex,
2851
+ },
2852
+ makerInfo,
2853
+ referrerInfo,
2854
+ userAccount.subAccountId
2855
+ );
2851
2856
  }
2852
2857
 
2853
- // Apply the latest blockhash to the txs so that we can sign before sending them
2854
- ixsToSign.push({
2855
- key: keys.signedMarketOrderTx,
2856
- ix: ordersIx,
2857
- });
2858
+ const ixs = await Promise.all(Object.values(ixPromisesForTxs));
2858
2859
 
2859
- const signedTransactions = await this.buildAndSignBulkTransactions(
2860
- ixsToSign.map((ix) => ix.ix),
2861
- ixsToSign.map((ix) => ix.key),
2860
+ const ixsMap = ixs.reduce((acc, ix, i) => {
2861
+ acc[txKeys[i]] = ix;
2862
+ return acc;
2863
+ }, {}) as MappedRecord<typeof ixPromisesForTxs, TransactionInstruction>;
2864
+
2865
+ const txsMap = (await this.buildTransactionsMap(
2866
+ ixsMap,
2862
2867
  txParams
2868
+ )) as MappedRecord<typeof ixsMap, Transaction | VersionedTransaction>;
2869
+
2870
+ return txsMap;
2871
+ }
2872
+
2873
+ /**
2874
+ * Sends a market order and returns a signed tx which can fill the order against the vamm, which the caller can use to fill their own order if required.
2875
+ * @param orderParams
2876
+ * @param userAccountPublicKey
2877
+ * @param userAccount
2878
+ * @param makerInfo
2879
+ * @param txParams
2880
+ * @param bracketOrdersParams
2881
+ * @param cancelExistingOrders - Builds and returns an extra transaciton to cancel the existing orders in the same perp market. Intended use is to auto-cancel TP/SL orders when closing a position. Ignored if orderParams.marketType is not MarketType.PERP
2882
+ * @returns
2883
+ */
2884
+ public async sendMarketOrderAndGetSignedFillTx(
2885
+ orderParams: OptionalOrderParams,
2886
+ userAccountPublicKey: PublicKey,
2887
+ userAccount: UserAccount,
2888
+ makerInfo?: MakerInfo | MakerInfo[],
2889
+ txParams?: TxParams,
2890
+ bracketOrdersParams = new Array<OptionalOrderParams>(),
2891
+ referrerInfo?: ReferrerInfo,
2892
+ cancelExistingOrders?: boolean,
2893
+ settlePnl?: boolean
2894
+ ): Promise<{
2895
+ txSig: TransactionSignature;
2896
+ signedFillTx?: Transaction;
2897
+ signedCancelExistingOrdersTx?: Transaction;
2898
+ signedSettlePnlTx?: Transaction;
2899
+ }> {
2900
+ const preppedTxs = await this.prepareMarketOrderTxs(
2901
+ orderParams,
2902
+ userAccountPublicKey,
2903
+ userAccount,
2904
+ makerInfo,
2905
+ txParams,
2906
+ bracketOrdersParams,
2907
+ referrerInfo,
2908
+ cancelExistingOrders,
2909
+ settlePnl
2863
2910
  );
2864
2911
 
2912
+ const signedTxs = (
2913
+ await this.txHandler.getSignedTransactionMap(preppedTxs, this.wallet)
2914
+ ).signedTxMap;
2915
+
2865
2916
  const { txSig, slot } = await this.sendTransaction(
2866
- signedTransactions[keys.signedMarketOrderTx],
2917
+ signedTxs.marketOrderTx,
2867
2918
  [],
2868
2919
  this.opts,
2869
2920
  true
@@ -2873,13 +2924,10 @@ export class DriftClient {
2873
2924
 
2874
2925
  return {
2875
2926
  txSig,
2876
- signedFillTx: signedTransactions?.[keys.signedFillTx] as Transaction,
2877
- signedCancelExistingOrdersTx: signedTransactions?.[
2878
- keys.signedCancelExistingOrdersTx
2879
- ] as Transaction,
2880
- signedSettlePnlTx: signedTransactions?.[
2881
- keys.signedSettlePnlTx
2882
- ] as Transaction,
2927
+ signedFillTx: signedTxs.fillTx as Transaction,
2928
+ signedCancelExistingOrdersTx:
2929
+ signedTxs.cancelExistingOrdersTx as Transaction,
2930
+ signedSettlePnlTx: signedTxs.settlePnlTx as Transaction,
2883
2931
  };
2884
2932
  }
2885
2933
 
@@ -3269,16 +3317,30 @@ export class DriftClient {
3269
3317
  subAccountId?: number
3270
3318
  ): Promise<TransactionSignature> {
3271
3319
  const { txSig } = await this.sendTransaction(
3272
- await this.buildTransaction(
3273
- await this.getPlaceOrdersIx(params, subAccountId),
3274
- txParams
3275
- ),
3320
+ (await this.preparePlaceOrdersTx(params, txParams, subAccountId))
3321
+ .placeOrdersTx,
3276
3322
  [],
3277
- this.opts
3323
+ this.opts,
3324
+ false
3278
3325
  );
3279
3326
  return txSig;
3280
3327
  }
3281
3328
 
3329
+ public async preparePlaceOrdersTx(
3330
+ params: OrderParams[],
3331
+ txParams?: TxParams,
3332
+ subAccountId?: number
3333
+ ) {
3334
+ const tx = await this.buildTransaction(
3335
+ await this.getPlaceOrdersIx(params, subAccountId),
3336
+ txParams
3337
+ );
3338
+
3339
+ return {
3340
+ placeOrdersTx: tx,
3341
+ };
3342
+ }
3343
+
3282
3344
  public async getPlaceOrdersIx(
3283
3345
  params: OptionalOrderParams[],
3284
3346
  subAccountId?: number
@@ -3449,18 +3511,32 @@ export class DriftClient {
3449
3511
  subAccountId?: number
3450
3512
  ): Promise<TransactionSignature> {
3451
3513
  const { txSig, slot } = await this.sendTransaction(
3452
- await this.buildTransaction(
3453
- await this.getPlaceSpotOrderIx(orderParams, subAccountId),
3454
- txParams
3455
- ),
3514
+ (await this.preparePlaceSpotOrderTx(orderParams, txParams, subAccountId))
3515
+ .placeSpotOrderTx,
3456
3516
  [],
3457
- this.opts
3517
+ this.opts,
3518
+ false
3458
3519
  );
3459
3520
  this.spotMarketLastSlotCache.set(orderParams.marketIndex, slot);
3460
3521
  this.spotMarketLastSlotCache.set(QUOTE_SPOT_MARKET_INDEX, slot);
3461
3522
  return txSig;
3462
3523
  }
3463
3524
 
3525
+ public async preparePlaceSpotOrderTx(
3526
+ orderParams: OptionalOrderParams,
3527
+ txParams?: TxParams,
3528
+ subAccountId?: number
3529
+ ) {
3530
+ const tx = await this.buildTransaction(
3531
+ await this.getPlaceSpotOrderIx(orderParams, subAccountId),
3532
+ txParams
3533
+ );
3534
+
3535
+ return {
3536
+ placeSpotOrderTx: tx,
3537
+ };
3538
+ }
3539
+
3464
3540
  public async getPlaceSpotOrderIx(
3465
3541
  orderParams: OptionalOrderParams,
3466
3542
  subAccountId?: number
@@ -4515,7 +4591,7 @@ export class DriftClient {
4515
4591
  return txSig;
4516
4592
  }
4517
4593
 
4518
- public async placeAndTakePerpWithAdditionalOrders(
4594
+ public async preparePlaceAndTakePerpOrderWithAdditionalOrders(
4519
4595
  orderParams: OptionalOrderParams,
4520
4596
  makerInfo?: MakerInfo | MakerInfo[],
4521
4597
  referrerInfo?: ReferrerInfo,
@@ -4526,21 +4602,18 @@ export class DriftClient {
4526
4602
  settlePnl?: boolean,
4527
4603
  exitEarlyIfSimFails?: boolean
4528
4604
  ): Promise<{
4529
- txSig: TransactionSignature;
4530
- signedCancelExistingOrdersTx?: Transaction;
4531
- signedSettlePnlTx?: Transaction;
4605
+ placeAndTakeTx: Transaction | VersionedTransaction;
4606
+ cancelExistingOrdersTx: Transaction | VersionedTransaction;
4607
+ settlePnlTx: Transaction | VersionedTransaction;
4532
4608
  }> {
4533
4609
  const placeAndTakeIxs: TransactionInstruction[] = [];
4534
4610
 
4535
- const txsToSign: {
4536
- key: string;
4537
- tx: Transaction | VersionedTransaction;
4538
- }[] = [];
4611
+ type TxKeys = 'placeAndTakeTx' | 'cancelExistingOrdersTx' | 'settlePnlTx';
4539
4612
 
4540
- const keys = {
4541
- placeAndTakeIx: 'placeAndTakeIx',
4542
- cancelExistingOrdersTx: 'cancelExistingOrdersTx',
4543
- settlePnlTx: 'settlePnlTx',
4613
+ const txsToSign: Record<TxKeys, Transaction | VersionedTransaction> = {
4614
+ placeAndTakeTx: undefined,
4615
+ cancelExistingOrdersTx: undefined,
4616
+ settlePnlTx: undefined,
4544
4617
  };
4545
4618
 
4546
4619
  // Get recent block hash so that we can re-use it for all transactions. Makes this logic run faster with fewer RPC requests
@@ -4598,32 +4671,26 @@ export class DriftClient {
4598
4671
  return;
4599
4672
  }
4600
4673
 
4601
- txsToSign.push({
4602
- key: keys.placeAndTakeIx,
4603
- tx: await this.buildTransaction(
4604
- placeAndTakeIxs,
4605
- {
4606
- ...txParamsWithoutImplicitSimulation,
4607
- computeUnits: simulationResult.computeUnits,
4608
- },
4609
- undefined,
4610
- undefined,
4611
- undefined,
4612
- recentBlockHash
4613
- ),
4614
- });
4674
+ txsToSign.placeAndTakeTx = await this.buildTransaction(
4675
+ placeAndTakeIxs,
4676
+ {
4677
+ ...txParamsWithoutImplicitSimulation,
4678
+ computeUnits: simulationResult.computeUnits,
4679
+ },
4680
+ undefined,
4681
+ undefined,
4682
+ undefined,
4683
+ recentBlockHash
4684
+ );
4615
4685
  } else {
4616
- txsToSign.push({
4617
- key: keys.placeAndTakeIx,
4618
- tx: await this.buildTransaction(
4619
- placeAndTakeIxs,
4620
- txParams,
4621
- undefined,
4622
- undefined,
4623
- undefined,
4624
- recentBlockHash
4625
- ),
4626
- });
4686
+ txsToSign.placeAndTakeTx = await this.buildTransaction(
4687
+ placeAndTakeIxs,
4688
+ txParams,
4689
+ undefined,
4690
+ undefined,
4691
+ undefined,
4692
+ recentBlockHash
4693
+ );
4627
4694
  }
4628
4695
 
4629
4696
  return;
@@ -4638,17 +4705,14 @@ export class DriftClient {
4638
4705
  subAccountId
4639
4706
  );
4640
4707
 
4641
- txsToSign.push({
4642
- key: keys.cancelExistingOrdersTx,
4643
- tx: await this.buildTransaction(
4644
- [cancelOrdersIx],
4645
- txParams,
4646
- this.txVersion,
4647
- undefined,
4648
- undefined,
4649
- recentBlockHash
4650
- ),
4651
- });
4708
+ txsToSign.cancelExistingOrdersTx = await this.buildTransaction(
4709
+ [cancelOrdersIx],
4710
+ txParams,
4711
+ this.txVersion,
4712
+ undefined,
4713
+ undefined,
4714
+ recentBlockHash
4715
+ );
4652
4716
  }
4653
4717
 
4654
4718
  return;
@@ -4666,17 +4730,14 @@ export class DriftClient {
4666
4730
  orderParams.marketIndex
4667
4731
  );
4668
4732
 
4669
- txsToSign.push({
4670
- key: keys.settlePnlTx,
4671
- tx: await this.buildTransaction(
4672
- [settlePnlIx],
4673
- txParams,
4674
- this.txVersion,
4675
- undefined,
4676
- undefined,
4677
- recentBlockHash
4678
- ),
4679
- });
4733
+ txsToSign.settlePnlTx = await this.buildTransaction(
4734
+ [settlePnlIx],
4735
+ txParams,
4736
+ this.txVersion,
4737
+ undefined,
4738
+ undefined,
4739
+ recentBlockHash
4740
+ );
4680
4741
  }
4681
4742
  return;
4682
4743
  };
@@ -4691,14 +4752,46 @@ export class DriftClient {
4691
4752
  return null;
4692
4753
  }
4693
4754
 
4694
- const signedTxs = await this.txHandler.getSignedTransactionMap(
4695
- txsToSign.map((tx) => tx.tx),
4696
- txsToSign.map((tx) => tx.key),
4697
- this.provider.wallet
4698
- );
4755
+ return txsToSign;
4756
+ }
4757
+
4758
+ public async placeAndTakePerpWithAdditionalOrders(
4759
+ orderParams: OptionalOrderParams,
4760
+ makerInfo?: MakerInfo | MakerInfo[],
4761
+ referrerInfo?: ReferrerInfo,
4762
+ bracketOrdersParams = new Array<OptionalOrderParams>(),
4763
+ txParams?: TxParams,
4764
+ subAccountId?: number,
4765
+ cancelExistingOrders?: boolean,
4766
+ settlePnl?: boolean,
4767
+ exitEarlyIfSimFails?: boolean
4768
+ ): Promise<{
4769
+ txSig: TransactionSignature;
4770
+ signedCancelExistingOrdersTx?: Transaction;
4771
+ signedSettlePnlTx?: Transaction;
4772
+ }> {
4773
+ const txsToSign =
4774
+ await this.preparePlaceAndTakePerpOrderWithAdditionalOrders(
4775
+ orderParams,
4776
+ makerInfo,
4777
+ referrerInfo,
4778
+ bracketOrdersParams,
4779
+ txParams,
4780
+ subAccountId,
4781
+ cancelExistingOrders,
4782
+ settlePnl,
4783
+ exitEarlyIfSimFails
4784
+ );
4785
+
4786
+ const signedTxs = (
4787
+ await this.txHandler.getSignedTransactionMap(
4788
+ txsToSign,
4789
+ this.provider.wallet
4790
+ )
4791
+ ).signedTxMap;
4699
4792
 
4700
4793
  const { txSig, slot } = await this.sendTransaction(
4701
- signedTxs[keys.placeAndTakeIx],
4794
+ signedTxs.placeAndTakeTx,
4702
4795
  [],
4703
4796
  this.opts,
4704
4797
  true
@@ -4708,10 +4801,9 @@ export class DriftClient {
4708
4801
 
4709
4802
  return {
4710
4803
  txSig,
4711
- signedCancelExistingOrdersTx: signedTxs[
4712
- keys.cancelExistingOrdersTx
4713
- ] as Transaction,
4714
- signedSettlePnlTx: signedTxs[keys.settlePnlTx] as Transaction,
4804
+ signedCancelExistingOrdersTx:
4805
+ signedTxs.cancelExistingOrdersTx as Transaction,
4806
+ signedSettlePnlTx: signedTxs.settlePnlTx as Transaction,
4715
4807
  };
4716
4808
  }
4717
4809
 
@@ -4864,6 +4956,30 @@ export class DriftClient {
4864
4956
  );
4865
4957
  }
4866
4958
 
4959
+ public async preparePlaceAndTakeSpotOrder(
4960
+ orderParams: OptionalOrderParams,
4961
+ fulfillmentConfig?: SerumV3FulfillmentConfigAccount,
4962
+ makerInfo?: MakerInfo,
4963
+ referrerInfo?: ReferrerInfo,
4964
+ txParams?: TxParams,
4965
+ subAccountId?: number
4966
+ ) {
4967
+ const tx = await this.buildTransaction(
4968
+ await this.getPlaceAndTakeSpotOrderIx(
4969
+ orderParams,
4970
+ fulfillmentConfig,
4971
+ makerInfo,
4972
+ referrerInfo,
4973
+ subAccountId
4974
+ ),
4975
+ txParams
4976
+ );
4977
+
4978
+ return {
4979
+ placeAndTakeSpotOrderTx: tx,
4980
+ };
4981
+ }
4982
+
4867
4983
  public async placeAndTakeSpotOrder(
4868
4984
  orderParams: OptionalOrderParams,
4869
4985
  fulfillmentConfig?: SerumV3FulfillmentConfigAccount,
@@ -4873,18 +4989,19 @@ export class DriftClient {
4873
4989
  subAccountId?: number
4874
4990
  ): Promise<TransactionSignature> {
4875
4991
  const { txSig, slot } = await this.sendTransaction(
4876
- await this.buildTransaction(
4877
- await this.getPlaceAndTakeSpotOrderIx(
4992
+ (
4993
+ await this.preparePlaceAndTakeSpotOrder(
4878
4994
  orderParams,
4879
4995
  fulfillmentConfig,
4880
4996
  makerInfo,
4881
4997
  referrerInfo,
4998
+ txParams,
4882
4999
  subAccountId
4883
- ),
4884
- txParams
4885
- ),
5000
+ )
5001
+ ).placeAndTakeSpotOrderTx,
4886
5002
  [],
4887
- this.opts
5003
+ this.opts,
5004
+ false
4888
5005
  );
4889
5006
  this.spotMarketLastSlotCache.set(orderParams.marketIndex, slot);
4890
5007
  this.spotMarketLastSlotCache.set(QUOTE_SPOT_MARKET_INDEX, slot);
@@ -5229,9 +5346,9 @@ export class DriftClient {
5229
5346
  oraclePriceOffset: newOraclePriceOffset || null,
5230
5347
  triggerPrice: newTriggerPrice || null,
5231
5348
  triggerCondition: newTriggerCondition || null,
5232
- auctionDuration: auctionDuration || 0,
5233
- auctionStartPrice: auctionStartPrice || ZERO,
5234
- auctionEndPrice: auctionEndPrice || ZERO,
5349
+ auctionDuration: auctionDuration || null,
5350
+ auctionStartPrice: auctionStartPrice || null,
5351
+ auctionEndPrice: auctionEndPrice || null,
5235
5352
  reduceOnly: reduceOnly != undefined ? reduceOnly : null,
5236
5353
  postOnly: postOnly != undefined ? postOnly : null,
5237
5354
  immediateOrCancel:
@@ -6814,16 +6931,41 @@ export class DriftClient {
6814
6931
  });
6815
6932
  }
6816
6933
 
6817
- async buildAndSignBulkTransactions(
6818
- instructions: (TransactionInstruction | TransactionInstruction[])[],
6819
- keys: string[],
6934
+ async buildTransactionsMap(
6935
+ instructionsMap: Record<
6936
+ string,
6937
+ TransactionInstruction | TransactionInstruction[]
6938
+ >,
6939
+ txParams?: TxParams,
6940
+ txVersion?: TransactionVersion,
6941
+ lookupTables?: AddressLookupTableAccount[],
6942
+ forceVersionedTransaction?: boolean
6943
+ ) {
6944
+ return this.txHandler.buildTransactionsMap({
6945
+ instructionsMap,
6946
+ txVersion: txVersion ?? this.txVersion,
6947
+ txParams: txParams ?? this.txParams,
6948
+ connection: this.connection,
6949
+ preFlightCommitment: this.opts.preflightCommitment,
6950
+ fetchMarketLookupTableAccount:
6951
+ this.fetchMarketLookupTableAccount.bind(this),
6952
+ lookupTables,
6953
+ forceVersionedTransaction,
6954
+ });
6955
+ }
6956
+
6957
+ async buildAndSignTransactionsMap(
6958
+ instructionsMap: Record<
6959
+ string,
6960
+ TransactionInstruction | TransactionInstruction[]
6961
+ >,
6820
6962
  txParams?: TxParams,
6821
6963
  txVersion?: TransactionVersion,
6822
6964
  lookupTables?: AddressLookupTableAccount[],
6823
6965
  forceVersionedTransaction?: boolean
6824
6966
  ) {
6825
6967
  return this.txHandler.buildAndSignTransactionMap({
6826
- instructions,
6968
+ instructionsMap,
6827
6969
  txVersion: txVersion ?? this.txVersion,
6828
6970
  txParams: txParams ?? this.txParams,
6829
6971
  connection: this.connection,
@@ -6832,7 +6974,6 @@ export class DriftClient {
6832
6974
  this.fetchMarketLookupTableAccount.bind(this),
6833
6975
  lookupTables,
6834
6976
  forceVersionedTransaction,
6835
- keys,
6836
6977
  });
6837
6978
  }
6838
6979
  }