@drift-labs/sdk 2.65.0-beta.1 → 2.65.0-beta.10

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.
@@ -51,7 +51,7 @@ export class AdminClient extends DriftClient {
51
51
  this.program.programId
52
52
  );
53
53
 
54
- const initializeTx = await this.program.transaction.initialize({
54
+ const initializeIx = await this.program.instruction.initialize({
55
55
  accounts: {
56
56
  admin: this.wallet.publicKey,
57
57
  state: driftStatePublicKey,
@@ -63,13 +63,11 @@ export class AdminClient extends DriftClient {
63
63
  },
64
64
  });
65
65
 
66
- const { txSig: initializeTxSig } = await super.sendTransaction(
67
- initializeTx,
68
- [],
69
- this.opts
70
- );
66
+ const tx = await this.buildTransaction(initializeIx);
67
+
68
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
71
69
 
72
- return [initializeTxSig];
70
+ return [txSig];
73
71
  }
74
72
 
75
73
  public async initializeSpotMarket(
@@ -105,7 +103,7 @@ export class AdminClient extends DriftClient {
105
103
  );
106
104
 
107
105
  const nameBuffer = encodeName(name);
108
- const initializeTx = await this.program.transaction.initializeSpotMarket(
106
+ const initializeIx = await this.program.instruction.initializeSpotMarket(
109
107
  optimalUtilization,
110
108
  optimalRate,
111
109
  maxRate,
@@ -135,7 +133,11 @@ export class AdminClient extends DriftClient {
135
133
  }
136
134
  );
137
135
 
138
- const { txSig } = await this.sendTransaction(initializeTx, [], this.opts);
136
+ const tx = await this.buildTransaction(initializeIx);
137
+
138
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
139
+
140
+ // const { txSig } = await this.sendTransaction(initializeTx, [], this.opts);
139
141
 
140
142
  await this.accountSubscriber.addSpotMarket(spotMarketIndex);
141
143
  await this.accountSubscriber.addOracle({
@@ -161,26 +163,30 @@ export class AdminClient extends DriftClient {
161
163
  serumMarket
162
164
  );
163
165
 
164
- const tx = await this.program.transaction.initializeSerumFulfillmentConfig(
165
- marketIndex,
166
- {
167
- accounts: {
168
- admin: this.wallet.publicKey,
169
- state: await this.getStatePublicKey(),
170
- baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
171
- quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
172
- driftSigner: this.getSignerPublicKey(),
173
- serumProgram,
174
- serumMarket,
175
- serumOpenOrders,
176
- rent: SYSVAR_RENT_PUBKEY,
177
- systemProgram: anchor.web3.SystemProgram.programId,
178
- serumFulfillmentConfig,
179
- },
180
- }
181
- );
166
+ const initializeIx =
167
+ await this.program.instruction.initializeSerumFulfillmentConfig(
168
+ marketIndex,
169
+ {
170
+ accounts: {
171
+ admin: this.wallet.publicKey,
172
+ state: await this.getStatePublicKey(),
173
+ baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
174
+ quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
175
+ driftSigner: this.getSignerPublicKey(),
176
+ serumProgram,
177
+ serumMarket,
178
+ serumOpenOrders,
179
+ rent: SYSVAR_RENT_PUBKEY,
180
+ systemProgram: anchor.web3.SystemProgram.programId,
181
+ serumFulfillmentConfig,
182
+ },
183
+ }
184
+ );
185
+
186
+ const tx = await this.buildTransaction(initializeIx);
182
187
 
183
188
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
189
+
184
190
  return txSig;
185
191
  }
186
192
 
@@ -193,8 +199,8 @@ export class AdminClient extends DriftClient {
193
199
  phoenixMarket
194
200
  );
195
201
 
196
- const tx =
197
- await this.program.transaction.initializePhoenixFulfillmentConfig(
202
+ const initializeIx =
203
+ await this.program.instruction.initializePhoenixFulfillmentConfig(
198
204
  marketIndex,
199
205
  {
200
206
  accounts: {
@@ -212,7 +218,10 @@ export class AdminClient extends DriftClient {
212
218
  }
213
219
  );
214
220
 
221
+ const tx = await this.buildTransaction(initializeIx);
222
+
215
223
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
224
+
216
225
  return txSig;
217
226
  }
218
227
 
@@ -237,8 +246,8 @@ export class AdminClient extends DriftClient {
237
246
  );
238
247
 
239
248
  const nameBuffer = encodeName(name);
240
- const initializeMarketTx =
241
- await this.program.transaction.initializePerpMarket(
249
+ const initializeMarketIx =
250
+ await this.program.instruction.initializePerpMarket(
242
251
  marketIndex,
243
252
  baseAssetReserve,
244
253
  quoteAssetReserve,
@@ -261,11 +270,9 @@ export class AdminClient extends DriftClient {
261
270
  },
262
271
  }
263
272
  );
264
- const { txSig } = await this.sendTransaction(
265
- initializeMarketTx,
266
- [],
267
- this.opts
268
- );
273
+ const tx = await this.buildTransaction(initializeMarketIx);
274
+
275
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
269
276
 
270
277
  while (this.getStateAccount().numberOfMarkets <= currentPerpMarketIndex) {
271
278
  await this.fetchAccounts();
@@ -288,8 +295,8 @@ export class AdminClient extends DriftClient {
288
295
  marketIndex
289
296
  );
290
297
 
291
- const deleteInitializeMarketTx =
292
- await this.program.transaction.deleteInitializedPerpMarket(marketIndex, {
298
+ const deleteInitializeMarketIx =
299
+ await this.program.instruction.deleteInitializedPerpMarket(marketIndex, {
293
300
  accounts: {
294
301
  state: await this.getStatePublicKey(),
295
302
  admin: this.wallet.publicKey,
@@ -297,11 +304,9 @@ export class AdminClient extends DriftClient {
297
304
  },
298
305
  });
299
306
 
300
- const { txSig } = await this.sendTransaction(
301
- deleteInitializeMarketTx,
302
- [],
303
- this.opts
304
- );
307
+ const tx = await this.buildTransaction(deleteInitializeMarketIx);
308
+
309
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
305
310
 
306
311
  return txSig;
307
312
  }
@@ -321,7 +326,7 @@ export class AdminClient extends DriftClient {
321
326
  sqrtK = squareRootBN(baseAssetReserve.mul(quoteAssetReserve));
322
327
  }
323
328
 
324
- const tx = await this.program.transaction.moveAmmPrice(
329
+ const moveAmmPriceIx = await this.program.instruction.moveAmmPrice(
325
330
  baseAssetReserve,
326
331
  quoteAssetReserve,
327
332
  sqrtK,
@@ -334,7 +339,10 @@ export class AdminClient extends DriftClient {
334
339
  }
335
340
  );
336
341
 
342
+ const tx = await this.buildTransaction(moveAmmPriceIx);
343
+
337
344
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
345
+
338
346
  return txSig;
339
347
  }
340
348
 
@@ -342,7 +350,7 @@ export class AdminClient extends DriftClient {
342
350
  perpMarketIndex: number,
343
351
  sqrtK: BN
344
352
  ): Promise<TransactionSignature> {
345
- const tx = await this.program.transaction.updateK(sqrtK, {
353
+ const updateKIx = await this.program.instruction.updateK(sqrtK, {
346
354
  accounts: {
347
355
  state: await this.getStatePublicKey(),
348
356
  admin: this.wallet.publicKey,
@@ -354,7 +362,10 @@ export class AdminClient extends DriftClient {
354
362
  },
355
363
  });
356
364
 
365
+ const tx = await this.buildTransaction(updateKIx);
366
+
357
367
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
368
+
358
369
  return txSig;
359
370
  }
360
371
 
@@ -368,19 +379,23 @@ export class AdminClient extends DriftClient {
368
379
  perpMarketIndex
369
380
  );
370
381
 
371
- const tx = await this.program.transaction.recenterPerpMarketAmm(
372
- pegMultiplier,
373
- sqrtK,
374
- {
375
- accounts: {
376
- state: await this.getStatePublicKey(),
377
- admin: this.wallet.publicKey,
378
- perpMarket: marketPublicKey,
379
- },
380
- }
381
- );
382
+ const recenterPerpMarketAmmIx =
383
+ await this.program.instruction.recenterPerpMarketAmm(
384
+ pegMultiplier,
385
+ sqrtK,
386
+ {
387
+ accounts: {
388
+ state: await this.getStatePublicKey(),
389
+ admin: this.wallet.publicKey,
390
+ perpMarket: marketPublicKey,
391
+ },
392
+ }
393
+ );
394
+
395
+ const tx = await this.buildTransaction(recenterPerpMarketAmmIx);
382
396
 
383
397
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
398
+
384
399
  return txSig;
385
400
  }
386
401
 
@@ -430,7 +445,7 @@ export class AdminClient extends DriftClient {
430
445
  perpMarketIndex
431
446
  );
432
447
 
433
- const tx = await this.program.transaction.moveAmmPrice(
448
+ const moveAmmPriceIx = await this.program.instruction.moveAmmPrice(
434
449
  newBaseAssetAmount,
435
450
  newQuoteAssetAmount,
436
451
  perpMarket.amm.sqrtK,
@@ -443,7 +458,10 @@ export class AdminClient extends DriftClient {
443
458
  }
444
459
  );
445
460
 
461
+ const tx = await this.buildTransaction(moveAmmPriceIx);
462
+
446
463
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
464
+
447
465
  return txSig;
448
466
  }
449
467
 
@@ -457,15 +475,22 @@ export class AdminClient extends DriftClient {
457
475
  );
458
476
  const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
459
477
 
460
- const tx = await this.program.transaction.repegAmmCurve(newPeg, {
461
- accounts: {
462
- state: await this.getStatePublicKey(),
463
- admin: this.wallet.publicKey,
464
- oracle: ammData.oracle,
465
- perpMarket: perpMarketPublicKey,
466
- },
467
- });
478
+ const repegAmmCurveIx = await this.program.instruction.repegAmmCurve(
479
+ newPeg,
480
+ {
481
+ accounts: {
482
+ state: await this.getStatePublicKey(),
483
+ admin: this.wallet.publicKey,
484
+ oracle: ammData.oracle,
485
+ perpMarket: perpMarketPublicKey,
486
+ },
487
+ }
488
+ );
489
+
490
+ const tx = await this.buildTransaction(repegAmmCurveIx);
491
+
468
492
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
493
+
469
494
  return txSig;
470
495
  }
471
496
 
@@ -514,9 +539,8 @@ export class AdminClient extends DriftClient {
514
539
  ): Promise<TransactionSignature> {
515
540
  const spotMarket = this.getQuoteSpotMarketAccount();
516
541
 
517
- const tx = await this.program.transaction.depositIntoPerpMarketFeePool(
518
- amount,
519
- {
542
+ const depositIntoPerpMarketFeePoolIx =
543
+ await this.program.instruction.depositIntoPerpMarketFeePool(amount, {
520
544
  accounts: {
521
545
  admin: this.wallet.publicKey,
522
546
  state: await this.getStatePublicKey(),
@@ -530,22 +554,27 @@ export class AdminClient extends DriftClient {
530
554
  spotMarketVault: spotMarket.vault,
531
555
  tokenProgram: TOKEN_PROGRAM_ID,
532
556
  },
533
- }
534
- );
557
+ });
558
+
559
+ const tx = await this.buildTransaction(depositIntoPerpMarketFeePoolIx);
535
560
 
536
561
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
562
+
537
563
  return txSig;
538
564
  }
539
565
 
540
566
  public async updateAdmin(admin: PublicKey): Promise<TransactionSignature> {
541
- const tx = await this.program.transaction.updateAdmin(admin, {
567
+ const updateAdminIx = await this.program.instruction.updateAdmin(admin, {
542
568
  accounts: {
543
569
  admin: this.wallet.publicKey,
544
570
  state: await this.getStatePublicKey(),
545
571
  },
546
572
  });
547
573
 
574
+ const tx = await this.buildTransaction(updateAdminIx);
575
+
548
576
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
577
+
549
578
  return txSig;
550
579
  }
551
580
 
@@ -595,22 +624,26 @@ export class AdminClient extends DriftClient {
595
624
  marginRatioInitial: number,
596
625
  marginRatioMaintenance: number
597
626
  ): Promise<TransactionSignature> {
598
- const tx = await this.program.transaction.updatePerpMarketMarginRatio(
599
- marginRatioInitial,
600
- marginRatioMaintenance,
601
- {
602
- accounts: {
603
- admin: this.wallet.publicKey,
604
- state: await this.getStatePublicKey(),
605
- perpMarket: await getPerpMarketPublicKey(
606
- this.program.programId,
607
- perpMarketIndex
608
- ),
609
- },
610
- }
611
- );
627
+ const updatePerpMarketMarginRatioIx =
628
+ await this.program.instruction.updatePerpMarketMarginRatio(
629
+ marginRatioInitial,
630
+ marginRatioMaintenance,
631
+ {
632
+ accounts: {
633
+ admin: this.wallet.publicKey,
634
+ state: await this.getStatePublicKey(),
635
+ perpMarket: await getPerpMarketPublicKey(
636
+ this.program.programId,
637
+ perpMarketIndex
638
+ ),
639
+ },
640
+ }
641
+ );
642
+
643
+ const tx = await this.buildTransaction(updatePerpMarketMarginRatioIx);
612
644
 
613
645
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
646
+
614
647
  return txSig;
615
648
  }
616
649
 
@@ -639,9 +672,8 @@ export class AdminClient extends DriftClient {
639
672
  perpMarketIndex: number,
640
673
  baseSpread: number
641
674
  ): Promise<TransactionSignature> {
642
- const tx = await this.program.transaction.updatePerpMarketBaseSpread(
643
- baseSpread,
644
- {
675
+ const updatePerpMarketBaseSpreadIx =
676
+ await this.program.instruction.updatePerpMarketBaseSpread(baseSpread, {
645
677
  accounts: {
646
678
  admin: this.wallet.publicKey,
647
679
  state: await this.getStatePublicKey(),
@@ -650,10 +682,12 @@ export class AdminClient extends DriftClient {
650
682
  perpMarketIndex
651
683
  ),
652
684
  },
653
- }
654
- );
685
+ });
686
+
687
+ const tx = await this.buildTransaction(updatePerpMarketBaseSpreadIx);
655
688
 
656
689
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
690
+
657
691
  return txSig;
658
692
  }
659
693
 
@@ -661,9 +695,8 @@ export class AdminClient extends DriftClient {
661
695
  perpMarketIndex: number,
662
696
  ammJitIntensity: number
663
697
  ): Promise<TransactionSignature> {
664
- const tx = await this.program.transaction.updateAmmJitIntensity(
665
- ammJitIntensity,
666
- {
698
+ const updateAmmJitIntensityIx =
699
+ await this.program.instruction.updateAmmJitIntensity(ammJitIntensity, {
667
700
  accounts: {
668
701
  admin: this.wallet.publicKey,
669
702
  state: await this.getStatePublicKey(),
@@ -672,10 +705,12 @@ export class AdminClient extends DriftClient {
672
705
  perpMarketIndex
673
706
  ),
674
707
  },
675
- }
676
- );
708
+ });
709
+
710
+ const tx = await this.buildTransaction(updateAmmJitIntensityIx);
677
711
 
678
712
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
713
+
679
714
  return txSig;
680
715
  }
681
716
 
@@ -685,18 +720,22 @@ export class AdminClient extends DriftClient {
685
720
  ): Promise<TransactionSignature> {
686
721
  const nameBuffer = encodeName(name);
687
722
 
688
- const tx = await this.program.transaction.updatePerpMarketName(nameBuffer, {
689
- accounts: {
690
- admin: this.wallet.publicKey,
691
- state: await this.getStatePublicKey(),
692
- perpMarket: await getPerpMarketPublicKey(
693
- this.program.programId,
694
- perpMarketIndex
695
- ),
696
- },
697
- });
723
+ const updatePerpMarketNameIx =
724
+ await this.program.instruction.updatePerpMarketName(nameBuffer, {
725
+ accounts: {
726
+ admin: this.wallet.publicKey,
727
+ state: await this.getStatePublicKey(),
728
+ perpMarket: await getPerpMarketPublicKey(
729
+ this.program.programId,
730
+ perpMarketIndex
731
+ ),
732
+ },
733
+ });
734
+
735
+ const tx = await this.buildTransaction(updatePerpMarketNameIx);
698
736
 
699
737
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
738
+
700
739
  return txSig;
701
740
  }
702
741
 
@@ -757,31 +796,36 @@ export class AdminClient extends DriftClient {
757
796
  public async updatePerpFeeStructure(
758
797
  feeStructure: FeeStructure
759
798
  ): Promise<TransactionSignature> {
760
- const tx = this.program.transaction.updatePerpFeeStructure(feeStructure, {
761
- accounts: {
762
- admin: this.wallet.publicKey,
763
- state: await this.getStatePublicKey(),
764
- },
765
- });
799
+ const updatePerpFeeStructureIx =
800
+ this.program.instruction.updatePerpFeeStructure(feeStructure, {
801
+ accounts: {
802
+ admin: this.wallet.publicKey,
803
+ state: await this.getStatePublicKey(),
804
+ },
805
+ });
806
+
807
+ const tx = await this.buildTransaction(updatePerpFeeStructureIx);
766
808
 
767
809
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
810
+
768
811
  return txSig;
769
812
  }
770
813
 
771
814
  public async updateSpotFeeStructure(
772
815
  feeStructure: FeeStructure
773
816
  ): Promise<TransactionSignature> {
774
- const tx = await this.program.transaction.updateSpotFeeStructure(
775
- feeStructure,
776
- {
817
+ const updateSpotFeeStructureIx =
818
+ await this.program.instruction.updateSpotFeeStructure(feeStructure, {
777
819
  accounts: {
778
820
  admin: this.wallet.publicKey,
779
821
  state: await this.getStatePublicKey(),
780
822
  },
781
- }
782
- );
823
+ });
824
+
825
+ const tx = await this.buildTransaction(updateSpotFeeStructureIx);
783
826
 
784
827
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
828
+
785
829
  return txSig;
786
830
  }
787
831
 
@@ -830,17 +874,18 @@ export class AdminClient extends DriftClient {
830
874
  public async updateOracleGuardRails(
831
875
  oracleGuardRails: OracleGuardRails
832
876
  ): Promise<TransactionSignature> {
833
- const tx = await this.program.transaction.updateOracleGuardRails(
834
- oracleGuardRails,
835
- {
877
+ const updateOracleGuardRailsIx =
878
+ await this.program.instruction.updateOracleGuardRails(oracleGuardRails, {
836
879
  accounts: {
837
880
  admin: this.wallet.publicKey,
838
881
  state: await this.getStatePublicKey(),
839
882
  },
840
- }
841
- );
883
+ });
884
+
885
+ const tx = await this.buildTransaction(updateOracleGuardRailsIx);
842
886
 
843
887
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
888
+
844
889
  return txSig;
845
890
  }
846
891
 
@@ -890,21 +935,25 @@ export class AdminClient extends DriftClient {
890
935
  spotMarketIndex: number,
891
936
  withdrawGuardThreshold: BN
892
937
  ): Promise<TransactionSignature> {
893
- const tx = await this.program.transaction.updateWithdrawGuardThreshold(
894
- withdrawGuardThreshold,
895
- {
896
- accounts: {
897
- admin: this.wallet.publicKey,
898
- state: await this.getStatePublicKey(),
899
- spotMarket: await getSpotMarketPublicKey(
900
- this.program.programId,
901
- spotMarketIndex
902
- ),
903
- },
904
- }
905
- );
938
+ const updateWithdrawGuardThresholdIx =
939
+ await this.program.instruction.updateWithdrawGuardThreshold(
940
+ withdrawGuardThreshold,
941
+ {
942
+ accounts: {
943
+ admin: this.wallet.publicKey,
944
+ state: await this.getStatePublicKey(),
945
+ spotMarket: await getSpotMarketPublicKey(
946
+ this.program.programId,
947
+ spotMarketIndex
948
+ ),
949
+ },
950
+ }
951
+ );
952
+
953
+ const tx = await this.buildTransaction(updateWithdrawGuardThresholdIx);
906
954
 
907
955
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
956
+
908
957
  return txSig;
909
958
  }
910
959
 
@@ -913,23 +962,27 @@ export class AdminClient extends DriftClient {
913
962
  userIfFactor: BN,
914
963
  totalIfFactor: BN
915
964
  ): Promise<TransactionSignature> {
916
- const tx = await this.program.transaction.updateSpotMarketIfFactor(
917
- spotMarketIndex,
918
- userIfFactor,
919
- totalIfFactor,
920
- {
921
- accounts: {
922
- admin: this.wallet.publicKey,
923
- state: await this.getStatePublicKey(),
924
- spotMarket: await getSpotMarketPublicKey(
925
- this.program.programId,
926
- spotMarketIndex
927
- ),
928
- },
929
- }
930
- );
965
+ const updateSpotMarketIfFactorIx =
966
+ await this.program.instruction.updateSpotMarketIfFactor(
967
+ spotMarketIndex,
968
+ userIfFactor,
969
+ totalIfFactor,
970
+ {
971
+ accounts: {
972
+ admin: this.wallet.publicKey,
973
+ state: await this.getStatePublicKey(),
974
+ spotMarket: await getSpotMarketPublicKey(
975
+ this.program.programId,
976
+ spotMarketIndex
977
+ ),
978
+ },
979
+ }
980
+ );
981
+
982
+ const tx = await this.buildTransaction(updateSpotMarketIfFactorIx);
931
983
 
932
984
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
985
+
933
986
  return txSig;
934
987
  }
935
988
 
@@ -937,8 +990,8 @@ export class AdminClient extends DriftClient {
937
990
  spotMarketIndex: number,
938
991
  revenueSettlePeriod: BN
939
992
  ): Promise<TransactionSignature> {
940
- const tx =
941
- await this.program.transaction.updateSpotMarketRevenueSettlePeriod(
993
+ const updateSpotMarketRevenueSettlePeriodIx =
994
+ await this.program.instruction.updateSpotMarketRevenueSettlePeriod(
942
995
  revenueSettlePeriod,
943
996
  {
944
997
  accounts: {
@@ -952,7 +1005,12 @@ export class AdminClient extends DriftClient {
952
1005
  }
953
1006
  );
954
1007
 
1008
+ const tx = await this.buildTransaction(
1009
+ updateSpotMarketRevenueSettlePeriodIx
1010
+ );
1011
+
955
1012
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1013
+
956
1014
  return txSig;
957
1015
  }
958
1016
 
@@ -960,21 +1018,25 @@ export class AdminClient extends DriftClient {
960
1018
  spotMarketIndex: number,
961
1019
  maxTokenDeposits: BN
962
1020
  ): Promise<TransactionSignature> {
963
- const tx = this.program.transaction.updateSpotMarketMaxTokenDeposits(
964
- maxTokenDeposits,
965
- {
966
- accounts: {
967
- admin: this.wallet.publicKey,
968
- state: await this.getStatePublicKey(),
969
- spotMarket: await getSpotMarketPublicKey(
970
- this.program.programId,
971
- spotMarketIndex
972
- ),
973
- },
974
- }
975
- );
1021
+ const updateSpotMarketMaxTokenDepositsIx =
1022
+ this.program.instruction.updateSpotMarketMaxTokenDeposits(
1023
+ maxTokenDeposits,
1024
+ {
1025
+ accounts: {
1026
+ admin: this.wallet.publicKey,
1027
+ state: await this.getStatePublicKey(),
1028
+ spotMarket: await getSpotMarketPublicKey(
1029
+ this.program.programId,
1030
+ spotMarketIndex
1031
+ ),
1032
+ },
1033
+ }
1034
+ );
1035
+
1036
+ const tx = await this.buildTransaction(updateSpotMarketMaxTokenDepositsIx);
976
1037
 
977
1038
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1039
+
978
1040
  return txSig;
979
1041
  }
980
1042
 
@@ -982,8 +1044,8 @@ export class AdminClient extends DriftClient {
982
1044
  spotMarketIndex: number,
983
1045
  scaleInitialAssetWeightStart: BN
984
1046
  ): Promise<TransactionSignature> {
985
- const tx =
986
- this.program.transaction.updateSpotMarketScaleInitialAssetWeightStart(
1047
+ const updateSpotMarketScaleInitialAssetWeightStartIx =
1048
+ this.program.instruction.updateSpotMarketScaleInitialAssetWeightStart(
987
1049
  scaleInitialAssetWeightStart,
988
1050
  {
989
1051
  accounts: {
@@ -997,7 +1059,12 @@ export class AdminClient extends DriftClient {
997
1059
  }
998
1060
  );
999
1061
 
1062
+ const tx = await this.buildTransaction(
1063
+ updateSpotMarketScaleInitialAssetWeightStartIx
1064
+ );
1065
+
1000
1066
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1067
+
1001
1068
  return txSig;
1002
1069
  }
1003
1070
 
@@ -1005,8 +1072,8 @@ export class AdminClient extends DriftClient {
1005
1072
  spotMarketIndex: number,
1006
1073
  insuranceWithdrawEscrowPeriod: BN
1007
1074
  ): Promise<TransactionSignature> {
1008
- const tx =
1009
- await this.program.transaction.updateInsuranceFundUnstakingPeriod(
1075
+ const updateInsuranceFundUnstakingPeriodIx =
1076
+ await this.program.instruction.updateInsuranceFundUnstakingPeriod(
1010
1077
  insuranceWithdrawEscrowPeriod,
1011
1078
  {
1012
1079
  accounts: {
@@ -1020,24 +1087,30 @@ export class AdminClient extends DriftClient {
1020
1087
  }
1021
1088
  );
1022
1089
 
1090
+ const tx = await this.buildTransaction(
1091
+ updateInsuranceFundUnstakingPeriodIx
1092
+ );
1093
+
1023
1094
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1095
+
1024
1096
  return txSig;
1025
1097
  }
1026
1098
 
1027
1099
  public async updateLpCooldownTime(
1028
1100
  cooldownTime: BN
1029
1101
  ): Promise<TransactionSignature> {
1030
- const tx = await this.program.transaction.updateLpCooldownTime(
1031
- cooldownTime,
1032
- {
1102
+ const updateLpCooldownTimeIx =
1103
+ await this.program.instruction.updateLpCooldownTime(cooldownTime, {
1033
1104
  accounts: {
1034
1105
  admin: this.wallet.publicKey,
1035
1106
  state: await this.getStatePublicKey(),
1036
1107
  },
1037
- }
1038
- );
1108
+ });
1109
+
1110
+ const tx = await this.buildTransaction(updateLpCooldownTimeIx);
1039
1111
 
1040
1112
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1113
+
1041
1114
  return txSig;
1042
1115
  }
1043
1116
 
@@ -1046,23 +1119,27 @@ export class AdminClient extends DriftClient {
1046
1119
  oracle: PublicKey,
1047
1120
  oracleSource: OracleSource
1048
1121
  ): Promise<TransactionSignature> {
1049
- const tx = await this.program.transaction.updatePerpMarketOracle(
1050
- oracle,
1051
- oracleSource,
1052
- {
1053
- accounts: {
1054
- admin: this.wallet.publicKey,
1055
- state: await this.getStatePublicKey(),
1056
- perpMarket: await getPerpMarketPublicKey(
1057
- this.program.programId,
1058
- perpMarketIndex
1059
- ),
1060
- oracle: oracle,
1061
- },
1062
- }
1063
- );
1122
+ const updatePerpMarketOracleIx =
1123
+ await this.program.instruction.updatePerpMarketOracle(
1124
+ oracle,
1125
+ oracleSource,
1126
+ {
1127
+ accounts: {
1128
+ admin: this.wallet.publicKey,
1129
+ state: await this.getStatePublicKey(),
1130
+ perpMarket: await getPerpMarketPublicKey(
1131
+ this.program.programId,
1132
+ perpMarketIndex
1133
+ ),
1134
+ oracle: oracle,
1135
+ },
1136
+ }
1137
+ );
1138
+
1139
+ const tx = await this.buildTransaction(updatePerpMarketOracleIx);
1064
1140
 
1065
1141
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1142
+
1066
1143
  return txSig;
1067
1144
  }
1068
1145
 
@@ -1071,8 +1148,8 @@ export class AdminClient extends DriftClient {
1071
1148
  stepSize: BN,
1072
1149
  tickSize: BN
1073
1150
  ): Promise<TransactionSignature> {
1074
- const tx =
1075
- await this.program.transaction.updatePerpMarketStepSizeAndTickSize(
1151
+ const updatePerpMarketStepSizeAndTickSizeIx =
1152
+ await this.program.instruction.updatePerpMarketStepSizeAndTickSize(
1076
1153
  stepSize,
1077
1154
  tickSize,
1078
1155
  {
@@ -1087,7 +1164,12 @@ export class AdminClient extends DriftClient {
1087
1164
  }
1088
1165
  );
1089
1166
 
1167
+ const tx = await this.buildTransaction(
1168
+ updatePerpMarketStepSizeAndTickSizeIx
1169
+ );
1170
+
1090
1171
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1172
+
1091
1173
  return txSig;
1092
1174
  }
1093
1175
 
@@ -1239,31 +1321,36 @@ export class AdminClient extends DriftClient {
1239
1321
  public async updateWhitelistMint(
1240
1322
  whitelistMint?: PublicKey
1241
1323
  ): Promise<TransactionSignature> {
1242
- const tx = await this.program.transaction.updateWhitelistMint(
1243
- whitelistMint,
1244
- {
1324
+ const updateWhitelistMintIx =
1325
+ await this.program.instruction.updateWhitelistMint(whitelistMint, {
1245
1326
  accounts: {
1246
1327
  admin: this.wallet.publicKey,
1247
1328
  state: await this.getStatePublicKey(),
1248
1329
  },
1249
- }
1250
- );
1330
+ });
1331
+
1332
+ const tx = await this.buildTransaction(updateWhitelistMintIx);
1251
1333
 
1252
1334
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1335
+
1253
1336
  return txSig;
1254
1337
  }
1255
1338
 
1256
1339
  public async updateDiscountMint(
1257
1340
  discountMint: PublicKey
1258
1341
  ): Promise<TransactionSignature> {
1259
- const tx = await this.program.transaction.updateDiscountMint(discountMint, {
1260
- accounts: {
1261
- admin: this.wallet.publicKey,
1262
- state: await this.getStatePublicKey(),
1263
- },
1264
- });
1342
+ const updateDiscountMintIx =
1343
+ await this.program.instruction.updateDiscountMint(discountMint, {
1344
+ accounts: {
1345
+ admin: this.wallet.publicKey,
1346
+ state: await this.getStatePublicKey(),
1347
+ },
1348
+ });
1349
+
1350
+ const tx = await this.buildTransaction(updateDiscountMintIx);
1265
1351
 
1266
1352
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1353
+
1267
1354
  return txSig;
1268
1355
  }
1269
1356
 
@@ -1321,9 +1408,8 @@ export class AdminClient extends DriftClient {
1321
1408
  spotMarketIndex: number,
1322
1409
  assetTier: AssetTier
1323
1410
  ): Promise<TransactionSignature> {
1324
- const tx = await this.program.transaction.updateSpotMarketAssetTier(
1325
- assetTier,
1326
- {
1411
+ const updateSpotMarketAssetTierIx =
1412
+ await this.program.instruction.updateSpotMarketAssetTier(assetTier, {
1327
1413
  accounts: {
1328
1414
  admin: this.wallet.publicKey,
1329
1415
  state: await this.getStatePublicKey(),
@@ -1332,10 +1418,12 @@ export class AdminClient extends DriftClient {
1332
1418
  spotMarketIndex
1333
1419
  ),
1334
1420
  },
1335
- }
1336
- );
1421
+ });
1422
+
1423
+ const tx = await this.buildTransaction(updateSpotMarketAssetTierIx);
1424
+
1425
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1337
1426
 
1338
- const { txSig } = await this.sendTransaction(tx);
1339
1427
  return txSig;
1340
1428
  }
1341
1429
 
@@ -1343,9 +1431,8 @@ export class AdminClient extends DriftClient {
1343
1431
  spotMarketIndex: number,
1344
1432
  marketStatus: MarketStatus
1345
1433
  ): Promise<TransactionSignature> {
1346
- const tx = await this.program.transaction.updateSpotMarketStatus(
1347
- marketStatus,
1348
- {
1434
+ const updateSpotMarketStatusIx =
1435
+ await this.program.instruction.updateSpotMarketStatus(marketStatus, {
1349
1436
  accounts: {
1350
1437
  admin: this.wallet.publicKey,
1351
1438
  state: await this.getStatePublicKey(),
@@ -1354,10 +1441,12 @@ export class AdminClient extends DriftClient {
1354
1441
  spotMarketIndex
1355
1442
  ),
1356
1443
  },
1357
- }
1358
- );
1444
+ });
1445
+
1446
+ const tx = await this.buildTransaction(updateSpotMarketStatusIx);
1359
1447
 
1360
1448
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1449
+
1361
1450
  return txSig;
1362
1451
  }
1363
1452
 
@@ -1365,21 +1454,25 @@ export class AdminClient extends DriftClient {
1365
1454
  spotMarketIndex: number,
1366
1455
  pausedOperations: number
1367
1456
  ): Promise<TransactionSignature> {
1368
- const tx = await this.program.transaction.updateSpotMarketPausedOperations(
1369
- pausedOperations,
1370
- {
1371
- accounts: {
1372
- admin: this.wallet.publicKey,
1373
- state: await this.getStatePublicKey(),
1374
- spotMarket: await getSpotMarketPublicKey(
1375
- this.program.programId,
1376
- spotMarketIndex
1377
- ),
1378
- },
1379
- }
1380
- );
1457
+ const updateSpotMarketPausedOperationsIx =
1458
+ await this.program.instruction.updateSpotMarketPausedOperations(
1459
+ pausedOperations,
1460
+ {
1461
+ accounts: {
1462
+ admin: this.wallet.publicKey,
1463
+ state: await this.getStatePublicKey(),
1464
+ spotMarket: await getSpotMarketPublicKey(
1465
+ this.program.programId,
1466
+ spotMarketIndex
1467
+ ),
1468
+ },
1469
+ }
1470
+ );
1471
+
1472
+ const tx = await this.buildTransaction(updateSpotMarketPausedOperationsIx);
1381
1473
 
1382
1474
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1475
+
1383
1476
  return txSig;
1384
1477
  }
1385
1478
 
@@ -1387,9 +1480,8 @@ export class AdminClient extends DriftClient {
1387
1480
  perpMarketIndex: number,
1388
1481
  marketStatus: MarketStatus
1389
1482
  ): Promise<TransactionSignature> {
1390
- const tx = await this.program.transaction.updatePerpMarketStatus(
1391
- marketStatus,
1392
- {
1483
+ const updatePerpMarketStatusIx =
1484
+ await this.program.instruction.updatePerpMarketStatus(marketStatus, {
1393
1485
  accounts: {
1394
1486
  admin: this.wallet.publicKey,
1395
1487
  state: await this.getStatePublicKey(),
@@ -1398,10 +1490,12 @@ export class AdminClient extends DriftClient {
1398
1490
  perpMarketIndex
1399
1491
  ),
1400
1492
  },
1401
- }
1402
- );
1493
+ });
1494
+
1495
+ const tx = await this.buildTransaction(updatePerpMarketStatusIx);
1403
1496
 
1404
1497
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1498
+
1405
1499
  return txSig;
1406
1500
  }
1407
1501
 
@@ -1409,21 +1503,25 @@ export class AdminClient extends DriftClient {
1409
1503
  perpMarketIndex: number,
1410
1504
  pausedOperations: number
1411
1505
  ): Promise<TransactionSignature> {
1412
- const tx = await this.program.transaction.updatePerpMarketPausedOperations(
1413
- pausedOperations,
1414
- {
1415
- accounts: {
1416
- admin: this.wallet.publicKey,
1417
- state: await this.getStatePublicKey(),
1418
- perpMarket: await getPerpMarketPublicKey(
1419
- this.program.programId,
1420
- perpMarketIndex
1421
- ),
1422
- },
1423
- }
1424
- );
1506
+ const updatePerpMarketPausedOperationsIx =
1507
+ await this.program.instruction.updatePerpMarketPausedOperations(
1508
+ pausedOperations,
1509
+ {
1510
+ accounts: {
1511
+ admin: this.wallet.publicKey,
1512
+ state: await this.getStatePublicKey(),
1513
+ perpMarket: await getPerpMarketPublicKey(
1514
+ this.program.programId,
1515
+ perpMarketIndex
1516
+ ),
1517
+ },
1518
+ }
1519
+ );
1520
+
1521
+ const tx = await this.buildTransaction(updatePerpMarketPausedOperationsIx);
1425
1522
 
1426
1523
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1524
+
1427
1525
  return txSig;
1428
1526
  }
1429
1527
 
@@ -1431,38 +1529,43 @@ export class AdminClient extends DriftClient {
1431
1529
  perpMarketIndex: number,
1432
1530
  contractTier: ContractTier
1433
1531
  ): Promise<TransactionSignature> {
1434
- const tx = await this.program.transaction.updatePerpMarketContractTier(
1435
- contractTier,
1436
- {
1437
- accounts: {
1438
- admin: this.wallet.publicKey,
1439
- state: await this.getStatePublicKey(),
1440
- perpMarket: await getPerpMarketPublicKey(
1441
- this.program.programId,
1442
- perpMarketIndex
1443
- ),
1444
- },
1445
- }
1446
- );
1532
+ const updatePerpMarketContractTierIx =
1533
+ await this.program.instruction.updatePerpMarketContractTier(
1534
+ contractTier,
1535
+ {
1536
+ accounts: {
1537
+ admin: this.wallet.publicKey,
1538
+ state: await this.getStatePublicKey(),
1539
+ perpMarket: await getPerpMarketPublicKey(
1540
+ this.program.programId,
1541
+ perpMarketIndex
1542
+ ),
1543
+ },
1544
+ }
1545
+ );
1546
+
1547
+ const tx = await this.buildTransaction(updatePerpMarketContractTierIx);
1447
1548
 
1448
1549
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1550
+
1449
1551
  return txSig;
1450
1552
  }
1451
1553
 
1452
1554
  public async updateExchangeStatus(
1453
1555
  exchangeStatus: ExchangeStatus
1454
1556
  ): Promise<TransactionSignature> {
1455
- const tx = await this.program.transaction.updateExchangeStatus(
1456
- exchangeStatus,
1457
- {
1557
+ const updateExchangeStatusIx =
1558
+ await this.program.instruction.updateExchangeStatus(exchangeStatus, {
1458
1559
  accounts: {
1459
1560
  admin: this.wallet.publicKey,
1460
1561
  state: await this.getStatePublicKey(),
1461
1562
  },
1462
- }
1463
- );
1563
+ });
1564
+
1565
+ const tx = await this.buildTransaction(updateExchangeStatusIx);
1464
1566
 
1465
1567
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1568
+
1466
1569
  return txSig;
1467
1570
  }
1468
1571