@curvefi/api 2.66.27 → 2.66.29
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.
|
@@ -19,7 +19,11 @@ function _depositBalancedAmounts(poolBalances, walletBalances, decimals) {
|
|
|
19
19
|
const balancedAmountsForEachScenarioBN = walletBalancesBN.map((_, i) => (walletBalancesBN.map((_, j) => (poolBalancesRatiosBN[j].times(walletBalancesBN[i]).div(poolBalancesRatiosBN[i])))));
|
|
20
20
|
const firstCoinBalanceForEachScenarioBN = balancedAmountsForEachScenarioBN.map(([a]) => a);
|
|
21
21
|
// get the scenario with the lowest balances, ignoring scenarios where the wallet balance is zero
|
|
22
|
-
const
|
|
22
|
+
const nonZeroBalances = firstCoinBalanceForEachScenarioBN.filter((b) => !b.isZero());
|
|
23
|
+
if (nonZeroBalances.length === 0) {
|
|
24
|
+
return poolBalances.map(() => "0"); // no balances at all, return zeroes
|
|
25
|
+
}
|
|
26
|
+
const min = BigNumber.min(...nonZeroBalances);
|
|
23
27
|
const scenarioWithLowestBalancesBN = firstCoinBalanceForEachScenarioBN.map(String).indexOf(min.toString());
|
|
24
28
|
const bestScenario = balancedAmountsForEachScenarioBN[scenarioWithLowestBalancesBN];
|
|
25
29
|
return bestScenario.map((a, i) => walletBalancesBN[i].isZero() ? "0" : a.toFixed(decimals[i]));
|
|
@@ -108,7 +108,7 @@ export class StatsPool {
|
|
|
108
108
|
poolType = this.pool.id.replace(/-\d+$/, '');
|
|
109
109
|
poolType = poolType.replace(/-v2$/, '');
|
|
110
110
|
}
|
|
111
|
-
const poolsData = (yield _getPoolsFromApi(network, poolType)).poolData;
|
|
111
|
+
const poolsData = (yield _getPoolsFromApi(network, poolType, curve.isLiteChain)).poolData;
|
|
112
112
|
try {
|
|
113
113
|
const totalLiquidity = poolsData.filter((data) => data.address.toLowerCase() === this.pool.address.toLowerCase())[0].usdTotal;
|
|
114
114
|
return String(totalLiquidity);
|