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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.36.1-beta.1
1
+ 2.36.1-beta.3
@@ -550,6 +550,8 @@ export declare class DriftClient {
550
550
  getResolveSpotBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number): Promise<TransactionInstruction>;
551
551
  updateFundingRate(perpMarketIndex: number, oracle: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
552
552
  getUpdateFundingRateIx(perpMarketIndex: number, oracle: PublicKey): Promise<TransactionInstruction>;
553
+ updatePerpBidAskTwap(perpMarketIndex: number, makers: [PublicKey, PublicKey][], txParams?: TxParams): Promise<TransactionSignature>;
554
+ getUpdatePerpBidAskTwapIx(perpMarketIndex: number, makers: [PublicKey, PublicKey][]): Promise<TransactionInstruction>;
553
555
  settleFundingPayment(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
554
556
  getSettleFundingPaymentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
555
557
  triggerEvent(eventName: keyof DriftClientAccountEvents, data?: any): void;
@@ -2813,6 +2813,36 @@ class DriftClient {
2813
2813
  },
2814
2814
  });
2815
2815
  }
2816
+ async updatePerpBidAskTwap(perpMarketIndex, makers, txParams) {
2817
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdatePerpBidAskTwapIx(perpMarketIndex, makers), txParams), [], this.opts);
2818
+ return txSig;
2819
+ }
2820
+ async getUpdatePerpBidAskTwapIx(perpMarketIndex, makers) {
2821
+ const perpMarket = this.getPerpMarketAccount(perpMarketIndex);
2822
+ const remainingAccounts = [];
2823
+ for (const [maker, makerStats] of makers) {
2824
+ remainingAccounts.push({
2825
+ pubkey: maker,
2826
+ isWritable: false,
2827
+ isSigner: false,
2828
+ });
2829
+ remainingAccounts.push({
2830
+ pubkey: makerStats,
2831
+ isWritable: false,
2832
+ isSigner: false,
2833
+ });
2834
+ }
2835
+ return await this.program.instruction.updatePerpBidAskTwap(perpMarketIndex, {
2836
+ accounts: {
2837
+ state: await this.getStatePublicKey(),
2838
+ perpMarket: perpMarket.pubkey,
2839
+ oracle: perpMarket.amm.oracle,
2840
+ authority: this.wallet.publicKey,
2841
+ keeperStats: this.getUserStatsAccountPublicKey(),
2842
+ },
2843
+ remainingAccounts,
2844
+ });
2845
+ }
2816
2846
  async settleFundingPayment(userAccountPublicKey, txParams) {
2817
2847
  const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getSettleFundingPaymentIx(userAccountPublicKey), txParams), [], this.opts);
2818
2848
  return txSig;
@@ -1389,6 +1389,32 @@
1389
1389
  ],
1390
1390
  "args": []
1391
1391
  },
1392
+ {
1393
+ "name": "adminDisableUpdatePerpBidAskTwap",
1394
+ "accounts": [
1395
+ {
1396
+ "name": "admin",
1397
+ "isMut": false,
1398
+ "isSigner": true
1399
+ },
1400
+ {
1401
+ "name": "state",
1402
+ "isMut": false,
1403
+ "isSigner": false
1404
+ },
1405
+ {
1406
+ "name": "userStats",
1407
+ "isMut": true,
1408
+ "isSigner": false
1409
+ }
1410
+ ],
1411
+ "args": [
1412
+ {
1413
+ "name": "disable",
1414
+ "type": "bool"
1415
+ }
1416
+ ]
1417
+ },
1392
1418
  {
1393
1419
  "name": "settlePnl",
1394
1420
  "accounts": [
@@ -1932,6 +1958,37 @@
1932
1958
  }
1933
1959
  ]
1934
1960
  },
1961
+ {
1962
+ "name": "updatePerpBidAskTwap",
1963
+ "accounts": [
1964
+ {
1965
+ "name": "state",
1966
+ "isMut": false,
1967
+ "isSigner": false
1968
+ },
1969
+ {
1970
+ "name": "perpMarket",
1971
+ "isMut": true,
1972
+ "isSigner": false
1973
+ },
1974
+ {
1975
+ "name": "oracle",
1976
+ "isMut": false,
1977
+ "isSigner": false
1978
+ },
1979
+ {
1980
+ "name": "keeperStats",
1981
+ "isMut": false,
1982
+ "isSigner": false
1983
+ },
1984
+ {
1985
+ "name": "authority",
1986
+ "isMut": false,
1987
+ "isSigner": true
1988
+ }
1989
+ ],
1990
+ "args": []
1991
+ },
1935
1992
  {
1936
1993
  "name": "updateSpotMarketCumulativeInterest",
1937
1994
  "accounts": [
@@ -5677,12 +5734,16 @@
5677
5734
  ],
5678
5735
  "type": "bool"
5679
5736
  },
5737
+ {
5738
+ "name": "disableUpdatePerpBidAskTwap",
5739
+ "type": "bool"
5740
+ },
5680
5741
  {
5681
5742
  "name": "padding",
5682
5743
  "type": {
5683
5744
  "array": [
5684
5745
  "u8",
5685
- 51
5746
+ 50
5686
5747
  ]
5687
5748
  }
5688
5749
  }
@@ -10574,6 +10635,11 @@
10574
10635
  "code": 6252,
10575
10636
  "name": "ImpossibleFill",
10576
10637
  "msg": "ImpossibleFill"
