@haven-fi/solauto-sdk 1.0.257 → 1.0.258

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,6 +41,7 @@ export declare class TransactionsManager {
41
41
  private retries;
42
42
  private retryDelay;
43
43
  private statuses;
44
+ private statusesStartIdx;
44
45
  private lookupTables;
45
46
  constructor(txHandler: SolautoClient | ReferralStateManager, statusCallback?: ((statuses: TransactionManagerStatuses) => void) | undefined, txType?: TransactionRunType | undefined, priorityFeeSetting?: PriorityFeeSetting, errorsToThrow?: ErrorsToThrow | undefined, retries?: number, retryDelay?: number);
46
47
  private assembleTransactionSets;
@@ -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,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xB,qBAAqB;YAiDrB,cAAc;YAyBd,eAAe;CAkD9B"}
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,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAM5B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,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;YAiDrB,cAAc;YAkCd,eAAe;CAkD9B"}
@@ -116,7 +116,7 @@ class TransactionSet {
116
116
  .filter((x) => x.tx && x.name !== undefined)
117
117
  .map((x) => x.name.toLowerCase());
118
118
  if (names.length > 1) {
119
- names = names.filter(x => x !== CHORES_TX_NAME);
119
+ names = names.filter((x) => x !== CHORES_TX_NAME);
120
120
  }
121
121
  if (names.length >= 3) {
122
122
  return [names.slice(0, -1).join(", "), names[names.length - 1]].join(", and ");
@@ -144,6 +144,7 @@ class TransactionsManager {
144
144
  this.retries = retries;
145
145
  this.retryDelay = retryDelay;
146
146
  this.statuses = [];
147
+ this.statusesStartIdx = 0;
147
148
  this.lookupTables = new LookupTables(this.txHandler.defaultLookupTables(), this.txHandler.umi);
148
149
  }
149
150
  async assembleTransactionSets(items) {
@@ -294,6 +295,7 @@ class TransactionsManager {
294
295
  }
295
296
  this.txHandler.log("Transaction items:", items.length);
296
297
  const itemSets = await this.assembleTransactionSets(items);
298
+ this.statusesStartIdx = this.statuses.length;
297
299
  this.updateStatusForSets(itemSets);
298
300
  this.txHandler.log("Initial item sets:", itemSets.length);
299
301
  if (this.txType === "only-simulate" && itemSets.length > 1) {
@@ -338,6 +340,11 @@ class TransactionsManager {
338
340
  ...itemSets.slice(currentIndex + 1).flatMap((set) => set.items),
339
341
  ]);
340
342
  if (newItemSets.length > 1) {
343
+ this.statuses.splice(this.statusesStartIdx + 1, itemSets.length - 1, ...newItemSets.map((x, i) => ({
344
+ name: x.name(),
345
+ status: TransactionStatus.Queued,
346
+ attemptNum: i === 0 ? attemptNum : 0,
347
+ })));
341
348
  itemSets.splice(currentIndex + 1, itemSets.length - currentIndex - 1, ...newItemSets.slice(1));
342
349
  this.updateStatusForSets(newItemSets.slice(1));
343
350
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.257",
3
+ "version": "1.0.258",
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",
@@ -177,7 +177,7 @@ class TransactionSet {
177
177
  .filter((x) => x.tx && x.name !== undefined)
178
178
  .map((x) => x.name!.toLowerCase());
179
179
  if (names.length > 1) {
180
- names = names.filter(x => x !== CHORES_TX_NAME);
180
+ names = names.filter((x) => x !== CHORES_TX_NAME);
181
181
  }
182
182
  if (names.length >= 3) {
183
183
  return [names.slice(0, -1).join(", "), names[names.length - 1]].join(
@@ -208,6 +208,7 @@ export type TransactionManagerStatuses = {
208
208
 
209
209
  export class TransactionsManager {
210
210
  private statuses: TransactionManagerStatuses = [];
211
+ private statusesStartIdx: number = 0;
211
212
  private lookupTables: LookupTables;
212
213
 
213
214
  constructor(
@@ -404,7 +405,10 @@ export class TransactionsManager {
404
405
  );
405
406
  }
406
407
  if (choresAfter.getInstructions().length > 0) {
407
- const chore = new TransactionItem(async () => ({ tx: choresAfter }), CHORES_TX_NAME);
408
+ const chore = new TransactionItem(
409
+ async () => ({ tx: choresAfter }),
410
+ CHORES_TX_NAME
411
+ );
408
412
  await chore.initialize();
409
413
  items.push(chore);
410
414
  this.txHandler.log(
@@ -439,6 +443,7 @@ export class TransactionsManager {
439
443
 
440
444
  this.txHandler.log("Transaction items:", items.length);
441
445
  const itemSets = await this.assembleTransactionSets(items);
446
+ this.statusesStartIdx = this.statuses.length;
442
447
  this.updateStatusForSets(itemSets);
443
448
  this.txHandler.log("Initial item sets:", itemSets.length);
444
449
 
@@ -521,6 +526,15 @@ export class TransactionsManager {
521
526
  ]);
522
527
 
523
528
  if (newItemSets.length > 1) {
529
+ this.statuses.splice(
530
+ this.statusesStartIdx + 1,
531
+ itemSets.length - 1,
532
+ ...newItemSets.map((x, i) => ({
533
+ name: x.name(),
534
+ status: TransactionStatus.Queued,
535
+ attemptNum: i === 0 ? attemptNum : 0,
536
+ }))
537
+ );
524
538
  itemSets.splice(
525
539
  currentIndex + 1,
526
540
  itemSets.length - currentIndex - 1,