@drift-labs/sdk 2.61.0-beta.3 → 2.61.0-beta.5

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.61.0-beta.3
1
+ 2.61.0-beta.5
@@ -129,6 +129,7 @@ export declare class DriftClient {
129
129
  subAccountId: number;
130
130
  }[]): Promise<TransactionSignature>;
131
131
  updateUserDelegate(delegate: PublicKey, subAccountId?: number): Promise<TransactionSignature>;
132
+ updateUserAdvancedLp(advancedLp: boolean, subAccountId?: number): Promise<TransactionSignature>;
132
133
  fetchAllUserAccounts(includeIdle?: boolean): Promise<ProgramAccount<UserAccount>[]>;
133
134
  getUserAccountsForDelegate(delegate: PublicKey): Promise<UserAccount[]>;
134
135
  getUserAccountsAndAddressesForAuthority(authority: PublicKey): Promise<ProgramAccount<UserAccount>[]>;
@@ -600,6 +600,16 @@ class DriftClient {
600
600
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
601
601
  return txSig;
602
602
  }
603
+ async updateUserAdvancedLp(advancedLp, subAccountId = 0) {
604
+ const tx = await this.program.transaction.updateUserAdvancedLp(subAccountId, advancedLp, {
605
+ accounts: {
606
+ user: await this.getUserAccountPublicKey(),
607
+ authority: this.wallet.publicKey,
608
+ },
609
+ });
610
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
611
+ return txSig;
612
+ }
603
613
  async fetchAllUserAccounts(includeIdle = true) {
604
614
  let filters = undefined;
605
615
  if (!includeIdle) {
@@ -1147,6 +1147,31 @@
1147
1147
  }
1148
1148
  ]
1149
1149
  },
1150
+ {
1151
+ "name": "updateUserAdvancedLp",
1152
+ "accounts": [
1153
+ {
1154
+ "name": "user",
1155
+ "isMut": true,
1156
+ "isSigner": false
1157
+ },
1158
+ {
1159
+ "name": "authority",
1160
+ "isMut": false,
1161
+ "isSigner": true
1162
+ }
1163
+ ],
1164
+ "args": [
1165
+ {
1166
+ "name": "subAccountId",
1167
+ "type": "u16"
1168
+ },
1169
+ {
1170
+ "name": "advancedLp",
1171
+ "type": "bool"
1172
+ }
1173
+ ]
1174
+ },
1150
1175
  {
1151
1176
  "name": "deleteUser",
1152
1177
  "accounts": [
@@ -8925,6 +8950,9 @@
8925
8950
  },
8926
8951
  {
8927
8952
  "name": "ReduceOnly"
8953
+ },
8954
+ {
8955
+ "name": "AdvancedLp"
8928
8956
  }
8929
8957
  ]
8930
8958
  }
