@haven-fi/solauto-sdk 1.0.269 → 1.0.271

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;AAKzD,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;AAO7D,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;AAmFD,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;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAA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OAAO;IACf,OAAO,CAAC,UAAU;IAXpB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,gBAAgB,CAAa;IACrC,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,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA8CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,mBAAmB;YAMb,SAAS;IAgBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA+DzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YAgCxB,qBAAqB;YAgDrB,cAAc;YAsCd,eAAe;CAkD9B"}
@@ -311,7 +311,9 @@ class TransactionsManager {
311
311
  }
312
312
  async processTransactionSet(itemSets, currentIndex) {
313
313
  let itemSet = itemSets[currentIndex];
314
+ let num = 0;
314
315
  await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum, prevError) => {
316
+ num = attemptNum;
315
317
  if (currentIndex > 0 || attemptNum > 0) {
316
318
  itemSet = await this.refreshItemSet(itemSets, currentIndex, attemptNum);
317
319
  }
@@ -327,7 +329,7 @@ class TransactionsManager {
327
329
  }
328
330
  }, this.retries, this.retryDelay, this.errorsToThrow).catch((e) => {
329
331
  if (itemSet) {
330
- this.updateStatus(itemSet.name(), TransactionStatus.Failed, this.retries);
332
+ this.updateStatus(itemSet.name(), TransactionStatus.Failed, num);
331
333
  }
332
334
  throw e;
333
335
  });
@@ -341,17 +343,15 @@ class TransactionsManager {
341
343
  ]);
342
344
  if (newItemSets.length > 1) {
343
345
  itemSets.splice(currentIndex, itemSets.length - currentIndex, ...newItemSets);
344
- // const startOfQueuedStatuses = this.statuses.findIndex(x => x.status === TransactionStatus.Queued);
345
- // this.statuses.splice(
346
- // startOfQueuedStatuses,
347
- // this.statuses.length - startOfQueuedStatuses,
348
- // ...newItemSets.map(x => ({
349
- // name: x.name(),
350
- // attemptNum: 0,
351
- // status: TransactionStatus.Queued,
352
- // }))
353
- // );
354
- this.updateStatusForSets(newItemSets);
346
+ const startOfQueuedStatuses = this.statuses.findIndex(x => x.status === TransactionStatus.Queued);
347
+ this.statuses.splice(startOfQueuedStatuses, this.statuses.length - startOfQueuedStatuses, ...newItemSets.map((x, i) => ({
348
+ name: x.name(),
349
+ attemptNum: i === 0 ? attemptNum : 0,
350
+ status: TransactionStatus.Queued,
351
+ })));
352
+ // if (this.statuses.map(x => x.name).includes(newItemSets[0].name())) {
353
+ // }
354
+ // this.updateStatusForSets(newItemSets.splice(1));
355
355
  }
356
356
  return newItemSets[0];
357
357
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.269",
3
+ "version": "1.0.271",
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",
@@ -468,9 +468,12 @@ export class TransactionsManager {
468
468
  currentIndex: number
469
469
  ) {
470
470
  let itemSet: TransactionSet | undefined = itemSets[currentIndex];
471
+ let num = 0;
471
472
 
472
473
  await retryWithExponentialBackoff(
473
474
  async (attemptNum, prevError) => {
475
+ num = attemptNum;
476
+
474
477
  if (currentIndex > 0 || attemptNum > 0) {
475
478
  itemSet = await this.refreshItemSet(
476
479
  itemSets,
@@ -502,11 +505,7 @@ export class TransactionsManager {
502
505
  this.errorsToThrow
503
506
  ).catch((e) => {
504
507
  if (itemSet) {
505
- this.updateStatus(
506
- itemSet.name(),
507
- TransactionStatus.Failed,
508
- this.retries
509
- );
508
+ this.updateStatus(itemSet.name(), TransactionStatus.Failed, num);
510
509
  }
511
510
  throw e;
512
511
  });
@@ -531,17 +530,20 @@ export class TransactionsManager {
531
530
  itemSets.length - currentIndex,
532
531
  ...newItemSets
533
532
  );
534
- // const startOfQueuedStatuses = this.statuses.findIndex(x => x.status === TransactionStatus.Queued);
535
- // this.statuses.splice(
536
- // startOfQueuedStatuses,
537
- // this.statuses.length - startOfQueuedStatuses,
538
- // ...newItemSets.map(x => ({
539
- // name: x.name(),
540
- // attemptNum: 0,
541
- // status: TransactionStatus.Queued,
542
- // }))
543
- // );
544
- this.updateStatusForSets(newItemSets);
533
+ const startOfQueuedStatuses = this.statuses.findIndex(x => x.status === TransactionStatus.Queued);
534
+ this.statuses.splice(
535
+ startOfQueuedStatuses,
536
+ this.statuses.length - startOfQueuedStatuses,
537
+ ...newItemSets.map((x, i) => ({
538
+ name: x.name(),
539
+ attemptNum: i === 0 ? attemptNum : 0,
540
+ status: TransactionStatus.Queued,
541
+ }))
542
+ );
543
+ // if (this.statuses.map(x => x.name).includes(newItemSets[0].name())) {
544
+
545
+ // }
546
+ // this.updateStatusForSets(newItemSets.splice(1));
545
547
  }
546
548
 
547
549
  return newItemSets[0];