@drift-labs/sdk 2.74.0-beta.13 → 2.74.0-beta.14
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.d.ts +9 -9
- package/lib/adminClient.js +265 -99
- package/lib/driftClient.js +3 -1
- package/lib/idl/drift.json +6 -0
- package/package.json +1 -1
- package/src/adminClient.ts +266 -110
- package/src/driftClient.ts +3 -1
- package/src/idl/drift.json +6 -0
package/src/adminClient.ts
CHANGED
|
@@ -61,7 +61,9 @@ export class AdminClient extends DriftClient {
|
|
|
61
61
|
|
|
62
62
|
const initializeIx = await this.program.instruction.initialize({
|
|
63
63
|
accounts: {
|
|
64
|
-
admin: this.
|
|
64
|
+
admin: this.isSubscribed
|
|
65
|
+
? this.getStateAccount().admin
|
|
66
|
+
: this.wallet.publicKey,
|
|
65
67
|
state: driftStatePublicKey,
|
|
66
68
|
quoteAssetMint: usdcMint,
|
|
67
69
|
rent: SYSVAR_RENT_PUBKEY,
|
|
@@ -104,7 +106,6 @@ export class AdminClient extends DriftClient {
|
|
|
104
106
|
const spotMarketIndex = this.getStateAccount().numberOfSpotMarkets;
|
|
105
107
|
|
|
106
108
|
const initializeIx = await this.getInitializeSpotMarketIx(
|
|
107
|
-
this.wallet.publicKey,
|
|
108
109
|
mint,
|
|
109
110
|
optimalUtilization,
|
|
110
111
|
optimalRate,
|
|
@@ -145,7 +146,6 @@ export class AdminClient extends DriftClient {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
public async getInitializeSpotMarketIx(
|
|
148
|
-
admin: PublicKey,
|
|
149
149
|
mint: PublicKey,
|
|
150
150
|
optimalUtilization: number,
|
|
151
151
|
optimalRate: number,
|
|
@@ -207,7 +207,9 @@ export class AdminClient extends DriftClient {
|
|
|
207
207
|
nameBuffer,
|
|
208
208
|
{
|
|
209
209
|
accounts: {
|
|
210
|
-
admin
|
|
210
|
+
admin: this.isSubscribed
|
|
211
|
+
? this.getStateAccount().admin
|
|
212
|
+
: this.wallet.publicKey,
|
|
211
213
|
state: await this.getStatePublicKey(),
|
|
212
214
|
spotMarket,
|
|
213
215
|
spotMarketVault,
|
|
@@ -231,7 +233,6 @@ export class AdminClient extends DriftClient {
|
|
|
231
233
|
serumProgram: PublicKey
|
|
232
234
|
): Promise<TransactionSignature> {
|
|
233
235
|
const initializeIx = await this.getInitializeSerumFulfillmentConfigIx(
|
|
234
|
-
this.wallet.publicKey,
|
|
235
236
|
marketIndex,
|
|
236
237
|
serumMarket,
|
|
237
238
|
serumProgram
|
|
@@ -245,7 +246,6 @@ export class AdminClient extends DriftClient {
|
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
public async getInitializeSerumFulfillmentConfigIx(
|
|
248
|
-
admin: PublicKey,
|
|
249
249
|
marketIndex: number,
|
|
250
250
|
serumMarket: PublicKey,
|
|
251
251
|
serumProgram: PublicKey
|
|
@@ -264,7 +264,9 @@ export class AdminClient extends DriftClient {
|
|
|
264
264
|
marketIndex,
|
|
265
265
|
{
|
|
266
266
|
accounts: {
|
|
267
|
-
admin
|
|
267
|
+
admin: this.isSubscribed
|
|
268
|
+
? this.getStateAccount().admin
|
|
269
|
+
: this.wallet.publicKey,
|
|
268
270
|
state: await this.getStatePublicKey(),
|
|
269
271
|
baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
|
|
270
272
|
quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
@@ -285,7 +287,6 @@ export class AdminClient extends DriftClient {
|
|
|
285
287
|
phoenixMarket: PublicKey
|
|
286
288
|
): Promise<TransactionSignature> {
|
|
287
289
|
const initializeIx = await this.getInitializePhoenixFulfillmentConfigIx(
|
|
288
|
-
this.wallet.publicKey,
|
|
289
290
|
marketIndex,
|
|
290
291
|
phoenixMarket
|
|
291
292
|
);
|
|
@@ -298,7 +299,6 @@ export class AdminClient extends DriftClient {
|
|
|
298
299
|
}
|
|
299
300
|
|
|
300
301
|
public async getInitializePhoenixFulfillmentConfigIx(
|
|
301
|
-
admin: PublicKey,
|
|
302
302
|
marketIndex: number,
|
|
303
303
|
phoenixMarket: PublicKey
|
|
304
304
|
): Promise<TransactionInstruction> {
|
|
@@ -311,7 +311,9 @@ export class AdminClient extends DriftClient {
|
|
|
311
311
|
marketIndex,
|
|
312
312
|
{
|
|
313
313
|
accounts: {
|
|
314
|
-
admin
|
|
314
|
+
admin: this.isSubscribed
|
|
315
|
+
? this.getStateAccount().admin
|
|
316
|
+
: this.wallet.publicKey,
|
|
315
317
|
state: await this.getStatePublicKey(),
|
|
316
318
|
baseSpotMarket: this.getSpotMarketAccount(marketIndex).pubkey,
|
|
317
319
|
quoteSpotMarket: this.getQuoteSpotMarketAccount().pubkey,
|
|
@@ -334,6 +336,7 @@ export class AdminClient extends DriftClient {
|
|
|
334
336
|
periodicity: BN,
|
|
335
337
|
pegMultiplier: BN = PEG_PRECISION,
|
|
336
338
|
oracleSource: OracleSource = OracleSource.PYTH,
|
|
339
|
+
contractTier: ContractTier = ContractTier.SPECULATIVE,
|
|
337
340
|
marginRatioInitial = 2000,
|
|
338
341
|
marginRatioMaintenance = 500,
|
|
339
342
|
liquidatorFee = 0,
|
|
@@ -356,7 +359,6 @@ export class AdminClient extends DriftClient {
|
|
|
356
359
|
const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
|
|
357
360
|
|
|
358
361
|
const initializeMarketIx = await this.getInitializePerpMarketIx(
|
|
359
|
-
this.wallet.publicKey,
|
|
360
362
|
marketIndex,
|
|
361
363
|
priceOracle,
|
|
362
364
|
baseAssetReserve,
|
|
@@ -364,6 +366,7 @@ export class AdminClient extends DriftClient {
|
|
|
364
366
|
periodicity,
|
|
365
367
|
pegMultiplier,
|
|
366
368
|
oracleSource,
|
|
369
|
+
contractTier,
|
|
367
370
|
marginRatioInitial,
|
|
368
371
|
marginRatioMaintenance,
|
|
369
372
|
liquidatorFee,
|
|
@@ -402,7 +405,6 @@ export class AdminClient extends DriftClient {
|
|
|
402
405
|
}
|
|
403
406
|
|
|
404
407
|
public async getInitializePerpMarketIx(
|
|
405
|
-
admin: PublicKey,
|
|
406
408
|
marketIndex: number,
|
|
407
409
|
priceOracle: PublicKey,
|
|
408
410
|
baseAssetReserve: BN,
|
|
@@ -410,6 +412,7 @@ export class AdminClient extends DriftClient {
|
|
|
410
412
|
periodicity: BN,
|
|
411
413
|
pegMultiplier: BN = PEG_PRECISION,
|
|
412
414
|
oracleSource: OracleSource = OracleSource.PYTH,
|
|
415
|
+
contractTier: ContractTier = ContractTier.SPECULATIVE,
|
|
413
416
|
marginRatioInitial = 2000,
|
|
414
417
|
marginRatioMaintenance = 500,
|
|
415
418
|
liquidatorFee = 0,
|
|
@@ -443,6 +446,7 @@ export class AdminClient extends DriftClient {
|
|
|
443
446
|
periodicity,
|
|
444
447
|
pegMultiplier,
|
|
445
448
|
oracleSource,
|
|
449
|
+
contractTier,
|
|
446
450
|
marginRatioInitial,
|
|
447
451
|
marginRatioMaintenance,
|
|
448
452
|
liquidatorFee,
|
|
@@ -464,7 +468,9 @@ export class AdminClient extends DriftClient {
|
|
|
464
468
|
{
|
|
465
469
|
accounts: {
|
|
466
470
|
state: await this.getStatePublicKey(),
|
|
467
|
-
admin
|
|
471
|
+
admin: this.isSubscribed
|
|
472
|
+
? this.getStateAccount().admin
|
|
473
|
+
: this.wallet.publicKey,
|
|
468
474
|
oracle: priceOracle,
|
|
469
475
|
perpMarket: perpMarketPublicKey,
|
|
470
476
|
rent: SYSVAR_RENT_PUBKEY,
|
|
@@ -486,7 +492,9 @@ export class AdminClient extends DriftClient {
|
|
|
486
492
|
await this.program.instruction.deleteInitializedPerpMarket(marketIndex, {
|
|
487
493
|
accounts: {
|
|
488
494
|
state: await this.getStatePublicKey(),
|
|
489
|
-
admin: this.
|
|
495
|
+
admin: this.isSubscribed
|
|
496
|
+
? this.getStateAccount().admin
|
|
497
|
+
: this.wallet.publicKey,
|
|
490
498
|
perpMarket: perpMarketPublicKey,
|
|
491
499
|
},
|
|
492
500
|
});
|
|
@@ -520,7 +528,9 @@ export class AdminClient extends DriftClient {
|
|
|
520
528
|
{
|
|
521
529
|
accounts: {
|
|
522
530
|
state: await this.getStatePublicKey(),
|
|
523
|
-
admin: this.
|
|
531
|
+
admin: this.isSubscribed
|
|
532
|
+
? this.getStateAccount().admin
|
|
533
|
+
: this.wallet.publicKey,
|
|
524
534
|
perpMarket: marketPublicKey,
|
|
525
535
|
},
|
|
526
536
|
}
|
|
@@ -540,7 +550,9 @@ export class AdminClient extends DriftClient {
|
|
|
540
550
|
const updateKIx = await this.program.instruction.updateK(sqrtK, {
|
|
541
551
|
accounts: {
|
|
542
552
|
state: await this.getStatePublicKey(),
|
|
543
|
-
admin: this.
|
|
553
|
+
admin: this.isSubscribed
|
|
554
|
+
? this.getStateAccount().admin
|
|
555
|
+
: this.wallet.publicKey,
|
|
544
556
|
perpMarket: await getPerpMarketPublicKey(
|
|
545
557
|
this.program.programId,
|
|
546
558
|
perpMarketIndex
|
|
@@ -573,7 +585,9 @@ export class AdminClient extends DriftClient {
|
|
|
573
585
|
{
|
|
574
586
|
accounts: {
|
|
575
587
|
state: await this.getStatePublicKey(),
|
|
576
|
-
admin: this.
|
|
588
|
+
admin: this.isSubscribed
|
|
589
|
+
? this.getStateAccount().admin
|
|
590
|
+
: this.wallet.publicKey,
|
|
577
591
|
perpMarket: marketPublicKey,
|
|
578
592
|
},
|
|
579
593
|
}
|
|
@@ -596,7 +610,9 @@ export class AdminClient extends DriftClient {
|
|
|
596
610
|
{
|
|
597
611
|
accounts: {
|
|
598
612
|
state: await this.getStatePublicKey(),
|
|
599
|
-
admin: this.
|
|
613
|
+
admin: this.isSubscribed
|
|
614
|
+
? this.getStateAccount().admin
|
|
615
|
+
: this.wallet.publicKey,
|
|
600
616
|
perpMarket: await getPerpMarketPublicKey(
|
|
601
617
|
this.program.programId,
|
|
602
618
|
perpMarketIndex
|
|
@@ -646,7 +662,9 @@ export class AdminClient extends DriftClient {
|
|
|
646
662
|
{
|
|
647
663
|
accounts: {
|
|
648
664
|
state: await this.getStatePublicKey(),
|
|
649
|
-
admin: this.
|
|
665
|
+
admin: this.isSubscribed
|
|
666
|
+
? this.getStateAccount().admin
|
|
667
|
+
: this.wallet.publicKey,
|
|
650
668
|
perpMarket: perpMarketPublicKey,
|
|
651
669
|
},
|
|
652
670
|
}
|
|
@@ -674,7 +692,9 @@ export class AdminClient extends DriftClient {
|
|
|
674
692
|
{
|
|
675
693
|
accounts: {
|
|
676
694
|
state: await this.getStatePublicKey(),
|
|
677
|
-
admin: this.
|
|
695
|
+
admin: this.isSubscribed
|
|
696
|
+
? this.getStateAccount().admin
|
|
697
|
+
: this.wallet.publicKey,
|
|
678
698
|
oracle: ammData.oracle,
|
|
679
699
|
perpMarket: perpMarketPublicKey,
|
|
680
700
|
},
|
|
@@ -701,7 +721,9 @@ export class AdminClient extends DriftClient {
|
|
|
701
721
|
await this.program.instruction.updatePerpMarketAmmOracleTwap({
|
|
702
722
|
accounts: {
|
|
703
723
|
state: await this.getStatePublicKey(),
|
|
704
|
-
admin: this.
|
|
724
|
+
admin: this.isSubscribed
|
|
725
|
+
? this.getStateAccount().admin
|
|
726
|
+
: this.wallet.publicKey,
|
|
705
727
|
oracle: ammData.oracle,
|
|
706
728
|
perpMarket: perpMarketPublicKey,
|
|
707
729
|
},
|
|
@@ -727,7 +749,9 @@ export class AdminClient extends DriftClient {
|
|
|
727
749
|
await this.program.instruction.resetPerpMarketAmmOracleTwap({
|
|
728
750
|
accounts: {
|
|
729
751
|
state: await this.getStatePublicKey(),
|
|
730
|
-
admin: this.
|
|
752
|
+
admin: this.isSubscribed
|
|
753
|
+
? this.getStateAccount().admin
|
|
754
|
+
: this.wallet.publicKey,
|
|
731
755
|
oracle: ammData.oracle,
|
|
732
756
|
perpMarket: perpMarketPublicKey,
|
|
733
757
|
},
|
|
@@ -750,7 +774,9 @@ export class AdminClient extends DriftClient {
|
|
|
750
774
|
const depositIntoPerpMarketFeePoolIx =
|
|
751
775
|
await this.program.instruction.depositIntoPerpMarketFeePool(amount, {
|
|
752
776
|
accounts: {
|
|
753
|
-
admin: this.
|
|
777
|
+
admin: this.isSubscribed
|
|
778
|
+
? this.getStateAccount().admin
|
|
779
|
+
: this.wallet.publicKey,
|
|
754
780
|
state: await this.getStatePublicKey(),
|
|
755
781
|
perpMarket: await getPerpMarketPublicKey(
|
|
756
782
|
this.program.programId,
|
|
@@ -774,7 +800,9 @@ export class AdminClient extends DriftClient {
|
|
|
774
800
|
public async updateAdmin(admin: PublicKey): Promise<TransactionSignature> {
|
|
775
801
|
const updateAdminIx = await this.program.instruction.updateAdmin(admin, {
|
|
776
802
|
accounts: {
|
|
777
|
-
admin: this.
|
|
803
|
+
admin: this.isSubscribed
|
|
804
|
+
? this.getStateAccount().admin
|
|
805
|
+
: this.wallet.publicKey,
|
|
778
806
|
state: await this.getStatePublicKey(),
|
|
779
807
|
},
|
|
780
808
|
});
|
|
@@ -798,7 +826,9 @@ export class AdminClient extends DriftClient {
|
|
|
798
826
|
curveUpdateIntensity,
|
|
799
827
|
{
|
|
800
828
|
accounts: {
|
|
801
|
-
admin: this.
|
|
829
|
+
admin: this.isSubscribed
|
|
830
|
+
? this.getStateAccount().admin
|
|
831
|
+
: this.wallet.publicKey,
|
|
802
832
|
state: await this.getStatePublicKey(),
|
|
803
833
|
perpMarket: await getPerpMarketPublicKey(
|
|
804
834
|
this.program.programId,
|
|
@@ -826,7 +856,9 @@ export class AdminClient extends DriftClient {
|
|
|
826
856
|
targetBaseAssetAmountPerLP,
|
|
827
857
|
{
|
|
828
858
|
accounts: {
|
|
829
|
-
admin: this.
|
|
859
|
+
admin: this.isSubscribed
|
|
860
|
+
? this.getStateAccount().admin
|
|
861
|
+
: this.wallet.publicKey,
|
|
830
862
|
state: await this.getStatePublicKey(),
|
|
831
863
|
perpMarket: await getPerpMarketPublicKey(
|
|
832
864
|
this.program.programId,
|
|
@@ -856,7 +888,9 @@ export class AdminClient extends DriftClient {
|
|
|
856
888
|
marginRatioMaintenance,
|
|
857
889
|
{
|
|
858
890
|
accounts: {
|
|
859
|
-
admin: this.
|
|
891
|
+
admin: this.isSubscribed
|
|
892
|
+
? this.getStateAccount().admin
|
|
893
|
+
: this.wallet.publicKey,
|
|
860
894
|
state: await this.getStatePublicKey(),
|
|
861
895
|
perpMarket: await getPerpMarketPublicKey(
|
|
862
896
|
this.program.programId,
|
|
@@ -884,7 +918,9 @@ export class AdminClient extends DriftClient {
|
|
|
884
918
|
unrealizedPnlImfFactor,
|
|
885
919
|
{
|
|
886
920
|
accounts: {
|
|
887
|
-
admin: this.
|
|
921
|
+
admin: this.isSubscribed
|
|
922
|
+
? this.getStateAccount().admin
|
|
923
|
+
: this.wallet.publicKey,
|
|
888
924
|
state: await this.getStatePublicKey(),
|
|
889
925
|
perpMarket: await getPerpMarketPublicKey(
|
|
890
926
|
this.program.programId,
|
|
@@ -908,7 +944,9 @@ export class AdminClient extends DriftClient {
|
|
|
908
944
|
const updatePerpMarketBaseSpreadIx =
|
|
909
945
|
await this.program.instruction.updatePerpMarketBaseSpread(baseSpread, {
|
|
910
946
|
accounts: {
|
|
911
|
-
admin: this.
|
|
947
|
+
admin: this.isSubscribed
|
|
948
|
+
? this.getStateAccount().admin
|
|
949
|
+
: this.wallet.publicKey,
|
|
912
950
|
state: await this.getStatePublicKey(),
|
|
913
951
|
perpMarket: await getPerpMarketPublicKey(
|
|
914
952
|
this.program.programId,
|
|
@@ -931,7 +969,9 @@ export class AdminClient extends DriftClient {
|
|
|
931
969
|
const updateAmmJitIntensityIx =
|
|
932
970
|
await this.program.instruction.updateAmmJitIntensity(ammJitIntensity, {
|
|
933
971
|
accounts: {
|
|
934
|
-
admin: this.
|
|
972
|
+
admin: this.isSubscribed
|
|
973
|
+
? this.getStateAccount().admin
|
|
974
|
+
: this.wallet.publicKey,
|
|
935
975
|
state: await this.getStatePublicKey(),
|
|
936
976
|
perpMarket: await getPerpMarketPublicKey(
|
|
937
977
|
this.program.programId,
|
|
@@ -956,7 +996,9 @@ export class AdminClient extends DriftClient {
|
|
|
956
996
|
const updatePerpMarketNameIx =
|
|
957
997
|
await this.program.instruction.updatePerpMarketName(nameBuffer, {
|
|
958
998
|
accounts: {
|
|
959
|
-
admin: this.
|
|
999
|
+
admin: this.isSubscribed
|
|
1000
|
+
? this.getStateAccount().admin
|
|
1001
|
+
: this.wallet.publicKey,
|
|
960
1002
|
state: await this.getStatePublicKey(),
|
|
961
1003
|
perpMarket: await getPerpMarketPublicKey(
|
|
962
1004
|
this.program.programId,
|
|
@@ -981,7 +1023,9 @@ export class AdminClient extends DriftClient {
|
|
|
981
1023
|
const updateSpotMarketNameIx =
|
|
982
1024
|
await this.program.instruction.updateSpotMarketName(nameBuffer, {
|
|
983
1025
|
accounts: {
|
|
984
|
-
admin: this.
|
|
1026
|
+
admin: this.isSubscribed
|
|
1027
|
+
? this.getStateAccount().admin
|
|
1028
|
+
: this.wallet.publicKey,
|
|
985
1029
|
state: await this.getStatePublicKey(),
|
|
986
1030
|
spotMarket: await getSpotMarketPublicKey(
|
|
987
1031
|
this.program.programId,
|
|
@@ -1009,7 +1053,9 @@ export class AdminClient extends DriftClient {
|
|
|
1009
1053
|
const updatePerpMarketPerLpBaseIx =
|
|
1010
1054
|
await this.program.instruction.updatePerpMarketPerLpBase(perLpBase, {
|
|
1011
1055
|
accounts: {
|
|
1012
|
-
admin: this.
|
|
1056
|
+
admin: this.isSubscribed
|
|
1057
|
+
? this.getStateAccount().admin
|
|
1058
|
+
: this.wallet.publicKey,
|
|
1013
1059
|
state: await this.getStatePublicKey(),
|
|
1014
1060
|
perpMarket: perpMarketPublicKey,
|
|
1015
1061
|
},
|
|
@@ -1034,7 +1080,9 @@ export class AdminClient extends DriftClient {
|
|
|
1034
1080
|
const updatePerpMarketMaxSpreadIx =
|
|
1035
1081
|
await this.program.instruction.updatePerpMarketMaxSpread(maxSpread, {
|
|
1036
1082
|
accounts: {
|
|
1037
|
-
admin: this.
|
|
1083
|
+
admin: this.isSubscribed
|
|
1084
|
+
? this.getStateAccount().admin
|
|
1085
|
+
: this.wallet.publicKey,
|
|
1038
1086
|
state: await this.getStatePublicKey(),
|
|
1039
1087
|
perpMarket: perpMarketPublicKey,
|
|
1040
1088
|
},
|
|
@@ -1053,7 +1101,9 @@ export class AdminClient extends DriftClient {
|
|
|
1053
1101
|
const updatePerpFeeStructureIx =
|
|
1054
1102
|
this.program.instruction.updatePerpFeeStructure(feeStructure, {
|
|
1055
1103
|
accounts: {
|
|
1056
|
-
admin: this.
|
|
1104
|
+
admin: this.isSubscribed
|
|
1105
|
+
? this.getStateAccount().admin
|
|
1106
|
+
: this.wallet.publicKey,
|
|
1057
1107
|
state: await this.getStatePublicKey(),
|
|
1058
1108
|
},
|
|
1059
1109
|
});
|
|
@@ -1071,7 +1121,9 @@ export class AdminClient extends DriftClient {
|
|
|
1071
1121
|
const updateSpotFeeStructureIx =
|
|
1072
1122
|
await this.program.instruction.updateSpotFeeStructure(feeStructure, {
|
|
1073
1123
|
accounts: {
|
|
1074
|
-
admin: this.
|
|
1124
|
+
admin: this.isSubscribed
|
|
1125
|
+
? this.getStateAccount().admin
|
|
1126
|
+
: this.wallet.publicKey,
|
|
1075
1127
|
state: await this.getStatePublicKey(),
|
|
1076
1128
|
},
|
|
1077
1129
|
});
|
|
@@ -1091,7 +1143,9 @@ export class AdminClient extends DriftClient {
|
|
|
1091
1143
|
initialPctToLiquidate,
|
|
1092
1144
|
{
|
|
1093
1145
|
accounts: {
|
|
1094
|
-
admin: this.
|
|
1146
|
+
admin: this.isSubscribed
|
|
1147
|
+
? this.getStateAccount().admin
|
|
1148
|
+
: this.wallet.publicKey,
|
|
1095
1149
|
state: await this.getStatePublicKey(),
|
|
1096
1150
|
},
|
|
1097
1151
|
}
|
|
@@ -1112,7 +1166,9 @@ export class AdminClient extends DriftClient {
|
|
|
1112
1166
|
liquidationDuration,
|
|
1113
1167
|
{
|
|
1114
1168
|
accounts: {
|
|
1115
|
-
admin: this.
|
|
1169
|
+
admin: this.isSubscribed
|
|
1170
|
+
? this.getStateAccount().admin
|
|
1171
|
+
: this.wallet.publicKey,
|
|
1116
1172
|
state: await this.getStatePublicKey(),
|
|
1117
1173
|
},
|
|
1118
1174
|
}
|
|
@@ -1133,7 +1189,9 @@ export class AdminClient extends DriftClient {
|
|
|
1133
1189
|
updateLiquidationMarginBufferRatio,
|
|
1134
1190
|
{
|
|
1135
1191
|
accounts: {
|
|
1136
|
-
admin: this.
|
|
1192
|
+
admin: this.isSubscribed
|
|
1193
|
+
? this.getStateAccount().admin
|
|
1194
|
+
: this.wallet.publicKey,
|
|
1137
1195
|
state: await this.getStatePublicKey(),
|
|
1138
1196
|
},
|
|
1139
1197
|
}
|
|
@@ -1154,7 +1212,9 @@ export class AdminClient extends DriftClient {
|
|
|
1154
1212
|
const updateOracleGuardRailsIx =
|
|
1155
1213
|
await this.program.instruction.updateOracleGuardRails(oracleGuardRails, {
|
|
1156
1214
|
accounts: {
|
|
1157
|
-
admin: this.
|
|
1215
|
+
admin: this.isSubscribed
|
|
1216
|
+
? this.getStateAccount().admin
|
|
1217
|
+
: this.wallet.publicKey,
|
|
1158
1218
|
state: await this.getStatePublicKey(),
|
|
1159
1219
|
},
|
|
1160
1220
|
});
|
|
@@ -1174,7 +1234,9 @@ export class AdminClient extends DriftClient {
|
|
|
1174
1234
|
settlementDuration,
|
|
1175
1235
|
{
|
|
1176
1236
|
accounts: {
|
|
1177
|
-
admin: this.
|
|
1237
|
+
admin: this.isSubscribed
|
|
1238
|
+
? this.getStateAccount().admin
|
|
1239
|
+
: this.wallet.publicKey,
|
|
1178
1240
|
state: await this.getStatePublicKey(),
|
|
1179
1241
|
},
|
|
1180
1242
|
}
|
|
@@ -1195,7 +1257,9 @@ export class AdminClient extends DriftClient {
|
|
|
1195
1257
|
maxNumberOfSubAccounts,
|
|
1196
1258
|
{
|
|
1197
1259
|
accounts: {
|
|
1198
|
-
admin: this.
|
|
1260
|
+
admin: this.isSubscribed
|
|
1261
|
+
? this.getStateAccount().admin
|
|
1262
|
+
: this.wallet.publicKey,
|
|
1199
1263
|
state: await this.getStatePublicKey(),
|
|
1200
1264
|
},
|
|
1201
1265
|
}
|
|
@@ -1216,7 +1280,9 @@ export class AdminClient extends DriftClient {
|
|
|
1216
1280
|
maxInitializeUserFee,
|
|
1217
1281
|
{
|
|
1218
1282
|
accounts: {
|
|
1219
|
-
admin: this.
|
|
1283
|
+
admin: this.isSubscribed
|
|
1284
|
+
? this.getStateAccount().admin
|
|
1285
|
+
: this.wallet.publicKey,
|
|
1220
1286
|
state: await this.getStatePublicKey(),
|
|
1221
1287
|
},
|
|
1222
1288
|
}
|
|
@@ -1238,7 +1304,9 @@ export class AdminClient extends DriftClient {
|
|
|
1238
1304
|
withdrawGuardThreshold,
|
|
1239
1305
|
{
|
|
1240
1306
|
accounts: {
|
|
1241
|
-
admin: this.
|
|
1307
|
+
admin: this.isSubscribed
|
|
1308
|
+
? this.getStateAccount().admin
|
|
1309
|
+
: this.wallet.publicKey,
|
|
1242
1310
|
state: await this.getStatePublicKey(),
|
|
1243
1311
|
spotMarket: await getSpotMarketPublicKey(
|
|
1244
1312
|
this.program.programId,
|
|
@@ -1267,7 +1335,9 @@ export class AdminClient extends DriftClient {
|
|
|
1267
1335
|
totalIfFactor,
|
|
1268
1336
|
{
|
|
1269
1337
|
accounts: {
|
|
1270
|
-
admin: this.
|
|
1338
|
+
admin: this.isSubscribed
|
|
1339
|
+
? this.getStateAccount().admin
|
|
1340
|
+
: this.wallet.publicKey,
|
|
1271
1341
|
state: await this.getStatePublicKey(),
|
|
1272
1342
|
spotMarket: await getSpotMarketPublicKey(
|
|
1273
1343
|
this.program.programId,
|
|
@@ -1293,7 +1363,9 @@ export class AdminClient extends DriftClient {
|
|
|
1293
1363
|
revenueSettlePeriod,
|
|
1294
1364
|
{
|
|
1295
1365
|
accounts: {
|
|
1296
|
-
admin: this.
|
|
1366
|
+
admin: this.isSubscribed
|
|
1367
|
+
? this.getStateAccount().admin
|
|
1368
|
+
: this.wallet.publicKey,
|
|
1297
1369
|
state: await this.getStatePublicKey(),
|
|
1298
1370
|
spotMarket: await getSpotMarketPublicKey(
|
|
1299
1371
|
this.program.programId,
|
|
@@ -1321,7 +1393,9 @@ export class AdminClient extends DriftClient {
|
|
|
1321
1393
|
maxTokenDeposits,
|
|
1322
1394
|
{
|
|
1323
1395
|
accounts: {
|
|
1324
|
-
admin: this.
|
|
1396
|
+
admin: this.isSubscribed
|
|
1397
|
+
? this.getStateAccount().admin
|
|
1398
|
+
: this.wallet.publicKey,
|
|
1325
1399
|
state: await this.getStatePublicKey(),
|
|
1326
1400
|
spotMarket: await getSpotMarketPublicKey(
|
|
1327
1401
|
this.program.programId,
|
|
@@ -1347,7 +1421,9 @@ export class AdminClient extends DriftClient {
|
|
|
1347
1421
|
scaleInitialAssetWeightStart,
|
|
1348
1422
|
{
|
|
1349
1423
|
accounts: {
|
|
1350
|
-
admin: this.
|
|
1424
|
+
admin: this.isSubscribed
|
|
1425
|
+
? this.getStateAccount().admin
|
|
1426
|
+
: this.wallet.publicKey,
|
|
1351
1427
|
state: await this.getStatePublicKey(),
|
|
1352
1428
|
spotMarket: await getSpotMarketPublicKey(
|
|
1353
1429
|
this.program.programId,
|
|
@@ -1375,7 +1451,9 @@ export class AdminClient extends DriftClient {
|
|
|
1375
1451
|
insuranceWithdrawEscrowPeriod,
|
|
1376
1452
|
{
|
|
1377
1453
|
accounts: {
|
|
1378
|
-
admin: this.
|
|
1454
|
+
admin: this.isSubscribed
|
|
1455
|
+
? this.getStateAccount().admin
|
|
1456
|
+
: this.wallet.publicKey,
|
|
1379
1457
|
state: await this.getStatePublicKey(),
|
|
1380
1458
|
spotMarket: await getSpotMarketPublicKey(
|
|
1381
1459
|
this.program.programId,
|
|
@@ -1400,7 +1478,9 @@ export class AdminClient extends DriftClient {
|
|
|
1400
1478
|
const updateLpCooldownTimeIx =
|
|
1401
1479
|
await this.program.instruction.updateLpCooldownTime(cooldownTime, {
|
|
1402
1480
|
accounts: {
|
|
1403
|
-
admin: this.
|
|
1481
|
+
admin: this.isSubscribed
|
|
1482
|
+
? this.getStateAccount().admin
|
|
1483
|
+
: this.wallet.publicKey,
|
|
1404
1484
|
state: await this.getStatePublicKey(),
|
|
1405
1485
|
},
|
|
1406
1486
|
});
|
|
@@ -1423,7 +1503,9 @@ export class AdminClient extends DriftClient {
|
|
|
1423
1503
|
oracleSource,
|
|
1424
1504
|
{
|
|
1425
1505
|
accounts: {
|
|
1426
|
-
admin: this.
|
|
1506
|
+
admin: this.isSubscribed
|
|
1507
|
+
? this.getStateAccount().admin
|
|
1508
|
+
: this.wallet.publicKey,
|
|
1427
1509
|
state: await this.getStatePublicKey(),
|
|
1428
1510
|
perpMarket: await getPerpMarketPublicKey(
|
|
1429
1511
|
this.program.programId,
|
|
@@ -1452,7 +1534,9 @@ export class AdminClient extends DriftClient {
|
|
|
1452
1534
|
tickSize,
|
|
1453
1535
|
{
|
|
1454
1536
|
accounts: {
|
|
1455
|
-
admin: this.
|
|
1537
|
+
admin: this.isSubscribed
|
|
1538
|
+
? this.getStateAccount().admin
|
|
1539
|
+
: this.wallet.publicKey,
|
|
1456
1540
|
state: await this.getStatePublicKey(),
|
|
1457
1541
|
perpMarket: await getPerpMarketPublicKey(
|
|
1458
1542
|
this.program.programId,
|
|
@@ -1478,7 +1562,9 @@ export class AdminClient extends DriftClient {
|
|
|
1478
1562
|
const updatePerpMarketMinOrderSizeIx =
|
|
1479
1563
|
await this.program.instruction.updatePerpMarketMinOrderSize(orderSize, {
|
|
1480
1564
|
accounts: {
|
|
1481
|
-
admin: this.
|
|
1565
|
+
admin: this.isSubscribed
|
|
1566
|
+
? this.getStateAccount().admin
|
|
1567
|
+
: this.wallet.publicKey,
|
|
1482
1568
|
state: await this.getStatePublicKey(),
|
|
1483
1569
|
perpMarket: await getPerpMarketPublicKey(
|
|
1484
1570
|
this.program.programId,
|
|
@@ -1505,7 +1591,9 @@ export class AdminClient extends DriftClient {
|
|
|
1505
1591
|
tickSize,
|
|
1506
1592
|
{
|
|
1507
1593
|
accounts: {
|
|
1508
|
-
admin: this.
|
|
1594
|
+
admin: this.isSubscribed
|
|
1595
|
+
? this.getStateAccount().admin
|
|
1596
|
+
: this.wallet.publicKey,
|
|
1509
1597
|
state: await this.getStatePublicKey(),
|
|
1510
1598
|
spotMarket: await getSpotMarketPublicKey(
|
|
1511
1599
|
this.program.programId,
|
|
@@ -1531,7 +1619,9 @@ export class AdminClient extends DriftClient {
|
|
|
1531
1619
|
const updateSpotMarketMinOrderSizeIx =
|
|
1532
1620
|
await this.program.instruction.updateSpotMarketMinOrderSize(orderSize, {
|
|
1533
1621
|
accounts: {
|
|
1534
|
-
admin: this.
|
|
1622
|
+
admin: this.isSubscribed
|
|
1623
|
+
? this.getStateAccount().admin
|
|
1624
|
+
: this.wallet.publicKey,
|
|
1535
1625
|
state: await this.getStatePublicKey(),
|
|
1536
1626
|
spotMarket: await getSpotMarketPublicKey(
|
|
1537
1627
|
this.program.programId,
|
|
@@ -1554,7 +1644,9 @@ export class AdminClient extends DriftClient {
|
|
|
1554
1644
|
const updatePerpMarketExpiryIx =
|
|
1555
1645
|
await this.program.instruction.updatePerpMarketExpiry(expiryTs, {
|
|
1556
1646
|
accounts: {
|
|
1557
|
-
admin: this.
|
|
1647
|
+
admin: this.isSubscribed
|
|
1648
|
+
? this.getStateAccount().admin
|
|
1649
|
+
: this.wallet.publicKey,
|
|
1558
1650
|
state: await this.getStatePublicKey(),
|
|
1559
1651
|
perpMarket: await getPerpMarketPublicKey(
|
|
1560
1652
|
this.program.programId,
|
|
@@ -1580,7 +1672,9 @@ export class AdminClient extends DriftClient {
|
|
|
1580
1672
|
oracleSource,
|
|
1581
1673
|
{
|
|
1582
1674
|
accounts: {
|
|
1583
|
-
admin: this.
|
|
1675
|
+
admin: this.isSubscribed
|
|
1676
|
+
? this.getStateAccount().admin
|
|
1677
|
+
: this.wallet.publicKey,
|
|
1584
1678
|
state: await this.getStatePublicKey(),
|
|
1585
1679
|
spotMarket: await getSpotMarketPublicKey(
|
|
1586
1680
|
this.program.programId,
|
|
@@ -1607,7 +1701,9 @@ export class AdminClient extends DriftClient {
|
|
|
1607
1701
|
ordersEnabled,
|
|
1608
1702
|
{
|
|
1609
1703
|
accounts: {
|
|
1610
|
-
admin: this.
|
|
1704
|
+
admin: this.isSubscribed
|
|
1705
|
+
? this.getStateAccount().admin
|
|
1706
|
+
: this.wallet.publicKey,
|
|
1611
1707
|
state: await this.getStatePublicKey(),
|
|
1612
1708
|
spotMarket: await getSpotMarketPublicKey(
|
|
1613
1709
|
this.program.programId,
|
|
@@ -1633,7 +1729,9 @@ export class AdminClient extends DriftClient {
|
|
|
1633
1729
|
status,
|
|
1634
1730
|
{
|
|
1635
1731
|
accounts: {
|
|
1636
|
-
admin: this.
|
|
1732
|
+
admin: this.isSubscribed
|
|
1733
|
+
? this.getStateAccount().admin
|
|
1734
|
+
: this.wallet.publicKey,
|
|
1637
1735
|
state: await this.getStatePublicKey(),
|
|
1638
1736
|
serumFulfillmentConfig,
|
|
1639
1737
|
},
|
|
@@ -1656,7 +1754,9 @@ export class AdminClient extends DriftClient {
|
|
|
1656
1754
|
const updatePhoenixFulfillmentConfigStatusIx =
|
|
1657
1755
|
await this.program.instruction.phoenixFulfillmentConfigStatus(status, {
|
|
1658
1756
|
accounts: {
|
|
1659
|
-
admin: this.
|
|
1757
|
+
admin: this.isSubscribed
|
|
1758
|
+
? this.getStateAccount().admin
|
|
1759
|
+
: this.wallet.publicKey,
|
|
1660
1760
|
state: await this.getStatePublicKey(),
|
|
1661
1761
|
phoenixFulfillmentConfig,
|
|
1662
1762
|
},
|
|
@@ -1678,7 +1778,9 @@ export class AdminClient extends DriftClient {
|
|
|
1678
1778
|
const updateSpotMarketExpiryIx =
|
|
1679
1779
|
await this.program.instruction.updateSpotMarketExpiry(expiryTs, {
|
|
1680
1780
|
accounts: {
|
|
1681
|
-
admin: this.
|
|
1781
|
+
admin: this.isSubscribed
|
|
1782
|
+
? this.getStateAccount().admin
|
|
1783
|
+
: this.wallet.publicKey,
|
|
1682
1784
|
state: await this.getStatePublicKey(),
|
|
1683
1785
|
spotMarket: await getSpotMarketPublicKey(
|
|
1684
1786
|
this.program.programId,
|
|
@@ -1700,7 +1802,9 @@ export class AdminClient extends DriftClient {
|
|
|
1700
1802
|
const updateWhitelistMintIx =
|
|
1701
1803
|
await this.program.instruction.updateWhitelistMint(whitelistMint, {
|
|
1702
1804
|
accounts: {
|
|
1703
|
-
admin: this.
|
|
1805
|
+
admin: this.isSubscribed
|
|
1806
|
+
? this.getStateAccount().admin
|
|
1807
|
+
: this.wallet.publicKey,
|
|
1704
1808
|
state: await this.getStatePublicKey(),
|
|
1705
1809
|
},
|
|
1706
1810
|
});
|
|
@@ -1718,7 +1822,9 @@ export class AdminClient extends DriftClient {
|
|
|
1718
1822
|
const updateDiscountMintIx =
|
|
1719
1823
|
await this.program.instruction.updateDiscountMint(discountMint, {
|
|
1720
1824
|
accounts: {
|
|
1721
|
-
admin: this.
|
|
1825
|
+
admin: this.isSubscribed
|
|
1826
|
+
? this.getStateAccount().admin
|
|
1827
|
+
: this.wallet.publicKey,
|
|
1722
1828
|
state: await this.getStatePublicKey(),
|
|
1723
1829
|
},
|
|
1724
1830
|
});
|
|
@@ -1747,7 +1853,9 @@ export class AdminClient extends DriftClient {
|
|
|
1747
1853
|
imfFactor,
|
|
1748
1854
|
{
|
|
1749
1855
|
accounts: {
|
|
1750
|
-
admin: this.
|
|
1856
|
+
admin: this.isSubscribed
|
|
1857
|
+
? this.getStateAccount().admin
|
|
1858
|
+
: this.wallet.publicKey,
|
|
1751
1859
|
state: await this.getStatePublicKey(),
|
|
1752
1860
|
spotMarket: await getSpotMarketPublicKey(
|
|
1753
1861
|
this.program.programId,
|
|
@@ -1777,7 +1885,9 @@ export class AdminClient extends DriftClient {
|
|
|
1777
1885
|
optimalMaxRate,
|
|
1778
1886
|
{
|
|
1779
1887
|
accounts: {
|
|
1780
|
-
admin: this.
|
|
1888
|
+
admin: this.isSubscribed
|
|
1889
|
+
? this.getStateAccount().admin
|
|
1890
|
+
: this.wallet.publicKey,
|
|
1781
1891
|
state: await this.getStatePublicKey(),
|
|
1782
1892
|
spotMarket: await getSpotMarketPublicKey(
|
|
1783
1893
|
this.program.programId,
|
|
@@ -1801,7 +1911,9 @@ export class AdminClient extends DriftClient {
|
|
|
1801
1911
|
const updateSpotMarketAssetTierIx =
|
|
1802
1912
|
await this.program.instruction.updateSpotMarketAssetTier(assetTier, {
|
|
1803
1913
|
accounts: {
|
|
1804
|
-
admin: this.
|
|
1914
|
+
admin: this.isSubscribed
|
|
1915
|
+
? this.getStateAccount().admin
|
|
1916
|
+
: this.wallet.publicKey,
|
|
1805
1917
|
state: await this.getStatePublicKey(),
|
|
1806
1918
|
spotMarket: await getSpotMarketPublicKey(
|
|
1807
1919
|
this.program.programId,
|
|
@@ -1824,7 +1936,9 @@ export class AdminClient extends DriftClient {
|
|
|
1824
1936
|
const updateSpotMarketStatusIx =
|
|
1825
1937
|
await this.program.instruction.updateSpotMarketStatus(marketStatus, {
|
|
1826
1938
|
accounts: {
|
|
1827
|
-
admin: this.
|
|
1939
|
+
admin: this.isSubscribed
|
|
1940
|
+
? this.getStateAccount().admin
|
|
1941
|
+
: this.wallet.publicKey,
|
|
1828
1942
|
state: await this.getStatePublicKey(),
|
|
1829
1943
|
spotMarket: await getSpotMarketPublicKey(
|
|
1830
1944
|
this.program.programId,
|
|
@@ -1849,7 +1963,9 @@ export class AdminClient extends DriftClient {
|
|
|
1849
1963
|
pausedOperations,
|
|
1850
1964
|
{
|
|
1851
1965
|
accounts: {
|
|
1852
|
-
admin: this.
|
|
1966
|
+
admin: this.isSubscribed
|
|
1967
|
+
? this.getStateAccount().admin
|
|
1968
|
+
: this.wallet.publicKey,
|
|
1853
1969
|
state: await this.getStatePublicKey(),
|
|
1854
1970
|
spotMarket: await getSpotMarketPublicKey(
|
|
1855
1971
|
this.program.programId,
|
|
@@ -1873,7 +1989,9 @@ export class AdminClient extends DriftClient {
|
|
|
1873
1989
|
const updatePerpMarketStatusIx =
|
|
1874
1990
|
await this.program.instruction.updatePerpMarketStatus(marketStatus, {
|
|
1875
1991
|
accounts: {
|
|
1876
|
-
admin: this.
|
|
1992
|
+
admin: this.isSubscribed
|
|
1993
|
+
? this.getStateAccount().admin
|
|
1994
|
+
: this.wallet.publicKey,
|
|
1877
1995
|
state: await this.getStatePublicKey(),
|
|
1878
1996
|
perpMarket: await getPerpMarketPublicKey(
|
|
1879
1997
|
this.program.programId,
|
|
@@ -1898,7 +2016,9 @@ export class AdminClient extends DriftClient {
|
|
|
1898
2016
|
pausedOperations,
|
|
1899
2017
|
{
|
|
1900
2018
|
accounts: {
|
|
1901
|
-
admin: this.
|
|
2019
|
+
admin: this.isSubscribed
|
|
2020
|
+
? this.getStateAccount().admin
|
|
2021
|
+
: this.wallet.publicKey,
|
|
1902
2022
|
state: await this.getStatePublicKey(),
|
|
1903
2023
|
perpMarket: await getPerpMarketPublicKey(
|
|
1904
2024
|
this.program.programId,
|
|
@@ -1924,7 +2044,9 @@ export class AdminClient extends DriftClient {
|
|
|
1924
2044
|
contractTier,
|
|
1925
2045
|
{
|
|
1926
2046
|
accounts: {
|
|
1927
|
-
admin: this.
|
|
2047
|
+
admin: this.isSubscribed
|
|
2048
|
+
? this.getStateAccount().admin
|
|
2049
|
+
: this.wallet.publicKey,
|
|
1928
2050
|
state: await this.getStatePublicKey(),
|
|
1929
2051
|
perpMarket: await getPerpMarketPublicKey(
|
|
1930
2052
|
this.program.programId,
|
|
@@ -1947,7 +2069,9 @@ export class AdminClient extends DriftClient {
|
|
|
1947
2069
|
const updateExchangeStatusIx =
|
|
1948
2070
|
await this.program.instruction.updateExchangeStatus(exchangeStatus, {
|
|
1949
2071
|
accounts: {
|
|
1950
|
-
admin: this.
|
|
2072
|
+
admin: this.isSubscribed
|
|
2073
|
+
? this.getStateAccount().admin
|
|
2074
|
+
: this.wallet.publicKey,
|
|
1951
2075
|
state: await this.getStatePublicKey(),
|
|
1952
2076
|
},
|
|
1953
2077
|
});
|
|
@@ -1967,7 +2091,9 @@ export class AdminClient extends DriftClient {
|
|
|
1967
2091
|
typeof minDuration === 'number' ? minDuration : minDuration.toNumber(),
|
|
1968
2092
|
{
|
|
1969
2093
|
accounts: {
|
|
1970
|
-
admin: this.
|
|
2094
|
+
admin: this.isSubscribed
|
|
2095
|
+
? this.getStateAccount().admin
|
|
2096
|
+
: this.wallet.publicKey,
|
|
1971
2097
|
state: await this.getStatePublicKey(),
|
|
1972
2098
|
},
|
|
1973
2099
|
}
|
|
@@ -1988,7 +2114,9 @@ export class AdminClient extends DriftClient {
|
|
|
1988
2114
|
defaultAuctionDuration,
|
|
1989
2115
|
{
|
|
1990
2116
|
accounts: {
|
|
1991
|
-
admin: this.
|
|
2117
|
+
admin: this.isSubscribed
|
|
2118
|
+
? this.getStateAccount().admin
|
|
2119
|
+
: this.wallet.publicKey,
|
|
1992
2120
|
state: await this.getStatePublicKey(),
|
|
1993
2121
|
},
|
|
1994
2122
|
}
|
|
@@ -2010,7 +2138,9 @@ export class AdminClient extends DriftClient {
|
|
|
2010
2138
|
maxBaseAssetAmountRatio,
|
|
2011
2139
|
{
|
|
2012
2140
|
accounts: {
|
|
2013
|
-
admin: this.
|
|
2141
|
+
admin: this.isSubscribed
|
|
2142
|
+
? this.getStateAccount().admin
|
|
2143
|
+
: this.wallet.publicKey,
|
|
2014
2144
|
state: await this.getStatePublicKey(),
|
|
2015
2145
|
perpMarket: await getPerpMarketPublicKey(
|
|
2016
2146
|
this.program.programId,
|
|
@@ -2036,7 +2166,9 @@ export class AdminClient extends DriftClient {
|
|
|
2036
2166
|
const updateMaxSlippageRatioIx =
|
|
2037
2167
|
await this.program.instruction.updateMaxSlippageRatio(maxSlippageRatio, {
|
|
2038
2168
|
accounts: {
|
|
2039
|
-
admin: this.
|
|
2169
|
+
admin: this.isSubscribed
|
|
2170
|
+
? this.getStateAccount().admin
|
|
2171
|
+
: this.wallet.publicKey,
|
|
2040
2172
|
state: await this.getStatePublicKey(),
|
|
2041
2173
|
perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
|
|
2042
2174
|
},
|
|
@@ -2060,7 +2192,9 @@ export class AdminClient extends DriftClient {
|
|
|
2060
2192
|
unrealizedMaintenanceAssetWeight,
|
|
2061
2193
|
{
|
|
2062
2194
|
accounts: {
|
|
2063
|
-
admin: this.
|
|
2195
|
+
admin: this.isSubscribed
|
|
2196
|
+
? this.getStateAccount().admin
|
|
2197
|
+
: this.wallet.publicKey,
|
|
2064
2198
|
state: await this.getStatePublicKey(),
|
|
2065
2199
|
perpMarket: await getPerpMarketPublicKey(
|
|
2066
2200
|
this.program.programId,
|
|
@@ -2092,7 +2226,9 @@ export class AdminClient extends DriftClient {
|
|
|
2092
2226
|
quoteMaxInsurance,
|
|
2093
2227
|
{
|
|
2094
2228
|
accounts: {
|
|
2095
|
-
admin: this.
|
|
2229
|
+
admin: this.isSubscribed
|
|
2230
|
+
? this.getStateAccount().admin
|
|
2231
|
+
: this.wallet.publicKey,
|
|
2096
2232
|
state: await this.getStatePublicKey(),
|
|
2097
2233
|
perpMarket: await getPerpMarketPublicKey(
|
|
2098
2234
|
this.program.programId,
|
|
@@ -2118,7 +2254,9 @@ export class AdminClient extends DriftClient {
|
|
|
2118
2254
|
maxOpenInterest,
|
|
2119
2255
|
{
|
|
2120
2256
|
accounts: {
|
|
2121
|
-
admin: this.
|
|
2257
|
+
admin: this.isSubscribed
|
|
2258
|
+
? this.getStateAccount().admin
|
|
2259
|
+
: this.wallet.publicKey,
|
|
2122
2260
|
state: await this.getStatePublicKey(),
|
|
2123
2261
|
perpMarket: await getPerpMarketPublicKey(
|
|
2124
2262
|
this.program.programId,
|
|
@@ -2144,7 +2282,9 @@ export class AdminClient extends DriftClient {
|
|
|
2144
2282
|
feeAdjustment,
|
|
2145
2283
|
{
|
|
2146
2284
|
accounts: {
|
|
2147
|
-
admin: this.
|
|
2285
|
+
admin: this.isSubscribed
|
|
2286
|
+
? this.getStateAccount().admin
|
|
2287
|
+
: this.wallet.publicKey,
|
|
2148
2288
|
state: await this.getStatePublicKey(),
|
|
2149
2289
|
perpMarket: await getPerpMarketPublicKey(
|
|
2150
2290
|
this.program.programId,
|
|
@@ -2168,7 +2308,9 @@ export class AdminClient extends DriftClient {
|
|
|
2168
2308
|
srmVault,
|
|
2169
2309
|
{
|
|
2170
2310
|
accounts: {
|
|
2171
|
-
admin: this.
|
|
2311
|
+
admin: this.isSubscribed
|
|
2312
|
+
? this.getStateAccount().admin
|
|
2313
|
+
: this.wallet.publicKey,
|
|
2172
2314
|
state: await this.getStatePublicKey(),
|
|
2173
2315
|
srmVault: srmVault,
|
|
2174
2316
|
},
|
|
@@ -2193,7 +2335,9 @@ export class AdminClient extends DriftClient {
|
|
|
2193
2335
|
ifLiquidationFee,
|
|
2194
2336
|
{
|
|
2195
2337
|
accounts: {
|
|
2196
|
-
admin: this.
|
|
2338
|
+
admin: this.isSubscribed
|
|
2339
|
+
? this.getStateAccount().admin
|
|
2340
|
+
: this.wallet.publicKey,
|
|
2197
2341
|
state: await this.getStatePublicKey(),
|
|
2198
2342
|
perpMarket: await getPerpMarketPublicKey(
|
|
2199
2343
|
this.program.programId,
|
|
@@ -2221,7 +2365,9 @@ export class AdminClient extends DriftClient {
|
|
|
2221
2365
|
ifLiquidationFee,
|
|
2222
2366
|
{
|
|
2223
2367
|
accounts: {
|
|
2224
|
-
admin: this.
|
|
2368
|
+
admin: this.isSubscribed
|
|
2369
|
+
? this.getStateAccount().admin
|
|
2370
|
+
: this.wallet.publicKey,
|
|
2225
2371
|
state: await this.getStatePublicKey(),
|
|
2226
2372
|
spotMarket: await getSpotMarketPublicKey(
|
|
2227
2373
|
this.program.programId,
|
|
@@ -2242,7 +2388,9 @@ export class AdminClient extends DriftClient {
|
|
|
2242
2388
|
const initializeProtocolIfSharesTransferConfigIx =
|
|
2243
2389
|
await this.program.instruction.initializeProtocolIfSharesTransferConfig({
|
|
2244
2390
|
accounts: {
|
|
2245
|
-
admin: this.
|
|
2391
|
+
admin: this.isSubscribed
|
|
2392
|
+
? this.getStateAccount().admin
|
|
2393
|
+
: this.wallet.publicKey,
|
|
2246
2394
|
state: await this.getStatePublicKey(),
|
|
2247
2395
|
rent: SYSVAR_RENT_PUBKEY,
|
|
2248
2396
|
systemProgram: anchor.web3.SystemProgram.programId,
|
|
@@ -2270,7 +2418,9 @@ export class AdminClient extends DriftClient {
|
|
|
2270
2418
|
maxTransferPerEpoch,
|
|
2271
2419
|
{
|
|
2272
2420
|
accounts: {
|
|
2273
|
-
admin: this.
|
|
2421
|
+
admin: this.isSubscribed
|
|
2422
|
+
? this.getStateAccount().admin
|
|
2423
|
+
: this.wallet.publicKey,
|
|
2274
2424
|
state: await this.getStatePublicKey(),
|
|
2275
2425
|
protocolIfSharesTransferConfig:
|
|
2276
2426
|
getProtocolIfSharesTransferConfigPublicKey(
|
|
@@ -2296,7 +2446,6 @@ export class AdminClient extends DriftClient {
|
|
|
2296
2446
|
): Promise<TransactionSignature> {
|
|
2297
2447
|
const initializePrelaunchOracleIx =
|
|
2298
2448
|
await this.getInitializePrelaunchOracleIx(
|
|
2299
|
-
this.wallet.publicKey,
|
|
2300
2449
|
perpMarketIndex,
|
|
2301
2450
|
price,
|
|
2302
2451
|
maxPrice
|
|
@@ -2310,7 +2459,6 @@ export class AdminClient extends DriftClient {
|
|
|
2310
2459
|
}
|
|
2311
2460
|
|
|
2312
2461
|
public async getInitializePrelaunchOracleIx(
|
|
2313
|
-
admin: PublicKey,
|
|
2314
2462
|
perpMarketIndex: number,
|
|
2315
2463
|
price?: BN,
|
|
2316
2464
|
maxPrice?: BN
|
|
@@ -2323,7 +2471,9 @@ export class AdminClient extends DriftClient {
|
|
|
2323
2471
|
|
|
2324
2472
|
return await this.program.instruction.initializePrelaunchOracle(params, {
|
|
2325
2473
|
accounts: {
|
|
2326
|
-
admin
|
|
2474
|
+
admin: this.isSubscribed
|
|
2475
|
+
? this.getStateAccount().admin
|
|
2476
|
+
: this.wallet.publicKey,
|
|
2327
2477
|
state: await this.getStatePublicKey(),
|
|
2328
2478
|
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
2329
2479
|
this.program.programId,
|
|
@@ -2336,14 +2486,12 @@ export class AdminClient extends DriftClient {
|
|
|
2336
2486
|
}
|
|
2337
2487
|
|
|
2338
2488
|
public async updatePrelaunchOracleParams(
|
|
2339
|
-
admin: PublicKey,
|
|
2340
2489
|
perpMarketIndex: number,
|
|
2341
2490
|
price?: BN,
|
|
2342
2491
|
maxPrice?: BN
|
|
2343
2492
|
): Promise<TransactionSignature> {
|
|
2344
2493
|
const updatePrelaunchOracleParamsIx =
|
|
2345
2494
|
await this.getUpdatePrelaunchOracleParamsIx(
|
|
2346
|
-
this.wallet.publicKey,
|
|
2347
2495
|
perpMarketIndex,
|
|
2348
2496
|
price,
|
|
2349
2497
|
maxPrice
|
|
@@ -2357,7 +2505,6 @@ export class AdminClient extends DriftClient {
|
|
|
2357
2505
|
}
|
|
2358
2506
|
|
|
2359
2507
|
public async getUpdatePrelaunchOracleParamsIx(
|
|
2360
|
-
admin: PublicKey,
|
|
2361
2508
|
perpMarketIndex: number,
|
|
2362
2509
|
price?: BN,
|
|
2363
2510
|
maxPrice?: BN
|
|
@@ -2375,7 +2522,9 @@ export class AdminClient extends DriftClient {
|
|
|
2375
2522
|
|
|
2376
2523
|
return await this.program.instruction.updatePrelaunchOracleParams(params, {
|
|
2377
2524
|
accounts: {
|
|
2378
|
-
admin
|
|
2525
|
+
admin: this.isSubscribed
|
|
2526
|
+
? this.getStateAccount().admin
|
|
2527
|
+
: this.wallet.publicKey,
|
|
2379
2528
|
state: await this.getStatePublicKey(),
|
|
2380
2529
|
perpMarket: perpMarketPublicKey,
|
|
2381
2530
|
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
@@ -2390,7 +2539,6 @@ export class AdminClient extends DriftClient {
|
|
|
2390
2539
|
perpMarketIndex: number
|
|
2391
2540
|
): Promise<TransactionSignature> {
|
|
2392
2541
|
const deletePrelaunchOracleIx = await this.getDeletePrelaunchOracleIx(
|
|
2393
|
-
this.wallet.publicKey,
|
|
2394
2542
|
perpMarketIndex
|
|
2395
2543
|
);
|
|
2396
2544
|
|
|
@@ -2402,25 +2550,33 @@ export class AdminClient extends DriftClient {
|
|
|
2402
2550
|
}
|
|
2403
2551
|
|
|
2404
2552
|
public async getDeletePrelaunchOracleIx(
|
|
2405
|
-
|
|
2406
|
-
|
|
2553
|
+
perpMarketIndex: number,
|
|
2554
|
+
price?: BN,
|
|
2555
|
+
maxPrice?: BN
|
|
2407
2556
|
): Promise<TransactionInstruction> {
|
|
2408
|
-
|
|
2557
|
+
const params = {
|
|
2409
2558
|
perpMarketIndex,
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
),
|
|
2418
|
-
perpMarket: await getPerpMarketPublicKey(
|
|
2419
|
-
this.program.programId,
|
|
2420
|
-
perpMarketIndex
|
|
2421
|
-
),
|
|
2422
|
-
},
|
|
2423
|
-
}
|
|
2559
|
+
price: price || null,
|
|
2560
|
+
maxPrice: maxPrice || null,
|
|
2561
|
+
};
|
|
2562
|
+
|
|
2563
|
+
const perpMarketPublicKey = await getPerpMarketPublicKey(
|
|
2564
|
+
this.program.programId,
|
|
2565
|
+
perpMarketIndex
|
|
2424
2566
|
);
|
|
2567
|
+
|
|
2568
|
+
return await this.program.instruction.getDeletePrelaunchOracleIx(params, {
|
|
2569
|
+
accounts: {
|
|
2570
|
+
admin: this.isSubscribed
|
|
2571
|
+
? this.getStateAccount().admin
|
|
2572
|
+
: this.wallet.publicKey,
|
|
2573
|
+
state: await this.getStatePublicKey(),
|
|
2574
|
+
perpMarket: perpMarketPublicKey,
|
|
2575
|
+
prelaunchOracle: await getPrelaunchOraclePublicKey(
|
|
2576
|
+
this.program.programId,
|
|
2577
|
+
perpMarketIndex
|
|
2578
|
+
),
|
|
2579
|
+
},
|
|
2580
|
+
});
|
|
2425
2581
|
}
|
|
2426
2582
|
}
|