@drift-labs/sdk 2.53.0-beta.3 → 2.53.0-beta.5

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.53.0-beta.3
1
+ 2.53.0-beta.5
@@ -2167,6 +2167,7 @@ class DriftClient {
2167
2167
  slippageBps,
2168
2168
  swapMode,
2169
2169
  onlyDirectRoutes,
2170
+ excludeDexes: ['Raydium CLMM'], // temp exclude to workaround bug with raydium clmm
2170
2171
  });
2171
2172
  quote = fetchedQuote;
2172
2173
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="bn.js" />
2
2
  import { AddressLookupTableAccount, PublicKey, TransactionInstruction } from '@solana/web3.js';
3
- import { JupiterClient } from '../jupiter/jupiterClient';
3
+ import { JupiterClient, QuoteResponse } from '../jupiter/jupiterClient';
4
4
  import { DriftClient } from '../driftClient';
5
5
  import { BN } from '@coral-xyz/anchor';
6
6
  import { User } from '../user';
@@ -29,7 +29,7 @@ export type BSOL_EMISSIONS_API_RESPONSE = {
29
29
  };
30
30
  export declare function fetchBSolMetrics(): Promise<any>;
31
31
  export declare function fetchBSolDriftEmissions(): Promise<any>;
32
- export declare function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, }: {
32
+ export declare function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, jupiterQuote, }: {
33
33
  marketIndex: number;
34
34
  amount: BN;
35
35
  jupiterClient: JupiterClient;
@@ -38,13 +38,14 @@ export declare function findBestSuperStakeIxs({ marketIndex, amount, jupiterClie
38
38
  userAccountPublicKey?: PublicKey;
39
39
  forceMarinade?: boolean;
40
40
  onlyDirectRoutes?: boolean;
41
+ jupiterQuote?: QuoteResponse;
41
42
  }): Promise<{
42
43
  ixs: TransactionInstruction[];
43
44
  lookupTables: AddressLookupTableAccount[];
44
45
  method: 'jupiter' | 'marinade';
45
- price: number;
46
+ price?: number;
46
47
  }>;
47
- export declare function findBestMSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, }: {
48
+ export declare function findBestMSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, jupiterQuote, }: {
48
49
  amount: BN;
49
50
  jupiterClient: JupiterClient;
50
51
  driftClient: DriftClient;
@@ -52,30 +53,32 @@ export declare function findBestMSolSuperStakeIxs({ amount, jupiterClient, drift
52
53
  userAccountPublicKey?: PublicKey;
53
54
  forceMarinade?: boolean;
54
55
  onlyDirectRoutes?: boolean;
56
+ jupiterQuote?: QuoteResponse;
55
57
  }): Promise<{
56
58
  ixs: TransactionInstruction[];
57
59
  lookupTables: AddressLookupTableAccount[];
58
60
  method: 'jupiter' | 'marinade';
59
61
  price: number;
60
62
  }>;
61
- export declare function findBestJitoSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, }: {
63
+ export declare function findBestJitoSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, jupiterQuote, }: {
62
64
  amount: BN;
63
65
  jupiterClient: JupiterClient;
64
66
  driftClient: DriftClient;
65
67
  userAccountPublicKey?: PublicKey;
66
68
  onlyDirectRoutes?: boolean;
69
+ jupiterQuote?: QuoteResponse;
67
70
  }): Promise<{
68
71
  ixs: TransactionInstruction[];
69
72
  lookupTables: AddressLookupTableAccount[];
70
73
  method: 'jupiter' | 'marinade';
71
- price: number;
74
+ price?: number;
72
75
  }>;
73
76
  /**
74
77
  * Finds best Jupiter Swap instructions for a generic lstMint
75
78
  *
76
79
  * Without doing any extra steps like checking if you can get a better rate by staking directly with that LST platform
77
80
  */
