@drift-labs/sdk 2.97.0-beta.1 → 2.97.0-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.97.0-beta.1
1
+ 2.97.0-beta.3
@@ -354,7 +354,8 @@ export declare class DriftClient {
354
354
  getUpdateAMMsIx(marketIndexes: number[]): Promise<TransactionInstruction>;
355
355
  settleExpiredMarket(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
356
356
  getSettleExpiredMarketIx(marketIndex: number): Promise<TransactionInstruction>;
357
- settleExpiredMarketPoolsToRevenuePool(perpMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
357
+ settleExpiredMarketPoolsToRevenuePool(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
358
+ getSettleExpiredMarketPoolsToRevenuePoolIx(perpMarketIndex: number): Promise<TransactionInstruction>;
358
359
  cancelOrder(orderId?: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
359
360
  getCancelOrderIx(orderId?: number, subAccountId?: number): Promise<TransactionInstruction>;
360
361
  cancelOrderByUserId(userOrderId: number, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
@@ -490,6 +491,8 @@ export declare class DriftClient {
490
491
  getForceCancelOrdersIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
491
492
  updateUserIdle(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
492
493
  getUpdateUserIdleIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
494
+ updateUserFuelBonus(userAccountPublicKey: PublicKey, user: UserAccount, userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
495
+ getUpdateUserFuelBonusIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, userAuthority: PublicKey): Promise<TransactionInstruction>;
493
496
  updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
494
497
  getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
495
498
  placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
@@ -1761,10 +1761,14 @@ class DriftClient {
1761
1761
  remainingAccounts,
1762
1762
  });
1763
1763
  }
1764
- async settleExpiredMarketPoolsToRevenuePool(perpMarketIndex, txParams) {
1764
+ async settleExpiredMarketPoolsToRevenuePool(marketIndex, txParams) {
1765
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getSettleExpiredMarketPoolsToRevenuePoolIx(marketIndex), txParams), [], this.opts);
1766
+ return txSig;
1767
+ }
1768
+ async getSettleExpiredMarketPoolsToRevenuePoolIx(perpMarketIndex) {
1765
1769
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
1766
1770
  const spotMarketPublicKey = await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, numericConstants_1.QUOTE_SPOT_MARKET_INDEX);
1767
- const ix = await this.program.instruction.settleExpiredMarketPoolsToRevenuePool({
1771
+ return await this.program.instruction.settleExpiredMarketPoolsToRevenuePool({
1768
1772
  accounts: {
1769
1773
  state: await this.getStatePublicKey(),
1770
1774
  admin: this.isSubscribed
@@ -1774,8 +1778,6 @@ class DriftClient {
1774
1778
  perpMarket: perpMarketPublicKey,
1775
1779
  },
1776
1780
  });
1777
- const { txSig } = await this.sendTransaction(await this.buildTransaction(ix, txParams), [], this.opts);
1778
- return txSig;
1779
1781
  }
1780
1782
  async cancelOrder(orderId, txParams, subAccountId) {
1781
1783
  const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getCancelOrderIx(orderId, subAccountId), txParams), [], this.opts);
@@ -2710,6 +2712,25 @@ class DriftClient {
2710
2712
  remainingAccounts,
2711
2713
  });
2712
2714
  }
2715
+ async updateUserFuelBonus(userAccountPublicKey, user, userAuthority, txParams) {
2716
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserFuelBonusIx(userAccountPublicKey, user, userAuthority), txParams), [], this.opts);
2717
+ return txSig;
2718
+ }
2719
+ async getUpdateUserFuelBonusIx(userAccountPublicKey, userAccount, userAuthority) {
2720
+ const userStatsAccountPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAuthority);
2721
+ const remainingAccounts = this.getRemainingAccounts({
2722
+ userAccounts: [userAccount],
2723
+ });
2724
+ return await this.program.instruction.updateUserFuelBonus({
2725
+ accounts: {
2726
+ state: await this.getStatePublicKey(),
2727
+ user: userAccountPublicKey,
2728
+ userStats: userStatsAccountPublicKey,
2729
+ authority: this.wallet.publicKey,
2730
+ },
2731
+ remainingAccounts,
2732
+ });
2733
+ }
2713
2734
  async updateUserOpenOrdersCount(userAccountPublicKey, user, txParams, fillerPublicKey) {
2714
2735
  const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserOpenOrdersCountIx(userAccountPublicKey, user, fillerPublicKey), txParams), [], this.opts);
2715
2736
  return txSig;
@@ -1498,6 +1498,32 @@
1498
1498
  ],
1499
1499
  "args": []
1500
1500
  },
