@haven-fi/solauto-sdk 1.0.417 → 1.0.419
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.
@@ -171,15 +171,14 @@ class TransactionsManager {
|
|
171
171
|
let newSet = new TransactionSet(this.txHandler, this.lookupTables, [
|
172
172
|
item,
|
173
173
|
]);
|
174
|
-
for (let j = i; j >= 0; j--) {
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
}
|
174
|
+
// for (let j = i; j >= 0; j--) {
|
175
|
+
// if (await newSet.fitsWith(items[j])) {
|
176
|
+
// newSet.prepend(items[j]);
|
177
|
+
// i--;
|
178
|
+
// } else {
|
179
|
+
// break;
|
180
|
+
// }
|
181
|
+
// }
|
183
182
|
transactionSets.unshift(newSet);
|
184
183
|
}
|
185
184
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAGT,gBAAgB,EAEjB,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,wBAAgB,mBAAmB,IAAI,SAAS,CAa/C;
|
1
|
+
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAGT,gBAAgB,EAEjB,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,wBAAgB,mBAAmB,IAAI,SAAS,CAa/C;AAoND,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB;;;;IAkB3D;AAED,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,CAqG/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -154,9 +154,7 @@ async function pollBundleStatus(bundleId, interval = 1000, timeout = 40000) {
|
|
154
154
|
async function sendJitoBundle(umi, transactions) {
|
155
155
|
let resp;
|
156
156
|
try {
|
157
|
-
resp = await axios_1.default.post(
|
158
|
-
// umi.rpc.getEndpoint(),
|
159
|
-
`${solautoConstants_1.JITO_BLOCK_ENGINE}/api/v1/bundles`, {
|
157
|
+
resp = await axios_1.default.post(umi.rpc.getEndpoint(), {
|
160
158
|
jsonrpc: "2.0",
|
161
159
|
id: 1,
|
162
160
|
method: "sendBundle",
|
@@ -178,8 +176,6 @@ async function sendJitoBundle(umi, transactions) {
|
|
178
176
|
}
|
179
177
|
function getRequiredSigners(message) {
|
180
178
|
const { numRequiredSignatures, numReadonlySignedAccounts } = message.header;
|
181
|
-
// Among the required signers, some are writable and some are read-only.
|
182
|
-
// "numRequiredSignatures - numReadonlySignedAccounts" tells us how many signers are writable.
|
183
179
|
const numWritableSigners = numRequiredSignatures - numReadonlySignedAccounts;
|
184
180
|
const signersInfo = [];
|
185
181
|
for (let i = 0; i < numRequiredSignatures; i++) {
|
@@ -217,18 +213,23 @@ async function sendJitoBundledTransactions(umi, connection, signer, txs, txType,
|
|
217
213
|
if (txType !== "only-simulate") {
|
218
214
|
onAwaitingSign?.();
|
219
215
|
console.log("Signers expected:");
|
220
|
-
(0, generalUtils_1.consoleLog)(builtTxs.map((tx) => getRequiredSigners(tx.message)));
|
216
|
+
(0, generalUtils_1.consoleLog)([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
|
221
217
|
builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, true, feeEstimates, simulationResults
|
222
218
|
? simulationResults.map((x) => x.unitsConsumed * 1.15)
|
223
219
|
: undefined);
|
224
|
-
console.log("Signers
|
225
|
-
(0, generalUtils_1.consoleLog)(builtTxs.map((tx) => getRequiredSigners(tx.message)));
|
220
|
+
console.log("Signers:");
|
221
|
+
(0, generalUtils_1.consoleLog)([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
|
226
222
|
const serializedTxs = builtTxs.map((x) => x.serialize());
|
227
223
|
if (serializedTxs.find((x) => x.length > 1232)) {
|
228
224
|
throw new Error("A transaction is too large");
|
229
225
|
}
|
230
|
-
|
231
|
-
|
226
|
+
console.log(serializedTxs.map((x) => bs58_1.default.encode(x)));
|
227
|
+
// const txSigs = await sendJitoBundle(
|
228
|
+
// umi,
|
229
|
+
// serializedTxs.map((x) => base58.encode(x))
|
230
|
+
// );
|
231
|
+
// return txSigs.length > 0 ? txSigs : undefined;
|
232
|
+
return ["test"];
|
232
233
|
}
|
233
234
|
return undefined;
|
234
235
|
}
|
package/package.json
CHANGED
@@ -263,14 +263,14 @@ export class TransactionsManager {
|
|
263
263
|
let newSet = new TransactionSet(this.txHandler, this.lookupTables, [
|
264
264
|
item,
|
265
265
|
]);
|
266
|
-
for (let j = i; j >= 0; j--) {
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
}
|
266
|
+
// for (let j = i; j >= 0; j--) {
|
267
|
+
// if (await newSet.fitsWith(items[j])) {
|
268
|
+
// newSet.prepend(items[j]);
|
269
|
+
// i--;
|
270
|
+
// } else {
|
271
|
+
// break;
|
272
|
+
// }
|
273
|
+
// }
|
274
274
|
transactionSets.unshift(newSet);
|
275
275
|
}
|
276
276
|
}
|
package/src/utils/jitoUtils.ts
CHANGED
@@ -230,8 +230,7 @@ async function sendJitoBundle(
|
|
230
230
|
let resp: any;
|
231
231
|
try {
|
232
232
|
resp = await axios.post<{ result: string }>(
|
233
|
-
|
234
|
-
`${JITO_BLOCK_ENGINE}/api/v1/bundles`,
|
233
|
+
umi.rpc.getEndpoint(),
|
235
234
|
{
|
236
235
|
jsonrpc: "2.0",
|
237
236
|
id: 1,
|
@@ -255,8 +254,6 @@ async function sendJitoBundle(
|
|
255
254
|
|
256
255
|
export function getRequiredSigners(message: VersionedMessage) {
|
257
256
|
const { numRequiredSignatures, numReadonlySignedAccounts } = message.header;
|
258
|
-
// Among the required signers, some are writable and some are read-only.
|
259
|
-
// "numRequiredSignatures - numReadonlySignedAccounts" tells us how many signers are writable.
|
260
257
|
|
261
258
|
const numWritableSigners = numRequiredSignatures - numReadonlySignedAccounts;
|
262
259
|
|
@@ -351,7 +348,7 @@ export async function sendJitoBundledTransactions(
|
|
351
348
|
onAwaitingSign?.();
|
352
349
|
|
353
350
|
console.log("Signers expected:");
|
354
|
-
consoleLog(builtTxs.map((tx) => getRequiredSigners(tx.message)));
|
351
|
+
consoleLog([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
|
355
352
|
|
356
353
|
builtTxs = await umiToVersionedTransactions(
|
357
354
|
umi,
|
@@ -365,19 +362,22 @@ export async function sendJitoBundledTransactions(
|
|
365
362
|
: undefined
|
366
363
|
);
|
367
364
|
|
368
|
-
console.log("Signers
|
369
|
-
consoleLog(builtTxs.map((tx) => getRequiredSigners(tx.message)));
|
365
|
+
console.log("Signers:");
|
366
|
+
consoleLog([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
|
370
367
|
|
371
368
|
const serializedTxs = builtTxs.map((x) => x.serialize());
|
372
369
|
if (serializedTxs.find((x) => x.length > 1232)) {
|
373
370
|
throw new Error("A transaction is too large");
|
374
371
|
}
|
375
372
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
373
|
+
console.log(serializedTxs.map((x) => base58.encode(x)));
|
374
|
+
|
375
|
+
// const txSigs = await sendJitoBundle(
|
376
|
+
// umi,
|
377
|
+
// serializedTxs.map((x) => base58.encode(x))
|
378
|
+
// );
|
379
|
+
// return txSigs.length > 0 ? txSigs : undefined;
|
380
|
+
return ["test"];
|
381
381
|
}
|
382
382
|
|
383
383
|
return undefined;
|