78
- export declare function findBestLstSuperStakeIxs({ amount, lstMint, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, lstMarketIndex, }: {
81
+ export declare function findBestLstSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, lstMarketIndex, jupiterQuote, }: {
79
82
  amount: BN;
80
83
  lstMint: PublicKey;
81
84
  lstMarketIndex: number;
@@ -83,11 +86,11 @@ export declare function findBestLstSuperStakeIxs({ amount, lstMint, jupiterClien
83
86
  driftClient: DriftClient;
84
87
  userAccountPublicKey?: PublicKey;
85
88
  onlyDirectRoutes?: boolean;
89
+ jupiterQuote?: QuoteResponse;
86
90
  }): Promise<{
87
91
  ixs: TransactionInstruction[];
88
92
  lookupTables: AddressLookupTableAccount[];
89
93
  method: 'jupiter' | 'marinade';
90
- price: number;
91
94
  }>;
92
95
  export type JITO_SOL_METRICS_ENDPOINT_RESPONSE = {
93
96
  data: {
@@ -19,7 +19,7 @@ async function fetchBSolDriftEmissions() {
19
19
  return await (0, node_fetch_1.default)('https://stake.solblaze.org/api/v1/drift_emissions');
20
20
  }
21
21
  exports.fetchBSolDriftEmissions = fetchBSolDriftEmissions;
22
- async function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, }) {
22
+ async function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, jupiterQuote, }) {
23
23
  if (marketIndex === 2) {
24
24
  return findBestMSolSuperStakeIxs({
25
25
  amount,
@@ -29,6 +29,7 @@ async function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, drift
29
29
  price,
30
30
  forceMarinade,
31
31
  onlyDirectRoutes,
32
+ jupiterQuote,
32
33
  });
33
34
  }
34
35
  else if (marketIndex === 6) {
@@ -38,6 +39,7 @@ async function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, drift
38
39
  driftClient,
39
40
  userAccountPublicKey,
40
41
  onlyDirectRoutes,
42
+ jupiterQuote,
41
43
  });
42
44
  }
43
45
  else if (marketIndex === 8) {
@@ -49,6 +51,7 @@ async function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, drift
49
51
  driftClient,
50
52
  userAccountPublicKey,
51
53
  onlyDirectRoutes,
54
+ jupiterQuote,
52
55
  });
53
56
  }
