@curvefi/api 2.50.1 → 2.50.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.
- package/lib/router.js +5 -4
- package/package.json +1 -1
package/lib/router.js
CHANGED
|
@@ -115,7 +115,7 @@ var SNX = {
|
|
|
115
115
|
},
|
|
116
116
|
};
|
|
117
117
|
var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
-
var routerGraph, _i, _a, outCoin, _b, _c, inCoin, _d, _e, outCoin, ALL_POOLS, amplificationCoefficientDict, _f, ALL_POOLS_1, _h, poolId, poolData, wrappedCoinAddresses, underlyingCoinAddresses, poolAddress, tokenAddress, isAaveLikeLending, poolType, tvlMultiplier, basePool, basePoolAddress, baseTokenAddress, secondBasePool, secondBasePoolAddress, secondBaseTokenAddress, metaCoinAddresses, swapAddress, tvl, coins, k, l, i, j, swapType, coins, k, l, i, j, swapType, i, j, i, j, hasEth, swapType;
|
|
118
|
+
var routerGraph, _i, _a, outCoin, _b, _c, inCoin, _d, _e, outCoin, ALL_POOLS, amplificationCoefficientDict, _f, ALL_POOLS_1, _h, poolId, poolData, wrappedCoinAddresses, underlyingCoinAddresses, poolAddress, tokenAddress, isAaveLikeLending, poolType, tvlMultiplier, basePool, basePoolAddress, baseTokenAddress, secondBasePool, secondBasePoolAddress, secondBaseTokenAddress, metaCoinAddresses, swapAddress, tvl, excludedUnderlyingSwaps, coins, k, l, i, j, swapType, coins, k, l, i, j, swapType, i, j, i, j, hasEth, swapType;
|
|
119
119
|
var _j, _k, _l;
|
|
120
120
|
return __generator(this, function (_m) {
|
|
121
121
|
switch (_m.label) {
|
|
@@ -300,6 +300,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
300
300
|
return [3 /*break*/, 4];
|
|
301
301
|
if (curve.chainId !== 1 && tvl < 100)
|
|
302
302
|
return [3 /*break*/, 4];
|
|
303
|
+
excludedUnderlyingSwaps = (poolId === 'aave' && curve.chainId === 1) || (poolId === 'geist' && curve.chainId === 250);
|
|
303
304
|
// Wrapped coin <-> LP "swaps" (actually add_liquidity/remove_liquidity_one_coin)
|
|
304
305
|
if (!poolData.is_fake && !poolData.is_llamma && wrappedCoinAddresses.length < 6) {
|
|
305
306
|
coins = __spreadArray([tokenAddress], wrappedCoinAddresses, true);
|
|
@@ -333,7 +334,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
336
|
// Underlying coin <-> LP "swaps" (actually add_liquidity/remove_liquidity_one_coin)
|
|
336
|
-
if ((poolData.is_fake || isAaveLikeLending) &&
|
|
337
|
+
if ((poolData.is_fake || isAaveLikeLending) && underlyingCoinAddresses.length < 6 && !excludedUnderlyingSwaps) {
|
|
337
338
|
coins = __spreadArray([tokenAddress], underlyingCoinAddresses, true);
|
|
338
339
|
for (k = 0; k < coins.length; k++) {
|
|
339
340
|
for (l = 0; l < coins.length; l++) {
|
|
@@ -396,7 +397,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
396
397
|
swapAddress = (poolData.is_crypto && poolData.is_meta) || ((basePool === null || basePool === void 0 ? void 0 : basePool.is_lending) && poolData.is_factory) ?
|
|
397
398
|
poolData.deposit_address : poolData.swap_address;
|
|
398
399
|
// Underlying swaps
|
|
399
|
-
if (!poolData.is_plain &&
|
|
400
|
+
if (!poolData.is_plain && !excludedUnderlyingSwaps) {
|
|
400
401
|
for (i = 0; i < underlyingCoinAddresses.length; i++) {
|
|
401
402
|
for (j = 0; j < underlyingCoinAddresses.length; j++) {
|
|
402
403
|
if (i === j)
|
|
@@ -404,7 +405,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
404
405
|
// Don't swap metacoins since they can be swapped directly in base pool
|
|
405
406
|
if (metaCoinAddresses.includes(underlyingCoinAddresses[i]) && metaCoinAddresses.includes(underlyingCoinAddresses[j]))
|
|
406
407
|
continue;
|
|
407
|
-
hasEth =
|
|
408
|
+
hasEth = underlyingCoinAddresses.includes(curve.constants.NATIVE_TOKEN.address);
|
|
408
409
|
swapType = (poolData.is_crypto && poolData.is_meta && poolData.is_factory) || ((basePool === null || basePool === void 0 ? void 0 : basePool.is_lending) && poolData.is_factory) ? 3
|
|
409
410
|
: hasEth && poolId !== 'avaxcrypto' ? 1 : 2;
|
|
410
411
|
if (!routerGraph[underlyingCoinAddresses[i]])
|