@drift-labs/vaults-sdk 0.4.34 → 0.4.36

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.
@@ -55,6 +55,7 @@ export declare class VaultClient {
55
55
  }>;
56
56
  getAllVaultDepositorsWithNoWithdrawRequest(vault: PublicKey): Promise<ProgramAccount<VaultDepositor>[]>;
57
57
  getAllVaultDepositors(vault?: PublicKey): Promise<ProgramAccount<VaultDepositor>[]>;
58
+ getAllVaultDepositorsForAuthority(authority: PublicKey): Promise<ProgramAccount<VaultDepositor>[]>;
58
59
  getSubscribedVaultUser(vaultDriftUserAccountPubKey: PublicKey): Promise<import("@drift-labs/sdk").User>;
59
60
  syncVaultUsers(): Promise<void>;
60
61
  /**
@@ -147,6 +147,26 @@ class VaultClient {
147
147
  // @ts-ignore
148
148
  return (await this.program.account.vaultDepositor.all(filters));
149
149
  }
150
+ async getAllVaultDepositorsForAuthority(authority) {
151
+ const filters = [
152
+ {
153
+ // discriminator = VaultDepositor
154
+ memcmp: {
155
+ offset: 0,
156
+ bytes: bytes_1.bs58.encode(anchor_1.BorshAccountsCoder.accountDiscriminator('VaultDepositor')),
157
+ },
158
+ },
159
+ ];
160
+ filters.push({
161
+ // authority = authority
162
+ memcmp: {
163
+ offset: 8 + 32 + 32,
164
+ bytes: authority.toBase58(),
165
+ },
166
+ });
167
+ // @ts-ignore
168
+ return (await this.program.account.vaultDepositor.all(filters));
169
+ }
150
170
  async getSubscribedVaultUser(vaultDriftUserAccountPubKey) {
151
171
  return this.vaultUsers.mustGet(vaultDriftUserAccountPubKey.toBase58(), {
152
172
  type: 'websocket',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/vaults-sdk",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "directories": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@coral-xyz/anchor": "0.28.0",
11
- "@drift-labs/sdk": "2.112.0-beta.2",
11
+ "@drift-labs/sdk": "2.112.0-beta.3",
12
12
  "@ledgerhq/hw-app-solana": "7.2.4",
13
13
  "@ledgerhq/hw-transport": "6.31.4",
14
14
  "@ledgerhq/hw-transport-node-hid": "6.29.5",
@@ -282,6 +282,33 @@ export class VaultClient {
282
282
  )) as ProgramAccount<VaultDepositor>[];
283
283
  }
284
284
 
285
+ public async getAllVaultDepositorsForAuthority(
286
+ authority: PublicKey
287
+ ): Promise<ProgramAccount<VaultDepositor>[]> {
288
+ const filters = [
289
+ {
290
+ // discriminator = VaultDepositor
291
+ memcmp: {
292
+ offset: 0,
293
+ bytes: bs58.encode(
294
+ BorshAccountsCoder.accountDiscriminator('VaultDepositor')
295
+ ),
296
+ },
297
+ },
298
+ ];
299
+ filters.push({
300
+ // authority = authority
301
+ memcmp: {
302
+ offset: 8 + 32 + 32,
303
+ bytes: authority.toBase58(),
304
+ },
305
+ });
306
+ // @ts-ignore
307
+ return (await this.program.account.vaultDepositor.all(
308
+ filters
309
+ )) as ProgramAccount<VaultDepositor>[];
310
+ }
311
+
285
312
  public async getSubscribedVaultUser(vaultDriftUserAccountPubKey: PublicKey) {
286
313
  return this.vaultUsers.mustGet(vaultDriftUserAccountPubKey.toBase58(), {
287
314
  type: 'websocket',