10638
+ },
10639
+ {
10640
+ "code": 6253,
10641
+ "name": "CantUpdatePerpBidAskTwap",
10642
+ "msg": "CantUpdatePerpBidAskTwap"
10577
10643
  }
10578
10644
  ]
10579
10645
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.36.1-beta.1",
3
+ "version": "2.36.1-beta.3",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -5073,6 +5073,57 @@ export class DriftClient {
5073
5073
  });
5074
5074
  }
5075
5075
 
5076
+ public async updatePerpBidAskTwap(
5077
+ perpMarketIndex: number,
5078
+ makers: [PublicKey, PublicKey][],
5079
+ txParams?: TxParams
5080
+ ): Promise<TransactionSignature> {
5081
+ const { txSig } = await this.sendTransaction(
5082
+ await this.buildTransaction(
5083
+ await this.getUpdatePerpBidAskTwapIx(perpMarketIndex, makers),
5084
+ txParams
5085
+ ),
5086
+ [],
5087
+ this.opts
5088
+ );
5089
+ return txSig;
5090
+ }
5091
+
5092
+ public async getUpdatePerpBidAskTwapIx(
5093
+ perpMarketIndex: number,
5094
+ makers: [PublicKey, PublicKey][]
5095
+ ): Promise<TransactionInstruction> {
5096
+ const perpMarket = this.getPerpMarketAccount(perpMarketIndex);
5097
+
5098
+ const remainingAccounts = [];
5099
+ for (const [maker, makerStats] of makers) {
5100
+ remainingAccounts.push({
5101
+ pubkey: maker,
5102
+ isWritable: false,
5103
+ isSigner: false,
5104
+ });
5105
+ remainingAccounts.push({
5106
+ pubkey: makerStats,
5107
+ isWritable: false,
5108
+ isSigner: false,
5109
+ });
5110
+ }
5111
+
5112
+ return await this.program.instruction.updatePerpBidAskTwap(
5113
+ perpMarketIndex,
5114
+ {
5115
+ accounts: {
5116
+ state: await this.getStatePublicKey(),
5117
+ perpMarket: perpMarket.pubkey,
5118
+ oracle: perpMarket.amm.oracle,
5119
+ authority: this.wallet.publicKey,
5120
+ keeperStats: this.getUserStatsAccountPublicKey(),
5121
+ },
5122
+ remainingAccounts,
5123
+ }
5124
+ );
5125
+ }
5126
+
5076
5127
  public async settleFundingPayment(
5077
5128
  userAccountPublicKey: PublicKey,
5078
5129
  txParams?: TxParams
@@ -1389,6 +1389,32 @@
1389
1389
  ],
1390
1390
  "args": []
1391
1391
  },
1392
+ {
1393
+ "name": "adminDisableUpdatePerpBidAskTwap",
1394
+ "accounts": [
1395
+ {
1396
+ "name": "admin",
1397
+ "isMut": false,
1398
+ "isSigner": true
1399
+ },
1400
+ {
1401
+ "name": "state",
1402
+ "isMut": false,
1403
+ "isSigner": false
1404
+ },
1405
+ {
1406
+ "name": "userStats",
1407
+ "isMut": true,
1408
+ "isSigner": false
1409
+ }
1410
+ ],
1411
+ "args": [
1412
+ {
1413
+ "name": "disable",
1414
+ "type": "bool"
1415
+ }
1416
+ ]
1417
+ },
1392
1418
  {
1393
1419
  "name": "settlePnl",
1394
1420
  "accounts": [
@@ -1932,6 +1958,37 @@
1932
1958
  }
1933
1959
  ]
1934
1960
  },
1961
+ {
1962
+ "name": "updatePerpBidAskTwap",
1963
+ "accounts": [
1964
+ {
1965
+ "name": "state",
1966
+ "isMut": false,
1967
+ "isSigner": false
1968
+ },
1969
+ {
1970
+ "name": "perpMarket",
1971
+ "isMut": true,
1972
+ "isSigner": false
1973
+ },
1974
+ {
1975
+ "name": "oracle",
1976
+ "isMut": false,
1977
+ "isSigner": false
1978
+ },
1979
+ {
1980
+ "name": "keeperStats",
1981
+ "isMut": false,
1982
+ "isSigner": false
1983
+ },
1984
+ {
1985
+ "name": "authority",
1986
+ "isMut": false,
1987
+ "isSigner": true
1988
+ }
1989
+ ],
1990
+ "args": []
1991
+ },
1935
1992
  {
1936
1993
  "name": "updateSpotMarketCumulativeInterest",
1937
1994
  "accounts": [
@@ -5677,12 +5734,16 @@
5677
5734
  ],
5678
5735
  "type": "bool"
5679
5736
  },
5737
+ {
5738
+ "name": "disableUpdatePerpBidAskTwap",
5739
+ "type": "bool"
5740
+ },
5680
5741
  {
5681
5742
  "name": "padding",
5682
5743
  "type": {
5683
5744
  "array": [
5684
5745
  "u8",
5685
- 51
5746
+ 50
5686
5747
  ]
5687
5748
  }
5688
5749
  }
@@ -10574,6 +10635,11 @@
10574
10635
  "code": 6252,
10575
10636
  "name": "ImpossibleFill",
10576
10637
  "msg": "ImpossibleFill"
10638
+ },
10639
+ {
10640
+ "code": 6253,
10641
+ "name": "CantUpdatePerpBidAskTwap",
10642
+ "msg": "CantUpdatePerpBidAskTwap"
10577
10643
  }
10578
10644
  ]
10579
10645
  }