@gearbox-protocol/sdk 1.15.19 → 1.15.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.
@@ -40,6 +40,6 @@ export declare class PathFinder {
40
40
  * - underlyingBalance - total balance of underlying token
41
41
  * - calls - list of calls which should be done to swap & unwrap everything to underlying token
42
42
  */
43
- findBestClosePath(creditAccount: CreditAccountData, slippage: number): Promise<PathFinderCloseResult>;
43
+ findBestClosePath(creditAccount: CreditAccountData, slippage: number, noConcurency?: boolean): Promise<PathFinderCloseResult>;
44
44
  static compare(r1: CloseResult, r2: CloseResult, gasPriceRAY: BigNumberish): CloseResult;
45
45
  }
@@ -164,23 +164,45 @@ var PathFinder = /** @class */ (function () {
164
164
  * - underlyingBalance - total balance of underlying token
165
165
  * - calls - list of calls which should be done to swap & unwrap everything to underlying token
166
166
  */
167
- PathFinder.prototype.findBestClosePath = function (creditAccount, slippage) {
167
+ PathFinder.prototype.findBestClosePath = function (creditAccount, slippage, noConcurency) {
168
+ if (noConcurency === void 0) { noConcurency = false; }
168
169
  return __awaiter(this, void 0, void 0, function () {
169
- var loopsPerTx, pathOptions, requests, results, bestResult;
170
+ var loopsPerTx, pathOptions, results, _i, pathOptions_2, po, _a, _b, requests, bestResult;
170
171
  var _this = this;
171
- return __generator(this, function (_a) {
172
- switch (_a.label) {
172
+ return __generator(this, function (_c) {
173
+ switch (_c.label) {
173
174
  case 0:
174
175
  loopsPerTx = Math.floor(GAS_PER_BLOCK / MAX_GAS_PER_ROUTE);
175
176
  pathOptions = pathOptions_1.PathOptionFactory.generatePathOptions(creditAccount.allBalances, loopsPerTx);
177
+ results = [];
178
+ if (!noConcurency) return [3 /*break*/, 5];
179
+ _i = 0, pathOptions_2 = pathOptions;
180
+ _c.label = 1;
181
+ case 1:
182
+ if (!(_i < pathOptions_2.length)) return [3 /*break*/, 4];
183
+ po = pathOptions_2[_i];
184
+ _b = (_a = results).push;
185
+ return [4 /*yield*/, this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, this._connectors, slippage, po, loopsPerTx, false, {
186
+ gasLimit: GAS_PER_BLOCK,
187
+ })];
188
+ case 2:
189
+ _b.apply(_a, [_c.sent()]);
190
+ _c.label = 3;
191
+ case 3:
192
+ _i++;
193
+ return [3 /*break*/, 1];
194
+ case 4: return [3 /*break*/, 7];
195
+ case 5:
176
196
  requests = pathOptions.map(function (po) {
177
197
  return _this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, _this._connectors, slippage, po, loopsPerTx, false, {
178
198
  gasLimit: GAS_PER_BLOCK,
179
199
  });
180
200
  });
181
201
  return [4 /*yield*/, Promise.all(requests)];
182
- case 1:
183
- results = _a.sent();
202
+ case 6:
203
+ results = _c.sent();
204
+ _c.label = 7;
205
+ case 7:
184
206
  bestResult = results.reduce(function (best, _a) {
185
207
  var pathFinderResult = _a[0], gasPriceRAY = _a[1];
186
208
  return PathFinder.compare(best, pathFinderResult, gasPriceRAY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.15.19",
3
+ "version": "1.15.20",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",