@drift-labs/sdk 2.73.0-beta.1 → 2.74.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/lib/adminClient.js +106 -26
- package/lib/idl/drift.json +1 -1
- package/package.json +1 -1
- package/src/adminClient.ts +488 -279
- package/src/idl/drift.json +1 -1
package/src/adminClient.ts
CHANGED
|
@@ -406,19 +406,26 @@ export class AdminClient extends DriftClient {
|
|
|
406
406
|
perpMarketIndex: number,
|
|
407
407
|
concentrationScale: BN
|
|
408
408
|
): Promise<TransactionSignature> {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
409
|
+
const updatePerpMarketConcentrationCoefIx =
|
|
410
|
+
await this.program.instruction.updatePerpMarketConcentrationCoef(
|
|
411
|
+
concentrationScale,
|
|
412
|
+
{
|
|
413
|
+
accounts: {
|
|
414
|
+
state: await this.getStatePublicKey(),
|
|
415
|
+
admin: this.wallet.publicKey,
|
|
416
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
417
|
+
this.program.programId,
|
|
418
|
+
perpMarketIndex
|
|
419
|
+
),
|
|
420
|
+
},
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
const tx = await this.buildTransaction(updatePerpMarketConcentrationCoefIx);
|
|
425
|
+
|
|
426
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
427
|
+
|
|
428
|
+
return txSig;
|
|
422
429
|
}
|
|
423
430
|
|
|
424
431
|
public async moveAmmToPrice(
|
|
@@ -506,14 +513,21 @@ export class AdminClient extends DriftClient {
|
|
|
506
513
|
perpMarketIndex
|
|
507
514
|
);
|
|
508
515
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
516
|
+
const updatePerpMarketAmmOracleTwapIx =
|
|
517
|
+
await this.program.instruction.updatePerpMarketAmmOracleTwap({
|
|
518
|
+
accounts: {
|
|
519
|
+
state: await this.getStatePublicKey(),
|
|
520
|
+
admin: this.wallet.publicKey,
|
|
521
|
+
oracle: ammData.oracle,
|
|
522
|
+
perpMarket: perpMarketPublicKey,
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
const tx = await this.buildTransaction(updatePerpMarketAmmOracleTwapIx);
|
|
527
|
+
|
|
528
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
529
|
+
|
|
530
|
+
return txSig;
|
|
517
531
|
}
|
|
518
532
|
|
|
519
533
|
public async resetPerpMarketAmmOracleTwap(
|
|
@@ -525,14 +539,21 @@ export class AdminClient extends DriftClient {
|
|
|
525
539
|
perpMarketIndex
|
|
526
540
|
);
|
|
527
541
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
542
|
+
const resetPerpMarketAmmOracleTwapIx =
|
|
543
|
+
await this.program.instruction.resetPerpMarketAmmOracleTwap({
|
|
544
|
+
accounts: {
|
|
545
|
+
state: await this.getStatePublicKey(),
|
|
546
|
+
admin: this.wallet.publicKey,
|
|
547
|
+
oracle: ammData.oracle,
|
|
548
|
+
perpMarket: perpMarketPublicKey,
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
const tx = await this.buildTransaction(resetPerpMarketAmmOracleTwapIx);
|
|
553
|
+
|
|
554
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
555
|
+
|
|
556
|
+
return txSig;
|
|
536
557
|
}
|
|
537
558
|
|
|
538
559
|
public async depositIntoPerpMarketFeePool(
|
|
@@ -588,38 +609,56 @@ export class AdminClient extends DriftClient {
|
|
|
588
609
|
// assert(curveUpdateIntensity >= 0 && curveUpdateIntensity <= 100);
|
|
589
610
|
// assert(Number.isInteger(curveUpdateIntensity));
|
|
590
611
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
612
|
+
const updatePerpMarketCurveUpdateIntensityIx =
|
|
613
|
+
await this.program.instruction.updatePerpMarketCurveUpdateIntensity(
|
|
614
|
+
curveUpdateIntensity,
|
|
615
|
+
{
|
|
616
|
+
accounts: {
|
|
617
|
+
admin: this.wallet.publicKey,
|
|
618
|
+
state: await this.getStatePublicKey(),
|
|
619
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
620
|
+
this.program.programId,
|
|
621
|
+
perpMarketIndex
|
|
622
|
+
),
|
|
623
|
+
},
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
|
|
627
|
+
const tx = await this.buildTransaction(
|
|
628
|
+
updatePerpMarketCurveUpdateIntensityIx
|
|
603
629
|
);
|
|
630
|
+
|
|
631
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
632
|
+
|
|
633
|
+
return txSig;
|
|
604
634
|
}
|
|
605
635
|
|
|
606
636
|
public async updatePerpMarketTargetBaseAssetAmountPerLp(
|
|
607
637
|
perpMarketIndex: number,
|
|
608
638
|
targetBaseAssetAmountPerLP: number
|
|
609
639
|
): Promise<TransactionSignature> {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
640
|
+
const updatePerpMarketTargetBaseAssetAmountPerLpIx =
|
|
641
|
+
await this.program.instruction.updatePerpMarketTargetBaseAssetAmountPerLp(
|
|
642
|
+
targetBaseAssetAmountPerLP,
|
|
643
|
+
{
|
|
644
|
+
accounts: {
|
|
645
|
+
admin: this.wallet.publicKey,
|
|
646
|
+
state: await this.getStatePublicKey(),
|
|
647
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
648
|
+
this.program.programId,
|
|
649
|
+
perpMarketIndex
|
|
650
|
+
),
|
|
651
|
+
},
|
|
652
|
+
}
|
|
653
|
+
);
|
|
654
|
+
|
|
655
|
+
const tx = await this.buildTransaction(
|
|
656
|
+
updatePerpMarketTargetBaseAssetAmountPerLpIx
|
|
622
657
|
);
|
|
658
|
+
|
|
659
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
660
|
+
|
|
661
|
+
return txSig;
|
|
623
662
|
}
|
|
624
663
|
|
|
625
664
|
public async updatePerpMarketMarginRatio(
|
|
@@ -655,20 +694,27 @@ export class AdminClient extends DriftClient {
|
|
|
655
694
|
imfFactor: number,
|
|
656
695
|
unrealizedPnlImfFactor: number
|
|
657
696
|
): Promise<TransactionSignature> {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
697
|
+
const updatePerpMarketImfFactorIx =
|
|
698
|
+
await this.program.instruction.updatePerpMarketImfFactor(
|
|
699
|
+
imfFactor,
|
|
700
|
+
unrealizedPnlImfFactor,
|
|
701
|
+
{
|
|
702
|
+
accounts: {
|
|
703
|
+
admin: this.wallet.publicKey,
|
|
704
|
+
state: await this.getStatePublicKey(),
|
|
705
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
706
|
+
this.program.programId,
|
|
707
|
+
perpMarketIndex
|
|
708
|
+
),
|
|
709
|
+
},
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
|
|
713
|
+
const tx = await this.buildTransaction(updatePerpMarketImfFactorIx);
|
|
714
|
+
|
|
715
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
716
|
+
|
|
717
|
+
return txSig;
|
|
672
718
|
}
|
|
673
719
|
|
|
674
720
|
public async updatePerpMarketBaseSpread(
|
|
@@ -748,16 +794,23 @@ export class AdminClient extends DriftClient {
|
|
|
748
794
|
): Promise<TransactionSignature> {
|
|
749
795
|
const nameBuffer = encodeName(name);
|
|
750
796
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
797
|
+
const updateSpotMarketNameIx =
|
|
798
|
+
await this.program.instruction.updateSpotMarketName(nameBuffer, {
|
|
799
|
+
accounts: {
|
|
800
|
+
admin: this.wallet.publicKey,
|
|
801
|
+
state: await this.getStatePublicKey(),
|
|
802
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
803
|
+
this.program.programId,
|
|
804
|
+
spotMarketIndex
|
|
805
|
+
),
|
|
806
|
+
},
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
const tx = await this.buildTransaction(updateSpotMarketNameIx);
|
|
810
|
+
|
|
811
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
812
|
+
|
|
813
|
+
return txSig;
|
|
761
814
|
}
|
|
762
815
|
|
|
763
816
|
public async updatePerpMarketPerLpBase(
|
|
@@ -769,13 +822,20 @@ export class AdminClient extends DriftClient {
|
|
|
769
822
|
perpMarketIndex
|
|
770
823
|
);
|
|
771
824
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
825
|
+
const updatePerpMarketPerLpBaseIx =
|
|
826
|
+
await this.program.instruction.updatePerpMarketPerLpBase(perLpBase, {
|
|
827
|
+
accounts: {
|
|
828
|
+
admin: this.wallet.publicKey,
|
|
829
|
+
state: await this.getStatePublicKey(),
|
|
830
|
+
perpMarket: perpMarketPublicKey,
|
|
831
|
+
},
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
const tx = await this.buildTransaction(updatePerpMarketPerLpBaseIx);
|
|
835
|
+
|
|
836
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
837
|
+
|
|
838
|
+
return txSig;
|
|
779
839
|
}
|
|
780
840
|
|
|
781
841
|
public async updatePerpMarketMaxSpread(
|
|
@@ -787,13 +847,20 @@ export class AdminClient extends DriftClient {
|
|
|
787
847
|
perpMarketIndex
|
|
788
848
|
);
|
|
789
849
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
850
|
+
const updatePerpMarketMaxSpreadIx =
|
|
851
|
+
await this.program.instruction.updatePerpMarketMaxSpread(maxSpread, {
|
|
852
|
+
accounts: {
|
|
853
|
+
admin: this.wallet.publicKey,
|
|
854
|
+
state: await this.getStatePublicKey(),
|
|
855
|
+
perpMarket: perpMarketPublicKey,
|
|
856
|
+
},
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
const tx = await this.buildTransaction(updatePerpMarketMaxSpreadIx);
|
|
860
|
+
|
|
861
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
862
|
+
|
|
863
|
+
return txSig;
|
|
797
864
|
}
|
|
798
865
|
|
|
799
866
|
public async updatePerpFeeStructure(
|
|
@@ -835,43 +902,66 @@ export class AdminClient extends DriftClient {
|
|
|
835
902
|
public async updateInitialPctToLiquidate(
|
|
836
903
|
initialPctToLiquidate: number
|
|
837
904
|
): Promise<TransactionSignature> {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
905
|
+
const updateInitialPctToLiquidateIx =
|
|
906
|
+
await this.program.instruction.updateInitialPctToLiquidate(
|
|
907
|
+
initialPctToLiquidate,
|
|
908
|
+
{
|
|
909
|
+
accounts: {
|
|
910
|
+
admin: this.wallet.publicKey,
|
|
911
|
+
state: await this.getStatePublicKey(),
|
|
912
|
+
},
|
|
913
|
+
}
|
|
914
|
+
);
|
|
915
|
+
|
|
916
|
+
const tx = await this.buildTransaction(updateInitialPctToLiquidateIx);
|
|
917
|
+
|
|
918
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
919
|
+
|
|
920
|
+
return txSig;
|
|
847
921
|
}
|
|
848
922
|
|
|
849
923
|
public async updateLiquidationDuration(
|
|
850
924
|
liquidationDuration: number
|
|
851
925
|
): Promise<TransactionSignature> {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
926
|
+
const updateLiquidationDurationIx =
|
|
927
|
+
await this.program.instruction.updateLiquidationDuration(
|
|
928
|
+
liquidationDuration,
|
|
929
|
+
{
|
|
930
|
+
accounts: {
|
|
931
|
+
admin: this.wallet.publicKey,
|
|
932
|
+
state: await this.getStatePublicKey(),
|
|
933
|
+
},
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
|
|
937
|
+
const tx = await this.buildTransaction(updateLiquidationDurationIx);
|
|
938
|
+
|
|
939
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
940
|
+
|
|
941
|
+
return txSig;
|
|
861
942
|
}
|
|
862
943
|
|
|
863
944
|
public async updateLiquidationMarginBufferRatio(
|
|
864
945
|
updateLiquidationMarginBufferRatio: number
|
|
865
946
|
): Promise<TransactionSignature> {
|
|
866
|
-
|
|
867
|
-
updateLiquidationMarginBufferRatio
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
947
|
+
const updateLiquidationMarginBufferRatioIx =
|
|
948
|
+
await this.program.instruction.updateLiquidationMarginBufferRatio(
|
|
949
|
+
updateLiquidationMarginBufferRatio,
|
|
950
|
+
{
|
|
951
|
+
accounts: {
|
|
952
|
+
admin: this.wallet.publicKey,
|
|
953
|
+
state: await this.getStatePublicKey(),
|
|
954
|
+
},
|
|
955
|
+
}
|
|
956
|
+
);
|
|
957
|
+
|
|
958
|
+
const tx = await this.buildTransaction(
|
|
959
|
+
updateLiquidationMarginBufferRatioIx
|
|
874
960
|
);
|
|
961
|
+
|
|
962
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
963
|
+
|
|
964
|
+
return txSig;
|
|
875
965
|
}
|
|
876
966
|
|
|
877
967
|
public async updateOracleGuardRails(
|
|
@@ -895,43 +985,64 @@ export class AdminClient extends DriftClient {
|
|
|
895
985
|
public async updateStateSettlementDuration(
|
|
896
986
|
settlementDuration: number
|
|
897
987
|
): Promise<TransactionSignature> {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
988
|
+
const updateStateSettlementDurationIx =
|
|
989
|
+
await this.program.instruction.updateStateSettlementDuration(
|
|
990
|
+
settlementDuration,
|
|
991
|
+
{
|
|
992
|
+
accounts: {
|
|
993
|
+
admin: this.wallet.publicKey,
|
|
994
|
+
state: await this.getStatePublicKey(),
|
|
995
|
+
},
|
|
996
|
+
}
|
|
997
|
+
);
|
|
998
|
+
|
|
999
|
+
const tx = await this.buildTransaction(updateStateSettlementDurationIx);
|
|
1000
|
+
|
|
1001
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1002
|
+
|
|
1003
|
+
return txSig;
|
|
907
1004
|
}
|
|
908
1005
|
|
|
909
1006
|
public async updateStateMaxNumberOfSubAccounts(
|
|
910
1007
|
maxNumberOfSubAccounts: number
|
|
911
1008
|
): Promise<TransactionSignature> {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1009
|
+
const updateStateMaxNumberOfSubAccountsIx =
|
|
1010
|
+
await this.program.instruction.updateStateMaxNumberOfSubAccounts(
|
|
1011
|
+
maxNumberOfSubAccounts,
|
|
1012
|
+
{
|
|
1013
|
+
accounts: {
|
|
1014
|
+
admin: this.wallet.publicKey,
|
|
1015
|
+
state: await this.getStatePublicKey(),
|
|
1016
|
+
},
|
|
1017
|
+
}
|
|
1018
|
+
);
|
|
1019
|
+
|
|
1020
|
+
const tx = await this.buildTransaction(updateStateMaxNumberOfSubAccountsIx);
|
|
1021
|
+
|
|
1022
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1023
|
+
|
|
1024
|
+
return txSig;
|
|
921
1025
|
}
|
|
922
1026
|
|
|
923
1027
|
public async updateStateMaxInitializeUserFee(
|
|
924
1028
|
maxInitializeUserFee: number
|
|
925
1029
|
): Promise<TransactionSignature> {
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1030
|
+
const updateStateMaxInitializeUserFeeIx =
|
|
1031
|
+
await this.program.instruction.updateStateMaxInitializeUserFee(
|
|
1032
|
+
maxInitializeUserFee,
|
|
1033
|
+
{
|
|
1034
|
+
accounts: {
|
|
1035
|
+
admin: this.wallet.publicKey,
|
|
1036
|
+
state: await this.getStatePublicKey(),
|
|
1037
|
+
},
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
|
|
1041
|
+
const tx = await this.buildTransaction(updateStateMaxInitializeUserFeeIx);
|
|
1042
|
+
|
|
1043
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1044
|
+
|
|
1045
|
+
return txSig;
|
|
935
1046
|
}
|
|
936
1047
|
|
|
937
1048
|
public async updateWithdrawGuardThreshold(
|
|
@@ -1139,36 +1250,89 @@ export class AdminClient extends DriftClient {
|
|
|
1139
1250
|
}
|
|
1140
1251
|
);
|
|
1141
1252
|
|
|
1142
|
-
const tx = await this.buildTransaction(updatePerpMarketOracleIx);
|
|
1253
|
+
const tx = await this.buildTransaction(updatePerpMarketOracleIx);
|
|
1254
|
+
|
|
1255
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1256
|
+
|
|
1257
|
+
return txSig;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
public async updatePerpMarketStepSizeAndTickSize(
|
|
1261
|
+
perpMarketIndex: number,
|
|
1262
|
+
stepSize: BN,
|
|
1263
|
+
tickSize: BN
|
|
1264
|
+
): Promise<TransactionSignature> {
|
|
1265
|
+
const updatePerpMarketStepSizeAndTickSizeIx =
|
|
1266
|
+
await this.program.instruction.updatePerpMarketStepSizeAndTickSize(
|
|
1267
|
+
stepSize,
|
|
1268
|
+
tickSize,
|
|
1269
|
+
{
|
|
1270
|
+
accounts: {
|
|
1271
|
+
admin: this.wallet.publicKey,
|
|
1272
|
+
state: await this.getStatePublicKey(),
|
|
1273
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
1274
|
+
this.program.programId,
|
|
1275
|
+
perpMarketIndex
|
|
1276
|
+
),
|
|
1277
|
+
},
|
|
1278
|
+
}
|
|
1279
|
+
);
|
|
1280
|
+
|
|
1281
|
+
const tx = await this.buildTransaction(
|
|
1282
|
+
updatePerpMarketStepSizeAndTickSizeIx
|
|
1283
|
+
);
|
|
1284
|
+
|
|
1285
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1286
|
+
|
|
1287
|
+
return txSig;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
public async updatePerpMarketMinOrderSize(
|
|
1291
|
+
perpMarketIndex: number,
|
|
1292
|
+
orderSize: BN
|
|
1293
|
+
): Promise<TransactionSignature> {
|
|
1294
|
+
const updatePerpMarketMinOrderSizeIx =
|
|
1295
|
+
await this.program.instruction.updatePerpMarketMinOrderSize(orderSize, {
|
|
1296
|
+
accounts: {
|
|
1297
|
+
admin: this.wallet.publicKey,
|
|
1298
|
+
state: await this.getStatePublicKey(),
|
|
1299
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
1300
|
+
this.program.programId,
|
|
1301
|
+
perpMarketIndex
|
|
1302
|
+
),
|
|
1303
|
+
},
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
const tx = await this.buildTransaction(updatePerpMarketMinOrderSizeIx);
|
|
1143
1307
|
|
|
1144
1308
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1145
1309
|
|
|
1146
1310
|
return txSig;
|
|
1147
1311
|
}
|
|
1148
1312
|
|
|
1149
|
-
public async
|
|
1150
|
-
|
|
1313
|
+
public async updateSpotMarketStepSizeAndTickSize(
|
|
1314
|
+
spotMarketIndex: number,
|
|
1151
1315
|
stepSize: BN,
|
|
1152
1316
|
tickSize: BN
|
|
1153
1317
|
): Promise<TransactionSignature> {
|
|
1154
|
-
const
|
|
1155
|
-
await this.program.instruction.
|
|
1318
|
+
const updateSpotMarketStepSizeAndTickSizeIx =
|
|
1319
|
+
await this.program.instruction.updateSpotMarketStepSizeAndTickSize(
|
|
1156
1320
|
stepSize,
|
|
1157
1321
|
tickSize,
|
|
1158
1322
|
{
|
|
1159
1323
|
accounts: {
|
|
1160
1324
|
admin: this.wallet.publicKey,
|
|
1161
1325
|
state: await this.getStatePublicKey(),
|
|
1162
|
-
|
|
1326
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
1163
1327
|
this.program.programId,
|
|
1164
|
-
|
|
1328
|
+
spotMarketIndex
|
|
1165
1329
|
),
|
|
1166
1330
|
},
|
|
1167
1331
|
}
|
|
1168
1332
|
);
|
|
1169
1333
|
|
|
1170
1334
|
const tx = await this.buildTransaction(
|
|
1171
|
-
|
|
1335
|
+
updateSpotMarketStepSizeAndTickSizeIx
|
|
1172
1336
|
);
|
|
1173
1337
|
|
|
1174
1338
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
@@ -1176,31 +1340,12 @@ export class AdminClient extends DriftClient {
|
|
|
1176
1340
|
return txSig;
|
|
1177
1341
|
}
|
|
1178
1342
|
|
|
1179
|
-
public async
|
|
1180
|
-
perpMarketIndex: number,
|
|
1181
|
-
orderSize: BN
|
|
1182
|
-
): Promise<TransactionSignature> {
|
|
1183
|
-
return await this.program.rpc.updatePerpMarketMinOrderSize(orderSize, {
|
|
1184
|
-
accounts: {
|
|
1185
|
-
admin: this.wallet.publicKey,
|
|
1186
|
-
state: await this.getStatePublicKey(),
|
|
1187
|
-
perpMarket: await getPerpMarketPublicKey(
|
|
1188
|
-
this.program.programId,
|
|
1189
|
-
perpMarketIndex
|
|
1190
|
-
),
|
|
1191
|
-
},
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
public async updateSpotMarketStepSizeAndTickSize(
|
|
1343
|
+
public async updateSpotMarketMinOrderSize(
|
|
1196
1344
|
spotMarketIndex: number,
|
|
1197
|
-
|
|
1198
|
-
tickSize: BN
|
|
1345
|
+
orderSize: BN
|
|
1199
1346
|
): Promise<TransactionSignature> {
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
tickSize,
|
|
1203
|
-
{
|
|
1347
|
+
const updateSpotMarketMinOrderSizeIx =
|
|
1348
|
+
await this.program.instruction.updateSpotMarketMinOrderSize(orderSize, {
|
|
1204
1349
|
accounts: {
|
|
1205
1350
|
admin: this.wallet.publicKey,
|
|
1206
1351
|
state: await this.getStatePublicKey(),
|
|
@@ -1209,40 +1354,35 @@ export class AdminClient extends DriftClient {
|
|
|
1209
1354
|
spotMarketIndex
|
|
1210
1355
|
),
|
|
1211
1356
|
},
|
|
1212
|
-
}
|
|
1213
|
-
);
|
|
1214
|
-
}
|
|
1357
|
+
});
|
|
1215
1358
|
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
return
|
|
1221
|
-
accounts: {
|
|
1222
|
-
admin: this.wallet.publicKey,
|
|
1223
|
-
state: await this.getStatePublicKey(),
|
|
1224
|
-
spotMarket: await getSpotMarketPublicKey(
|
|
1225
|
-
this.program.programId,
|
|
1226
|
-
spotMarketIndex
|
|
1227
|
-
),
|
|
1228
|
-
},
|
|
1229
|
-
});
|
|
1359
|
+
const tx = await this.buildTransaction(updateSpotMarketMinOrderSizeIx);
|
|
1360
|
+
|
|
1361
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1362
|
+
|
|
1363
|
+
return txSig;
|
|
1230
1364
|
}
|
|
1231
1365
|
|
|
1232
1366
|
public async updatePerpMarketExpiry(
|
|
1233
1367
|
perpMarketIndex: number,
|
|
1234
1368
|
expiryTs: BN
|
|
1235
1369
|
): Promise<TransactionSignature> {
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1370
|
+
const updatePerpMarketExpiryIx =
|
|
1371
|
+
await this.program.instruction.updatePerpMarketExpiry(expiryTs, {
|
|
1372
|
+
accounts: {
|
|
1373
|
+
admin: this.wallet.publicKey,
|
|
1374
|
+
state: await this.getStatePublicKey(),
|
|
1375
|
+
perpMarket: await getPerpMarketPublicKey(
|
|
1376
|
+
this.program.programId,
|
|
1377
|
+
perpMarketIndex
|
|
1378
|
+
),
|
|
1379
|
+
},
|
|
1380
|
+
});
|
|
1381
|
+
const tx = await this.buildTransaction(updatePerpMarketExpiryIx);
|
|
1382
|
+
|
|
1383
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1384
|
+
|
|
1385
|
+
return txSig;
|
|
1246
1386
|
}
|
|
1247
1387
|
|
|
1248
1388
|
public async updateSpotMarketOracle(
|
|
@@ -1250,75 +1390,124 @@ export class AdminClient extends DriftClient {
|
|
|
1250
1390
|
oracle: PublicKey,
|
|
1251
1391
|
oracleSource: OracleSource
|
|
1252
1392
|
): Promise<TransactionSignature> {
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1393
|
+
const updateSpotMarketOracleIx =
|
|
1394
|
+
await this.program.instruction.updateSpotMarketOracle(
|
|
1395
|
+
oracle,
|
|
1396
|
+
oracleSource,
|
|
1397
|
+
{
|
|
1398
|
+
accounts: {
|
|
1399
|
+
admin: this.wallet.publicKey,
|
|
1400
|
+
state: await this.getStatePublicKey(),
|
|
1401
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
1402
|
+
this.program.programId,
|
|
1403
|
+
spotMarketIndex
|
|
1404
|
+
),
|
|
1405
|
+
oracle: oracle,
|
|
1406
|
+
},
|
|
1407
|
+
}
|
|
1408
|
+
);
|
|
1409
|
+
|
|
1410
|
+
const tx = await this.buildTransaction(updateSpotMarketOracleIx);
|
|
1411
|
+
|
|
1412
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1413
|
+
|
|
1414
|
+
return txSig;
|
|
1264
1415
|
}
|
|
1265
1416
|
|
|
1266
1417
|
public async updateSpotMarketOrdersEnabled(
|
|
1267
1418
|
spotMarketIndex: number,
|
|
1268
1419
|
ordersEnabled: boolean
|
|
1269
1420
|
): Promise<TransactionSignature> {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1421
|
+
const updateSpotMarketOrdersEnabledIx =
|
|
1422
|
+
await this.program.instruction.updateSpotMarketOrdersEnabled(
|
|
1423
|
+
ordersEnabled,
|
|
1424
|
+
{
|
|
1425
|
+
accounts: {
|
|
1426
|
+
admin: this.wallet.publicKey,
|
|
1427
|
+
state: await this.getStatePublicKey(),
|
|
1428
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
1429
|
+
this.program.programId,
|
|
1430
|
+
spotMarketIndex
|
|
1431
|
+
),
|
|
1432
|
+
},
|
|
1433
|
+
}
|
|
1434
|
+
);
|
|
1435
|
+
|
|
1436
|
+
const tx = await this.buildTransaction(updateSpotMarketOrdersEnabledIx);
|
|
1437
|
+
|
|
1438
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1439
|
+
|
|
1440
|
+
return txSig;
|
|
1280
1441
|
}
|
|
1281
1442
|
|
|
1282
1443
|
public async updateSerumFulfillmentConfigStatus(
|
|
1283
1444
|
serumFulfillmentConfig: PublicKey,
|
|
1284
1445
|
status: SpotFulfillmentConfigStatus
|
|
1285
1446
|
): Promise<TransactionSignature> {
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1447
|
+
const updateSerumFulfillmentConfigStatusIx =
|
|
1448
|
+
await this.program.instruction.updateSerumFulfillmentConfigStatus(
|
|
1449
|
+
status,
|
|
1450
|
+
{
|
|
1451
|
+
accounts: {
|
|
1452
|
+
admin: this.wallet.publicKey,
|
|
1453
|
+
state: await this.getStatePublicKey(),
|
|
1454
|
+
serumFulfillmentConfig,
|
|
1455
|
+
},
|
|
1456
|
+
}
|
|
1457
|
+
);
|
|
1458
|
+
|
|
1459
|
+
const tx = await this.buildTransaction(
|
|
1460
|
+
updateSerumFulfillmentConfigStatusIx
|
|
1461
|
+
);
|
|
1462
|
+
|
|
1463
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1464
|
+
|
|
1465
|
+
return txSig;
|
|
1293
1466
|
}
|
|
1294
1467
|
|
|
1295
1468
|
public async updatePhoenixFulfillmentConfigStatus(
|
|
1296
1469
|
phoenixFulfillmentConfig: PublicKey,
|
|
1297
1470
|
status: SpotFulfillmentConfigStatus
|
|
1298
1471
|
): Promise<TransactionSignature> {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1472
|
+
const updatePhoenixFulfillmentConfigStatusIx =
|
|
1473
|
+
await this.program.instruction.phoenixFulfillmentConfigStatus(status, {
|
|
1474
|
+
accounts: {
|
|
1475
|
+
admin: this.wallet.publicKey,
|
|
1476
|
+
state: await this.getStatePublicKey(),
|
|
1477
|
+
phoenixFulfillmentConfig,
|
|
1478
|
+
},
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
const tx = await this.buildTransaction(
|
|
1482
|
+
updatePhoenixFulfillmentConfigStatusIx
|
|
1483
|
+
);
|
|
1484
|
+
|
|
1485
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1486
|
+
|
|
1487
|
+
return txSig;
|
|
1306
1488
|
}
|
|
1307
1489
|
|
|
1308
1490
|
public async updateSpotMarketExpiry(
|
|
1309
1491
|
spotMarketIndex: number,
|
|
1310
1492
|
expiryTs: BN
|
|
1311
1493
|
): Promise<TransactionSignature> {
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1494
|
+
const updateSpotMarketExpiryIx =
|
|
1495
|
+
await this.program.instruction.updateSpotMarketExpiry(expiryTs, {
|
|
1496
|
+
accounts: {
|
|
1497
|
+
admin: this.wallet.publicKey,
|
|
1498
|
+
state: await this.getStatePublicKey(),
|
|
1499
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
1500
|
+
this.program.programId,
|
|
1501
|
+
spotMarketIndex
|
|
1502
|
+
),
|
|
1503
|
+
},
|
|
1504
|
+
});
|
|
1505
|
+
|
|
1506
|
+
const tx = await this.buildTransaction(updateSpotMarketExpiryIx);
|
|
1507
|
+
|
|
1508
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1509
|
+
|
|
1510
|
+
return txSig;
|
|
1322
1511
|
}
|
|
1323
1512
|
|
|
1324
1513
|
public async updateWhitelistMint(
|
|
@@ -1365,23 +1554,30 @@ export class AdminClient extends DriftClient {
|
|
|
1365
1554
|
maintenanceLiabilityWeight: number,
|
|
1366
1555
|
imfFactor = 0
|
|
1367
1556
|
): Promise<TransactionSignature> {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1557
|
+
const updateSpotMarketMarginWeightsIx =
|
|
1558
|
+
await this.program.instruction.updateSpotMarketMarginWeights(
|
|
1559
|
+
initialAssetWeight,
|
|
1560
|
+
maintenanceAssetWeight,
|
|
1561
|
+
initialLiabilityWeight,
|
|
1562
|
+
maintenanceLiabilityWeight,
|
|
1563
|
+
imfFactor,
|
|
1564
|
+
{
|
|
1565
|
+
accounts: {
|
|
1566
|
+
admin: this.wallet.publicKey,
|
|
1567
|
+
state: await this.getStatePublicKey(),
|
|
1568
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
1569
|
+
this.program.programId,
|
|
1570
|
+
spotMarketIndex
|
|
1571
|
+
),
|
|
1572
|
+
},
|
|
1573
|
+
}
|
|
1574
|
+
);
|
|
1575
|
+
|
|
1576
|
+
const tx = await this.buildTransaction(updateSpotMarketMarginWeightsIx);
|
|
1577
|
+
|
|
1578
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1579
|
+
|
|
1580
|
+
return txSig;
|
|
1385
1581
|
}
|
|
1386
1582
|
|
|
1387
1583
|
public async updateSpotMarketBorrowRate(
|
|
@@ -1390,21 +1586,28 @@ export class AdminClient extends DriftClient {
|
|
|
1390
1586
|
optimalBorrowRate: number,
|
|
1391
1587
|
optimalMaxRate: number
|
|
1392
1588
|
): Promise<TransactionSignature> {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1589
|
+
const updateSpotMarketBorrowRateIx =
|
|
1590
|
+
await this.program.instruction.updateSpotMarketBorrowRate(
|
|
1591
|
+
optimalUtilization,
|
|
1592
|
+
optimalBorrowRate,
|
|
1593
|
+
optimalMaxRate,
|
|
1594
|
+
{
|
|
1595
|
+
accounts: {
|
|
1596
|
+
admin: this.wallet.publicKey,
|
|
1597
|
+
state: await this.getStatePublicKey(),
|
|
1598
|
+
spotMarket: await getSpotMarketPublicKey(
|
|
1599
|
+
this.program.programId,
|
|
1600
|
+
spotMarketIndex
|
|
1601
|
+
),
|
|
1602
|
+
},
|
|
1603
|
+
}
|
|
1604
|
+
);
|
|
1605
|
+
|
|
1606
|
+
const tx = await this.buildTransaction(updateSpotMarketBorrowRateIx);
|
|
1607
|
+
|
|
1608
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
1609
|
+
|
|
1610
|
+
return txSig;
|
|
1408
1611
|
}
|
|
1409
1612
|
|
|
1410
1613
|
public async updateSpotMarketAssetTier(
|
|
@@ -1945,11 +2148,17 @@ export class AdminClient extends DriftClient {
|
|
|
1945
2148
|
maxPrice: maxPrice || null,
|
|
1946
2149
|
};
|
|
1947
2150
|
|
|
2151
|
+
const perpMarketPublicKey = await getPerpMarketPublicKey(
|
|
2152
|
+
this.program.programId,
|
|
2153
|
+
perpMarketIndex
|
|
2154
|
+
);
|
|
2155
|
+
|
|
1948
2156
|
const updatePrelaunchOracleParamsIx =
|
|
1949
2157
|
await this.program.instruction.updatePrelaunchOracleParams(params, {
|
|
1950
2158
|
accounts: {
|
|
1951
2159
|
admin: this.wallet.publicKey,
|
|
1952
2160
|
state: await this.getStatePublicKey(),
|
|
2161
|
+
perpMarket: perpMarketPublicKey,
|
|
1953
2162
|
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
1954
2163
|
this.program.programId,
|
|
1955
2164
|
perpMarketIndex
|