@curvefi/api 2.50.0 → 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 +9 -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);
|
|
@@ -307,6 +308,8 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
307
308
|
for (l = 0; l < coins.length; l++) {
|
|
308
309
|
if (k > 0 && l > 0)
|
|
309
310
|
continue;
|
|
311
|
+
if (k == 0 && l == 0)
|
|
312
|
+
continue;
|
|
310
313
|
i = Math.max(k - 1, 0);
|
|
311
314
|
j = Math.max(l - 1, 0);
|
|
312
315
|
swapType = k == 0 ? 6 : 4;
|
|
@@ -331,12 +334,14 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
331
334
|
}
|
|
332
335
|
}
|
|
333
336
|
// Underlying coin <-> LP "swaps" (actually add_liquidity/remove_liquidity_one_coin)
|
|
334
|
-
if ((poolData.is_fake || isAaveLikeLending) && underlyingCoinAddresses.length < 6) {
|
|
337
|
+
if ((poolData.is_fake || isAaveLikeLending) && underlyingCoinAddresses.length < 6 && !excludedUnderlyingSwaps) {
|
|
335
338
|
coins = __spreadArray([tokenAddress], underlyingCoinAddresses, true);
|
|
336
339
|
for (k = 0; k < coins.length; k++) {
|
|
337
340
|
for (l = 0; l < coins.length; l++) {
|
|
338
341
|
if (k > 0 && l > 0)
|
|
339
342
|
continue;
|
|
343
|
+
if (k == 0 && l == 0)
|
|
344
|
+
continue;
|
|
340
345
|
i = Math.max(k - 1, 0);
|
|
341
346
|
j = Math.max(l - 1, 0);
|
|
342
347
|
swapType = isAaveLikeLending ? 7 : 6;
|
|
@@ -392,7 +397,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
392
397
|
swapAddress = (poolData.is_crypto && poolData.is_meta) || ((basePool === null || basePool === void 0 ? void 0 : basePool.is_lending) && poolData.is_factory) ?
|
|
393
398
|
poolData.deposit_address : poolData.swap_address;
|
|
394
399
|
// Underlying swaps
|
|
395
|
-
if (!poolData.is_plain) {
|
|
400
|
+
if (!poolData.is_plain && !excludedUnderlyingSwaps) {
|
|
396
401
|
for (i = 0; i < underlyingCoinAddresses.length; i++) {
|
|
397
402
|
for (j = 0; j < underlyingCoinAddresses.length; j++) {
|
|
398
403
|
if (i === j)
|
|
@@ -400,7 +405,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
400
405
|
// Don't swap metacoins since they can be swapped directly in base pool
|
|
401
406
|
if (metaCoinAddresses.includes(underlyingCoinAddresses[i]) && metaCoinAddresses.includes(underlyingCoinAddresses[j]))
|
|
402
407
|
continue;
|
|
403
|
-
hasEth =
|
|
408
|
+
hasEth = underlyingCoinAddresses.includes(curve.constants.NATIVE_TOKEN.address);
|
|
404
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
|
|
405
410
|
: hasEth && poolId !== 'avaxcrypto' ? 1 : 2;
|
|
406
411
|
if (!routerGraph[underlyingCoinAddresses[i]])
|