@drift-labs/sdk 2.109.0-beta.6 → 2.109.0-beta.8

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.109.0-beta.6
1
+ 2.109.0-beta.8
@@ -228,7 +228,8 @@ function decodeUser(buffer) {
228
228
  offset += 1;
229
229
  const auctionDuration = buffer.readUInt8(offset);
230
230
  offset += 1;
231
- offset += 3; // padding
231
+ const postedSlotTail = buffer.readUint8(offset);
232
+ offset += 2; // padding
232
233
  orders.push({
233
234
  slot,
234
235
  price,
@@ -254,6 +255,7 @@ function decodeUser(buffer) {
254
255
  immediateOrCancel,
255
256
  triggerCondition,
256
257
  auctionDuration,
258
+ postedSlotTail,
257
259
  });
258
260
  }
259
261
  const lastAddPerpLpSharesTs = readSignedBigInt64LE(buffer, offset);
@@ -888,8 +888,8 @@ export declare class DriftClient {
888
888
  disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
889
889
  getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
890
890
  fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
891
- updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, txParams?: TxParams): Promise<TransactionSignature>;
892
- getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean): Promise<TransactionInstruction>;
891
+ updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, authority?: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
892
+ getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean, authority?: PublicKey): Promise<TransactionInstruction>;
893
893
  getPauseSpotMarketDepositWithdrawIx(spotMarketIndex: number): Promise<TransactionInstruction>;
894
894
  pauseSpotMarketDepositWithdraw(spotMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
895
895
  private handleSignedTransaction;
@@ -4847,15 +4847,15 @@ class DriftClient {
4847
4847
  const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
4848
4848
  return config;
4849
4849
  }
4850
- async updateUserProtectedMakerOrders(subAccountId, protectedOrders, txParams) {
4851
- const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders), txParams), [], this.opts);
4850
+ async updateUserProtectedMakerOrders(subAccountId, protectedOrders, authority, txParams) {
4851
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority), txParams), [], this.opts);
4852
4852
  return txSig;
4853
4853
  }
4854
- async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders) {
4854
+ async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority) {
4855
4855
  const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, protectedOrders, {
4856
4856
  accounts: {
4857
4857
  state: await this.getStatePublicKey(),
4858
- user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId),
4858
+ user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, authority !== null && authority !== void 0 ? authority : this.authority, subAccountId),
4859
4859
  authority: this.wallet.publicKey,
4860
4860
  protectedMakerModeConfig: (0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId),
4861
4861
  },
@@ -10875,12 +10875,19 @@
10875
10875
  ],
10876
10876
  "type": "u8"
10877
10877
  },
10878
+ {
10879
+ "name": "postedSlotTail",
10880
+ "docs": [
10881
+ "Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
10882
+ ],
10883
+ "type": "u8"
10884
+ },
10878
10885
  {
10879
10886
  "name": "padding",
10880
10887
  "type": {
10881
10888
  "array": [
10882
10889
  "u8",
10883
- 3
10890
+ 2
10884
10891
  ]
10885
10892
  }
10886
10893
  }
@@ -1096,6 +1096,7 @@ export type Order = {
1096
1096
  auctionStartPrice: BN;
1097
1097
  auctionEndPrice: BN;
1098
1098
  maxTs: BN;
1099
+ postedSlotTail: number;
1099
1100
  };
1100
1101
  export type OrderParams = {
1101
1102
  orderType: OrderType;
@@ -228,7 +228,8 @@ function decodeUser(buffer) {
228
228
  offset += 1;
229
229
  const auctionDuration = buffer.readUInt8(offset);
230
230
  offset += 1;
231
- offset += 3; // padding
231
+ const postedSlotTail = buffer.readUint8(offset);
232
+ offset += 2; // padding
232
233
  orders.push({
233
234
  slot,
234
235
  price,
@@ -254,6 +255,7 @@ function decodeUser(buffer) {
254
255
  immediateOrCancel,
255
256
  triggerCondition,
256
257
  auctionDuration,
258
+ postedSlotTail,
257
259
  });
258
260
  }
259
261
  const lastAddPerpLpSharesTs = readSignedBigInt64LE(buffer, offset);
@@ -888,8 +888,8 @@ export declare class DriftClient {
888
888
  disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
889
889
  getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
890
890
  fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
891
- updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, txParams?: TxParams): Promise<TransactionSignature>;
892
- getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean): Promise<TransactionInstruction>;
891
+ updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, authority?: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
892
+ getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean, authority?: PublicKey): Promise<TransactionInstruction>;
893
893
  getPauseSpotMarketDepositWithdrawIx(spotMarketIndex: number): Promise<TransactionInstruction>;
894
894
  pauseSpotMarketDepositWithdraw(spotMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
895
895
  private handleSignedTransaction;
@@ -4847,15 +4847,15 @@ class DriftClient {
4847
4847
  const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
4848
4848
  return config;
4849
4849
  }
4850
- async updateUserProtectedMakerOrders(subAccountId, protectedOrders, txParams) {
4851
- const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders), txParams), [], this.opts);
4850
+ async updateUserProtectedMakerOrders(subAccountId, protectedOrders, authority, txParams) {
4851
+ const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority), txParams), [], this.opts);
4852
4852
  return txSig;
4853
4853
  }
