@drift-labs/sdk 2.114.0-beta.6 → 2.114.0-beta.7
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/browser/driftClient.d.ts +1 -0
- package/lib/browser/driftClient.js +31 -5
- package/lib/browser/math/superStake.d.ts +2 -3
- package/lib/node/driftClient.d.ts +1 -0
- package/lib/node/driftClient.js +31 -5
- package/lib/node/math/superStake.d.ts +2 -3
- package/package.json +2 -2
- package/src/driftClient.ts +41 -6
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.114.0-beta.
|
|
1
|
+
2.114.0-beta.7
|
|
@@ -912,6 +912,7 @@ export declare class DriftClient {
|
|
|
912
912
|
}, feedId: string, encodedVaaAddress: PublicKey): Promise<TransactionInstruction>;
|
|
913
913
|
postPythLazerOracleUpdate(feedIds: number[], pythMessageHex: string): Promise<string>;
|
|
914
914
|
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
915
|
+
getPostManySwitchboardOnDemandUpdatesAtomicIxs(feeds: PublicKey[], recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction[] | undefined>;
|
|
915
916
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
916
917
|
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
917
918
|
private getBuildEncodedVaaIxs;
|
|
@@ -4848,6 +4848,30 @@ class DriftClient {
|
|
|
4848
4848
|
});
|
|
4849
4849
|
return [verifyIx, ix];
|
|
4850
4850
|
}
|
|
4851
|
+
async getPostManySwitchboardOnDemandUpdatesAtomicIxs(feeds, recentSlothash, numSignatures = 3) {
|
|
4852
|
+
const program = await this.getSwitchboardOnDemandProgram();
|
|
4853
|
+
for (const feed of feeds) {
|
|
4854
|
+
const feedAccount = new on_demand_1.PullFeed(program, feed);
|
|
4855
|
+
if (!this.sbProgramFeedConfigs) {
|
|
4856
|
+
this.sbProgramFeedConfigs = new Map();
|
|
4857
|
+
}
|
|
4858
|
+
if (!this.sbProgramFeedConfigs.has(feedAccount.pubkey.toString())) {
|
|
4859
|
+
const feedConfig = await feedAccount.loadConfigs();
|
|
4860
|
+
this.sbProgramFeedConfigs.set(feed.toString(), feedConfig);
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
const [pullIxs, _responses, success] = await on_demand_1.PullFeed.fetchUpdateManyIx(program, {
|
|
4864
|
+
feeds,
|
|
4865
|
+
numSignatures,
|
|
4866
|
+
recentSlothashes: recentSlothash
|
|
4867
|
+
? [[new anchor_1.BN(recentSlothash.slot), recentSlothash.hash]]
|
|
4868
|
+
: undefined,
|
|
4869
|
+
});
|
|
4870
|
+
if (!success) {
|
|
4871
|
+
return undefined;
|
|
4872
|
+
}
|
|
4873
|
+
return pullIxs;
|
|
4874
|
+
}
|
|
4851
4875
|
async getPostSwitchboardOnDemandUpdateAtomicIx(feed, recentSlothash, numSignatures = 3) {
|
|
4852
4876
|
const program = await this.getSwitchboardOnDemandProgram();
|
|
4853
4877
|
const feedAccount = new on_demand_1.PullFeed(program, feed);
|
|
@@ -4858,15 +4882,17 @@ class DriftClient {
|
|
|
4858
4882
|
const feedConfig = await feedAccount.loadConfigs();
|
|
4859
4883
|
this.sbProgramFeedConfigs.set(feed.toString(), feedConfig);
|
|
4860
4884
|
}
|
|
4861
|
-
const [pullIx, _responses, success] = await
|
|
4885
|
+
const [pullIx, _responses, success] = await on_demand_1.PullFeed.fetchUpdateManyIx(program, {
|
|
4886
|
+
feeds: [feed],
|
|
4862
4887
|
numSignatures,
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4888
|
+
recentSlothashes: recentSlothash
|
|
4889
|
+
? [[new anchor_1.BN(recentSlothash.slot), recentSlothash.hash]]
|
|
4890
|
+
: undefined,
|
|
4891
|
+
});
|
|
4866
4892
|
if (!success) {
|
|
4867
4893
|
return undefined;
|
|
4868
4894
|
}
|
|
4869
|
-
return pullIx;
|
|
4895
|
+
return pullIx[0];
|
|
4870
4896
|
}
|
|
4871
4897
|
async postSwitchboardOnDemandUpdate(feed, recentSlothash, numSignatures = 3) {
|
|
4872
4898
|
const pullIx = await this.getPostSwitchboardOnDemandUpdateAtomicIx(feed, recentSlothash, numSignatures);
|
|
@@ -5,7 +5,6 @@ import { DriftClient } from '../driftClient';
|
|
|
5
5
|
import { BN } from '@coral-xyz/anchor';
|
|
6
6
|
import { User } from '../user';
|
|
7
7
|
import { DepositRecord } from '../types';
|
|
8
|
-
import fetch from 'node-fetch';
|
|
9
8
|
export type BSOL_STATS_API_RESPONSE = {
|
|
10
9
|
success: boolean;
|
|
11
10
|
stats?: {
|
|
@@ -28,8 +27,8 @@ export type BSOL_EMISSIONS_API_RESPONSE = {
|
|
|
28
27
|
lend: number;
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
|
-
export declare function fetchBSolMetrics(): Promise<
|
|
32
|
-
export declare function fetchBSolDriftEmissions(): Promise<
|
|
30
|
+
export declare function fetchBSolMetrics(): Promise<any>;
|
|
31
|
+
export declare function fetchBSolDriftEmissions(): Promise<any>;
|
|
33
32
|
export declare function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, jupiterQuote, }: {
|
|
34
33
|
marketIndex: number;
|
|
35
34
|
amount: BN;
|
|
@@ -912,6 +912,7 @@ export declare class DriftClient {
|
|
|
912
912
|
}, feedId: string, encodedVaaAddress: PublicKey): Promise<TransactionInstruction>;
|
|
913
913
|
postPythLazerOracleUpdate(feedIds: number[], pythMessageHex: string): Promise<string>;
|
|
914
914
|
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
915
|
+
getPostManySwitchboardOnDemandUpdatesAtomicIxs(feeds: PublicKey[], recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction[] | undefined>;
|
|
915
916
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
916
917
|
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
917
918
|
private getBuildEncodedVaaIxs;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -4848,6 +4848,30 @@ class DriftClient {
|
|
|
4848
4848
|
});
|
|
4849
4849
|
return [verifyIx, ix];
|
|
4850
4850
|
}
|
|
4851
|
+
async getPostManySwitchboardOnDemandUpdatesAtomicIxs(feeds, recentSlothash, numSignatures = 3) {
|
|
4852
|
+
const program = await this.getSwitchboardOnDemandProgram();
|
|
4853
|
+
for (const feed of feeds) {
|
|
4854
|
+
const feedAccount = new on_demand_1.PullFeed(program, feed);
|
|
4855
|
+
if (!this.sbProgramFeedConfigs) {
|
|
4856
|
+
this.sbProgramFeedConfigs = new Map();
|
|
4857
|
+
}
|
|
4858
|
+
if (!this.sbProgramFeedConfigs.has(feedAccount.pubkey.toString())) {
|
|
4859
|
+
const feedConfig = await feedAccount.loadConfigs();
|
|
4860
|
+
this.sbProgramFeedConfigs.set(feed.toString(), feedConfig);
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
const [pullIxs, _responses, success] = await on_demand_1.PullFeed.fetchUpdateManyIx(program, {
|
|
4864
|
+
feeds,
|
|
4865
|
+
numSignatures,
|
|
4866
|
+
recentSlothashes: recentSlothash
|
|
4867
|
+
? [[new anchor_1.BN(recentSlothash.slot), recentSlothash.hash]]
|
|
4868
|
+
: undefined,
|
|
4869
|
+
});
|
|
4870
|
+
if (!success) {
|
|
4871
|
+
return undefined;
|
|
4872
|
+
}
|
|
4873
|
+
return pullIxs;
|
|
4874
|
+
}
|
|
4851
4875
|
async getPostSwitchboardOnDemandUpdateAtomicIx(feed, recentSlothash, numSignatures = 3) {
|
|
4852
4876
|
const program = await this.getSwitchboardOnDemandProgram();
|
|
4853
4877
|
const feedAccount = new on_demand_1.PullFeed(program, feed);
|
|
@@ -4858,15 +4882,17 @@ class DriftClient {
|
|
|
4858
4882
|
const feedConfig = await feedAccount.loadConfigs();
|
|
4859
4883
|
this.sbProgramFeedConfigs.set(feed.toString(), feedConfig);
|
|
4860
4884
|
}
|
|
4861
|
-
const [pullIx, _responses, success] = await
|
|
4885
|
+
const [pullIx, _responses, success] = await on_demand_1.PullFeed.fetchUpdateManyIx(program, {
|
|
4886
|
+
feeds: [feed],
|
|
4862
4887
|
numSignatures,
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4888
|
+
recentSlothashes: recentSlothash
|
|
4889
|
+
? [[new anchor_1.BN(recentSlothash.slot), recentSlothash.hash]]
|
|
4890
|
+
: undefined,
|
|
4891
|
+
});
|
|
4866
4892
|
if (!success) {
|
|
4867
4893
|
return undefined;
|
|
4868
4894
|
}
|
|
4869
|
-
return pullIx;
|
|
4895
|
+
return pullIx[0];
|
|
4870
4896
|
}
|
|
4871
4897
|
async postSwitchboardOnDemandUpdate(feed, recentSlothash, numSignatures = 3) {
|
|
4872
4898
|
const pullIx = await this.getPostSwitchboardOnDemandUpdateAtomicIx(feed, recentSlothash, numSignatures);
|
|
@@ -5,7 +5,6 @@ import { DriftClient } from '../driftClient';
|
|
|
5
5
|
import { BN } from '@coral-xyz/anchor';
|
|
6
6
|
import { User } from '../user';
|
|
7
7
|
import { DepositRecord } from '../types';
|
|
8
|
-
import fetch from 'node-fetch';
|
|
9
8
|
export type BSOL_STATS_API_RESPONSE = {
|
|
10
9
|
success: boolean;
|
|
11
10
|
stats?: {
|
|
@@ -28,8 +27,8 @@ export type BSOL_EMISSIONS_API_RESPONSE = {
|
|
|
28
27
|
lend: number;
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
|
-
export declare function fetchBSolMetrics(): Promise<
|
|
32
|
-
export declare function fetchBSolDriftEmissions(): Promise<
|
|
30
|
+
export declare function fetchBSolMetrics(): Promise<any>;
|
|
31
|
+
export declare function fetchBSolDriftEmissions(): Promise<any>;
|
|
33
32
|
export declare function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, jupiterQuote, }: {
|
|
34
33
|
marketIndex: number;
|
|
35
34
|
amount: BN;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drift-labs/sdk",
|
|
3
|
-
"version": "2.114.0-beta.
|
|
3
|
+
"version": "2.114.0-beta.7",
|
|
4
4
|
"main": "lib/node/index.js",
|
|
5
5
|
"types": "lib/node/index.d.ts",
|
|
6
6
|
"browser": "./lib/browser/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@pythnetwork/pyth-solana-receiver": "0.7.0",
|
|
48
48
|
"@solana/spl-token": "0.3.7",
|
|
49
49
|
"@solana/web3.js": "1.92.3",
|
|
50
|
-
"@switchboard-xyz/on-demand": "
|
|
50
|
+
"@switchboard-xyz/on-demand": "2.2.0",
|
|
51
51
|
"@triton-one/yellowstone-grpc": "1.3.0",
|
|
52
52
|
"anchor-bankrun": "0.3.0",
|
|
53
53
|
"nanoid": "3.3.4",
|
package/src/driftClient.ts
CHANGED
|
@@ -9289,6 +9289,39 @@ export class DriftClient {
|
|
|
9289
9289
|
return [verifyIx, ix];
|
|
9290
9290
|
}
|
|
9291
9291
|
|
|
9292
|
+
public async getPostManySwitchboardOnDemandUpdatesAtomicIxs(
|
|
9293
|
+
feeds: PublicKey[],
|
|
9294
|
+
recentSlothash?: Slothash,
|
|
9295
|
+
numSignatures = 3
|
|
9296
|
+
): Promise<TransactionInstruction[] | undefined> {
|
|
9297
|
+
const program = await this.getSwitchboardOnDemandProgram();
|
|
9298
|
+
for (const feed of feeds) {
|
|
9299
|
+
const feedAccount = new PullFeed(program, feed);
|
|
9300
|
+
if (!this.sbProgramFeedConfigs) {
|
|
9301
|
+
this.sbProgramFeedConfigs = new Map();
|
|
9302
|
+
}
|
|
9303
|
+
if (!this.sbProgramFeedConfigs.has(feedAccount.pubkey.toString())) {
|
|
9304
|
+
const feedConfig = await feedAccount.loadConfigs();
|
|
9305
|
+
this.sbProgramFeedConfigs.set(feed.toString(), feedConfig);
|
|
9306
|
+
}
|
|
9307
|
+
}
|
|
9308
|
+
|
|
9309
|
+
const [pullIxs, _responses, success] = await PullFeed.fetchUpdateManyIx(
|
|
9310
|
+
program,
|
|
9311
|
+
{
|
|
9312
|
+
feeds,
|
|
9313
|
+
numSignatures,
|
|
9314
|
+
recentSlothashes: recentSlothash
|
|
9315
|
+
? [[new BN(recentSlothash.slot), recentSlothash.hash]]
|
|
9316
|
+
: undefined,
|
|
9317
|
+
}
|
|
9318
|
+
);
|
|
9319
|
+
if (!success) {
|
|
9320
|
+
return undefined;
|
|
9321
|
+
}
|
|
9322
|
+
return pullIxs;
|
|
9323
|
+
}
|
|
9324
|
+
|
|
9292
9325
|
public async getPostSwitchboardOnDemandUpdateAtomicIx(
|
|
9293
9326
|
feed: PublicKey,
|
|
9294
9327
|
recentSlothash?: Slothash,
|
|
@@ -9303,18 +9336,20 @@ export class DriftClient {
|
|
|
9303
9336
|
const feedConfig = await feedAccount.loadConfigs();
|
|
9304
9337
|
this.sbProgramFeedConfigs.set(feed.toString(), feedConfig);
|
|
9305
9338
|
}
|
|
9306
|
-
const [pullIx, _responses, success] = await
|
|
9339
|
+
const [pullIx, _responses, success] = await PullFeed.fetchUpdateManyIx(
|
|
9340
|
+
program,
|
|
9307
9341
|
{
|
|
9342
|
+
feeds: [feed],
|
|
9308
9343
|
numSignatures,
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9344
|
+
recentSlothashes: recentSlothash
|
|
9345
|
+
? [[new BN(recentSlothash.slot), recentSlothash.hash]]
|
|
9346
|
+
: undefined,
|
|
9347
|
+
}
|
|
9313
9348
|
);
|
|
9314
9349
|
if (!success) {
|
|
9315
9350
|
return undefined;
|
|
9316
9351
|
}
|
|
9317
|
-
return pullIx;
|
|
9352
|
+
return pullIx[0];
|
|
9318
9353
|
}
|
|
9319
9354
|
|
|
9320
9355
|
public async postSwitchboardOnDemandUpdate(
|