1501
+ {
1502
+ "name": "updateUserFuelBonus",
1503
+ "accounts": [
1504
+ {
1505
+ "name": "state",
1506
+ "isMut": false,
1507
+ "isSigner": false
1508
+ },
1509
+ {
1510
+ "name": "authority",
1511
+ "isMut": false,
1512
+ "isSigner": true
1513
+ },
1514
+ {
1515
+ "name": "user",
1516
+ "isMut": true,
1517
+ "isSigner": false
1518
+ },
1519
+ {
1520
+ "name": "userStats",
1521
+ "isMut": true,
1522
+ "isSigner": false
1523
+ }
1524
+ ],
1525
+ "args": []
1526
+ },
1501
1527
  {
1502
1528
  "name": "updateUserOpenOrdersCount",
1503
1529
  "accounts": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.97.0-beta.1",
3
+ "version": "2.97.0-beta.3",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -3333,9 +3333,23 @@ export class DriftClient {
3333
3333
  }
3334
3334
 
3335
3335
  public async settleExpiredMarketPoolsToRevenuePool(
3336
- perpMarketIndex: number,
3336
+ marketIndex: number,
3337
3337
  txParams?: TxParams
3338
3338
  ): Promise<TransactionSignature> {
3339
+ const { txSig } = await this.sendTransaction(
3340
+ await this.buildTransaction(
3341
+ await this.getSettleExpiredMarketPoolsToRevenuePoolIx(marketIndex),
3342
+ txParams
3343
+ ),
3344
+ [],
3345
+ this.opts
3346
+ );
3347
+ return txSig;
3348
+ }
3349
+
3350
+ public async getSettleExpiredMarketPoolsToRevenuePoolIx(
3351
+ perpMarketIndex: number
3352
+ ): Promise<TransactionInstruction> {
3339
3353
  const perpMarketPublicKey = await getPerpMarketPublicKey(
3340
3354
  this.program.programId,
3341
3355
  perpMarketIndex
@@ -3346,8 +3360,8 @@ export class DriftClient {
3346
3360
  QUOTE_SPOT_MARKET_INDEX
3347
3361
  );
3348
3362
 
3349
- const ix =
3350
- await this.program.instruction.settleExpiredMarketPoolsToRevenuePool({
3363
+ return await this.program.instruction.settleExpiredMarketPoolsToRevenuePool(
3364
+ {
3351
3365
  accounts: {
3352
3366
  state: await this.getStatePublicKey(),
3353
3367
  admin: this.isSubscribed
@@ -3356,15 +3370,8 @@ export class DriftClient {
3356
3370
  spotMarket: spotMarketPublicKey,
3357
3371
  perpMarket: perpMarketPublicKey,
3358
3372
  },
3359
- });
3360
-
3361
- const { txSig } = await this.sendTransaction(
3362
- await this.buildTransaction(ix, txParams),
3363
- [],
3364
- this.opts
3373
+ }
3365
3374
  );
3366
-
3367
- return txSig;
3368
3375
  }
3369
3376
 
3370
3377
  public async cancelOrder(
@@ -4929,6 +4936,52 @@ export class DriftClient {
4929
4936
  });
4930
4937
  }
4931
4938
 
4939
+ public async updateUserFuelBonus(
4940
+ userAccountPublicKey: PublicKey,
4941
+ user: UserAccount,
4942
+ userAuthority: PublicKey,
4943
+ txParams?: TxParams
4944
+ ): Promise<TransactionSignature> {
4945
+ const { txSig } = await this.sendTransaction(
4946
+ await this.buildTransaction(
4947
+ await this.getUpdateUserFuelBonusIx(
4948
+ userAccountPublicKey,
4949
+ user,
4950
+ userAuthority
4951
+ ),
4952
+ txParams
4953
+ ),
4954
+ [],
4955
+ this.opts
4956
+ );
4957
+ return txSig;
4958
+ }
4959
+
4960
+ public async getUpdateUserFuelBonusIx(
4961
+ userAccountPublicKey: PublicKey,
4962
+ userAccount: UserAccount,
4963
+ userAuthority: PublicKey
4964
+ ): Promise<TransactionInstruction> {
4965
+ const userStatsAccountPublicKey = getUserStatsAccountPublicKey(
4966
+ this.program.programId,
4967
+ userAuthority
4968
+ );
4969
+
4970
+ const remainingAccounts = this.getRemainingAccounts({
4971
+ userAccounts: [userAccount],
4972
+ });
4973
+
4974
+ return await this.program.instruction.updateUserFuelBonus({
4975
+ accounts: {
4976
+ state: await this.getStatePublicKey(),
4977
+ user: userAccountPublicKey,
4978
+ userStats: userStatsAccountPublicKey,
4979
+ authority: this.wallet.publicKey,
4980
+ },
4981
+ remainingAccounts,
4982
+ });
4983
+ }
4984
+
4932
4985
  public async updateUserOpenOrdersCount(
4933
4986
  userAccountPublicKey: PublicKey,
4934
4987
  user: UserAccount,
@@ -1498,6 +1498,32 @@
1498
1498
  ],
1499
1499
  "args": []
1500
1500
  },
1501
+ {
1502
+ "name": "updateUserFuelBonus",
1503
+ "accounts": [
1504
+ {
1505
+ "name": "state",
1506
+ "isMut": false,
1507
+ "isSigner": false
1508
+ },
1509
+ {
1510
+ "name": "authority",
1511
+ "isMut": false,
1512
+ "isSigner": true
1513
+ },
1514
+ {
1515
+ "name": "user",
1516
+ "isMut": true,
1517
+ "isSigner": false
1518
+ },
1519
+ {
1520
+ "name": "userStats",
1521
+ "isMut": true,
1522
+ "isSigner": false
1523
+ }
1524
+ ],
1525
+ "args": []
1526
+ },
1501
1527
  {
1502
1528
  "name": "updateUserOpenOrdersCount",
1503
1529
  "accounts": [