package/lib/types.d.ts CHANGED
@@ -56,7 +56,8 @@ export declare enum SpotOperation {
56
56
  export declare enum UserStatus {
57
57
  BEING_LIQUIDATED = 1,
58
58
  BANKRUPT = 2,
59
- REDUCE_ONLY = 4
59
+ REDUCE_ONLY = 4,
60
+ ADVANCED_LP = 8
60
61
  }
61
62
  export declare class ContractType {
62
63
  static readonly PERPETUAL: {
package/lib/types.js CHANGED
@@ -46,6 +46,7 @@ var UserStatus;
46
46
  UserStatus[UserStatus["BEING_LIQUIDATED"] = 1] = "BEING_LIQUIDATED";
47
47
  UserStatus[UserStatus["BANKRUPT"] = 2] = "BANKRUPT";
48
48
  UserStatus[UserStatus["REDUCE_ONLY"] = 4] = "REDUCE_ONLY";
49
+ UserStatus[UserStatus["ADVANCED_LP"] = 8] = "ADVANCED_LP";
49
50
  })(UserStatus = exports.UserStatus || (exports.UserStatus = {}));
50
51
  class ContractType {
51
52
  }
package/lib/user.d.ts CHANGED
@@ -4,7 +4,7 @@ import { PublicKey } from '@solana/web3.js';
4
4
  import { EventEmitter } from 'events';
5
5
  import StrictEventEmitter from 'strict-event-emitter-types';
6
6
  import { DriftClient } from './driftClient';
7
- import { HealthComponents, MarginCategory, Order, PerpMarketAccount, PerpPosition, SpotPosition, UserAccount } from './types';
7
+ import { HealthComponents, MarginCategory, Order, PerpMarketAccount, PerpPosition, SpotPosition, UserAccount, UserStatus } from './types';
8
8
  import { DataAndSlot, UserAccountEvents, UserAccountSubscriber } from './accounts/types';
9
9
  import { BN, MarketType, PositionDirection, SpotMarketAccount } from '.';
10
10
  import { OraclePriceData } from './oracles/types';
@@ -230,6 +230,7 @@ export declare class User {
230
230
  totalCollateral: BN;
231
231
  };
232
232
  isBeingLiquidated(): boolean;
233
+ hasStatus(status: UserStatus): boolean;
233
234
  isBankrupt(): boolean;
234
235
  /**
235
236
  * Checks if any user position cumulative funding differs from respective market cumulative funding
package/lib/user.js CHANGED
@@ -1011,6 +1011,9 @@ class User {
1011
1011
  (types_1.UserStatus.BEING_LIQUIDATED | types_1.UserStatus.BANKRUPT)) >
1012
1012
  0);
1013
1013
  }
1014
+ hasStatus(status) {
1015
+ return (this.getUserAccount().status & status) > 0;
1016
+ }
1014
1017
  isBankrupt() {
1015
1018
  return (this.getUserAccount().status & types_1.UserStatus.BANKRUPT) > 0;
1016
1019
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.61.0-beta.3",
3
+ "version": "2.61.0-beta.5",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -1024,6 +1024,25 @@ export class DriftClient {
1024
1024
  return txSig;
1025
1025
  }
1026
1026
 
1027
+ public async updateUserAdvancedLp(
1028
+ advancedLp: boolean,
1029
+ subAccountId = 0
1030
+ ): Promise<TransactionSignature> {
1031
+ const tx = await this.program.transaction.updateUserAdvancedLp(
1032
+ subAccountId,
1033
+ advancedLp,
1034
+ {
1035
+ accounts: {
1036
+ user: await this.getUserAccountPublicKey(),
1037
+ authority: this.wallet.publicKey,
1038
+ },
1039
+ }
1040
+ );
1041
+
1042
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
1043
+ return txSig;
1044
+ }
1045
+
1027
1046
  public async fetchAllUserAccounts(
1028
1047
  includeIdle = true
1029
1048
  ): Promise<ProgramAccount<UserAccount>[]> {
@@ -1147,6 +1147,31 @@
1147
1147
  }
1148
1148
  ]
1149
1149
  },
1150
+ {
1151
+ "name": "updateUserAdvancedLp",
1152
+ "accounts": [
1153
+ {
1154
+ "name": "user",
1155
+ "isMut": true,
1156
+ "isSigner": false
1157
+ },
1158
+ {
1159
+ "name": "authority",
1160
+ "isMut": false,
1161
+ "isSigner": true
1162
+ }
1163
+ ],
1164
+ "args": [
1165
+ {
1166
+ "name": "subAccountId",
1167
+ "type": "u16"
1168
+ },
1169
+ {
1170
+ "name": "advancedLp",
1171
+ "type": "bool"
1172
+ }
1173
+ ]
1174
+ },
1150
1175
  {
1151
1176
  "name": "deleteUser",
1152
1177
  "accounts": [
@@ -8925,6 +8950,9 @@
8925
8950
  },
8926
8951
  {
8927
8952
  "name": "ReduceOnly"
8953
+ },
8954
+ {
8955
+ "name": "AdvancedLp"
8928
8956
  }
8929
8957
  ]
8930
8958
  }
package/src/types.ts CHANGED
@@ -45,6 +45,7 @@ export enum UserStatus {
45
45
  BEING_LIQUIDATED = 1,
46
46
  BANKRUPT = 2,
47
47
  REDUCE_ONLY = 4,
48
+ ADVANCED_LP = 8,
48
49
  }
49
50
 
50
51
  export class ContractType {
package/src/user.ts CHANGED
@@ -1850,6 +1850,10 @@ export class User {
1850
1850
  );
1851
1851
  }
1852
1852
 
1853
+ public hasStatus(status: UserStatus): boolean {
1854
+ return (this.getUserAccount().status & status) > 0;
1855
+ }
1856
+
1853
1857
  public isBankrupt(): boolean {
1854
1858
  return (this.getUserAccount().status & UserStatus.BANKRUPT) > 0;
1855
1859
  }