@drift-labs/sdk 2.10.0-beta.1 → 2.10.0-beta.3

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 (63) hide show
  1. package/lib/accounts/bulkAccountLoader.d.ts +2 -1
  2. package/lib/accounts/pollingDriftClientAccountSubscriber.js +12 -3
  3. package/lib/accounts/types.d.ts +5 -4
  4. package/lib/adminClient.js +96 -34
  5. package/lib/config.d.ts +2 -2
  6. package/lib/constants/perpMarkets.d.ts +1 -1
  7. package/lib/constants/spotMarkets.d.ts +1 -1
  8. package/lib/dlob/DLOB.d.ts +4 -4
  9. package/lib/dlob/DLOBNode.d.ts +2 -2
  10. package/lib/dlob/DLOBOrders.d.ts +2 -2
  11. package/lib/dlob/NodeList.d.ts +1 -1
  12. package/lib/driftClient.d.ts +4 -3
  13. package/lib/driftClient.js +105 -64
  14. package/lib/driftClientConfig.d.ts +3 -3
  15. package/lib/events/fetchLogs.d.ts +2 -2
  16. package/lib/events/types.d.ts +13 -13
  17. package/lib/factory/bigNum.js +4 -4
  18. package/lib/idl/drift.json +1 -1
  19. package/lib/index.d.ts +1 -0
  20. package/lib/index.js +1 -0
  21. package/lib/math/amm.d.ts +1 -1
  22. package/lib/math/amm.js +15 -6
  23. package/lib/math/oracles.js +2 -2
  24. package/lib/math/repeg.d.ts +1 -1
  25. package/lib/math/repeg.js +46 -19
  26. package/lib/math/trade.d.ts +1 -1
  27. package/lib/oracles/types.d.ts +2 -2
  28. package/lib/serum/types.d.ts +1 -1
  29. package/lib/slot/SlotSubscriber.d.ts +1 -1
  30. package/lib/testClient.d.ts +8 -0
  31. package/lib/testClient.js +22 -0
  32. package/lib/tx/retryTxSender.d.ts +1 -1
  33. package/lib/tx/types.d.ts +1 -1
  34. package/lib/types.d.ts +43 -43
  35. package/lib/user.d.ts +1 -0
  36. package/lib/user.js +10 -6
  37. package/lib/userConfig.d.ts +2 -2
  38. package/lib/userMap/userMap.js +3 -0
  39. package/lib/userMap/userStatsMap.js +3 -0
  40. package/lib/userStatsConfig.d.ts +2 -2
  41. package/package.json +1 -1
  42. package/src/accounts/pollingDriftClientAccountSubscriber.ts +26 -3
  43. package/src/adminClient.ts +301 -169
  44. package/src/driftClient.ts +199 -118
  45. package/src/driftClientConfig.ts +1 -1
  46. package/src/idl/drift.json +1 -1
  47. package/src/index.ts +1 -0
  48. package/src/math/amm.ts +27 -12
  49. package/src/math/oracles.ts +6 -4
  50. package/src/math/repeg.ts +54 -26
  51. package/src/testClient.ts +40 -0
  52. package/src/user.ts +5 -0
  53. package/src/userMap/userMap.ts +2 -0
  54. package/src/userMap/userStatsMap.ts +2 -0
  55. package/src/assert/assert.js +0 -9
  56. package/src/examples/makeTradeExample.js +0 -157
  57. package/src/token/index.js +0 -38
  58. package/src/tx/types.js +0 -2
  59. package/src/tx/utils.js +0 -17
  60. package/src/util/computeUnits.js +0 -27
  61. package/src/util/getTokenAddress.js +0 -9
  62. package/src/util/promiseTimeout.js +0 -14
  63. package/src/util/tps.js +0 -27
@@ -60,7 +60,7 @@ export class AdminClient extends DriftClient {
60
60
  },
61
61
  });
62
62
 