54
57
  else {
@@ -56,27 +59,30 @@ async function findBestSuperStakeIxs({ marketIndex, amount, jupiterClient, drift
56
59
  }
57
60
  }
58
61
  exports.findBestSuperStakeIxs = findBestSuperStakeIxs;
59
- async function findBestMSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, }) {
62
+ async function findBestMSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, price, forceMarinade, onlyDirectRoutes, jupiterQuote, }) {
60
63
  if (!price) {
61
64
  const marinadeProgram = (0, marinade_1.getMarinadeFinanceProgram)(driftClient.provider);
62
65
  price = await (0, marinade_1.getMarinadeMSolPrice)(marinadeProgram);
63
66
  }
64
- const solMint = driftClient.getSpotMarketAccount(1).mint;
65
- const mSOLMint = driftClient.getSpotMarketAccount(2).mint;
67
+ const solSpotMarketAccount = driftClient.getSpotMarketAccount(1);
68
+ const mSolSpotMarketAccount = driftClient.getSpotMarketAccount(2);
66
69
  let jupiterPrice;
67
- let bestRoute;
68
- try {
69
- const jupiterRoutes = await jupiterClient.getRoutes({
70
- inputMint: solMint,
71
- outputMint: mSOLMint,
72
- amount,
73
- onlyDirectRoutes,
74
- });
75
- bestRoute = jupiterRoutes[0];
76
- jupiterPrice = bestRoute.inAmount / bestRoute.outAmount;
77
- }
78
- catch (e) {
79
- console.error('Error getting jupiter price', e);
70
+ let quote = jupiterQuote;
71
+ if (!jupiterQuote) {
72
+ try {
73
+ const fetchedQuote = await jupiterClient.getQuote({
74
+ inputMint: solSpotMarketAccount.mint,
75
+ outputMint: mSolSpotMarketAccount.mint,
76
+ amount,
77
+ slippageBps: 1000,
78
+ onlyDirectRoutes,
79
+ });
80
+ jupiterPrice = +quote.outAmount / +quote.inAmount;
81
+ quote = fetchedQuote;
82
+ }
83
+ catch (e) {
84
+ console.error('Error getting jupiter price', e);
85
+ }
80
86
  }
81
87
  if (!jupiterPrice || price <= jupiterPrice || forceMarinade) {
82
88
  const ixs = await driftClient.getStakeForMSOLIx({
@@ -91,13 +97,14 @@ async function findBestMSolSuperStakeIxs({ amount, jupiterClient, driftClient, u
91
97
  };
92
98
  }
93
99
  else {
94
- const { ixs, lookupTables } = await driftClient.getJupiterSwapIx({
100
+ const { ixs, lookupTables } = await driftClient.getJupiterSwapIxV6({
95
101
  inMarketIndex: 1,
96
102
  outMarketIndex: 2,
97
- route: bestRoute,
98
103
  jupiterClient,
99
104
  amount,
100
105
  userAccountPublicKey,
106
+ onlyDirectRoutes,
107
+ quote,
101
108
  });
102
109
  return {
103
110
  method: 'jupiter',
@@ -108,7 +115,7 @@ async function findBestMSolSuperStakeIxs({ amount, jupiterClient, driftClient, u
108
115
  }
109
116
  }
110
117
  exports.findBestMSolSuperStakeIxs = findBestMSolSuperStakeIxs;
111
- async function findBestJitoSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, }) {
118
+ async function findBestJitoSolSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, jupiterQuote, }) {
112
119
  return await findBestLstSuperStakeIxs({
113
120
  amount,
114
121
  jupiterClient,
@@ -117,6 +124,7 @@ async function findBestJitoSolSuperStakeIxs({ amount, jupiterClient, driftClient
117
124
  onlyDirectRoutes,
118
125
  lstMint: driftClient.getSpotMarketAccount(6).mint,
119
126
  lstMarketIndex: 6,
127
+ jupiterQuote,
120
128
  });
121
129
  }
122
130
  exports.findBestJitoSolSuperStakeIxs = findBestJitoSolSuperStakeIxs;
@@ -125,37 +133,21 @@ exports.findBestJitoSolSuperStakeIxs = findBestJitoSolSuperStakeIxs;
125
133
  *
126
134
  * Without doing any extra steps like checking if you can get a better rate by staking directly with that LST platform
127
135
  */
128
- async function findBestLstSuperStakeIxs({ amount, lstMint, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, lstMarketIndex, }) {
129
- const solMint = driftClient.getSpotMarketAccount(1).mint;
130
- let jupiterPrice;
131
- let bestRoute;
132
- try {
133
- const jupiterRoutes = await jupiterClient.getRoutes({
134
- inputMint: solMint,
135
- outputMint: lstMint,
136
- amount,
137
- onlyDirectRoutes,
138
- });
139
- bestRoute = jupiterRoutes[0];
140
- jupiterPrice = bestRoute.inAmount / bestRoute.outAmount;
141
- }
142
- catch (e) {
143
- console.error('Error getting jupiter price', e);
144
- throw e;
145
- }
146
- const { ixs, lookupTables } = await driftClient.getJupiterSwapIx({
136
+ async function findBestLstSuperStakeIxs({ amount, jupiterClient, driftClient, userAccountPublicKey, onlyDirectRoutes, lstMarketIndex, jupiterQuote, }) {
137
+ const { ixs, lookupTables } = await driftClient.getJupiterSwapIxV6({
147
138
  inMarketIndex: 1,
148
139
  outMarketIndex: lstMarketIndex,
149
- route: bestRoute,
150
140
  jupiterClient,
151
141
  amount,
152
142
  userAccountPublicKey,
143
+ onlyDirectRoutes,
144
+ quote: jupiterQuote,
153
145
  });
154
146
  return {
155
147
  method: 'jupiter',
156
148
  ixs,
157
149
  lookupTables,
158
- price: jupiterPrice,
150
+ // price: jupiterPrice,
159
151
  };
160
152
  }
161
153
  exports.findBestLstSuperStakeIxs = findBestLstSuperStakeIxs;
@@ -12,13 +12,15 @@ export declare class FastSingleTxSender extends BaseTxSender {
12
12
  additionalConnections: Connection[];
13
13
  timoutCount: number;
14
14
  blockhashQueue: string[];
15
- constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, }: {
15
+ skipConfirmation: boolean;
16
+ constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, }: {
16
17
  connection: Connection;
17
18
  wallet: IWallet;
18
19
  opts?: ConfirmOptions;
19
20
  timeout?: number;
20
21
  blockhashRefreshInterval?: number;
21
22
  additionalConnections?: any;
23
+ skipConfirmation?: boolean;
22
24
  });
23
25
  startBlockhashRefreshLoop(): void;
24
26
  addBlockhashToQueue(blockhash: string): void;
@@ -8,7 +8,7 @@ const DEFAULT_TIMEOUT = 35000;
8
8
  const DEFAULT_BLOCKHASH_REFRESH = 500;
9
9
  const MAX_BLOCKHASH_QUEUE_LENGTH = 100;
10
10
  class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
11
- constructor({ connection, wallet, opts = anchor_1.AnchorProvider.defaultOptions(), timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), }) {
11
+ constructor({ connection, wallet, opts = anchor_1.AnchorProvider.defaultOptions(), timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), skipConfirmation = false, }) {
12
12
  super({ connection, wallet, opts, timeout, additionalConnections });
13
13
  this.timoutCount = 0;
14
14
  this.blockhashQueue = [];
@@ -18,6 +18,7 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
18
18
  this.timeout = timeout;
19
19
  this.blockhashRefreshInterval = blockhashRefreshInterval;
20
20
  this.additionalConnections = additionalConnections;
21
+ this.skipConfirmation = skipConfirmation;
21
22
  this.startBlockhashRefreshLoop();
22
23
  }
23
24
  startBlockhashRefreshLoop() {
@@ -87,13 +88,15 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
87
88
  });
88
89
  this.sendToAdditionalConnections(rawTransaction, opts);
89
90
  let slot;
90
- try {
91
- const result = await this.confirmTransaction(txid, opts.commitment);
92
- slot = result.context.slot;
93
- }
94
- catch (e) {
95
- console.error(e);
96
- throw e;
91
+ if (!this.skipConfirmation) {
92
+ try {
93
+ const result = await this.confirmTransaction(txid, opts.commitment);
94
+ slot = result.context.slot;
95
+ }
96
+ catch (e) {
97
+ console.error(e);
98
+ throw e;
99
+ }
97
100
  }
98
101
  return { txSig: txid, slot };
99
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.53.0-beta.3",
3
+ "version": "2.53.0-beta.5",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -3865,6 +3865,7 @@ export class DriftClient {
3865
3865
  slippageBps,
3866
3866
  swapMode,
3867
3867
  onlyDirectRoutes,
3868
+ excludeDexes: ['Raydium CLMM'], // temp exclude to workaround bug with raydium clmm
3868
3869
  });
3869
3870
 
3870
3871
  quote = fetchedQuote;
@@ -4,7 +4,7 @@ import {
4
4
  PublicKey,
5
5
  TransactionInstruction,
6
6
  } from '@solana/web3.js';
7
- import { JupiterClient } from '../jupiter/jupiterClient';
7
+ import { JupiterClient, QuoteResponse } from '../jupiter/jupiterClient';
8
8
  import { DriftClient } from '../driftClient';
9
9
  import { getMarinadeFinanceProgram, getMarinadeMSolPrice } from '../marinade';
10
10
  import { BN } from '@coral-xyz/anchor';
@@ -55,6 +55,7 @@ export async function findBestSuperStakeIxs({
55
55
  price,
56
56
  forceMarinade,
57
57
  onlyDirectRoutes,
58
+ jupiterQuote,
58
59
  }: {
59
60
  marketIndex: number;
60
61
  amount: BN;
@@ -64,11 +65,12 @@ export async function findBestSuperStakeIxs({
64
65
  userAccountPublicKey?: PublicKey;
65
66
  forceMarinade?: boolean;
66
67
  onlyDirectRoutes?: boolean;
68
+ jupiterQuote?: QuoteResponse;
67
69
  }): Promise<{
68
70
  ixs: TransactionInstruction[];
69
71
  lookupTables: AddressLookupTableAccount[];
70
72
  method: 'jupiter' | 'marinade';
71
- price: number;
73
+ price?: number;
72
74
  }> {
73
75
  if (marketIndex === 2) {
74
76
  return findBestMSolSuperStakeIxs({
@@ -79,6 +81,7 @@ export async function findBestSuperStakeIxs({
79
81
  price,
80
82
  forceMarinade,
81
83
  onlyDirectRoutes,
84
+ jupiterQuote,
82
85
  });
83
86
  } else if (marketIndex === 6) {
84
87
  return findBestJitoSolSuperStakeIxs({
@@ -87,6 +90,7 @@ export async function findBestSuperStakeIxs({
87
90
  driftClient,
88
91
  userAccountPublicKey,
89
92
  onlyDirectRoutes,
93
+ jupiterQuote,
90
94
  });
91
95
  } else if (marketIndex === 8) {
92
96
  return findBestLstSuperStakeIxs({
@@ -97,6 +101,7 @@ export async function findBestSuperStakeIxs({
97
101
  driftClient,
98
102
  userAccountPublicKey,
99
103
  onlyDirectRoutes,
104
+ jupiterQuote,
100
105
  });
101
106
  } else {
102
107
  throw new Error(`Unsupported superstake market index: ${marketIndex}`);
@@ -111,6 +116,7 @@ export async function findBestMSolSuperStakeIxs({
111
116
  price,
112
117
  forceMarinade,
113
118
  onlyDirectRoutes,
119
+ jupiterQuote,
114
120
  }: {
115
121
  amount: BN;
116
122
  jupiterClient: JupiterClient;
@@ -119,6 +125,7 @@ export async function findBestMSolSuperStakeIxs({
119
125
  userAccountPublicKey?: PublicKey;
120
126
  forceMarinade?: boolean;
121
127
  onlyDirectRoutes?: boolean;
128
+ jupiterQuote?: QuoteResponse;
122
129
  }): Promise<{
123
130
  ixs: TransactionInstruction[];
124
131
  lookupTables: AddressLookupTableAccount[];
@@ -130,23 +137,27 @@ export async function findBestMSolSuperStakeIxs({
130
137
  price = await getMarinadeMSolPrice(marinadeProgram);
131
138
  }
132
139
 
133
- const solMint = driftClient.getSpotMarketAccount(1).mint;
134
- const mSOLMint = driftClient.getSpotMarketAccount(2).mint;
140
+ const solSpotMarketAccount = driftClient.getSpotMarketAccount(1);
141
+ const mSolSpotMarketAccount = driftClient.getSpotMarketAccount(2);
142
+
143
+ let jupiterPrice: number;
144
+ let quote = jupiterQuote;
145
+ if (!jupiterQuote) {
146
+ try {
147
+ const fetchedQuote = await jupiterClient.getQuote({
148
+ inputMint: solSpotMarketAccount.mint,
149
+ outputMint: mSolSpotMarketAccount.mint,
150
+ amount,
151
+ slippageBps: 1000,
152
+ onlyDirectRoutes,
153
+ });
135
154
 
136
- let jupiterPrice;
137
- let bestRoute;
138
- try {
139
- const jupiterRoutes = await jupiterClient.getRoutes({
140
- inputMint: solMint,
141
- outputMint: mSOLMint,
142
- amount,
143
- onlyDirectRoutes,
144
- });
155
+ jupiterPrice = +quote.outAmount / +quote.inAmount;
145
156
 
146
- bestRoute = jupiterRoutes[0];
147
- jupiterPrice = bestRoute.inAmount / bestRoute.outAmount;
148
- } catch (e) {
149
- console.error('Error getting jupiter price', e);
157
+ quote = fetchedQuote;
158
+ } catch (e) {
159
+ console.error('Error getting jupiter price', e);
160
+ }
150
161
  }
151
162
 
152
163
  if (!jupiterPrice || price <= jupiterPrice || forceMarinade) {
@@ -161,13 +172,14 @@ export async function findBestMSolSuperStakeIxs({
161
172
  price: price,
162
173
  };
163
174
  } else {
164
- const { ixs, lookupTables } = await driftClient.getJupiterSwapIx({
175
+ const { ixs, lookupTables } = await driftClient.getJupiterSwapIxV6({
165
176
  inMarketIndex: 1,
166
177
  outMarketIndex: 2,
167
- route: bestRoute,
168
178
  jupiterClient,
169
179
  amount,
170
180
  userAccountPublicKey,
181
+ onlyDirectRoutes,
182
+ quote,
171
183
  });
172
184
  return {
173
185
  method: 'jupiter',
@@ -184,17 +196,19 @@ export async function findBestJitoSolSuperStakeIxs({
184
196
  driftClient,
185
197
  userAccountPublicKey,
186
198
  onlyDirectRoutes,
199
+ jupiterQuote,
187
200
  }: {
188
201
  amount: BN;
189
202
  jupiterClient: JupiterClient;
190
203
  driftClient: DriftClient;
191
204
  userAccountPublicKey?: PublicKey;
192
205
  onlyDirectRoutes?: boolean;
206
+ jupiterQuote?: QuoteResponse;
193
207
  }): Promise<{
194
208
  ixs: TransactionInstruction[];
195
209
  lookupTables: AddressLookupTableAccount[];
196
210
  method: 'jupiter' | 'marinade';
197
- price: number;
211
+ price?: number;
198
212
  }> {
199
213
  return await findBestLstSuperStakeIxs({
200
214
  amount,
@@ -204,6 +218,7 @@ export async function findBestJitoSolSuperStakeIxs({
204
218
  onlyDirectRoutes,
205
219
  lstMint: driftClient.getSpotMarketAccount(6).mint,
206
220
  lstMarketIndex: 6,
221
+ jupiterQuote,
207
222
  });
208
223
  }
209
224
 
@@ -214,12 +229,12 @@ export async function findBestJitoSolSuperStakeIxs({
214
229
  */
215
230
  export async function findBestLstSuperStakeIxs({
216
231
  amount,
217
- lstMint,
218
232
  jupiterClient,
219
233
  driftClient,
220
234
  userAccountPublicKey,
221
235
  onlyDirectRoutes,
222
236
  lstMarketIndex,
237
+ jupiterQuote,
223
238
  }: {
224
239
  amount: BN;
225
240
  lstMint: PublicKey;
@@ -228,44 +243,26 @@ export async function findBestLstSuperStakeIxs({
228
243
  driftClient: DriftClient;
229
244
  userAccountPublicKey?: PublicKey;
230
245
  onlyDirectRoutes?: boolean;
246
+ jupiterQuote?: QuoteResponse;
231
247
  }): Promise<{
232
248
  ixs: TransactionInstruction[];
233
249
  lookupTables: AddressLookupTableAccount[];
234
250
  method: 'jupiter' | 'marinade';
235
- price: number;
236
251
  }> {
237
- const solMint = driftClient.getSpotMarketAccount(1).mint;
238
-
239
- let jupiterPrice;
240
- let bestRoute;
241
- try {
242
- const jupiterRoutes = await jupiterClient.getRoutes({
243
- inputMint: solMint,
244
- outputMint: lstMint,
245
- amount,
246
- onlyDirectRoutes,
247
- });
248
-
249
- bestRoute = jupiterRoutes[0];
250
- jupiterPrice = bestRoute.inAmount / bestRoute.outAmount;
251
- } catch (e) {
252
- console.error('Error getting jupiter price', e);
253
- throw e;
254
- }
255
-
256
- const { ixs, lookupTables } = await driftClient.getJupiterSwapIx({
252
+ const { ixs, lookupTables } = await driftClient.getJupiterSwapIxV6({
257
253
  inMarketIndex: 1,
258
254
  outMarketIndex: lstMarketIndex,
259
- route: bestRoute,
260
255
  jupiterClient,
261
256
  amount,
262
257
  userAccountPublicKey,
258
+ onlyDirectRoutes,
259
+ quote: jupiterQuote,
263
260
  });
264
261
  return {
265
262
  method: 'jupiter',
266
263
  ixs,
267
264
  lookupTables,
268
- price: jupiterPrice,
265
+ // price: jupiterPrice,
269
266
  };
270
267
  }
271
268
 
@@ -27,6 +27,7 @@ export class FastSingleTxSender extends BaseTxSender {
27
27
  additionalConnections: Connection[];
28
28
  timoutCount = 0;
29
29
  blockhashQueue: string[] = [];
30
+ skipConfirmation: boolean;
30
31
 
31
32
  public constructor({
32
33
  connection,
@@ -35,6 +36,7 @@ export class FastSingleTxSender extends BaseTxSender {
35
36
  timeout = DEFAULT_TIMEOUT,
36
37
  blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH,
37
38
  additionalConnections = new Array<Connection>(),
39
+ skipConfirmation = false,
38
40
  }: {
39
41
  connection: Connection;
40
42
  wallet: IWallet;
@@ -42,6 +44,7 @@ export class FastSingleTxSender extends BaseTxSender {
42
44
  timeout?: number;
43
45
  blockhashRefreshInterval?: number;
44
46
  additionalConnections?;
47
+ skipConfirmation?: boolean;
45
48
  }) {
46
49
  super({ connection, wallet, opts, timeout, additionalConnections });
47
50
  this.connection = connection;
@@ -50,6 +53,7 @@ export class FastSingleTxSender extends BaseTxSender {
50
53
  this.timeout = timeout;
51
54
  this.blockhashRefreshInterval = blockhashRefreshInterval;
52
55
  this.additionalConnections = additionalConnections;
56
+ this.skipConfirmation = skipConfirmation;
53
57
  this.startBlockhashRefreshLoop();
54
58
  }
55
59
 
@@ -144,12 +148,14 @@ export class FastSingleTxSender extends BaseTxSender {
144
148
  this.sendToAdditionalConnections(rawTransaction, opts);
145
149
 
146
150
  let slot: number;
147
- try {
148
- const result = await this.confirmTransaction(txid, opts.commitment);
149
- slot = result.context.slot;
150
- } catch (e) {
151
- console.error(e);
152
- throw e;
151
+ if (!this.skipConfirmation) {
152
+ try {
153
+ const result = await this.confirmTransaction(txid, opts.commitment);
154
+ slot = result.context.slot;
155
+ } catch (e) {
156
+ console.error(e);
157
+ throw e;
158
+ }
153
159
  }
154
160
 
155
161
  return { txSig: txid, slot };