4854
- async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders) {
4854
+ async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority) {
4855
4855
  const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, protectedOrders, {
4856
4856
  accounts: {
4857
4857
  state: await this.getStatePublicKey(),
4858
- user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId),
4858
+ user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, authority !== null && authority !== void 0 ? authority : this.authority, subAccountId),
4859
4859
  authority: this.wallet.publicKey,
4860
4860
  protectedMakerModeConfig: (0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId),
4861
4861
  },
@@ -10875,12 +10875,19 @@
10875
10875
  ],
10876
10876
  "type": "u8"
10877
10877
  },
10878
+ {
10879
+ "name": "postedSlotTail",
10880
+ "docs": [
10881
+ "Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
10882
+ ],
10883
+ "type": "u8"
10884
+ },
10878
10885
  {
10879
10886
  "name": "padding",
10880
10887
  "type": {
10881
10888
  "array": [
10882
10889
  "u8",
10883
- 3
10890
+ 2
10884
10891
  ]
10885
10892
  }
10886
10893
  }
@@ -1096,6 +1096,7 @@ export type Order = {
1096
1096
  auctionStartPrice: BN;
1097
1097
  auctionEndPrice: BN;
1098
1098
  maxTs: BN;
1099
+ postedSlotTail: number;
1099
1100
  };
1100
1101
  export type OrderParams = {
1101
1102
  orderType: OrderType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.109.0-beta.6",
3
+ "version": "2.109.0-beta.8",
4
4
  "main": "lib/node/index.js",
5
5
  "types": "lib/node/index.d.ts",
6
6
  "browser": "./lib/browser/index.js",
@@ -237,7 +237,8 @@ export function decodeUser(buffer: Buffer): UserAccount {
237
237
  offset += 1;
238
238
  const auctionDuration = buffer.readUInt8(offset);
239
239
  offset += 1;
240
- offset += 3; // padding
240
+ const postedSlotTail = buffer.readUint8(offset);
241
+ offset += 2; // padding
241
242
  orders.push({
242
243
  slot,
243
244
  price,
@@ -263,6 +264,7 @@ export function decodeUser(buffer: Buffer): UserAccount {
263
264
  immediateOrCancel,
264
265
  triggerCondition,
265
266
  auctionDuration,
267
+ postedSlotTail,
266
268
  });
267
269
  }
268
270
 
@@ -9209,13 +9209,15 @@ export class DriftClient {
9209
9209
  public async updateUserProtectedMakerOrders(
9210
9210
  subAccountId: number,
9211
9211
  protectedOrders: boolean,
9212
+ authority?: PublicKey,
9212
9213
  txParams?: TxParams
9213
9214
  ): Promise<TransactionSignature> {
9214
9215
  const { txSig } = await this.sendTransaction(
9215
9216
  await this.buildTransaction(
9216
9217
  await this.getUpdateUserProtectedMakerOrdersIx(
9217
9218
  subAccountId,
9218
- protectedOrders
9219
+ protectedOrders,
9220
+ authority
9219
9221
  ),
9220
9222
  txParams
9221
9223
  ),
@@ -9227,7 +9229,8 @@ export class DriftClient {
9227
9229
 
9228
9230
  public async getUpdateUserProtectedMakerOrdersIx(
9229
9231
  subAccountId: number,
9230
- protectedOrders: boolean
9232
+ protectedOrders: boolean,
9233
+ authority?: PublicKey
9231
9234
  ): Promise<TransactionInstruction> {
9232
9235
  const ix = await this.program.instruction.updateUserProtectedMakerOrders(
9233
9236
  subAccountId,
@@ -9237,7 +9240,7 @@ export class DriftClient {
9237
9240
  state: await this.getStatePublicKey(),
9238
9241
  user: getUserAccountPublicKeySync(
9239
9242
  this.program.programId,
9240
- this.wallet.publicKey,
9243
+ authority ?? this.authority,
9241
9244
  subAccountId
9242
9245
  ),
9243
9246
  authority: this.wallet.publicKey,
@@ -10875,12 +10875,19 @@
10875
10875
  ],
10876
10876
  "type": "u8"
10877
10877
  },
10878
+ {
10879
+ "name": "postedSlotTail",
10880
+ "docs": [
10881
+ "Last 8 bits of the slot the order was posted on-chain (not order slot for swift orders)"
10882
+ ],
10883
+ "type": "u8"
10884
+ },
10878
10885
  {
10879
10886
  "name": "padding",
10880
10887
  "type": {
10881
10888
  "array": [
10882
10889
  "u8",
10883
- 3
10890
+ 2
10884
10891
  ]
10885
10892
  }
10886
10893
  }
package/src/types.ts CHANGED
@@ -1040,6 +1040,7 @@ export type Order = {
1040
1040
  auctionStartPrice: BN;
1041
1041
  auctionEndPrice: BN;
1042
1042
  maxTs: BN;
1043
+ postedSlotTail: number;
1043
1044
  };
1044
1045
 
1045
1046
  export type OrderParams = {
@@ -41,6 +41,7 @@ export const mockOrder: Order = {
41
41
  auctionStartPrice: ZERO,
42
42
  auctionEndPrice: ZERO,
43
43
  maxTs: ZERO,
44
+ postedSlotTail: 0,
44
45
  };
45
46
 
46
47
  export const mockSpotPosition: SpotPosition = {