@haven-fi/solauto-sdk 1.0.532 → 1.0.533

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,EAEL,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;AAa7D,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;AAqGD,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;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A4I7B,qBAAqB;YAoDrB,eAAe;YA0Df,eAAe;CA4D9B"}
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,EAEL,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;AAa7D,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;AAqGD,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,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actionsManager {
336
336
  }
337
337
  else if (attemptNum > 0) {
338
338
  for (const item of items) {
339
- await item.refetch(0);
339
+ await item.refetch(attemptNum);
340
340
  }
341
341
  }
342
342
  this.txHandler.log("Transaction items:", items.length);
343
343
  return await this.assembleTransactionSets(items);
344
- }, 2);
344
+ }, this.totalRetries);
345
345
  this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
346
346
  this.txHandler.log("Initial item sets:", itemSets.length);
347
347
  if (this.atomically) {
@@ -445,23 +445,21 @@ class TransactionsManager {
445
445
  }, this.totalRetries, this.retryDelay, this.errorsToThrow);
446
446
  }
447
447
  async refreshItemSets(itemSets, attemptNum, currentIndex) {
448
- const newItemSets = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
449
- if (currentIndex !== undefined) {
450
- const itemSet = itemSets[currentIndex];
448
+ if (currentIndex !== undefined) {
449
+ const itemSet = itemSets[currentIndex];
450
+ await itemSet.refetchAll(attemptNum);
451
+ }
452
+ else {
453
+ for (const itemSet of itemSets) {
451
454
  await itemSet.refetchAll(attemptNum);
452
455
  }
453
- else {
454
- for (const itemSet of itemSets) {
455
- await itemSet.refetchAll(attemptNum);
456
- }
457
- }
458
- return await this.assembleTransactionSets(currentIndex !== undefined
459
- ? [
460
- ...itemSets[currentIndex].items,
461
- ...itemSets.slice(currentIndex + 1).flatMap((set) => set.items),
462
- ]
463
- : itemSets.flatMap((set) => set.items));
464
- }, 2);
456
+ }
457
+ const newItemSets = await this.assembleTransactionSets(currentIndex !== undefined
458
+ ? [
459
+ ...itemSets[currentIndex].items,
460
+ ...itemSets.slice(currentIndex + 1).flatMap((set) => set.items),
461
+ ]
462
+ : itemSets.flatMap((set) => set.items));
465
463
  const newItemSetNames = newItemSets.map((x) => x.name());
466
464
  if (newItemSetNames.length === 1 &&
467
465
  newItemSetNames[0] === this.updateOracleTxName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.532",
3
+ "version": "1.0.533",
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",
@@ -546,12 +546,12 @@ export class TransactionsManager {
546
546
  }
547
547
  } else if (attemptNum > 0) {
548
548
  for (const item of items) {
549
- await item.refetch(0);
549
+ await item.refetch(attemptNum);
550
550
  }
551
551
  }
552
552
  this.txHandler.log("Transaction items:", items.length);
553
553
  return await this.assembleTransactionSets(items);
554
- }, 2);
554
+ }, this.totalRetries);
555
555
 
556
556
  this.updateStatusForSets(itemSets, TransactionStatus.Queued, 0);
557
557
  this.txHandler.log("Initial item sets:", itemSets.length);
@@ -766,25 +766,23 @@ export class TransactionsManager {
766
766
  attemptNum: number,
767
767
  currentIndex?: number
768
768
  ): Promise<TransactionSet[] | undefined> {
769
- const newItemSets = await retryWithExponentialBackoff(async () => {
770
- if (currentIndex !== undefined) {
771
- const itemSet = itemSets[currentIndex];
769
+ if (currentIndex !== undefined) {
770
+ const itemSet = itemSets[currentIndex];
771
+ await itemSet.refetchAll(attemptNum);
772
+ } else {
773
+ for (const itemSet of itemSets) {
772
774
  await itemSet.refetchAll(attemptNum);
773
- } else {
774
- for (const itemSet of itemSets) {
775
- await itemSet.refetchAll(attemptNum);
776
- }
777
775
  }
776
+ }
778
777
 
779
- return await this.assembleTransactionSets(
780
- currentIndex !== undefined
781
- ? [
782
- ...itemSets[currentIndex].items,
783
- ...itemSets.slice(currentIndex + 1).flatMap((set) => set.items),
784
- ]
785
- : itemSets.flatMap((set) => set.items)
786
- );
787
- }, 2);
778
+ const newItemSets = await this.assembleTransactionSets(
779
+ currentIndex !== undefined
780
+ ? [
781
+ ...itemSets[currentIndex].items,
782
+ ...itemSets.slice(currentIndex + 1).flatMap((set) => set.items),
783
+ ]
784
+ : itemSets.flatMap((set) => set.items)
785
+ );
788
786
 
789
787
  const newItemSetNames = newItemSets.map((x) => x.name());
790
788
  if (
@@ -44,12 +44,12 @@ import { PriorityFeeSetting } from "../../src/types";
44
44
  import { buildIronforgeApiUrl, fromBaseUnit, tokenInfo, USD_DECIMALS } from "../../dist";
45
45
 
46
46
  describe("Solauto Marginfi tests", async () => {
47
- // const signer = setupTest();
48
- const signer = setupTest("solauto-manager");
47
+ const signer = setupTest();
48
+ // const signer = setupTest("solauto-manager");
49
49
 
50
- const payForTransactions = true;
51
- const testProgram = false;
52
- const positionId = 3;
50
+ const payForTransactions = false;
51
+ const testProgram = true;
52
+ const positionId = 1;
53
53
 
54
54
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
55
55
  const client = new SolautoMarginfiClient(
@@ -65,7 +65,7 @@ describe("Solauto Marginfi tests", async () => {
65
65
  await client.initialize({
66
66
  signer,
67
67
  positionId,
68
- authority: new PublicKey("FKYQs7KgRvaKQHxXwb8HKfoBcFdSxLL3JvHWpPdVQ16v"),
68
+ // authority: new PublicKey("FKYQs7KgRvaKQHxXwb8HKfoBcFdSxLL3JvHWpPdVQ16v"),
69
69
  // new: true,
70
70
  // marginfiAccount: new PublicKey(
71
71
  // ""
@@ -145,7 +145,7 @@ describe("Solauto Marginfi tests", async () => {
145
145
  transactionItems.push(
146
146
  new TransactionItem(
147
147
  async (attemptNum) =>
148
- await buildSolautoRebalanceTransaction(client, undefined, attemptNum),
148
+ await buildSolautoRebalanceTransaction(client, 2000, attemptNum),
149
149
  "rebalance"
150
150
  )
151
151
  );