@haven-fi/solauto-sdk 1.0.419 → 1.0.421

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,14 +171,15 @@ 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
- // if (await newSet.fitsWith(items[j])) {
176
- // newSet.prepend(items[j]);
177
- // i--;
178
- // } else {
179
- // break;
180
- // }
181
- // }
174
+ for (let j = i; j >= 0; j--) {
175
+ if (await newSet.fitsWith(items[j])) {
176
+ newSet.prepend(items[j]);
177
+ i--;
178
+ }
179
+ else {
180
+ break;
181
+ }
182
+ }
182
183
  transactionSets.unshift(newSet);
183
184
  }
184
185
  }
@@ -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;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"}
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;AAiND,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"}
@@ -211,25 +211,22 @@ async function sendJitoBundledTransactions(umi, connection, signer, txs, txType,
211
211
  simulationResults = await simulateJitoBundle(umi, builtTxs);
212
212
  }
213
213
  if (txType !== "only-simulate") {
214
+ const signers = [...builtTxs].map((tx) => getRequiredSigners(tx.message));
215
+ if (Array.from(new Set(signers.flatMap((x) => x).filter((x) => x.publicKey)))
216
+ .length > 1) {
217
+ (0, generalUtils_1.consoleLog)("Signers:", signers);
218
+ throw new Error("Unexpected error 301. Please retry.");
219
+ }
214
220
  onAwaitingSign?.();
215
- console.log("Signers expected:");
216
- (0, generalUtils_1.consoleLog)([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
217
221
  builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, true, feeEstimates, simulationResults
218
222
  ? simulationResults.map((x) => x.unitsConsumed * 1.15)
219
223
  : undefined);
220
- console.log("Signers:");
221
- (0, generalUtils_1.consoleLog)([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
222
224
  const serializedTxs = builtTxs.map((x) => x.serialize());
223
225
  if (serializedTxs.find((x) => x.length > 1232)) {
224
226
  throw new Error("A transaction is too large");
225
227
  }
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"];
228
+ const txSigs = await sendJitoBundle(umi, serializedTxs.map((x) => bs58_1.default.encode(x)));
229
+ return txSigs.length > 0 ? txSigs : undefined;
233
230
  }
234
231
  return undefined;
235
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.419",
3
+ "version": "1.0.421",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -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
- // if (await newSet.fitsWith(items[j])) {
268
- // newSet.prepend(items[j]);
269
- // i--;
270
- // } else {
271
- // break;
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
  }
@@ -229,15 +229,12 @@ async function sendJitoBundle(
229
229
  ): Promise<string[]> {
230
230
  let resp: any;
231
231
  try {
232
- resp = await axios.post<{ result: string }>(
233
- umi.rpc.getEndpoint(),
234
- {
235
- jsonrpc: "2.0",
236
- id: 1,
237
- method: "sendBundle",
238
- params: [transactions],
239
- }
240
- );
232
+ resp = await axios.post<{ result: string }>(umi.rpc.getEndpoint(), {
233
+ jsonrpc: "2.0",
234
+ id: 1,
235
+ method: "sendBundle",
236
+ params: [transactions],
237
+ });
241
238
  } catch (e: any) {
242
239
  if (e.response.data.error) {
243
240
  console.error("Jito send bundle error:", e.response.data.error);
@@ -345,10 +342,16 @@ export async function sendJitoBundledTransactions(
345
342
  }
346
343
 
347
344
  if (txType !== "only-simulate") {
348
- onAwaitingSign?.();
345
+ const signers = [...builtTxs].map((tx) => getRequiredSigners(tx.message));
346
+ if (
347
+ Array.from(new Set(signers.flatMap((x) => x).filter((x) => x.publicKey)))
348
+ .length > 1
349
+ ) {
350
+ consoleLog("Signers:", signers);
351
+ throw new Error("Unexpected error 301. Please retry.");
352
+ }
349
353
 
350
- console.log("Signers expected:");
351
- consoleLog([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
354
+ onAwaitingSign?.();
352
355
 
353
356
  builtTxs = await umiToVersionedTransactions(
354
357
  umi,
@@ -362,22 +365,16 @@ export async function sendJitoBundledTransactions(
362
365
  : undefined
363
366
  );
364
367
 
365
- console.log("Signers:");
366
- consoleLog([...builtTxs].map((tx) => getRequiredSigners(tx.message)));
367
-
368
368
  const serializedTxs = builtTxs.map((x) => x.serialize());
369
369
  if (serializedTxs.find((x) => x.length > 1232)) {
370
370
  throw new Error("A transaction is too large");
371
371
  }
372
372
 
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"];
373
+ const txSigs = await sendJitoBundle(
374
+ umi,
375
+ serializedTxs.map((x) => base58.encode(x))
376
+ );
377
+ return txSigs.length > 0 ? txSigs : undefined;
381
378
  }
382
379
 
383
380
  return undefined;