@haven-fi/solauto-sdk 1.0.18 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -180,7 +180,7 @@ class TransactionsManager {
180
180
  const updateLookupTable = await this.client.updateLookupTable();
181
181
  if (updateLookupTable && updateLookupTable?.needsToBeIsolated) {
182
182
  this.updateStatus("update lookup table", TransactionStatus.Processing);
183
- await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.client.umi, this.client.connection, updateLookupTable.updateLutTx, this.simulateOnly, attemptNum), 2, undefined, this.errorsToThrow);
183
+ await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.client.umi, this.client.connection, updateLookupTable.updateLutTx, this.simulateOnly, attemptNum), 2, 150, this.errorsToThrow);
184
184
  this.updateStatus("update lookup table", TransactionStatus.Successful);
185
185
  }
186
186
  for (const item of this.items) {
@@ -256,7 +256,7 @@ class TransactionsManager {
256
256
  const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.client.umi, this.client.connection, tx, this.simulateOnly, attemptNum);
257
257
  this.updateStatus(itemSet.name(), TransactionStatus.Successful, txSig ? bs58_1.default.encode(txSig) : undefined);
258
258
  }
259
- }, 3, undefined, this.errorsToThrow);
259
+ }, 3, 150, this.errorsToThrow);
260
260
  }
261
261
  }
262
262
  if (!this.simulateOnly) {
@@ -1 +1 @@
1
- {"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../src/utils/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAK3E,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAO1C;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAsB,uBAAuB,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MAAM,EAAE,GAAG,OAAO,CAU1E;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiD1E;AAED,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC,CAAC;AAEjE,wBAAgB,2BAA2B,CAAC,CAAC,EAC3C,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,GAAE,MAAU,EACnB,KAAK,GAAE,MAAY,EACnB,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,CAAC,CAAC,CAoCZ"}
@@ -88,6 +88,12 @@ function retryWithExponentialBackoff(fn, retries = 5, delay = 150, errorsToThrow
88
88
  .then(resolve)
89
89
  .catch((error) => {
90
90
  attemptNum++;
91
+ console.log(errorsToThrow?.length);
92
+ if (errorsToThrow) {
93
+ for (const e of errorsToThrow) {
94
+ console.log(error instanceof e);
95
+ }
96
+ }
91
97
  if (errorsToThrow &&
92
98
  errorsToThrow.some((errorType) => error instanceof errorType)) {
93
99
  reject(error);
@@ -97,7 +103,7 @@ function retryWithExponentialBackoff(fn, retries = 5, delay = 150, errorsToThrow
97
103
  console.log(error);
98
104
  setTimeout(() => {
99
105
  console.log("Retrying...");
100
- attempt(attemptNum);
106
+ return attempt(attemptNum);
101
107
  }, delay);
102
108
  delay *= 2;
103
109
  }
@@ -106,7 +112,7 @@ function retryWithExponentialBackoff(fn, retries = 5, delay = 150, errorsToThrow
106
112
  }
107
113
  });
108
114
  };
109
- attempt(0);
115
+ return attempt(0);
110
116
  });
111
117
  }
112
118
  exports.retryWithExponentialBackoff = retryWithExponentialBackoff;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
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",
@@ -260,7 +260,7 @@ export class TransactionsManager {
260
260
  attemptNum
261
261
  ),
262
262
  2,
263
- undefined,
263
+ 150,
264
264
  this.errorsToThrow
265
265
  );
266
266
  this.updateStatus("update lookup table", TransactionStatus.Successful);
@@ -378,7 +378,7 @@ export class TransactionsManager {
378
378
  }
379
379
  },
380
380
  3,
381
- undefined,
381
+ 150,
382
382
  this.errorsToThrow
383
383
  );
384
384
  }
@@ -111,6 +111,12 @@ export function retryWithExponentialBackoff<T>(
111
111
  .catch((error: Error) => {
112
112
  attemptNum++;
113
113
 
114
+ console.log(errorsToThrow?.length);
115
+ if (errorsToThrow) {
116
+ for (const e of errorsToThrow) {
117
+ console.log(error instanceof e);
118
+ }
119
+ }
114
120
  if (
115
121
  errorsToThrow &&
116
122
  errorsToThrow.some((errorType) => error instanceof errorType)
@@ -123,7 +129,7 @@ export function retryWithExponentialBackoff<T>(
123
129
  console.log(error);
124
130
  setTimeout(() => {
125
131
  console.log("Retrying...");
126
- attempt(attemptNum);
132
+ return attempt(attemptNum);
127
133
  }, delay);
128
134
  delay *= 2;
129
135
  } else {
@@ -131,6 +137,6 @@ export function retryWithExponentialBackoff<T>(
131
137
  }
132
138
  });
133
139
  };
134
- attempt(0);
140
+ return attempt(0);
135
141
  });
136
142
  }