@haven-fi/solauto-sdk 1.0.18 → 1.0.20

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,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAqC/B,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC;IATd,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE,EACM,IAAI,CAAC,oBAAQ;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IATxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EAAE,EACxB,cAAc,CAAC,6CAA4C,IAAI,aAAA,EAC/D,YAAY,CAAC,qBAAS,EACtB,YAAY,CAAC,qBAAS,EACtB,aAAa,CAAC,2BAAe;YAKzB,uBAAuB;IAsCrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAgB9D,IAAI;CA8IX"}
1
+ {"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAqC/B,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC;IATd,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE,EACM,IAAI,CAAC,oBAAQ;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IATxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EAAE,EACxB,cAAc,CAAC,6CAA4C,IAAI,aAAA,EAC/D,YAAY,CAAC,qBAAS,EACtB,YAAY,CAAC,qBAAS,EACtB,aAAa,CAAC,2BAAe;YAMzB,uBAAuB;IAsCrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAgB9D,IAAI;CA+IX"}
@@ -128,6 +128,7 @@ class TransactionsManager {
128
128
  this.mustBeAtomic = mustBeAtomic;
129
129
  this.errorsToThrow = errorsToThrow;
130
130
  this.statuses = [];
131
+ console.log(this.errorsToThrow);
131
132
  this.lookupTables = new LookupTables(client);
132
133
  }
133
134
  async assembleTransactionSets(items) {
@@ -177,10 +178,11 @@ class TransactionsManager {
177
178
  this.statusCallback?.(this.statuses);
178
179
  }
179
180
  async send() {
181
+ console.log(this.errorsToThrow);
180
182
  const updateLookupTable = await this.client.updateLookupTable();
181
183
  if (updateLookupTable && updateLookupTable?.needsToBeIsolated) {
182
184
  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);
185
+ 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
186
  this.updateStatus("update lookup table", TransactionStatus.Successful);
185
187
  }
186
188
  for (const item of this.items) {
@@ -256,7 +258,7 @@ class TransactionsManager {
256
258
  const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.client.umi, this.client.connection, tx, this.simulateOnly, attemptNum);
257
259
  this.updateStatus(itemSet.name(), TransactionStatus.Successful, txSig ? bs58_1.default.encode(txSig) : undefined);
258
260
  }
259
- }, 3, undefined, this.errorsToThrow);
261
+ }, 3, 150, this.errorsToThrow);
260
262
  }
261
263
  }
262
264
  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,CAC3C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,SAAS,GACZ,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEnE;AAED,wBAAgB,cAAc,CAAC,MAAM,E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,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.20",
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",
@@ -189,6 +189,7 @@ export class TransactionsManager {
189
189
  private mustBeAtomic?: boolean,
190
190
  private errorsToThrow?: ErrorsToThrow
191
191
  ) {
192
+ console.log(this.errorsToThrow);
192
193
  this.lookupTables = new LookupTables(client);
193
194
  }
194
195
 
@@ -247,6 +248,7 @@ export class TransactionsManager {
247
248
  }
248
249
 
249
250
  async send() {
251
+ console.log(this.errorsToThrow);
250
252
  const updateLookupTable = await this.client.updateLookupTable();
251
253
  if (updateLookupTable && updateLookupTable?.needsToBeIsolated) {
252
254
  this.updateStatus("update lookup table", TransactionStatus.Processing);
@@ -260,7 +262,7 @@ export class TransactionsManager {
260
262
  attemptNum
261
263
  ),
262
264
  2,
263
- undefined,
265
+ 150,
264
266
  this.errorsToThrow
265
267
  );
266
268
  this.updateStatus("update lookup table", TransactionStatus.Successful);
@@ -378,7 +380,7 @@ export class TransactionsManager {
378
380
  }
379
381
  },
380
382
  3,
381
- undefined,
383
+ 150,
382
384
  this.errorsToThrow
383
385
  );
384
386
  }
@@ -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
  }
@@ -141,7 +141,7 @@ describe("Solauto Marginfi tests", async () => {
141
141
  transactionItems,
142
142
  undefined,
143
143
  !payForTransactions,
144
- useJitoBundle
144
+ useJitoBundle,
145
145
  ).send();
146
146
  });
147
147
  });