@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 +1 -1
- package/lib/driftClient.js +5 -2
- package/lib/factory/oracleClient.js +4 -3
- package/lib/idl/switchboard.json +8354 -0
- package/lib/oracles/switchboardClient.d.ts +11 -0
- package/lib/oracles/switchboardClient.js +40 -0
- package/lib/types.d.ts +3 -0
- package/lib/types.js +1 -1
- package/package.json +1 -1
- package/src/driftClient.ts +6 -2
- package/src/factory/oracleClient.ts +4 -3
- package/src/idl/switchboard.json +8354 -0
- package/src/oracles/switchboardClient.ts +74 -0
- package/src/types.ts +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.67.0-beta.
|
|
1
|
+
2.67.0-beta.2
|
package/lib/driftClient.js
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
23
|
-
|
|
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
|
}
|