@drift-labs/sdk 2.72.0-beta.3 → 2.73.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 CHANGED
@@ -1 +1 @@
1
- 2.72.0-beta.3
1
+ 2.73.0-beta.0
@@ -23,7 +23,6 @@ export declare class AdminClient extends DriftClient {
23
23
  updatePerpMarketCurveUpdateIntensity(perpMarketIndex: number, curveUpdateIntensity: number): Promise<TransactionSignature>;
24
24
  updatePerpMarketTargetBaseAssetAmountPerLp(perpMarketIndex: number, targetBaseAssetAmountPerLP: number): Promise<TransactionSignature>;
25
25
  updatePerpMarketMarginRatio(perpMarketIndex: number, marginRatioInitial: number, marginRatioMaintenance: number): Promise<TransactionSignature>;
26
- updatePerpMarketFundingPeriod(perpMarketIndex: number, fundingPeriod: BN): Promise<TransactionSignature>;
27
26
  updatePerpMarketImfFactor(perpMarketIndex: number, imfFactor: number, unrealizedPnlImfFactor: number): Promise<TransactionSignature>;
28
27
  updatePerpMarketBaseSpread(perpMarketIndex: number, baseSpread: number): Promise<TransactionSignature>;
29
28
  updateAmmJitIntensity(perpMarketIndex: number, ammJitIntensity: number): Promise<TransactionSignature>;
@@ -84,5 +83,4 @@ export declare class AdminClient extends DriftClient {
84
83
  updateProtocolIfSharesTransferConfig(whitelistedSigners?: PublicKey[], maxTransferPerEpoch?: BN): Promise<TransactionSignature>;
85
84
  initializePrelaunchOracle(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionSignature>;
86
85
  updatePrelaunchOracleParams(perpMarketIndex: number, price?: BN, maxPrice?: BN): Promise<TransactionSignature>;
87
- deletePrelaunchOracle(perpMarketIndex: number): Promise<TransactionSignature>;
88
86
  }
@@ -341,18 +341,6 @@ class AdminClient extends driftClient_1.DriftClient {
341
341
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
342
342
  return txSig;
343
343
  }
344
- async updatePerpMarketFundingPeriod(perpMarketIndex, fundingPeriod) {
345
- const updatePerpMarketMarginRatioIx = await this.program.instruction.updatePerpMarketFundingRate(fundingPeriod, {
346
- accounts: {
347
- admin: this.wallet.publicKey,
348
- state: await this.getStatePublicKey(),
349
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
350
- },
351
- });
352
- const tx = await this.buildTransaction(updatePerpMarketMarginRatioIx);
353
- const { txSig } = await this.sendTransaction(tx, [], this.opts);
354
- return txSig;
355
- }
356
344
  async updatePerpMarketImfFactor(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
357
345
  return await this.program.rpc.updatePerpMarketImfFactor(imfFactor, unrealizedPnlImfFactor, {
358
346
  accounts: {
@@ -824,104 +812,137 @@ class AdminClient extends driftClient_1.DriftClient {
824
812
  return txSig;
825
813
  }
826
814
  async updatePerpAuctionDuration(minDuration) {
827
- return await this.program.rpc.updatePerpAuctionDuration(typeof minDuration === 'number' ? minDuration : minDuration.toNumber(), {
815
+ const updatePerpAuctionDurationIx = await this.program.instruction.updatePerpAuctionDuration(typeof minDuration === 'number' ? minDuration : minDuration.toNumber(), {
828
816
  accounts: {
829
817
  admin: this.wallet.publicKey,
830
818
  state: await this.getStatePublicKey(),
831
819
  },
832
820
  });
821
+ const tx = await this.buildTransaction(updatePerpAuctionDurationIx);
822
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
823
+ return txSig;
833
824
  }
834
825
  async updateSpotAuctionDuration(defaultAuctionDuration) {
835
- return await this.program.rpc.updateSpotAuctionDuration(defaultAuctionDuration, {
826
+ const updateSpotAuctionDurationIx = await this.program.instruction.updateSpotAuctionDuration(defaultAuctionDuration, {
836
827
  accounts: {
837
828
  admin: this.wallet.publicKey,
838
829
  state: await this.getStatePublicKey(),
839
830
  },
840
831
  });
832
+ const tx = await this.buildTransaction(updateSpotAuctionDurationIx);
833
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
834
+ return txSig;
841
835
  }
842
836
  async updatePerpMarketMaxFillReserveFraction(perpMarketIndex, maxBaseAssetAmountRatio) {
843
- return await this.program.rpc.updatePerpMarketMaxFillReserveFraction(maxBaseAssetAmountRatio, {
837
+ const updatePerpMarketMaxFillReserveFractionIx = await this.program.instruction.updatePerpMarketMaxFillReserveFraction(maxBaseAssetAmountRatio, {
844
838
  accounts: {
845
839
  admin: this.wallet.publicKey,
846
840
  state: await this.getStatePublicKey(),
847
841
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
848
842
  },
849
843
  });
844
+ const tx = await this.buildTransaction(updatePerpMarketMaxFillReserveFractionIx);
845
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
846
+ return txSig;
850
847
  }
851
848
  async updateMaxSlippageRatio(perpMarketIndex, maxSlippageRatio) {
852
- return await this.program.rpc.updateMaxSlippageRatio(maxSlippageRatio, {
849
+ const updateMaxSlippageRatioIx = await this.program.instruction.updateMaxSlippageRatio(maxSlippageRatio, {
853
850
  accounts: {
854
851
  admin: this.wallet.publicKey,
855
852
  state: await this.getStatePublicKey(),
856
853
  perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
857
854
  },
858
855
  });
856
+ const tx = await this.buildTransaction(updateMaxSlippageRatioIx);
857
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
858
+ return txSig;
859
859
  }
860
860
  async updatePerpMarketUnrealizedAssetWeight(perpMarketIndex, unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight) {
861
- return await this.program.rpc.updatePerpMarketUnrealizedAssetWeight(unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight, {
861
+ const updatePerpMarketUnrealizedAssetWeightIx = await this.program.instruction.updatePerpMarketUnrealizedAssetWeight(unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight, {
862
862
  accounts: {
863
863
  admin: this.wallet.publicKey,
864
864
  state: await this.getStatePublicKey(),
865
865
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
866
866
  },
867
867
  });
868
+ const tx = await this.buildTransaction(updatePerpMarketUnrealizedAssetWeightIx);
869
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
870
+ return txSig;
868
871
  }
869
872
  async updatePerpMarketMaxImbalances(perpMarketIndex, unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance) {
870
- return await this.program.rpc.updatePerpMarketMaxImbalances(unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, {
873
+ const updatePerpMarketMaxImabalancesIx = await this.program.instruction.updatePerpMarketMaxImbalances(unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, {
871
874
  accounts: {
872
875
  admin: this.wallet.publicKey,
873
876
  state: await this.getStatePublicKey(),
874
877
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
875
878
  },
876
879
  });
880
+ const tx = await this.buildTransaction(updatePerpMarketMaxImabalancesIx);
881
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
882
+ return txSig;
877
883
  }
878
884
  async updatePerpMarketMaxOpenInterest(perpMarketIndex, maxOpenInterest) {
879
- return await this.program.rpc.updatePerpMarketMaxOpenInterest(maxOpenInterest, {
885
+ const updatePerpMarketMaxOpenInterestIx = await this.program.instruction.updatePerpMarketMaxOpenInterest(maxOpenInterest, {
880
886
  accounts: {
881
887
  admin: this.wallet.publicKey,
882
888
  state: await this.getStatePublicKey(),
883
889
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
884
890
  },
885
891
  });
892
+ const tx = await this.buildTransaction(updatePerpMarketMaxOpenInterestIx);
893
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
894
+ return txSig;
886
895
  }
887
896
  async updatePerpMarketFeeAdjustment(perpMarketIndex, feeAdjustment) {
888
- return await this.program.rpc.updatePerpMarketFeeAdjustment(feeAdjustment, {
897
+ const updatepPerpMarketFeeAdjustmentIx = await this.program.instruction.updatePerpMarketFeeAdjustment(feeAdjustment, {
889
898
  accounts: {
890
899
  admin: this.wallet.publicKey,
891
900
  state: await this.getStatePublicKey(),
892
901
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
893
902
  },
894
903
  });
904
+ const tx = await this.buildTransaction(updatepPerpMarketFeeAdjustmentIx);
905
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
906
+ return txSig;
895
907
  }
896
908
  async updateSerumVault(srmVault) {
897
- return await this.program.rpc.updateSerumVault({
909
+ const updateSerumVaultIx = await this.program.instruction.updateSerumVault(srmVault, {
898
910
  accounts: {
899
911
  admin: this.wallet.publicKey,
900
912
  state: await this.getStatePublicKey(),
901
913
  srmVault: srmVault,
902
914
  },
903
915
  });
916
+ const tx = await this.buildTransaction(updateSerumVaultIx);
917
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
918
+ return txSig;
904
919
  }
905
920
  async updatePerpMarketLiquidationFee(perpMarketIndex, liquidatorFee, ifLiquidationFee) {
906
- return await this.program.rpc.updatePerpMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
921
+ const updatePerpMarketLiquidationFeeIx = await this.program.instruction.updatePerpMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
907
922
  accounts: {
908
923
  admin: this.wallet.publicKey,
909
924
  state: await this.getStatePublicKey(),
910
925
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
911
926
  },
912
927
  });
928
+ const tx = await this.buildTransaction(updatePerpMarketLiquidationFeeIx);
929
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
930
+ return txSig;
913
931
  }
914
932
  async updateSpotMarketLiquidationFee(spotMarketIndex, liquidatorFee, ifLiquidationFee) {
915
- return await this.program.rpc.updateSpotMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
933
+ const updateSpotMarketLiquidationFeeIx = await this.program.instruction.updateSpotMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
916
934
  accounts: {
917
935
  admin: this.wallet.publicKey,
918
936
  state: await this.getStatePublicKey(),
919
937
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
920
938
  },
921
939
  });
940
+ const tx = await this.buildTransaction(updateSpotMarketLiquidationFeeIx);
941
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
942
+ return txSig;
922
943
  }
923
944
  async initializeProtocolIfSharesTransferConfig() {
924
- return await this.program.rpc.initializeProtocolIfSharesTransferConfig({
945
+ const initializeProtocolIfSharesTransferConfigIx = await this.program.instruction.initializeProtocolIfSharesTransferConfig({
925
946
  accounts: {
926
947
  admin: this.wallet.publicKey,
927
948
  state: await this.getStatePublicKey(),
@@ -930,15 +951,21 @@ class AdminClient extends driftClient_1.DriftClient {
930
951
  protocolIfSharesTransferConfig: (0, pda_1.getProtocolIfSharesTransferConfigPublicKey)(this.program.programId),
931
952
  },
932
953
  });
954
+ const tx = await this.buildTransaction(initializeProtocolIfSharesTransferConfigIx);
955
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
956
+ return txSig;
933
957
  }
934
958
  async updateProtocolIfSharesTransferConfig(whitelistedSigners, maxTransferPerEpoch) {
935
- return await this.program.rpc.updateProtocolIfSharesTransferConfig(whitelistedSigners || null, maxTransferPerEpoch, {
959
+ const updateProtocolIfSharesTransferConfigIx = await this.program.instruction.updateProtocolIfSharesTransferConfig(whitelistedSigners || null, maxTransferPerEpoch, {
936
960
  accounts: {
937
961
  admin: this.wallet.publicKey,
938
962
  state: await this.getStatePublicKey(),
939
963
  protocolIfSharesTransferConfig: (0, pda_1.getProtocolIfSharesTransferConfigPublicKey)(this.program.programId),
940
964
  },
941
965
  });
966
+ const tx = await this.buildTransaction(updateProtocolIfSharesTransferConfigIx);
967
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
968
+ return txSig;
942
969
  }
943
970
  async initializePrelaunchOracle(perpMarketIndex, price, maxPrice) {
944
971
  const params = {
@@ -946,7 +973,7 @@ class AdminClient extends driftClient_1.DriftClient {
946
973
  price: price || null,
947
974
  maxPrice: maxPrice || null,
948
975
  };
949
- return await this.program.rpc.initializePrelaunchOracle(params, {
976
+ const initializePrelaunchOracleIx = await this.program.instruction.initializePrelaunchOracle(params, {
950
977
  accounts: {
951
978
  admin: this.wallet.publicKey,
952
979
  state: await this.getStatePublicKey(),
@@ -955,6 +982,9 @@ class AdminClient extends driftClient_1.DriftClient {
955
982
  systemProgram: anchor.web3.SystemProgram.programId,
956
983
  },
957
984
  });
985
+ const tx = await this.buildTransaction(initializePrelaunchOracleIx);
986
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
987
+ return txSig;
958
988
  }
959
989
  async updatePrelaunchOracleParams(perpMarketIndex, price, maxPrice) {
960
990
  const params = {
@@ -962,24 +992,16 @@ class AdminClient extends driftClient_1.DriftClient {
962
992
  price: price || null,
963
993
  maxPrice: maxPrice || null,
964
994
  };
965
- return await this.program.rpc.updatePrelaunchOracleParams(params, {
966
- accounts: {
967
- admin: this.wallet.publicKey,
968
- state: await this.getStatePublicKey(),
969
- prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
970
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
971
- },
972
- });
973
- }
974
- async deletePrelaunchOracle(perpMarketIndex) {
975
- return await this.program.rpc.deletePrelaunchOracle(perpMarketIndex, {
995
+ const updatePrelaunchOracleParamsIx = await this.program.instruction.updatePrelaunchOracleParams(params, {
976
996
  accounts: {
977
997
  admin: this.wallet.publicKey,
978
998
  state: await this.getStatePublicKey(),
979
999
  prelaunchOracle: await (0, pda_1.getPrelaunchOraclePublicKey)(this.program.programId, perpMarketIndex),
980
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
981
1000
  },
982
1001
  });
1002
+ const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
1003
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1004
+ return txSig;
983
1005
  }
984
1006
  }
985
1007
  exports.AdminClient = AdminClient;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.71.0",
2
+ "version": "2.72.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.72.0-beta.3",
3
+ "version": "2.73.0-beta.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -650,32 +650,6 @@ export class AdminClient extends DriftClient {
650
650
  return txSig;
651
651
  }
652
652
 
653
- public async updatePerpMarketFundingPeriod(
654
- perpMarketIndex: number,
655
- fundingPeriod: BN
656
- ): Promise<TransactionSignature> {
657
- const updatePerpMarketMarginRatioIx =
658
- await this.program.instruction.updatePerpMarketFundingRate(
659
- fundingPeriod,
660
- {
661
- accounts: {
662
- admin: this.wallet.publicKey,
663
- state: await this.getStatePublicKey(),
664
- perpMarket: await getPerpMarketPublicKey(
665
- this.program.programId,
666
- perpMarketIndex
667
- ),
668
- },
669
- }
670
- );
671
-
672
- const tx = await this.buildTransaction(updatePerpMarketMarginRatioIx);
673
-
674
- const { txSig } = await this.sendTransaction(tx, [], this.opts);
675
-
676
- return txSig;
677
- }
678
-
679
653
  public async updatePerpMarketImfFactor(
680
654
  perpMarketIndex: number,
681
655
  imfFactor: number,
@@ -1601,61 +1575,91 @@ export class AdminClient extends DriftClient {
1601
1575
  public async updatePerpAuctionDuration(
1602
1576
  minDuration: BN | number
1603
1577
  ): Promise<TransactionSignature> {
1604
- return await this.program.rpc.updatePerpAuctionDuration(
1605
- typeof minDuration === 'number' ? minDuration : minDuration.toNumber(),
1606
- {
1607
- accounts: {
1608
- admin: this.wallet.publicKey,
1609
- state: await this.getStatePublicKey(),
1610
- },
1611
- }
1612
- );
1578
+ const updatePerpAuctionDurationIx =
1579
+ await this.program.instruction.updatePerpAuctionDuration(
1580
+ typeof minDuration === 'number' ? minDuration : minDuration.toNumber(),
1581
+ {
1582
+ accounts: {
1583
+ admin: this.wallet.publicKey,
1584
+ state: await this.getStatePublicKey(),
1585
+ },
1586
+ }
1587
+ );
1588
+
1589
+ const tx = await this.buildTransaction(updatePerpAuctionDurationIx);
1590
+
1591
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1592
+
1593
+ return txSig;
1613
1594
  }
1614
1595
 
1615
1596
  public async updateSpotAuctionDuration(
1616
1597
  defaultAuctionDuration: number
1617
1598
  ): Promise<TransactionSignature> {
1618
- return await this.program.rpc.updateSpotAuctionDuration(
1619
- defaultAuctionDuration,
1620
- {
1621
- accounts: {
1622
- admin: this.wallet.publicKey,
1623
- state: await this.getStatePublicKey(),
1624
- },
1625
- }
1626
- );
1599
+ const updateSpotAuctionDurationIx =
1600
+ await this.program.instruction.updateSpotAuctionDuration(
1601
+ defaultAuctionDuration,
1602
+ {
1603
+ accounts: {
1604
+ admin: this.wallet.publicKey,
1605
+ state: await this.getStatePublicKey(),
1606
+ },
1607
+ }
1608
+ );
1609
+
1610
+ const tx = await this.buildTransaction(updateSpotAuctionDurationIx);
1611
+
1612
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1613
+
1614
+ return txSig;
1627
1615
  }
1628
1616
 
1629
1617
  public async updatePerpMarketMaxFillReserveFraction(
1630
1618
  perpMarketIndex: number,
1631
1619
  maxBaseAssetAmountRatio: number
1632
1620
  ): Promise<TransactionSignature> {
1633
- return await this.program.rpc.updatePerpMarketMaxFillReserveFraction(
1634
- maxBaseAssetAmountRatio,
1635
- {
1636
- accounts: {
1637
- admin: this.wallet.publicKey,
1638
- state: await this.getStatePublicKey(),
1639
- perpMarket: await getPerpMarketPublicKey(
1640
- this.program.programId,
1641
- perpMarketIndex
1642
- ),
1643
- },
1644
- }
1621
+ const updatePerpMarketMaxFillReserveFractionIx =
1622
+ await this.program.instruction.updatePerpMarketMaxFillReserveFraction(
1623
+ maxBaseAssetAmountRatio,
1624
+ {
1625
+ accounts: {
1626
+ admin: this.wallet.publicKey,
1627
+ state: await this.getStatePublicKey(),
1628
+ perpMarket: await getPerpMarketPublicKey(
1629
+ this.program.programId,
1630
+ perpMarketIndex
1631
+ ),
1632
+ },
1633
+ }
1634
+ );
1635
+
1636
+ const tx = await this.buildTransaction(
1637
+ updatePerpMarketMaxFillReserveFractionIx
1645
1638
  );
1639
+
1640
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1641
+
1642
+ return txSig;
1646
1643
  }
1647
1644
 
1648
1645
  public async updateMaxSlippageRatio(
1649
1646
  perpMarketIndex: number,
1650
1647
  maxSlippageRatio: number
1651
1648
  ): Promise<TransactionSignature> {
1652
- return await this.program.rpc.updateMaxSlippageRatio(maxSlippageRatio, {
1653
- accounts: {
1654
- admin: this.wallet.publicKey,
1655
- state: await this.getStatePublicKey(),
1656
- perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
1657
- },
1658
- });
1649
+ const updateMaxSlippageRatioIx =
1650
+ await this.program.instruction.updateMaxSlippageRatio(maxSlippageRatio, {
1651
+ accounts: {
1652
+ admin: this.wallet.publicKey,
1653
+ state: await this.getStatePublicKey(),
1654
+ perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
1655
+ },
1656
+ });
1657
+
1658
+ const tx = await this.buildTransaction(updateMaxSlippageRatioIx);
1659
+
1660
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1661
+
1662
+ return txSig;
1659
1663
  }
1660
1664
 
1661
1665
  public async updatePerpMarketUnrealizedAssetWeight(
@@ -1663,20 +1667,29 @@ export class AdminClient extends DriftClient {
1663
1667
  unrealizedInitialAssetWeight: number,
1664
1668
  unrealizedMaintenanceAssetWeight: number
1665
1669
  ): Promise<TransactionSignature> {
1666
- return await this.program.rpc.updatePerpMarketUnrealizedAssetWeight(
1667
- unrealizedInitialAssetWeight,
1668
- unrealizedMaintenanceAssetWeight,
1669
- {
1670
- accounts: {
1671
- admin: this.wallet.publicKey,
1672
- state: await this.getStatePublicKey(),
1673
- perpMarket: await getPerpMarketPublicKey(
1674
- this.program.programId,
1675
- perpMarketIndex
1676
- ),
1677
- },
1678
- }
1670
+ const updatePerpMarketUnrealizedAssetWeightIx =
1671
+ await this.program.instruction.updatePerpMarketUnrealizedAssetWeight(
1672
+ unrealizedInitialAssetWeight,
1673
+ unrealizedMaintenanceAssetWeight,
1674
+ {
1675
+ accounts: {
1676
+ admin: this.wallet.publicKey,
1677
+ state: await this.getStatePublicKey(),
1678
+ perpMarket: await getPerpMarketPublicKey(
1679
+ this.program.programId,
1680
+ perpMarketIndex
1681
+ ),
1682
+ },
1683
+ }
1684
+ );
1685
+
1686
+ const tx = await this.buildTransaction(
1687
+ updatePerpMarketUnrealizedAssetWeightIx
1679
1688
  );
1689
+
1690
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1691
+
1692
+ return txSig;
1680
1693
  }
1681
1694
 
1682
1695
  public async updatePerpMarketMaxImbalances(
@@ -1685,89 +1698,129 @@ export class AdminClient extends DriftClient {
1685
1698
  maxRevenueWithdrawPerPeriod: BN,
1686
1699
  quoteMaxInsurance: BN
1687
1700
  ): Promise<TransactionSignature> {
1688
- return await this.program.rpc.updatePerpMarketMaxImbalances(
1689
- unrealizedMaxImbalance,
1690
- maxRevenueWithdrawPerPeriod,
1691
- quoteMaxInsurance,
1692
- {
1693
- accounts: {
1694
- admin: this.wallet.publicKey,
1695
- state: await this.getStatePublicKey(),
1696
- perpMarket: await getPerpMarketPublicKey(
1697
- this.program.programId,
1698
- perpMarketIndex
1699
- ),
1700
- },
1701
- }
1702
- );
1701
+ const updatePerpMarketMaxImabalancesIx =
1702
+ await this.program.instruction.updatePerpMarketMaxImbalances(
1703
+ unrealizedMaxImbalance,
1704
+ maxRevenueWithdrawPerPeriod,
1705
+ quoteMaxInsurance,
1706
+ {
1707
+ accounts: {
1708
+ admin: this.wallet.publicKey,
1709
+ state: await this.getStatePublicKey(),
1710
+ perpMarket: await getPerpMarketPublicKey(
1711
+ this.program.programId,
1712
+ perpMarketIndex
1713
+ ),
1714
+ },
1715
+ }
1716
+ );
1717
+
1718
+ const tx = await this.buildTransaction(updatePerpMarketMaxImabalancesIx);
1719
+
1720
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1721
+
1722
+ return txSig;
1703
1723
  }
1704
1724
 
1705
1725
  public async updatePerpMarketMaxOpenInterest(
1706
1726
  perpMarketIndex: number,
1707
1727
  maxOpenInterest: BN
1708
1728
  ): Promise<TransactionSignature> {
1709
- return await this.program.rpc.updatePerpMarketMaxOpenInterest(
1710
- maxOpenInterest,
1711
- {
1712
- accounts: {
1713
- admin: this.wallet.publicKey,
1714
- state: await this.getStatePublicKey(),
1715
- perpMarket: await getPerpMarketPublicKey(
1716
- this.program.programId,
1717
- perpMarketIndex
1718
- ),
1719
- },
1720
- }
1721
- );
1729
+ const updatePerpMarketMaxOpenInterestIx =
1730
+ await this.program.instruction.updatePerpMarketMaxOpenInterest(
1731
+ maxOpenInterest,
1732
+ {
1733
+ accounts: {
1734
+ admin: this.wallet.publicKey,
1735
+ state: await this.getStatePublicKey(),
1736
+ perpMarket: await getPerpMarketPublicKey(
1737
+ this.program.programId,
1738
+ perpMarketIndex
1739
+ ),
1740
+ },
1741
+ }
1742
+ );
1743
+
1744
+ const tx = await this.buildTransaction(updatePerpMarketMaxOpenInterestIx);
1745
+
1746
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1747
+
1748
+ return txSig;
1722
1749
  }
1723
1750
 
1724
1751
  public async updatePerpMarketFeeAdjustment(
1725
1752
  perpMarketIndex: number,
1726
1753
  feeAdjustment: number
1727
1754
  ): Promise<TransactionSignature> {
1728
- return await this.program.rpc.updatePerpMarketFeeAdjustment(feeAdjustment, {
1729
- accounts: {
1730
- admin: this.wallet.publicKey,
1731
- state: await this.getStatePublicKey(),
1732
- perpMarket: await getPerpMarketPublicKey(
1733
- this.program.programId,
1734
- perpMarketIndex
1735
- ),
1736
- },
1737
- });
1755
+ const updatepPerpMarketFeeAdjustmentIx =
1756
+ await this.program.instruction.updatePerpMarketFeeAdjustment(
1757
+ feeAdjustment,
1758
+ {
1759
+ accounts: {
1760
+ admin: this.wallet.publicKey,
1761
+ state: await this.getStatePublicKey(),
1762
+ perpMarket: await getPerpMarketPublicKey(
1763
+ this.program.programId,
1764
+ perpMarketIndex
1765
+ ),
1766
+ },
1767
+ }
1768
+ );
1769
+
1770
+ const tx = await this.buildTransaction(updatepPerpMarketFeeAdjustmentIx);
1771
+
1772
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1773
+
1774
+ return txSig;
1738
1775
  }
1739
1776
 
1740
1777
  public async updateSerumVault(
1741
1778
  srmVault: PublicKey
1742
1779
  ): Promise<TransactionSignature> {
1743
- return await this.program.rpc.updateSerumVault({
1744
- accounts: {
1745
- admin: this.wallet.publicKey,
1746
- state: await this.getStatePublicKey(),
1747
- srmVault: srmVault,
1748
- },
1749
- });
1750
- }
1751
-
1752
- public async updatePerpMarketLiquidationFee(
1753
- perpMarketIndex: number,
1754
- liquidatorFee: number,
1755
- ifLiquidationFee: number
1756
- ): Promise<TransactionSignature> {
1757
- return await this.program.rpc.updatePerpMarketLiquidationFee(
1758
- liquidatorFee,
1759
- ifLiquidationFee,
1780
+ const updateSerumVaultIx = await this.program.instruction.updateSerumVault(
1781
+ srmVault,
1760
1782
  {
1761
1783
  accounts: {
1762
1784
  admin: this.wallet.publicKey,
1763
1785
  state: await this.getStatePublicKey(),
1764
- perpMarket: await getPerpMarketPublicKey(
1765
- this.program.programId,
1766
- perpMarketIndex
1767
- ),
1786
+ srmVault: srmVault,
1768
1787
  },
1769
1788
  }
1770
1789
  );
1790
+
1791
+ const tx = await this.buildTransaction(updateSerumVaultIx);
1792
+
1793
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1794
+
1795
+ return txSig;
1796
+ }
1797
+
1798
+ public async updatePerpMarketLiquidationFee(
1799
+ perpMarketIndex: number,
1800
+ liquidatorFee: number,
1801
+ ifLiquidationFee: number
1802
+ ): Promise<TransactionSignature> {
1803
+ const updatePerpMarketLiquidationFeeIx =
1804
+ await this.program.instruction.updatePerpMarketLiquidationFee(
1805
+ liquidatorFee,
1806
+ ifLiquidationFee,
1807
+ {
1808
+ accounts: {
1809
+ admin: this.wallet.publicKey,
1810
+ state: await this.getStatePublicKey(),
1811
+ perpMarket: await getPerpMarketPublicKey(
1812
+ this.program.programId,
1813
+ perpMarketIndex
1814
+ ),
1815
+ },
1816
+ }
1817
+ );
1818
+
1819
+ const tx = await this.buildTransaction(updatePerpMarketLiquidationFeeIx);
1820
+
1821
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1822
+
1823
+ return txSig;
1771
1824
  }
1772
1825
 
1773
1826
  public async updateSpotMarketLiquidationFee(
@@ -1775,51 +1828,78 @@ export class AdminClient extends DriftClient {
1775
1828
  liquidatorFee: number,
1776
1829
  ifLiquidationFee: number
1777
1830
  ): Promise<TransactionSignature> {
1778
- return await this.program.rpc.updateSpotMarketLiquidationFee(
1779
- liquidatorFee,
1780
- ifLiquidationFee,
1781
- {
1831
+ const updateSpotMarketLiquidationFeeIx =
1832
+ await this.program.instruction.updateSpotMarketLiquidationFee(
1833
+ liquidatorFee,
1834
+ ifLiquidationFee,
1835
+ {
1836
+ accounts: {
1837
+ admin: this.wallet.publicKey,
1838
+ state: await this.getStatePublicKey(),
1839
+ spotMarket: await getSpotMarketPublicKey(
1840
+ this.program.programId,
1841
+ spotMarketIndex
1842
+ ),
1843
+ },
1844
+ }
1845
+ );
1846
+
1847
+ const tx = await this.buildTransaction(updateSpotMarketLiquidationFeeIx);
1848
+
1849
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1850
+
1851
+ return txSig;
1852
+ }
1853
+
1854
+ public async initializeProtocolIfSharesTransferConfig(): Promise<TransactionSignature> {
1855
+ const initializeProtocolIfSharesTransferConfigIx =
1856
+ await this.program.instruction.initializeProtocolIfSharesTransferConfig({
1782
1857
  accounts: {
1783
1858
  admin: this.wallet.publicKey,
1784
1859
  state: await this.getStatePublicKey(),
1785
- spotMarket: await getSpotMarketPublicKey(
1786
- this.program.programId,
1787
- spotMarketIndex
1788
- ),
1860
+ rent: SYSVAR_RENT_PUBKEY,
1861
+ systemProgram: anchor.web3.SystemProgram.programId,
1862
+ protocolIfSharesTransferConfig:
1863
+ getProtocolIfSharesTransferConfigPublicKey(this.program.programId),
1789
1864
  },
1790
- }
1865
+ });
1866
+
1867
+ const tx = await this.buildTransaction(
1868
+ initializeProtocolIfSharesTransferConfigIx
1791
1869
  );
1792
- }
1793
1870
 
1794
- public async initializeProtocolIfSharesTransferConfig(): Promise<TransactionSignature> {
1795
- return await this.program.rpc.initializeProtocolIfSharesTransferConfig({
1796
- accounts: {
1797
- admin: this.wallet.publicKey,
1798
- state: await this.getStatePublicKey(),
1799
- rent: SYSVAR_RENT_PUBKEY,
1800
- systemProgram: anchor.web3.SystemProgram.programId,
1801
- protocolIfSharesTransferConfig:
1802
- getProtocolIfSharesTransferConfigPublicKey(this.program.programId),
1803
- },
1804
- });
1871
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1872
+
1873
+ return txSig;
1805
1874
  }
1806
1875
 
1807
1876
  public async updateProtocolIfSharesTransferConfig(
1808
1877
  whitelistedSigners?: PublicKey[],
1809
1878
  maxTransferPerEpoch?: BN
1810
1879
  ): Promise<TransactionSignature> {
1811
- return await this.program.rpc.updateProtocolIfSharesTransferConfig(
1812
- whitelistedSigners || null,
1813
- maxTransferPerEpoch,
1814
- {
1815
- accounts: {
1816
- admin: this.wallet.publicKey,
1817
- state: await this.getStatePublicKey(),
1818
- protocolIfSharesTransferConfig:
1819
- getProtocolIfSharesTransferConfigPublicKey(this.program.programId),
1820
- },
1821
- }
1880
+ const updateProtocolIfSharesTransferConfigIx =
1881
+ await this.program.instruction.updateProtocolIfSharesTransferConfig(
1882
+ whitelistedSigners || null,
1883
+ maxTransferPerEpoch,
1884
+ {
1885
+ accounts: {
1886
+ admin: this.wallet.publicKey,
1887
+ state: await this.getStatePublicKey(),
1888
+ protocolIfSharesTransferConfig:
1889
+ getProtocolIfSharesTransferConfigPublicKey(
1890
+ this.program.programId
1891
+ ),
1892
+ },
1893
+ }
1894
+ );
1895
+
1896
+ const tx = await this.buildTransaction(
1897
+ updateProtocolIfSharesTransferConfigIx
1822
1898
  );
1899
+
1900
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1901
+
1902
+ return txSig;
1823
1903
  }
1824
1904
 
1825
1905
  public async initializePrelaunchOracle(
@@ -1832,18 +1912,26 @@ export class AdminClient extends DriftClient {
1832
1912
  price: price || null,
1833
1913
  maxPrice: maxPrice || null,
1834
1914
  };
1835
- return await this.program.rpc.initializePrelaunchOracle(params, {
1836
- accounts: {
1837
- admin: this.wallet.publicKey,
1838
- state: await this.getStatePublicKey(),
1839
- prelaunchOracle: await getPrelaunchOraclePublicKey(
1840
- this.program.programId,
1841
- perpMarketIndex
1842
- ),
1843
- rent: SYSVAR_RENT_PUBKEY,
1844
- systemProgram: anchor.web3.SystemProgram.programId,
1845
- },
1846
- });
1915
+
1916
+ const initializePrelaunchOracleIx =
1917
+ await this.program.instruction.initializePrelaunchOracle(params, {
1918
+ accounts: {
1919
+ admin: this.wallet.publicKey,
1920
+ state: await this.getStatePublicKey(),
1921
+ prelaunchOracle: await getPrelaunchOraclePublicKey(
1922
+ this.program.programId,
1923
+ perpMarketIndex
1924
+ ),
1925
+ rent: SYSVAR_RENT_PUBKEY,
1926
+ systemProgram: anchor.web3.SystemProgram.programId,
1927
+ },
1928
+ });
1929
+
1930
+ const tx = await this.buildTransaction(initializePrelaunchOracleIx);
1931
+
1932
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1933
+
1934
+ return txSig;
1847
1935
  }
1848
1936
 
1849
1937
  public async updatePrelaunchOracleParams(
@@ -1856,38 +1944,23 @@ export class AdminClient extends DriftClient {
1856
1944
  price: price || null,
1857
1945
  maxPrice: maxPrice || null,
1858
1946
  };
1859
- return await this.program.rpc.updatePrelaunchOracleParams(params, {
1860
- accounts: {
1861
- admin: this.wallet.publicKey,
1862
- state: await this.getStatePublicKey(),
1863
- prelaunchOracle: await getPrelaunchOraclePublicKey(
1864
- this.program.programId,
1865
- perpMarketIndex
1866
- ),
1867
- perpMarket: await getPerpMarketPublicKey(
1868
- this.program.programId,
1869
- perpMarketIndex
1870
- ),
1871
- },
1872
- });
1873
- }
1874
1947
 
1875
- public async deletePrelaunchOracle(
1876
- perpMarketIndex: number
1877
- ): Promise<TransactionSignature> {
1878
- return await this.program.rpc.deletePrelaunchOracle(perpMarketIndex, {
1879
- accounts: {
1880
- admin: this.wallet.publicKey,
1881
- state: await this.getStatePublicKey(),
1882
- prelaunchOracle: await getPrelaunchOraclePublicKey(
1883
- this.program.programId,
1884
- perpMarketIndex
1885
- ),
1886
- perpMarket: await getPerpMarketPublicKey(
1887
- this.program.programId,
1888
- perpMarketIndex
1889
- ),
1890
- },
1891
- });
1948
+ const updatePrelaunchOracleParamsIx =
1949
+ await this.program.instruction.updatePrelaunchOracleParams(params, {
1950
+ accounts: {
1951
+ admin: this.wallet.publicKey,
1952
+ state: await this.getStatePublicKey(),
1953
+ prelaunchOracle: await getPrelaunchOraclePublicKey(
1954
+ this.program.programId,
1955
+ perpMarketIndex
1956
+ ),
1957
+ },
1958
+ });
1959
+
1960
+ const tx = await this.buildTransaction(updatePrelaunchOracleParamsIx);
1961
+
1962
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1963
+
1964
+ return txSig;
1892
1965
  }
1893
1966
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.71.0",
2
+ "version": "2.72.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {