@drift-labs/sdk 2.32.1-beta.10 → 2.32.1-beta.11
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/math/superStake.d.ts +2 -2
- package/lib/math/superStake.js +6 -3
- package/package.json +1 -1
- package/src/math/superStake.ts +7 -4
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.32.1-beta.
|
|
1
|
+
2.32.1-beta.11
|
package/lib/math/superStake.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ import { DriftClient } from '../driftClient';
|
|
|
4
4
|
import { BN } from '@coral-xyz/anchor';
|
|
5
5
|
import { User } from '../user';
|
|
6
6
|
import { DepositRecord } from '../types';
|
|
7
|
-
export declare function findBestSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, marinadePrice,
|
|
7
|
+
export declare function findBestSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, marinadePrice, forceMarinade, }: {
|
|
8
8
|
amount: BN;
|
|
9
9
|
jupiterClient: JupiterClient;
|
|
10
10
|
driftClient: DriftClient;
|
|
11
11
|
marinadePrice?: number;
|
|
12
12
|
userAccountPublicKey?: PublicKey;
|
|
13
|
-
|
|
13
|
+
forceMarinade?: boolean;
|
|
14
14
|
}): Promise<{
|
|
15
15
|
ixs: TransactionInstruction[];
|
|
16
16
|
lookupTables: AddressLookupTableAccount[];
|
package/lib/math/superStake.js
CHANGED
|
@@ -10,7 +10,7 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
10
10
|
const types_1 = require("../types");
|
|
11
11
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
12
12
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
13
|
-
async function findBestSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, marinadePrice,
|
|
13
|
+
async function findBestSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, marinadePrice, forceMarinade, }) {
|
|
14
14
|
if (!marinadePrice) {
|
|
15
15
|
const marinadeProgram = (0, marinade_1.getMarinadeFinanceProgram)(driftClient.provider);
|
|
16
16
|
marinadePrice = await (0, marinade_1.getMarinadeMSolPrice)(marinadeProgram);
|
|
@@ -31,8 +31,11 @@ async function findBestSuperStakeIxs({ amount, jupiterClient, driftClient, userA
|
|
|
31
31
|
catch (e) {
|
|
32
32
|
console.error('Error getting jupiter price', e);
|
|
33
33
|
}
|
|
34
|
-
if (!jupiterPrice || marinadePrice <= jupiterPrice ||
|
|
35
|
-
const ixs = await driftClient.getStakeForMSOLIx({
|
|
34
|
+
if (!jupiterPrice || marinadePrice <= jupiterPrice || forceMarinade) {
|
|
35
|
+
const ixs = await driftClient.getStakeForMSOLIx({
|
|
36
|
+
amount,
|
|
37
|
+
userAccountPublicKey,
|
|
38
|
+
});
|
|
36
39
|
return {
|
|
37
40
|
method: 'marinade',
|
|
38
41
|
ixs,
|
package/package.json
CHANGED
package/src/math/superStake.ts
CHANGED
|
@@ -19,14 +19,14 @@ export async function findBestSuperStakeIxs({
|
|
|
19
19
|
driftClient,
|
|
20
20
|
userAccountPublicKey,
|
|
21
21
|
marinadePrice,
|
|
22
|
-
|
|
22
|
+
forceMarinade,
|
|
23
23
|
}: {
|
|
24
24
|
amount: BN;
|
|
25
25
|
jupiterClient: JupiterClient;
|
|
26
26
|
driftClient: DriftClient;
|
|
27
27
|
marinadePrice?: number;
|
|
28
28
|
userAccountPublicKey?: PublicKey;
|
|
29
|
-
|
|
29
|
+
forceMarinade?: boolean;
|
|
30
30
|
}): Promise<{
|
|
31
31
|
ixs: TransactionInstruction[];
|
|
32
32
|
lookupTables: AddressLookupTableAccount[];
|
|
@@ -56,8 +56,11 @@ export async function findBestSuperStakeIxs({
|
|
|
56
56
|
console.error('Error getting jupiter price', e);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if (!jupiterPrice || marinadePrice <= jupiterPrice ||
|
|
60
|
-
const ixs = await driftClient.getStakeForMSOLIx({
|
|
59
|
+
if (!jupiterPrice || marinadePrice <= jupiterPrice || forceMarinade) {
|
|
60
|
+
const ixs = await driftClient.getStakeForMSOLIx({
|
|
61
|
+
amount,
|
|
62
|
+
userAccountPublicKey,
|
|
63
|
+
});
|
|
61
64
|
return {
|
|
62
65
|
method: 'marinade',
|
|
63
66
|
ixs,
|