@drift-labs/vaults-sdk 0.2.54 → 0.2.56

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.
@@ -1,7 +1,7 @@
1
1
  import { BN, DriftClient, UserMap, OracleSource } from '@drift-labs/sdk';
2
2
  import { Program, ProgramAccount } from '@coral-xyz/anchor';
3
3
  import { DriftVaults } from './types/drift_vaults';
4
- import { AddressLookupTableAccount, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
4
+ import { AccountMeta, AddressLookupTableAccount, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
5
5
  import { Vault, VaultDepositor, VaultProtocol, VaultProtocolParams, WithdrawUnit } from './types/types';
6
6
  import { UserMapConfig } from '@drift-labs/sdk';
7
7
  import { Metaplex } from '@metaplex-foundation/js';
@@ -237,7 +237,7 @@ export declare class VaultClient {
237
237
  driftProgram: PublicKey;
238
238
  tokenProgram: PublicKey;
239
239
  };
240
- remainingAccounts: import("@solana/web3.js").AccountMeta[];
240
+ remainingAccounts: AccountMeta[];
241
241
  preIxs: TransactionInstruction[];
242
242
  postIxs: TransactionInstruction[];
243
243
  }>;
@@ -415,16 +415,28 @@ class VaultClient {
415
415
  driftUser: vaultAccount.user,
416
416
  driftProgram: this.driftClient.program.programId,
417
417
  };
418
+ const user = await this.getSubscribedVaultUser(vaultAccount.user);
419
+ let remainingAccounts = [];
420
+ try {
421
+ remainingAccounts = this.driftClient.getRemainingAccounts({
422
+ userAccounts: [user.getUserAccount()],
423
+ });
424
+ }
425
+ catch (err) {
426
+ // do nothing
427
+ }
418
428
  if (this.cliMode) {
419
429
  return await this.program.methods
420
430
  .updateMarginTradingEnabled(enabled)
421
431
  .accounts(accounts)
432
+ .remainingAccounts(remainingAccounts)
422
433
  .rpc();
423
434
  }
424
435
  else {
425
436
  const updateMarginTradingEnabledIx = await this.program.methods
426
437
  .updateMarginTradingEnabled(enabled)
427
438
  .accounts({ ...accounts, manager: this.driftClient.wallet.publicKey })
439
+ .remainingAccounts(remainingAccounts)
428
440
  .instruction();
429
441
  return await this.createAndSendTxn([updateMarginTradingEnabledIx], uiTxParams);
430
442
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/vaults-sdk",
3
- "version": "0.2.54",
3
+ "version": "0.2.56",
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.107.0-beta.6",
11
+ "@drift-labs/sdk": "2.107.0-beta.8",
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",
@@ -26,6 +26,7 @@ import {
26
26
  getVaultProtocolAddressSync,
27
27
  } from './addresses';
28
28
  import {
29
+ AccountMeta,
29
30
  AddressLookupTableAccount,
30
31
  ComputeBudgetProgram,
31
32
  PublicKey,
@@ -633,15 +634,28 @@ export class VaultClient {
633
634
  driftProgram: this.driftClient.program.programId,
634
635
  };
635
636
 
637
+ const user = await this.getSubscribedVaultUser(vaultAccount.user);
638
+
639
+ let remainingAccounts: AccountMeta[] = [];
640
+ try {
641
+ remainingAccounts = this.driftClient.getRemainingAccounts({
642
+ userAccounts: [user.getUserAccount()],
643
+ });
644
+ } catch (err) {
645
+ // do nothing
646
+ }
647
+
636
648
  if (this.cliMode) {
637
649
  return await this.program.methods
638
650
  .updateMarginTradingEnabled(enabled)
639
651
  .accounts(accounts)
652
+ .remainingAccounts(remainingAccounts)
640
653
  .rpc();
641
654
  } else {
642
655
  const updateMarginTradingEnabledIx = await this.program.methods
643
656
  .updateMarginTradingEnabled(enabled)
644
657
  .accounts({ ...accounts, manager: this.driftClient.wallet.publicKey })
658
+ .remainingAccounts(remainingAccounts)
645
659
  .instruction();
646
660
  return await this.createAndSendTxn(
647
661
  [updateMarginTradingEnabledIx],