@drift-labs/sdk 2.67.0-beta.1 → 2.67.0-beta.2

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.67.0-beta.1
1
+ 2.67.0-beta.2
@@ -3302,6 +3302,7 @@ class DriftClient {
3302
3302
  return txSig;
3303
3303
  }
3304
3304
  async removeInsuranceFundStake(marketIndex, collateralAccountPublicKey) {
3305
+ var _a, _b;
3305
3306
  const removeIfStakeIxs = [];
3306
3307
  const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
3307
3308
  const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
@@ -3324,9 +3325,11 @@ class DriftClient {
3324
3325
  removeIfStakeIxs.push(createTokenAccountIx);
3325
3326
  }
3326
3327
  }
3328
+ const userAccountExists = !!((_b = (_a = this.getUser()) === null || _a === void 0 ? void 0 : _a.accountSubscriber) === null || _b === void 0 ? void 0 : _b.isSubscribed) &&
3329
+ (await this.checkIfAccountExists(this.getUser().userAccountPublicKey));
3327
3330
  const remainingAccounts = this.getRemainingAccounts({
3328
- userAccounts: [this.getUserAccount()],
3329
- useMarketLastSlotCache: true,
3331
+ userAccounts: userAccountExists ? [this.getUserAccount()] : [],
3332
+ useMarketLastSlotCache: false,
3330
3333
  writableSpotMarketIndexes: [marketIndex],
3331
3334
  });
3332
3335
  const removeStakeIx = await this.program.instruction.removeInsuranceFundStake(marketIndex, {
@@ -6,6 +6,7 @@ const pythClient_1 = require("../oracles/pythClient");
6
6
  // import { SwitchboardClient } from '../oracles/switchboardClient';
7
7
  const quoteAssetOracleClient_1 = require("../oracles/quoteAssetOracleClient");
8
8
  const anchor_1 = require("@coral-xyz/anchor");
9
+ const switchboardClient_1 = require("../oracles/switchboardClient");
9
10
  function getOracleClient(oracleSource, connection) {
10
11
  if ((0, types_1.isVariant)(oracleSource, 'pyth')) {
11
12
  return new pythClient_1.PythClient(connection);
@@ -19,9 +20,9 @@ function getOracleClient(oracleSource, connection) {
19
20
  if ((0, types_1.isVariant)(oracleSource, 'pythStableCoin')) {
20
21
  return new pythClient_1.PythClient(connection, undefined, true);
21
22
  }
22
- // if (isVariant(oracleSource, 'switchboard')) {
23
- // return new SwitchboardClient(connection);
24
- // }
23
+ if ((0, types_1.isVariant)(oracleSource, 'switchboard')) {
24
+ return new switchboardClient_1.SwitchboardClient(connection);
25
+ }
25
26
  if ((0, types_1.isVariant)(oracleSource, 'quoteAsset')) {
26
27
  return new quoteAssetOracleClient_1.QuoteAssetOracleClient();
27
28
  }