@gearbox-protocol/sdk 11.0.0-next.1 → 11.0.0-next.2

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.
@@ -43,6 +43,9 @@ class AliasLossPolicyV310Contract extends import_base.BaseContract {
43
43
  blockNumber
44
44
  });
45
45
  this.logger?.debug({ feeds: pfs }, "got required alias price feeds");
46
+ if (pfs.length === 0) {
47
+ return "0x";
48
+ }
46
49
  const updates = await this.sdk.priceFeeds.generateExternalPriceFeedsUpdates(
47
50
  [...pfs],
48
51
  blockNumber ? { blockNumber } : void 0
@@ -219,13 +219,12 @@ class RouterV310Contract extends import_AbstractRouterContract.AbstractRouterCon
219
219
  minAmount: 0n,
220
220
  calls: []
221
221
  }
222
- } : this.contract.simulate.routeManyToOne([
223
- ca.creditAccount,
224
- targetToken,
225
- BigInt(slippage),
226
- tData
227
- ]));
222
+ } : this.contract.simulate.routeManyToOne(
223
+ [ca.creditAccount, targetToken, BigInt(slippage), tData],
224
+ { gas: this.sdk.gasLimit }
225
+ ));
228
226
  const underlyingBalance = ca.tokens.find((t) => t.token === ca.underlying)?.balance ?? 0n;
227
+ this.logger?.debug("routeManyToOne succeeded");
229
228
  return {
230
229
  underlyingBalance: underlyingBalance + result.minAmount,
231
230
  amount: result.amount,
@@ -20,6 +20,9 @@ class AliasLossPolicyV310Contract extends BaseContract {
20
20
  blockNumber
21
21
  });
22
22
  this.logger?.debug({ feeds: pfs }, "got required alias price feeds");
23
+ if (pfs.length === 0) {
24
+ return "0x";
25
+ }
23
26
  const updates = await this.sdk.priceFeeds.generateExternalPriceFeedsUpdates(
24
27
  [...pfs],
25
28
  blockNumber ? { blockNumber } : void 0
@@ -196,13 +196,12 @@ class RouterV310Contract extends AbstractRouterContract {
196
196
  minAmount: 0n,
197
197
  calls: []
198
198
  }
199
- } : this.contract.simulate.routeManyToOne([
200
- ca.creditAccount,
201
- targetToken,
202
- BigInt(slippage),
203
- tData
204
- ]));
199
+ } : this.contract.simulate.routeManyToOne(
200
+ [ca.creditAccount, targetToken, BigInt(slippage), tData],
201
+ { gas: this.sdk.gasLimit }
202
+ ));
205
203
  const underlyingBalance = ca.tokens.find((t) => t.token === ca.underlying)?.balance ?? 0n;
204
+ this.logger?.debug("routeManyToOne succeeded");
206
205
  return {
207
206
  underlyingBalance: underlyingBalance + result.minAmount,
208
207
  amount: result.amount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "11.0.0-next.1",
3
+ "version": "11.0.0-next.2",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",