@gearbox-protocol/sdk 3.0.0-next.118 → 3.0.0-next.119

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PathOptionFactory = void 0;
4
4
  const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
5
+ const aura_1 = require("@gearbox-protocol/sdk-gov/lib/tokens/aura");
5
6
  class PathOptionFactory {
6
7
  static generatePathOptions(balances, loopsInTx) {
7
8
  const curvePools = PathOptionFactory.getCurvePools(balances);
@@ -66,14 +67,21 @@ class PathOptionFactory {
66
67
  return Array.from(curveSet.values());
67
68
  }
68
69
  static getBalancerPools(balances) {
69
- const result = [];
70
- for (const [token, { balance }] of Object.entries(balances)) {
71
- const symbol = sdk_gov_1.tokenSymbolByAddress[token.toLowerCase()];
72
- if ((0, sdk_gov_1.isBalancerLPToken)(symbol) && (0, sdk_gov_1.toBigInt)(balance) > 1) {
73
- result.push(symbol);
74
- }
75
- }
76
- return result;
70
+ const balancerSymbols = Object.keys(sdk_gov_1.balancerLpTokens);
71
+ const balancerPools = Object.entries(balances)
72
+ .filter(([, balance]) => (0, sdk_gov_1.toBigInt)(balance.balance) > 1)
73
+ .map(([token]) => sdk_gov_1.tokenSymbolByAddress[token.toLowerCase()])
74
+ .filter(symbol => balancerSymbols.includes(symbol));
75
+ const balancerAuraTokens = Object.entries(aura_1.auraLpTokens)
76
+ .filter(([, data]) => balancerSymbols.includes(data.underlying))
77
+ .map(([token]) => token);
78
+ const balancerTokensFromAura = Object.entries(balances)
79
+ .filter(([, balance]) => (0, sdk_gov_1.toBigInt)(balance.balance) > 1)
80
+ .map(([token]) => sdk_gov_1.tokenSymbolByAddress[token.toLowerCase()])
81
+ .filter(symbol => balancerAuraTokens.includes(symbol))
82
+ .map(symbol => aura_1.auraLpTokens[symbol].underlying);
83
+ const balancerSet = new Set([...balancerPools, ...balancerTokensFromAura]);
84
+ return Array.from(balancerSet.values());
77
85
  }
78
86
  static next(path) {
79
87
  let newPath = [...path];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.118",
3
+ "version": "3.0.0-next.119",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",