@drift-labs/sdk 2.73.0-beta.2 → 2.74.0-beta.1
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 +88 -22
- package/lib/idl/drift.json +1 -1
- package/lib/priorityFee/priorityFeeSubscriber.d.ts +1 -0
- package/lib/priorityFee/priorityFeeSubscriber.js +3 -0
- package/package.json +1 -1
- package/src/adminClient.ts +395 -221
- package/src/idl/drift.json +1 -1
- package/src/priorityFee/priorityFeeSubscriber.ts +4 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.74.0-beta.1
|
package/lib/adminClient.js
CHANGED
|
@@ -216,13 +216,16 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
216
216
|
return txSig;
|
|
217
217
|
}
|
|
218
218
|
async updatePerpMarketConcentrationScale(perpMarketIndex, concentrationScale) {
|
|
219
|
-
|
|
219
|
+
const updatePerpMarketConcentrationCoefIx = await this.program.instruction.updatePerpMarketConcentrationCoef(concentrationScale, {
|
|
220
220
|
accounts: {
|
|
221
221
|
state: await this.getStatePublicKey(),
|
|
222
222
|
admin: this.wallet.publicKey,
|
|
223
223
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
224
224
|
},
|
|
225
225
|
});
|
|
226
|
+
const tx = await this.buildTransaction(updatePerpMarketConcentrationCoefIx);
|
|
227
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
228
|
+
return txSig;
|
|
226
229
|
}
|
|
227
230
|
async moveAmmToPrice(perpMarketIndex, targetPrice) {
|
|
228
231
|
const perpMarket = this.getPerpMarketAccount(perpMarketIndex);
|
|
@@ -259,7 +262,7 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
259
262
|
async updatePerpMarketAmmOracleTwap(perpMarketIndex) {
|
|
260
263
|
const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
|
|
261
264
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
262
|
-
|
|
265
|
+
const updatePerpMarketAmmOracleTwapIx = await this.program.instruction.updatePerpMarketAmmOracleTwap({
|
|
263
266
|
accounts: {
|
|
264
267
|
state: await this.getStatePublicKey(),
|
|
265
268
|
admin: this.wallet.publicKey,
|
|
@@ -267,11 +270,14 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
267
270
|
perpMarket: perpMarketPublicKey,
|
|
268
271
|
},
|
|
269
272
|
});
|
|
273
|
+
const tx = await this.buildTransaction(updatePerpMarketAmmOracleTwapIx);
|
|
274
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
275
|
+
return txSig;
|
|
270
276
|
}
|
|
271
277
|
async resetPerpMarketAmmOracleTwap(perpMarketIndex) {
|
|
272
278
|
const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
|
|
273
279
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
274
|
-
|
|
280
|
+
const resetPerpMarketAmmOracleTwapIx = await this.program.instruction.resetPerpMarketAmmOracleTwap({
|
|
275
281
|
accounts: {
|
|
276
282
|
state: await this.getStatePublicKey(),
|
|
277
283
|
admin: this.wallet.publicKey,
|
|
@@ -279,6 +285,9 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
279
285
|
perpMarket: perpMarketPublicKey,
|
|
280
286
|
},
|
|
281
287
|
});
|
|
288
|
+
const tx = await this.buildTransaction(resetPerpMarketAmmOracleTwapIx);
|
|
289
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
290
|
+
return txSig;
|
|
282
291
|
}
|
|
283
292
|
async depositIntoPerpMarketFeePool(perpMarketIndex, amount, sourceVault) {
|
|
284
293
|
const spotMarket = this.getQuoteSpotMarketAccount();
|
|
@@ -312,22 +321,28 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
312
321
|
async updatePerpMarketCurveUpdateIntensity(perpMarketIndex, curveUpdateIntensity) {
|
|
313
322
|
// assert(curveUpdateIntensity >= 0 && curveUpdateIntensity <= 100);
|
|
314
323
|
// assert(Number.isInteger(curveUpdateIntensity));
|
|
315
|
-
|
|
324
|
+
const updatePerpMarketCurveUpdateIntensityIx = await this.program.instruction.updatePerpMarketCurveUpdateIntensity(curveUpdateIntensity, {
|
|
316
325
|
accounts: {
|
|
317
326
|
admin: this.wallet.publicKey,
|
|
318
327
|
state: await this.getStatePublicKey(),
|
|
319
328
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
320
329
|
},
|
|
321
330
|
});
|
|
331
|
+
const tx = await this.buildTransaction(updatePerpMarketCurveUpdateIntensityIx);
|
|
332
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
333
|
+
return txSig;
|
|
322
334
|
}
|
|
323
335
|
async updatePerpMarketTargetBaseAssetAmountPerLp(perpMarketIndex, targetBaseAssetAmountPerLP) {
|
|
324
|
-
|
|
336
|
+
const updatePerpMarketTargetBaseAssetAmountPerLpIx = await this.program.instruction.updatePerpMarketTargetBaseAssetAmountPerLp(targetBaseAssetAmountPerLP, {
|
|
325
337
|
accounts: {
|
|
326
338
|
admin: this.wallet.publicKey,
|
|
327
339
|
state: await this.getStatePublicKey(),
|
|
328
340
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
329
341
|
},
|
|
330
342
|
});
|
|
343
|
+
const tx = await this.buildTransaction(updatePerpMarketTargetBaseAssetAmountPerLpIx);
|
|
344
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
345
|
+
return txSig;
|
|
331
346
|
}
|
|
332
347
|
async updatePerpMarketMarginRatio(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
|
|
333
348
|
const updatePerpMarketMarginRatioIx = await this.program.instruction.updatePerpMarketMarginRatio(marginRatioInitial, marginRatioMaintenance, {
|
|
@@ -342,13 +357,16 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
342
357
|
return txSig;
|
|
343
358
|
}
|
|
344
359
|
async updatePerpMarketImfFactor(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
|
|
345
|
-
|
|
360
|
+
const updatePerpMarketImfFactorIx = await this.program.instruction.updatePerpMarketImfFactor(imfFactor, unrealizedPnlImfFactor, {
|
|
346
361
|
accounts: {
|
|
347
362
|
admin: this.wallet.publicKey,
|
|
348
363
|
state: await this.getStatePublicKey(),
|
|
349
364
|
perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
350
365
|
},
|
|
351
366
|
});
|
|
367
|
+
const tx = await this.buildTransaction(updatePerpMarketImfFactorIx);
|
|
368
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
369
|
+
return txSig;
|
|
352
370
|
}
|
|
353
371
|
async updatePerpMarketBaseSpread(perpMarketIndex, baseSpread) {
|
|
354
372
|
const updatePerpMarketBaseSpreadIx = await this.program.instruction.updatePerpMarketBaseSpread(baseSpread, {
|
|
@@ -389,33 +407,42 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
389
407
|
}
|
|
390
408
|
async updateSpotMarketName(spotMarketIndex, name) {
|
|
391
409
|
const nameBuffer = (0, userName_1.encodeName)(name);
|
|
392
|
-
|
|
410
|
+
const updateSpotMarketNameIx = await this.program.instruction.updateSpotMarketName(nameBuffer, {
|
|
393
411
|
accounts: {
|
|
394
412
|
admin: this.wallet.publicKey,
|
|
395
413
|
state: await this.getStatePublicKey(),
|
|
396
414
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
397
415
|
},
|
|
398
416
|
});
|
|
417
|
+
const tx = await this.buildTransaction(updateSpotMarketNameIx);
|
|
418
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
419
|
+
return txSig;
|
|
399
420
|
}
|
|
400
421
|
async updatePerpMarketPerLpBase(perpMarketIndex, perLpBase) {
|
|
401
422
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
402
|
-
|
|
423
|
+
const updatePerpMarketPerLpBaseIx = await this.program.instruction.updatePerpMarketPerLpBase(perLpBase, {
|
|
403
424
|
accounts: {
|
|
404
425
|
admin: this.wallet.publicKey,
|
|
405
426
|
state: await this.getStatePublicKey(),
|
|
406
427
|
perpMarket: perpMarketPublicKey,
|
|
407
428
|
},
|
|
408
429
|
});
|
|
430
|
+
const tx = await this.buildTransaction(updatePerpMarketPerLpBaseIx);
|
|
431
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
432
|
+
return txSig;
|
|
409
433
|
}
|
|
410
434
|
async updatePerpMarketMaxSpread(perpMarketIndex, maxSpread) {
|
|
411
435
|
const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
|
|
412
|
-
|
|
436
|
+
const updatePerpMarketMaxSpreadIx = await this.program.instruction.updatePerpMarketMaxSpread(maxSpread, {
|
|
413
437
|
accounts: {
|
|
414
438
|
admin: this.wallet.publicKey,
|
|
415
439
|
state: await this.getStatePublicKey(),
|
|
416
440
|
perpMarket: perpMarketPublicKey,
|
|
417
441
|
},
|
|
418
442
|
});
|
|
443
|
+
const tx = await this.buildTransaction(updatePerpMarketMaxSpreadIx);
|
|
444
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
445
|
+
return txSig;
|
|
419
446
|
}
|
|
420
447
|
async updatePerpFeeStructure(feeStructure) {
|
|
421
448
|
const updatePerpFeeStructureIx = this.program.instruction.updatePerpFeeStructure(feeStructure, {
|
|
@@ -440,28 +467,37 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
440
467
|
return txSig;
|
|
441
468
|
}
|
|
442
469
|
async updateInitialPctToLiquidate(initialPctToLiquidate) {
|
|
443
|
-
|
|
470
|
+
const updateInitialPctToLiquidateIx = await this.program.instruction.updateInitialPctToLiquidate(initialPctToLiquidate, {
|
|
444
471
|
accounts: {
|
|
445
472
|
admin: this.wallet.publicKey,
|
|
446
473
|
state: await this.getStatePublicKey(),
|
|
447
474
|
},
|
|
448
475
|
});
|
|
476
|
+
const tx = await this.buildTransaction(updateInitialPctToLiquidateIx);
|
|
477
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
478
|
+
return txSig;
|
|
449
479
|
}
|
|
450
480
|
async updateLiquidationDuration(liquidationDuration) {
|
|
451
|
-
|
|
481
|
+
const updateLiquidationDurationIx = await this.program.instruction.updateLiquidationDuration(liquidationDuration, {
|
|
452
482
|
accounts: {
|
|
453
483
|
admin: this.wallet.publicKey,
|
|
454
484
|
state: await this.getStatePublicKey(),
|
|
455
485
|
},
|
|
456
486
|
});
|
|
487
|
+
const tx = await this.buildTransaction(updateLiquidationDurationIx);
|
|
488
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
489
|
+
return txSig;
|
|
457
490
|
}
|
|
458
491
|
async updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio) {
|
|
459
|
-
|
|
492
|
+
const updateLiquidationMarginBufferRatioIx = await this.program.instruction.updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio, {
|
|
460
493
|
accounts: {
|
|
461
494
|
admin: this.wallet.publicKey,
|
|
462
495
|
state: await this.getStatePublicKey(),
|
|
463
496
|
},
|
|
464
497
|
});
|
|
498
|
+
const tx = await this.buildTransaction(updateLiquidationMarginBufferRatioIx);
|
|
499
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
500
|
+
return txSig;
|
|
465
501
|
}
|
|
466
502
|
async updateOracleGuardRails(oracleGuardRails) {
|
|
467
503
|
const updateOracleGuardRailsIx = await this.program.instruction.updateOracleGuardRails(oracleGuardRails, {
|
|
@@ -475,28 +511,37 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
475
511
|
return txSig;
|
|
476
512
|
}
|
|
477
513
|
async updateStateSettlementDuration(settlementDuration) {
|
|
478
|
-
|
|
514
|
+
const updateStateSettlementDurationIx = await this.program.instruction.updateStateSettlementDuration(settlementDuration, {
|
|
479
515
|
accounts: {
|
|
480
516
|
admin: this.wallet.publicKey,
|
|
481
517
|
state: await this.getStatePublicKey(),
|
|
482
518
|
},
|
|
483
519
|
});
|
|
520
|
+
const tx = await this.buildTransaction(updateStateSettlementDurationIx);
|
|
521
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
522
|
+
return txSig;
|
|
484
523
|
}
|
|
485
524
|
async updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts) {
|
|
486
|
-
|
|
525
|
+
const updateStateMaxNumberOfSubAccountsIx = await this.program.instruction.updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts, {
|
|
487
526
|
accounts: {
|
|
488
527
|
admin: this.wallet.publicKey,
|
|
489
528
|
state: await this.getStatePublicKey(),
|
|
490
529
|
},
|
|
491
530
|
});
|
|
531
|
+
const tx = await this.buildTransaction(updateStateMaxNumberOfSubAccountsIx);
|
|
532
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
533
|
+
return txSig;
|
|
492
534
|
}
|
|
493
535
|
async updateStateMaxInitializeUserFee(maxInitializeUserFee) {
|
|
494
|
-
|
|
536
|
+
const updateStateMaxInitializeUserFeeIx = await this.program.instruction.updateStateMaxInitializeUserFee(maxInitializeUserFee, {
|
|
495
537
|
accounts: {
|
|
496
538
|
admin: this.wallet.publicKey,
|
|
497
539
|
state: await this.getStatePublicKey(),
|
|
498
540
|
},
|
|
499
541
|
});
|
|
542
|
+
const tx = await this.buildTransaction(updateStateMaxInitializeUserFeeIx);
|
|
543
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
544
|
+
return txSig;
|
|
500
545
|
}
|
|
501
546
|
async updateWithdrawGuardThreshold(spotMarketIndex, withdrawGuardThreshold) {
|
|
502
547
|
const updateWithdrawGuardThresholdIx = await this.program.instruction.updateWithdrawGuardThreshold(withdrawGuardThreshold, {
|
|
@@ -655,7 +700,7 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
655
700
|
return txSig;
|
|
656
701
|
}
|
|
657
702
|
async updateSpotMarketOracle(spotMarketIndex, oracle, oracleSource) {
|
|
658
|
-
|
|
703
|
+
const updateSpotMarketOracleIx = await this.program.instruction.updateSpotMarketOracle(oracle, oracleSource, {
|
|
659
704
|
accounts: {
|
|
660
705
|
admin: this.wallet.publicKey,
|
|
661
706
|
state: await this.getStatePublicKey(),
|
|
@@ -663,42 +708,57 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
663
708
|
oracle: oracle,
|
|
664
709
|
},
|
|
665
710
|
});
|
|
711
|
+
const tx = await this.buildTransaction(updateSpotMarketOracleIx);
|
|
712
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
713
|
+
return txSig;
|
|
666
714
|
}
|
|
667
715
|
async updateSpotMarketOrdersEnabled(spotMarketIndex, ordersEnabled) {
|
|
668
|
-
|
|
716
|
+
const updateSpotMarketOrdersEnabledIx = await this.program.instruction.updateSpotMarketOrdersEnabled(ordersEnabled, {
|
|
669
717
|
accounts: {
|
|
670
718
|
admin: this.wallet.publicKey,
|
|
671
719
|
state: await this.getStatePublicKey(),
|
|
672
720
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
673
721
|
},
|
|
674
722
|
});
|
|
723
|
+
const tx = await this.buildTransaction(updateSpotMarketOrdersEnabledIx);
|
|
724
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
725
|
+
return txSig;
|
|
675
726
|
}
|
|
676
727
|
async updateSerumFulfillmentConfigStatus(serumFulfillmentConfig, status) {
|
|
677
|
-
|
|
728
|
+
const updateSerumFulfillmentConfigStatusIx = await this.program.instruction.updateSerumFulfillmentConfigStatus(status, {
|
|
678
729
|
accounts: {
|
|
679
730
|
admin: this.wallet.publicKey,
|
|
680
731
|
state: await this.getStatePublicKey(),
|
|
681
732
|
serumFulfillmentConfig,
|
|
682
733
|
},
|
|
683
734
|
});
|
|
735
|
+
const tx = await this.buildTransaction(updateSerumFulfillmentConfigStatusIx);
|
|
736
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
737
|
+
return txSig;
|
|
684
738
|
}
|
|
685
739
|
async updatePhoenixFulfillmentConfigStatus(phoenixFulfillmentConfig, status) {
|
|
686
|
-
|
|
740
|
+
const updatePhoenixFulfillmentConfigStatusIx = await this.program.instruction.phoenixFulfillmentConfigStatus(status, {
|
|
687
741
|
accounts: {
|
|
688
742
|
admin: this.wallet.publicKey,
|
|
689
743
|
state: await this.getStatePublicKey(),
|
|
690
744
|
phoenixFulfillmentConfig,
|
|
691
745
|
},
|
|
692
746
|
});
|
|
747
|
+
const tx = await this.buildTransaction(updatePhoenixFulfillmentConfigStatusIx);
|
|
748
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
749
|
+
return txSig;
|
|
693
750
|
}
|
|
694
751
|
async updateSpotMarketExpiry(spotMarketIndex, expiryTs) {
|
|
695
|
-
|
|
752
|
+
const updateSpotMarketExpiryIx = await this.program.instruction.updateSpotMarketExpiry(expiryTs, {
|
|
696
753
|
accounts: {
|
|
697
754
|
admin: this.wallet.publicKey,
|
|
698
755
|
state: await this.getStatePublicKey(),
|
|
699
756
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
700
757
|
},
|
|
701
758
|
});
|
|
759
|
+
const tx = await this.buildTransaction(updateSpotMarketExpiryIx);
|
|
760
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
761
|
+
return txSig;
|
|
702
762
|
}
|
|
703
763
|
async updateWhitelistMint(whitelistMint) {
|
|
704
764
|
const updateWhitelistMintIx = await this.program.instruction.updateWhitelistMint(whitelistMint, {
|
|
@@ -723,22 +783,28 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
723
783
|
return txSig;
|
|
724
784
|
}
|
|
725
785
|
async updateSpotMarketMarginWeights(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0) {
|
|
726
|
-
|
|
786
|
+
const updateSpotMarketMarginWeightsIx = await this.program.instruction.updateSpotMarketMarginWeights(initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, {
|
|
727
787
|
accounts: {
|
|
728
788
|
admin: this.wallet.publicKey,
|
|
729
789
|
state: await this.getStatePublicKey(),
|
|
730
790
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
731
791
|
},
|
|
732
792
|
});
|
|
793
|
+
const tx = await this.buildTransaction(updateSpotMarketMarginWeightsIx);
|
|
794
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
795
|
+
return txSig;
|
|
733
796
|
}
|
|
734
797
|
async updateSpotMarketBorrowRate(spotMarketIndex, optimalUtilization, optimalBorrowRate, optimalMaxRate) {
|
|
735
|
-
|
|
798
|
+
const updateSpotMarketBorrowRateIx = await this.program.instruction.updateSpotMarketBorrowRate(optimalUtilization, optimalBorrowRate, optimalMaxRate, {
|
|
736
799
|
accounts: {
|
|
737
800
|
admin: this.wallet.publicKey,
|
|
738
801
|
state: await this.getStatePublicKey(),
|
|
739
802
|
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
740
803
|
},
|
|
741
804
|
});
|
|
805
|
+
const tx = await this.buildTransaction(updateSpotMarketBorrowRateIx);
|
|
806
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
807
|
+
return txSig;
|
|
742
808
|
}
|
|
743
809
|
async updateSpotMarketAssetTier(spotMarketIndex, assetTier) {
|
|
744
810
|
const updateSpotMarketAssetTierIx = await this.program.instruction.updateSpotMarketAssetTier(assetTier, {
|
package/lib/idl/drift.json
CHANGED
|
@@ -27,6 +27,7 @@ export declare class PriorityFeeSubscriber {
|
|
|
27
27
|
private loadForHelius;
|
|
28
28
|
getMaxPriorityFee(): number | undefined;
|
|
29
29
|
updateMaxPriorityFee(newMaxFee: number | undefined): void;
|
|
30
|
+
updateCustomStrategy(newStrategy: PriorityFeeStrategy): void;
|
|
30
31
|
getHeliusPriorityFeeLevel(level?: HeliusPriorityLevel): number;
|
|
31
32
|
getCustomStrategyResult(): number;
|
|
32
33
|
getAvgStrategyResult(): number;
|
|
@@ -87,6 +87,9 @@ class PriorityFeeSubscriber {
|
|
|
87
87
|
updateMaxPriorityFee(newMaxFee) {
|
|
88
88
|
this.maxFeeMicroLamports = newMaxFee;
|
|
89
89
|
}
|
|
90
|
+
updateCustomStrategy(newStrategy) {
|
|
91
|
+
this.customStrategy = newStrategy;
|
|
92
|
+
}
|
|
90
93
|
getHeliusPriorityFeeLevel(level = heliusPriorityFeeMethod_1.HeliusPriorityLevel.MEDIUM) {
|
|
91
94
|
if (this.lastHeliusSample === undefined) {
|
|
92
95
|
return 0;
|
package/package.json
CHANGED
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(
|
|
@@ -1279,75 +1390,124 @@ export class AdminClient extends DriftClient {
|
|
|
1279
1390
|
oracle: PublicKey,
|
|
1280
1391
|
oracleSource: OracleSource
|
|
1281
1392
|
): Promise<TransactionSignature> {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
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;
|
|
1293
1415
|
}
|
|
1294
1416
|
|
|
1295
1417
|
public async updateSpotMarketOrdersEnabled(
|
|
1296
1418
|
spotMarketIndex: number,
|
|
1297
1419
|
ordersEnabled: boolean
|
|
1298
1420
|
): Promise<TransactionSignature> {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
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;
|
|
1309
1441
|
}
|
|
1310
1442
|
|
|
1311
1443
|
public async updateSerumFulfillmentConfigStatus(
|
|
1312
1444
|
serumFulfillmentConfig: PublicKey,
|
|
1313
1445
|
status: SpotFulfillmentConfigStatus
|
|
1314
1446
|
): Promise<TransactionSignature> {
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
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;
|
|
1322
1466
|
}
|
|
1323
1467
|
|
|
1324
1468
|
public async updatePhoenixFulfillmentConfigStatus(
|
|
1325
1469
|
phoenixFulfillmentConfig: PublicKey,
|
|
1326
1470
|
status: SpotFulfillmentConfigStatus
|
|
1327
1471
|
): Promise<TransactionSignature> {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
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;
|
|
1335
1488
|
}
|
|
1336
1489
|
|
|
1337
1490
|
public async updateSpotMarketExpiry(
|
|
1338
1491
|
spotMarketIndex: number,
|
|
1339
1492
|
expiryTs: BN
|
|
1340
1493
|
): Promise<TransactionSignature> {
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
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;
|
|
1351
1511
|
}
|
|
1352
1512
|
|
|
1353
1513
|
public async updateWhitelistMint(
|
|
@@ -1394,23 +1554,30 @@ export class AdminClient extends DriftClient {
|
|
|
1394
1554
|
maintenanceLiabilityWeight: number,
|
|
1395
1555
|
imfFactor = 0
|
|
1396
1556
|
): Promise<TransactionSignature> {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
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;
|
|
1414
1581
|
}
|
|
1415
1582
|
|
|
1416
1583
|
public async updateSpotMarketBorrowRate(
|
|
@@ -1419,21 +1586,28 @@ export class AdminClient extends DriftClient {
|
|
|
1419
1586
|
optimalBorrowRate: number,
|
|
1420
1587
|
optimalMaxRate: number
|
|
1421
1588
|
): Promise<TransactionSignature> {
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
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;
|
|
1437
1611
|
}
|
|
1438
1612
|
|
|
1439
1613
|
public async updateSpotMarketAssetTier(
|
package/src/idl/drift.json
CHANGED
|
@@ -126,6 +126,10 @@ export class PriorityFeeSubscriber {
|
|
|
126
126
|
this.maxFeeMicroLamports = newMaxFee;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
public updateCustomStrategy(newStrategy: PriorityFeeStrategy) {
|
|
130
|
+
this.customStrategy = newStrategy;
|
|
131
|
+
}
|
|
132
|
+
|
|
129
133
|
public getHeliusPriorityFeeLevel(
|
|
130
134
|
level: HeliusPriorityLevel = HeliusPriorityLevel.MEDIUM
|
|
131
135
|
): number {
|