63
- const { txSig: initializeTxSig } = await this.txSender.send(
63
+ const { txSig: initializeTxSig } = await super.sendTransaction(
64
64
  initializeTx,
65
65
  [],
66
66
  this.opts
@@ -132,7 +132,7 @@ export class AdminClient extends DriftClient {
132
132
  }
133
133
  );
134
134
 
135
- const { txSig } = await this.txSender.send(initializeTx, [], this.opts);
135
+ const { txSig } = await this.sendTransaction(initializeTx, [], this.opts);
136
136
 
137
137
  await this.accountSubscriber.addSpotMarket(spotMarketIndex);
138
138
  await this.accountSubscriber.addOracle({
@@ -158,7 +158,7 @@ export class AdminClient extends DriftClient {
158
158
  serumMarket
159
159
  );
160
160
 
161
- return await this.program.rpc.initializeSerumFulfillmentConfig(
161
+ const tx = await this.program.transaction.initializeSerumFulfillmentConfig(
162
162
  marketIndex,
163
163
  {
164
164
  accounts: {
@@ -176,6 +176,9 @@ export class AdminClient extends DriftClient {
176
176
  },
177
177
  }
178
178
  );
179
+
180
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
181
+ return txSig;
179
182
  }
180
183
 
181
184
  public async initializePerpMarket(
@@ -191,9 +194,10 @@ export class AdminClient extends DriftClient {
191
194
  activeStatus = true,
192
195
  name = DEFAULT_MARKET_NAME
193
196
  ): Promise<TransactionSignature> {
197
+ const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
194
198
  const perpMarketPublicKey = await getPerpMarketPublicKey(
195
199
  this.program.programId,
196
- this.getStateAccount().numberOfMarkets
200
+ currentPerpMarketIndex
197
201
  );
198
202
 
199
203
  const nameBuffer = encodeName(name);
@@ -220,15 +224,17 @@ export class AdminClient extends DriftClient {
220
224
  },
221
225
  }
222
226
  );
223
- const { txSig } = await this.txSender.send(
227
+ const { txSig } = await this.sendTransaction(
224
228
  initializeMarketTx,
225
229
  [],
226
230
  this.opts
227
231
  );
228
232
 
229
- await this.accountSubscriber.addPerpMarket(
230
- this.getStateAccount().numberOfMarkets
231
- );
233
+ while (this.getStateAccount().numberOfMarkets <= currentPerpMarketIndex) {
234
+ await this.fetchAccounts();
235
+ }
236
+
237
+ await this.accountSubscriber.addPerpMarket(currentPerpMarketIndex);
232
238
  await this.accountSubscriber.addOracle({
233
239
  source: oracleSource,
234
240
  publicKey: priceOracle,
@@ -252,7 +258,7 @@ export class AdminClient extends DriftClient {
252
258
  sqrtK = squareRootBN(baseAssetReserve.mul(quoteAssetReserve));
253
259
  }
254
260
 
255
- return await this.program.rpc.moveAmmPrice(
261
+ const tx = await this.program.transaction.moveAmmPrice(
256
262
  baseAssetReserve,
257
263
  quoteAssetReserve,
258
264
  sqrtK,
@@ -264,13 +270,16 @@ export class AdminClient extends DriftClient {
264
270
  },
265
271
  }
266
272
  );
273
+
274
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
275
+ return txSig;
267
276
  }
268
277
 
269
278
  public async updateK(
270
279
  perpMarketIndex: number,
271
280
  sqrtK: BN
272
281
  ): Promise<TransactionSignature> {
273
- return await this.program.rpc.updateK(sqrtK, {
282
+ const tx = await this.program.transaction.updateK(sqrtK, {
274
283
  accounts: {
275
284
  state: await this.getStatePublicKey(),
276
285
  admin: this.wallet.publicKey,
@@ -281,6 +290,9 @@ export class AdminClient extends DriftClient {
281
290
  oracle: this.getPerpMarketAccount(perpMarketIndex).amm.oracle,
282
291
  },
283
292
  });
293
+
294
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
295
+ return txSig;
284
296
  }
285
297
 
286
298
  public async updatePerpMarketConcentrationScale(
@@ -329,7 +341,7 @@ export class AdminClient extends DriftClient {
329
341
  perpMarketIndex
330
342
  );
331
343
 
332
- return await this.program.rpc.moveAmmPrice(
344
+ const tx = await this.program.transaction.moveAmmPrice(
333
345
  newBaseAssetAmount,
334
346
  newQuoteAssetAmount,
335
347
  perpMarket.amm.sqrtK,
@@ -341,6 +353,9 @@ export class AdminClient extends DriftClient {
341
353
  },
342
354
  }
343
355
  );
356
+
357
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
358
+ return txSig;
344
359
  }
345
360
 
346
361
  public async repegAmmCurve(
@@ -353,7 +368,7 @@ export class AdminClient extends DriftClient {
353
368
  );
354
369
  const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
355
370
 
356
- return await this.program.rpc.repegAmmCurve(newPeg, {
371
+ const tx = await this.program.transaction.repegAmmCurve(newPeg, {
357
372
  accounts: {
358
373
  state: await this.getStatePublicKey(),
359
374
  admin: this.wallet.publicKey,
@@ -361,6 +376,8 @@ export class AdminClient extends DriftClient {
361
376
  perpMarket: perpMarketPublicKey,
362
377
  },
363
378
  });
379
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
380
+ return txSig;
364
381
  }
365
382
 
366
383
  public async updatePerpMarketAmmOracleTwap(
@@ -408,30 +425,39 @@ export class AdminClient extends DriftClient {
408
425
  ): Promise<TransactionSignature> {
409
426
  const spotMarket = this.getQuoteSpotMarketAccount();
410
427
 
411
- return await this.program.rpc.depositIntoPerpMarketFeePool(amount, {
412
- accounts: {
413
- admin: this.wallet.publicKey,
414
- state: await this.getStatePublicKey(),
415
- perpMarket: await getPerpMarketPublicKey(
416
- this.program.programId,
417
- perpMarketIndex
418
- ),
419
- sourceVault,
420
- driftSigner: this.getSignerPublicKey(),
421
- quoteSpotMarket: spotMarket.pubkey,
422
- spotMarketVault: spotMarket.vault,
423
- tokenProgram: TOKEN_PROGRAM_ID,
424
- },
425
- });
428
+ const tx = await this.program.transaction.depositIntoPerpMarketFeePool(
429
+ amount,
430
+ {
431
+ accounts: {
432
+ admin: this.wallet.publicKey,
433
+ state: await this.getStatePublicKey(),
434
+ perpMarket: await getPerpMarketPublicKey(
435
+ this.program.programId,
436
+ perpMarketIndex
437
+ ),
438
+ sourceVault,
439
+ driftSigner: this.getSignerPublicKey(),
440
+ quoteSpotMarket: spotMarket.pubkey,
441
+ spotMarketVault: spotMarket.vault,
442
+ tokenProgram: TOKEN_PROGRAM_ID,
443
+ },
444
+ }
445
+ );
446
+
447
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
448
+ return txSig;
426
449
  }
427
450
 
428
451
  public async updateAdmin(admin: PublicKey): Promise<TransactionSignature> {
429
- return await this.program.rpc.updateAdmin(admin, {
452
+ const tx = await this.program.transaction.updateAdmin(admin, {
430
453
  accounts: {
431
454
  admin: this.wallet.publicKey,
432
455
  state: await this.getStatePublicKey(),
433
456
  },
434
457
  });
458
+
459
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
460
+ return txSig;
435
461
  }
436
462
 
437
463
  public async updatePerpMarketCurveUpdateIntensity(
@@ -461,7 +487,7 @@ export class AdminClient extends DriftClient {
461
487
  marginRatioInitial: number,
462
488
  marginRatioMaintenance: number
463
489
  ): Promise<TransactionSignature> {
464
- return await this.program.rpc.updatePerpMarketMarginRatio(
490
+ const tx = await this.program.transaction.updatePerpMarketMarginRatio(
465
491
  marginRatioInitial,
466
492
  marginRatioMaintenance,
467
493
  {
@@ -475,6 +501,9 @@ export class AdminClient extends DriftClient {
475
501
  },
476
502
  }
477
503
  );
504
+
505
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
506
+ return txSig;
478
507
  }
479
508
 
480
509
  public async updatePerpMarketImfFactor(
@@ -502,32 +531,44 @@ export class AdminClient extends DriftClient {
502
531
  perpMarketIndex: number,
503
532
  baseSpread: number
504
533
  ): Promise<TransactionSignature> {
505
- return await this.program.rpc.updatePerpMarketBaseSpread(baseSpread, {
506
- accounts: {
507
- admin: this.wallet.publicKey,
508
- state: await this.getStatePublicKey(),
509
- perpMarket: await getPerpMarketPublicKey(
510
- this.program.programId,
511
- perpMarketIndex
512
- ),
513
- },
514
- });
534
+ const tx = await this.program.transaction.updatePerpMarketBaseSpread(
535
+ baseSpread,
536
+ {
537
+ accounts: {
538
+ admin: this.wallet.publicKey,
539
+ state: await this.getStatePublicKey(),
540
+ perpMarket: await getPerpMarketPublicKey(
541
+ this.program.programId,
542
+ perpMarketIndex
543
+ ),
544
+ },
545
+ }
546
+ );
547
+
548
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
549
+ return txSig;
515
550
  }
516
551
 
517
552
  public async updateAmmJitIntensity(
518
553
  perpMarketIndex: number,
519
554
  ammJitIntensity: number
520
555
  ): Promise<TransactionSignature> {
521
- return await this.program.rpc.updateAmmJitIntensity(ammJitIntensity, {
522
- accounts: {
523
- admin: this.wallet.publicKey,
524
- state: await this.getStatePublicKey(),
525
- perpMarket: await getPerpMarketPublicKey(
526
- this.program.programId,
527
- perpMarketIndex
528
- ),
529
- },
530
- });
556
+ const tx = await this.program.transaction.updateAmmJitIntensity(
557
+ ammJitIntensity,
558
+ {
559
+ accounts: {
560
+ admin: this.wallet.publicKey,
561
+ state: await this.getStatePublicKey(),
562
+ perpMarket: await getPerpMarketPublicKey(
563
+ this.program.programId,
564
+ perpMarketIndex
565
+ ),
566
+ },
567
+ }
568
+ );
569
+
570
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
571
+ return txSig;
531
572
  }
532
573
 
533
574
  public async updatePerpMarketName(
@@ -536,7 +577,7 @@ export class AdminClient extends DriftClient {
536
577
  ): Promise<TransactionSignature> {
537
578
  const nameBuffer = encodeName(name);
538
579
 
539
- return await this.program.rpc.updatePerpMarketName(nameBuffer, {
580
+ const tx = await this.program.transaction.updatePerpMarketName(nameBuffer, {
540
581
  accounts: {
541
582
  admin: this.wallet.publicKey,
542
583
  state: await this.getStatePublicKey(),
@@ -546,6 +587,9 @@ export class AdminClient extends DriftClient {
546
587
  ),
547
588
  },
548
589
  });
590
+
591
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
592
+ return txSig;
549
593
  }
550
594
 
551
595
  public async updateSpotMarketName(
@@ -587,23 +631,32 @@ export class AdminClient extends DriftClient {
587
631
  public async updatePerpFeeStructure(
588
632
  feeStructure: FeeStructure
589
633
  ): Promise<TransactionSignature> {
590
- return await this.program.rpc.updatePerpFeeStructure(feeStructure, {
634
+ const tx = this.program.transaction.updatePerpFeeStructure(feeStructure, {
591
635
  accounts: {
592
636
  admin: this.wallet.publicKey,
593
637
  state: await this.getStatePublicKey(),
594
638
  },
595
639
  });
640
+
641
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
642
+ return txSig;
596
643
  }
597
644
 
598
645
  public async updateSpotFeeStructure(
599
646
  feeStructure: FeeStructure
600
647
  ): Promise<TransactionSignature> {
601
- return await this.program.rpc.updateSpotFeeStructure(feeStructure, {
602
- accounts: {
603
- admin: this.wallet.publicKey,
604
- state: await this.getStatePublicKey(),
605
- },
606
- });
648
+ const tx = await this.program.transaction.updateSpotFeeStructure(
649
+ feeStructure,
650
+ {
651
+ accounts: {
652
+ admin: this.wallet.publicKey,
653
+ state: await this.getStatePublicKey(),
654
+ },
655
+ }
656
+ );
657
+
658
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
659
+ return txSig;
607
660
  }
608
661
 
609
662
  public async updateInitialPctToLiquidate(
@@ -637,12 +690,18 @@ export class AdminClient extends DriftClient {
637
690
  public async updateOracleGuardRails(
638
691
  oracleGuardRails: OracleGuardRails
639
692
  ): Promise<TransactionSignature> {
640
- return await this.program.rpc.updateOracleGuardRails(oracleGuardRails, {
641
- accounts: {
642
- admin: this.wallet.publicKey,
643
- state: await this.getStatePublicKey(),
644
- },
645
- });
693
+ const tx = await this.program.transaction.updateOracleGuardRails(
694
+ oracleGuardRails,
695
+ {
696
+ accounts: {
697
+ admin: this.wallet.publicKey,
698
+ state: await this.getStatePublicKey(),
699
+ },
700
+ }
701
+ );
702
+
703
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
704
+ return txSig;
646
705
  }
647
706
 
648
707
  public async updateStateSettlementDuration(
@@ -663,7 +722,7 @@ export class AdminClient extends DriftClient {
663
722
  spotMarketIndex: number,
664
723
  withdrawGuardThreshold: BN
665
724
  ): Promise<TransactionSignature> {
666
- return await this.program.rpc.updateWithdrawGuardThreshold(
725
+ const tx = await this.program.transaction.updateWithdrawGuardThreshold(
667
726
  withdrawGuardThreshold,
668
727
  {
669
728
  accounts: {
@@ -676,6 +735,9 @@ export class AdminClient extends DriftClient {
676
735
  },
677
736
  }
678
737
  );
738
+
739
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
740
+ return txSig;
679
741
  }
680
742
 
681
743
  public async updateSpotMarketIfFactor(
@@ -683,7 +745,7 @@ export class AdminClient extends DriftClient {
683
745
  userIfFactor: BN,
684
746
  totalIfFactor: BN
685
747
  ): Promise<TransactionSignature> {
686
- return await this.program.rpc.updateSpotMarketIfFactor(
748
+ const tx = await this.program.transaction.updateSpotMarketIfFactor(
687
749
  spotMarketIndex,
688
750
  userIfFactor,
689
751
  totalIfFactor,
@@ -698,32 +760,39 @@ export class AdminClient extends DriftClient {
698
760
  },
699
761
  }
700
762
  );
763
+
764
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
765
+ return txSig;
701
766
  }
702
767
 
703
768
  public async updateSpotMarketRevenueSettlePeriod(
704
769
  spotMarketIndex: number,
705
770
  revenueSettlePeriod: BN
706
771
  ): Promise<TransactionSignature> {
707
- return await this.program.rpc.updateSpotMarketRevenueSettlePeriod(
708
- revenueSettlePeriod,
709
- {
710
- accounts: {
711
- admin: this.wallet.publicKey,
712
- state: await this.getStatePublicKey(),
713
- spotMarket: await getSpotMarketPublicKey(
714
- this.program.programId,
715
- spotMarketIndex
716
- ),
717
- },
718
- }
719
- );
772
+ const tx =
773
+ await this.program.transaction.updateSpotMarketRevenueSettlePeriod(
774
+ revenueSettlePeriod,
775
+ {
776
+ accounts: {
777
+ admin: this.wallet.publicKey,
778
+ state: await this.getStatePublicKey(),
779
+ spotMarket: await getSpotMarketPublicKey(
780
+ this.program.programId,
781
+ spotMarketIndex
782
+ ),
783
+ },
784
+ }
785
+ );
786
+
787
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
788
+ return txSig;
720
789
  }
721
790
 
722
791
  public async updateSpotMarketMaxTokenDeposits(
723
792
  spotMarketIndex: number,
724
793
  maxTokenDeposits: BN
725
794
  ): Promise<TransactionSignature> {
726
- return await this.program.rpc.updateSpotMarketMaxTokenDeposits(
795
+ const tx = this.program.transaction.updateSpotMarketMaxTokenDeposits(
727
796
  maxTokenDeposits,
728
797
  {
729
798
  accounts: {
@@ -736,36 +805,49 @@ export class AdminClient extends DriftClient {
736
805
  },
737
806
  }
738
807
  );
808
+
809
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
810
+ return txSig;
739
811
  }
740
812
 
741
813
  public async updateInsuranceFundUnstakingPeriod(
742
814
  spotMarketIndex: number,
743
815
  insuranceWithdrawEscrowPeriod: BN
744
816
  ): Promise<TransactionSignature> {
745
- return await this.program.rpc.updateInsuranceFundUnstakingPeriod(
746
- insuranceWithdrawEscrowPeriod,
817
+ const tx =
818
+ await this.program.transaction.updateInsuranceFundUnstakingPeriod(
819
+ insuranceWithdrawEscrowPeriod,
820
+ {
821
+ accounts: {
822
+ admin: this.wallet.publicKey,
823
+ state: await this.getStatePublicKey(),
824
+ spotMarket: await getSpotMarketPublicKey(
825
+ this.program.programId,
826
+ spotMarketIndex
827
+ ),
828
+ },
829
+ }
830
+ );
831
+
832
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
833
+ return txSig;
834
+ }
835
+
836
+ public async updateLpCooldownTime(
837
+ cooldownTime: BN
838
+ ): Promise<TransactionSignature> {
839
+ const tx = await this.program.transaction.updateLpCooldownTime(
840
+ cooldownTime,
747
841
  {
748
842
  accounts: {
749
843
  admin: this.wallet.publicKey,
750
844
  state: await this.getStatePublicKey(),
751
- spotMarket: await getSpotMarketPublicKey(
752
- this.program.programId,
753
- spotMarketIndex
754
- ),
755
845
  },
756
846
  }
757
847
  );
758
- }
759
848
 
760
- public async updateLpCooldownTime(
761
- cooldownTime: BN
762
- ): Promise<TransactionSignature> {
763
- return await this.program.rpc.updateLpCooldownTime(cooldownTime, {
764
- accounts: {
765
- admin: this.wallet.publicKey,
766
- state: await this.getStatePublicKey(),
767
- },
768
- });
849
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
850
+ return txSig;
769
851
  }
770
852
 
771
853
  public async updatePerpMarketOracle(
@@ -773,27 +855,9 @@ export class AdminClient extends DriftClient {
773
855
  oracle: PublicKey,
774
856
  oracleSource: OracleSource
775
857
  ): Promise<TransactionSignature> {
776
- return await this.program.rpc.updatePerpMarketOracle(oracle, oracleSource, {
777
- accounts: {
778
- admin: this.wallet.publicKey,
779
- state: await this.getStatePublicKey(),
780
- perpMarket: await getPerpMarketPublicKey(
781
- this.program.programId,
782
- perpMarketIndex
783
- ),
784
- oracle: oracle,
785
- },
786
- });
787
- }
788
-
789
- public async updatePerpMarketStepSizeAndTickSize(
790
- perpMarketIndex: number,
791
- stepSize: BN,
792
- tickSize: BN
793
- ): Promise<TransactionSignature> {
794
- return await this.program.rpc.updatePerpMarketStepSizeAndTickSize(
795
- stepSize,
796
- tickSize,
858
+ const tx = await this.program.transaction.updatePerpMarketOracle(
859
+ oracle,
860
+ oracleSource,
797
861
  {
798
862
  accounts: {
799
863
  admin: this.wallet.publicKey,
@@ -802,9 +866,38 @@ export class AdminClient extends DriftClient {
802
866
  this.program.programId,
803
867
  perpMarketIndex
804
868
  ),
869
+ oracle: oracle,
805
870
  },
806
871
  }
807
872
  );
873
+
874
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
875
+ return txSig;
876
+ }
877
+
878
+ public async updatePerpMarketStepSizeAndTickSize(
879
+ perpMarketIndex: number,
880
+ stepSize: BN,
881
+ tickSize: BN
882
+ ): Promise<TransactionSignature> {
883
+ const tx =
884
+ await this.program.transaction.updatePerpMarketStepSizeAndTickSize(
885
+ stepSize,
886
+ tickSize,
887
+ {
888
+ accounts: {
889
+ admin: this.wallet.publicKey,
890
+ state: await this.getStatePublicKey(),
891
+ perpMarket: await getPerpMarketPublicKey(
892
+ this.program.programId,
893
+ perpMarketIndex
894
+ ),
895
+ },
896
+ }
897
+ );
898
+
899
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
900
+ return txSig;
808
901
  }
809
902
 
810
903
  public async updatePerpMarketMinOrderSize(
@@ -942,23 +1035,32 @@ export class AdminClient extends DriftClient {
942
1035
  public async updateWhitelistMint(
943
1036
  whitelistMint?: PublicKey
944
1037
  ): Promise<TransactionSignature> {
945
- return await this.program.rpc.updateWhitelistMint(whitelistMint, {
946
- accounts: {
947
- admin: this.wallet.publicKey,
948
- state: await this.getStatePublicKey(),
949
- },
950
- });
1038
+ const tx = await this.program.transaction.updateWhitelistMint(
1039
+ whitelistMint,
1040
+ {
1041
+ accounts: {
1042
+ admin: this.wallet.publicKey,
1043
+ state: await this.getStatePublicKey(),
1044
+ },
1045
+ }
1046
+ );
1047
+
1048
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1049
+ return txSig;
951
1050
  }
952
1051
 
953
1052
  public async updateDiscountMint(
954
1053
  discountMint: PublicKey
955
1054
  ): Promise<TransactionSignature> {
956
- return await this.program.rpc.updateDiscountMint(discountMint, {
1055
+ const tx = await this.program.transaction.updateDiscountMint(discountMint, {
957
1056
  accounts: {
958
1057
  admin: this.wallet.publicKey,
959
1058
  state: await this.getStatePublicKey(),
960
1059
  },
961
1060
  });
1061
+
1062
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1063
+ return txSig;
962
1064
  }
963
1065
 
964
1066
  public async updateSpotMarketMarginWeights(
@@ -1015,75 +1117,105 @@ export class AdminClient extends DriftClient {
1015
1117
  spotMarketIndex: number,
1016
1118
  assetTier: AssetTier
1017
1119
  ): Promise<TransactionSignature> {
1018
- return await this.program.rpc.updateSpotMarketAssetTier(assetTier, {
1019
- accounts: {
1020
- admin: this.wallet.publicKey,
1021
- state: await this.getStatePublicKey(),
1022
- spotMarket: await getSpotMarketPublicKey(
1023
- this.program.programId,
1024
- spotMarketIndex
1025
- ),
1026
- },
1027
- });
1120
+ const tx = await this.program.transaction.updateSpotMarketAssetTier(
1121
+ assetTier,
1122
+ {
1123
+ accounts: {
1124
+ admin: this.wallet.publicKey,
1125
+ state: await this.getStatePublicKey(),
1126
+ spotMarket: await getSpotMarketPublicKey(
1127
+ this.program.programId,
1128
+ spotMarketIndex
1129
+ ),
1130
+ },
1131
+ }
1132
+ );
1133
+
1134
+ const { txSig } = await this.sendTransaction(tx);
1135
+ return txSig;
1028
1136
  }
1029
1137
 
1030
1138
  public async updateSpotMarketStatus(
1031
1139
  spotMarketIndex: number,
1032
1140
  marketStatus: MarketStatus
1033
1141
  ): Promise<TransactionSignature> {
1034
- return await this.program.rpc.updateSpotMarketStatus(marketStatus, {
1035
- accounts: {
1036
- admin: this.wallet.publicKey,
1037
- state: await this.getStatePublicKey(),
1038
- spotMarket: await getSpotMarketPublicKey(
1039
- this.program.programId,
1040
- spotMarketIndex
1041
- ),
1042
- },
1043
- });
1142
+ const tx = await this.program.transaction.updateSpotMarketStatus(
1143
+ marketStatus,
1144
+ {
1145
+ accounts: {
1146
+ admin: this.wallet.publicKey,
1147
+ state: await this.getStatePublicKey(),
1148
+ spotMarket: await getSpotMarketPublicKey(
1149
+ this.program.programId,
1150
+ spotMarketIndex
1151
+ ),
1152
+ },
1153
+ }
1154
+ );
1155
+
1156
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1157
+ return txSig;
1044
1158
  }
1045
1159
 
1046
1160
  public async updatePerpMarketStatus(
1047
1161
  perpMarketIndex: number,
1048
1162
  marketStatus: MarketStatus
1049
1163
  ): Promise<TransactionSignature> {
1050
- return await this.program.rpc.updatePerpMarketStatus(marketStatus, {
1051
- accounts: {
1052
- admin: this.wallet.publicKey,
1053
- state: await this.getStatePublicKey(),
1054
- perpMarket: await getPerpMarketPublicKey(
1055
- this.program.programId,
1056
- perpMarketIndex
1057
- ),
1058
- },
1059
- });
1164
+ const tx = await this.program.transaction.updatePerpMarketStatus(
1165
+ marketStatus,
1166
+ {
1167
+ accounts: {
1168
+ admin: this.wallet.publicKey,
1169
+ state: await this.getStatePublicKey(),
1170
+ perpMarket: await getPerpMarketPublicKey(
1171
+ this.program.programId,
1172
+ perpMarketIndex
1173
+ ),
1174
+ },
1175
+ }
1176
+ );
1177
+
1178
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1179
+ return txSig;
1060
1180
  }
1061
1181
 
1062
1182
  public async updatePerpMarketContractTier(
1063
1183
  perpMarketIndex: number,
1064
1184
  contractTier: ContractTier
1065
1185
  ): Promise<TransactionSignature> {
1066
- return await this.program.rpc.updatePerpMarketContractTier(contractTier, {
1067
- accounts: {
1068
- admin: this.wallet.publicKey,
1069
- state: await this.getStatePublicKey(),
1070
- perpMarket: await getPerpMarketPublicKey(
1071
- this.program.programId,
1072
- perpMarketIndex
1073
- ),
1074
- },
1075
- });
1186
+ const tx = await this.program.transaction.updatePerpMarketContractTier(
1187
+ contractTier,
1188
+ {
1189
+ accounts: {
1190
+ admin: this.wallet.publicKey,
1191
+ state: await this.getStatePublicKey(),
1192
+ perpMarket: await getPerpMarketPublicKey(
1193
+ this.program.programId,
1194
+ perpMarketIndex
1195
+ ),
1196
+ },
1197
+ }
1198
+ );
1199
+
1200
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1201
+ return txSig;
1076
1202
  }
1077
1203
 
1078
1204
  public async updateExchangeStatus(
1079
1205
  exchangeStatus: ExchangeStatus
1080
1206
  ): Promise<TransactionSignature> {
1081
- return await this.program.rpc.updateExchangeStatus(exchangeStatus, {
1082
- accounts: {
1083
- admin: this.wallet.publicKey,
1084
- state: await this.getStatePublicKey(),
1085
- },
1086
- });
1207
+ const tx = await this.program.transaction.updateExchangeStatus(
1208
+ exchangeStatus,
1209
+ {
1210
+ accounts: {
1211
+ admin: this.wallet.publicKey,
1212
+ state: await this.getStatePublicKey(),
1213
+ },
1214
+ }
1215
+ );
1216
+
1217
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1218
+ return txSig;
1087
1219
  }
1088
1220
 
1089
1221
  public async updatePerpAuctionDuration(