@haven-fi/solauto-sdk 1.0.330 → 1.0.332

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":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAW7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAMjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IARtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IACjB,WAAW,EAAE,OAAO,CAAS;gBAG3B,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,YAAA;IAGhB,UAAU;IAKV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAyFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;I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AC,MAAM,CAAC;IACf,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IAXpB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,SAAS,EAAE,aAAa,GAAG,oBAAoB,EAC/C,cAAc,CAAC,GAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,UAAU,GAAE,OAAe,EAC3B,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,mBAAmB;YAoBb,SAAS;IAgBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA4FzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YAmCxB,6BAA6B;YAmE7B,qBAAqB;YAuDrB,cAAc;YAqCd,eAAe;CAmD9B"}
@@ -244,9 +244,9 @@ class TransactionsManager {
244
244
  }
245
245
  return this.priorityFeeSetting;
246
246
  }
247
- updateStatusForSets(itemSets) {
248
- itemSets.forEach((itemSet) => {
249
- this.updateStatus(itemSet.name(), TransactionStatus.Queued, 0);
247
+ updateStatusForSets(itemSets, status, attemptNum, txSigs, simulationSuccessful, moreInfo) {
248
+ itemSets.forEach((itemSet, i) => {
249
+ this.updateStatus(itemSet.name(), status, attemptNum, txSigs !== undefined ? txSigs[i] : undefined, simulationSuccessful, moreInfo);
250
250
  });
251
251
  }
252
252
  async updateLut(tx, newLut) {
@@ -316,7 +316,7 @@ class TransactionsManager {
316
316
  }
317
317
  this.txHandler.log("Transaction items:", items.length);
318
318
  const itemSets = await this.assembleTransactionSets(items);
319
- this.updateStatusForSets(itemSets);
319
+ this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
320
320
  this.txHandler.log("Initial item sets:", itemSets.length);
321
321
  if (this.txType === "only-simulate" && itemSets.length > 1) {
322
322
  this.txHandler.log("Only simulate and more than 1 transaction. Skipping...");
@@ -342,23 +342,23 @@ class TransactionsManager {
342
342
  for (let i = 0; i < itemSets.length; i++) {
343
343
  await itemSets[i].refetchAll(attemptNum);
344
344
  }
345
- itemSets = await this.assembleTransactionSets(itemSets.flatMap(x => x.items));
345
+ itemSets = await this.assembleTransactionSets(itemSets.flatMap((x) => x.items));
346
346
  }
347
347
  let transactions = [];
348
348
  for (const set of itemSets) {
349
349
  transactions.push(await set.getSingleTransaction());
350
350
  }
351
- itemSets.forEach((x) => this.updateStatus(x.name(), TransactionStatus.Processing, attemptNum));
351
+ this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum);
352
352
  const txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.signer, transactions, false, this.priorityFeeSetting);
353
353
  if (Boolean(txSigs) && txSigs.length > 0) {
354
- itemSets.forEach((x, i) => this.updateStatus(x.name(), TransactionStatus.Successful, attemptNum, txSigs[i]));
354
+ this.updateStatusForSets(itemSets, TransactionStatus.Successful, attemptNum, txSigs);
355
355
  }
356
356
  else {
357
- itemSets.forEach((x) => this.updateStatus(x.name(), TransactionStatus.Failed, attemptNum, undefined, true));
357
+ this.updateStatusForSets(itemSets, TransactionStatus.Failed, attemptNum, txSigs, true);
358
358
  throw new Error("Unknown error");
359
359
  }
360
360
  }, this.retries, this.retryDelay, this.errorsToThrow).catch((e) => {
361
- itemSets.forEach((x) => this.updateStatus(x.name(), TransactionStatus.Failed, num, undefined, true, e.message));
361
+ this.updateStatusForSets(itemSets, TransactionStatus.Failed, num, undefined, true, e.message);
362
362
  throw e;
363
363
  });
364
364
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAsHD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,kBAA2C,GAC9D,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CA8C/B"}
1
+ {"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAsHD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,kBAA2C,GAC9D,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAkD/B"}
@@ -115,6 +115,9 @@ async function sendJitoBundledTransactions(umi, signer, txs, simulateOnly, prior
115
115
  : undefined;
116
116
  let builtTxs = await umiToVersionedTransactions(umi, signer, txs, true, // false if simulating first and rebuilding later
117
117
  feeEstimates);
118
+ for (let i = 0; i < txs.length; i++) {
119
+ (0, generalUtils_1.consoleLog)("Transaction", i, txs[i].getInstructions());
120
+ }
118
121
  // const simulationResults = await simulateJitoBundle(umi, builtTxs);
119
122
  if (!simulateOnly) {
120
123
  // let builtTxs = await umiToVersionedTransactions(
@@ -64,7 +64,7 @@ async function getSwitchboardPrices(mints) {
64
64
  const results = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
65
65
  const res = await crossbar.simulateSolanaFeeds("mainnet", mints.map((x) => switchboardConstants_1.SWITCHBOARD_PRICE_FEED_IDS[x.toString()]));
66
66
  const prices = res.flatMap((x) => x.results[0]);
67
- if (prices.find((x) => x === null)) {
67
+ if (prices.find((x) => !x || x === -Infinity)) {
68
68
  throw new Error("Unable to fetch Switchboard prices");
69
69
  }
70
70
  return prices;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.330",
3
+ "version": "1.0.332",
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",
@@ -358,9 +358,23 @@ export class TransactionsManager {
358
358
  return this.priorityFeeSetting;
359
359
  }
360
360
 
361
- private updateStatusForSets(itemSets: TransactionSet[]) {
362
- itemSets.forEach((itemSet) => {
363
- this.updateStatus(itemSet.name(), TransactionStatus.Queued, 0);
361
+ private updateStatusForSets(
362
+ itemSets: TransactionSet[],
363
+ status: TransactionStatus,
364
+ attemptNum: number,
365
+ txSigs?: string[],
366
+ simulationSuccessful?: boolean,
367
+ moreInfo?: string
368
+ ) {
369
+ itemSets.forEach((itemSet, i) => {
370
+ this.updateStatus(
371
+ itemSet.name(),
372
+ status,
373
+ attemptNum,
374
+ txSigs !== undefined ? txSigs[i] : undefined,
375
+ simulationSuccessful,
376
+ moreInfo
377
+ );
364
378
  });
365
379
  }
366
380
 
@@ -488,7 +502,7 @@ export class TransactionsManager {
488
502
 
489
503
  this.txHandler.log("Transaction items:", items.length);
490
504
  const itemSets = await this.assembleTransactionSets(items);
491
- this.updateStatusForSets(itemSets);
505
+ this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
492
506
  this.txHandler.log("Initial item sets:", itemSets.length);
493
507
 
494
508
  if (this.txType === "only-simulate" && itemSets.length > 1) {
@@ -522,7 +536,9 @@ export class TransactionsManager {
522
536
  for (let i = 0; i < itemSets.length; i++) {
523
537
  await itemSets[i].refetchAll(attemptNum);
524
538
  }
525
- itemSets = await this.assembleTransactionSets(itemSets.flatMap(x => x.items));
539
+ itemSets = await this.assembleTransactionSets(
540
+ itemSets.flatMap((x) => x.items)
541
+ );
526
542
  }
527
543
 
528
544
  let transactions = [];
@@ -530,8 +546,10 @@ export class TransactionsManager {
530
546
  transactions.push(await set.getSingleTransaction());
531
547
  }
532
548
 
533
- itemSets.forEach((x) =>
534
- this.updateStatus(x.name(), TransactionStatus.Processing, attemptNum)
549
+ this.updateStatusForSets(
550
+ itemSets,
551
+ TransactionStatus.Processing,
552
+ attemptNum
535
553
  );
536
554
  const txSigs = await sendJitoBundledTransactions(
537
555
  this.txHandler.umi,
@@ -541,23 +559,19 @@ export class TransactionsManager {
541
559
  this.priorityFeeSetting
542
560
  );
543
561
  if (Boolean(txSigs) && txSigs!.length > 0) {
544
- itemSets.forEach((x, i) =>
545
- this.updateStatus(
546
- x.name(),
547
- TransactionStatus.Successful,
548
- attemptNum,
549
- txSigs![i]
550
- )
562
+ this.updateStatusForSets(
563
+ itemSets,
564
+ TransactionStatus.Successful,
565
+ attemptNum,
566
+ txSigs
551
567
  );
552
568
  } else {
553
- itemSets.forEach((x) =>
554
- this.updateStatus(
555
- x.name(),
556
- TransactionStatus.Failed,
557
- attemptNum,
558
- undefined,
559
- true,
560
- )
569
+ this.updateStatusForSets(
570
+ itemSets,
571
+ TransactionStatus.Failed,
572
+ attemptNum,
573
+ txSigs,
574
+ true
561
575
  );
562
576
  throw new Error("Unknown error");
563
577
  }
@@ -566,15 +580,13 @@ export class TransactionsManager {
566
580
  this.retryDelay,
567
581
  this.errorsToThrow
568
582
  ).catch((e: Error) => {
569
- itemSets.forEach((x) =>
570
- this.updateStatus(
571
- x.name(),
572
- TransactionStatus.Failed,
573
- num,
574
- undefined,
575
- true,
576
- e.message
577
- )
583
+ this.updateStatusForSets(
584
+ itemSets,
585
+ TransactionStatus.Failed,
586
+ num,
587
+ undefined,
588
+ true,
589
+ e.message
578
590
  );
579
591
  throw e;
580
592
  });
@@ -184,6 +184,10 @@ export async function sendJitoBundledTransactions(
184
184
  feeEstimates
185
185
  );
186
186
 
187
+ for (let i = 0; i < txs.length; i++) {
188
+ consoleLog("Transaction", i, txs[i].getInstructions());
189
+ }
190
+
187
191
  // const simulationResults = await simulateJitoBundle(umi, builtTxs);
188
192
 
189
193
  if (!simulateOnly) {
@@ -115,7 +115,7 @@ export async function getSwitchboardPrices(
115
115
  );
116
116
 
117
117
  const prices = res.flatMap((x) => x.results[0]);
118
- if (prices.find((x) => x === null)) {
118
+ if (prices.find((x) => !x || x === -Infinity)) {
119
119
  throw new Error("Unable to fetch Switchboard prices");
120
120
  }
121
121