@haven-fi/solauto-sdk 1.0.407 → 1.0.409
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;
|
1
|
+
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAmND,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAwF/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -109,9 +109,7 @@ async function simulateJitoBundle(umi, txs) {
|
|
109
109
|
}
|
110
110
|
async function umiToVersionedTransactions(umi, blockhash, signer, txs, sign, feeEstimates, computeUnitLimits) {
|
111
111
|
let builtTxs = await Promise.all(txs.map(async (tx, i) => {
|
112
|
-
return (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined)
|
113
|
-
.setBlockhash(blockhash)
|
114
|
-
.build(umi);
|
112
|
+
return await (0, solanaUtils_1.assembleFinalTransaction)(signer, tx, feeEstimates ? feeEstimates[i] : undefined, computeUnitLimits ? computeUnitLimits[i] : undefined).buildWithLatestBlockhash(umi);
|
115
113
|
}));
|
116
114
|
if (sign) {
|
117
115
|
builtTxs = await signer.signAllTransactions(builtTxs);
|
@@ -153,7 +151,9 @@ async function pollBundleStatus(bundleId, interval = 1000, timeout = 40000) {
|
|
153
151
|
async function sendJitoBundle(umi, transactions) {
|
154
152
|
let resp;
|
155
153
|
try {
|
156
|
-
resp = await axios_1.default.post(
|
154
|
+
resp = await axios_1.default.post(
|
155
|
+
// umi.rpc.getEndpoint(),
|
156
|
+
`${solautoConstants_1.JITO_BLOCK_ENGINE}/api/v1/bundles`, {
|
157
157
|
jsonrpc: "2.0",
|
158
158
|
id: 1,
|
159
159
|
method: "sendBundle",
|
@@ -183,8 +183,7 @@ async function sendJitoBundledTransactions(umi, connection, signer, txs, txType,
|
|
183
183
|
(0, generalUtils_1.consoleLog)("Transaction sizes: ", txs.map((x) => x.getTransactionSize(umi)));
|
184
184
|
txs[0] = txs[0].prepend(await getTipInstruction(signer, 150000));
|
185
185
|
const feeEstimates = priorityFeeSetting !== types_1.PriorityFeeSetting.None
|
186
|
-
? await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting, true)) ??
|
187
|
-
1000000))
|
186
|
+
? await Promise.all(txs.map(async (x) => (await (0, solanaUtils_1.getComputeUnitPriceEstimate)(umi, x, priorityFeeSetting, true)) ?? 1000000))
|
188
187
|
: undefined;
|
189
188
|
const latestBlockhash = (await umi.rpc.getLatestBlockhash({ commitment: "confirmed" })).blockhash;
|
190
189
|
let builtTxs;
|
package/package.json
CHANGED
package/src/utils/jitoUtils.ts
CHANGED
@@ -163,14 +163,12 @@ async function umiToVersionedTransactions(
|
|
163
163
|
): Promise<VersionedTransaction[]> {
|
164
164
|
let builtTxs = await Promise.all(
|
165
165
|
txs.map(async (tx, i) => {
|
166
|
-
return assembleFinalTransaction(
|
166
|
+
return await assembleFinalTransaction(
|
167
167
|
signer,
|
168
168
|
tx,
|
169
169
|
feeEstimates ? feeEstimates[i] : undefined,
|
170
170
|
computeUnitLimits ? computeUnitLimits[i] : undefined
|
171
|
-
)
|
172
|
-
.setBlockhash(blockhash)
|
173
|
-
.build(umi);
|
171
|
+
).buildWithLatestBlockhash(umi);
|
174
172
|
})
|
175
173
|
);
|
176
174
|
|
@@ -228,12 +226,16 @@ async function sendJitoBundle(
|
|
228
226
|
): Promise<string[]> {
|
229
227
|
let resp: any;
|
230
228
|
try {
|
231
|
-
resp = await axios.post<{ result: string }>(
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
229
|
+
resp = await axios.post<{ result: string }>(
|
230
|
+
// umi.rpc.getEndpoint(),
|
231
|
+
`${JITO_BLOCK_ENGINE}/api/v1/bundles`,
|
232
|
+
{
|
233
|
+
jsonrpc: "2.0",
|
234
|
+
id: 1,
|
235
|
+
method: "sendBundle",
|
236
|
+
params: [transactions],
|
237
|
+
}
|
238
|
+
);
|
237
239
|
} catch (e: any) {
|
238
240
|
if (e.response.data.error) {
|
239
241
|
console.error("Jito send bundle error:", e.response.data.error);
|
@@ -258,7 +260,14 @@ export async function sendJitoBundledTransactions(
|
|
258
260
|
onAwaitingSign?: () => void
|
259
261
|
): Promise<string[] | undefined> {
|
260
262
|
if (txs.length === 1) {
|
261
|
-
const resp = await sendSingleOptimizedTransaction(
|
263
|
+
const resp = await sendSingleOptimizedTransaction(
|
264
|
+
umi,
|
265
|
+
connection,
|
266
|
+
txs[0],
|
267
|
+
txType,
|
268
|
+
priorityFeeSetting,
|
269
|
+
onAwaitingSign
|
270
|
+
);
|
262
271
|
return resp ? [bs58.encode(resp)] : undefined;
|
263
272
|
}
|
264
273
|
|
@@ -275,8 +284,12 @@ export async function sendJitoBundledTransactions(
|
|
275
284
|
? await Promise.all(
|
276
285
|
txs.map(
|
277
286
|
async (x) =>
|
278
|
-
(await getComputeUnitPriceEstimate(
|
279
|
-
|
287
|
+
(await getComputeUnitPriceEstimate(
|
288
|
+
umi,
|
289
|
+
x,
|
290
|
+
priorityFeeSetting,
|
291
|
+
true
|
292
|
+
)) ?? 1000000
|
280
293
|
)
|
281
294
|
)
|
282
295
|
: undefined;
|