@curvefi/api 2.8.8 → 2.10.0
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/constants/aliases.d.ts +1 -0
- package/lib/constants/aliases.js +13 -1
- package/lib/constants/coins/moonbeam.d.ts +7 -0
- package/lib/constants/coins/moonbeam.js +16 -0
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +3 -1
- package/lib/constants/pools/moonbeam.d.ts +4 -0
- package/lib/constants/pools/moonbeam.js +37 -0
- package/lib/curve.d.ts +1 -0
- package/lib/curve.js +17 -0
- package/lib/external-api.d.ts +22 -0
- package/lib/external-api.js +41 -1
- package/lib/factory/common.js +9 -94
- package/lib/factory/constants.d.ts +38 -8
- package/lib/factory/constants.js +103 -18
- package/lib/factory/factory-api.js +3 -1
- package/lib/factory/factory-crypto.js +3 -0
- package/lib/factory/factory.js +4 -1
- package/lib/interfaces.d.ts +7 -0
- package/lib/pools/PoolTemplate.js +58 -17
- package/lib/router.d.ts +10 -0
- package/lib/router.js +453 -123
- package/lib/utils.js +12 -6
- package/package.json +2 -2
package/lib/utils.js
CHANGED
|
@@ -408,10 +408,10 @@ var getPoolNameBySwapAddress = function (swapAddress) {
|
|
|
408
408
|
};
|
|
409
409
|
exports.getPoolNameBySwapAddress = getPoolNameBySwapAddress;
|
|
410
410
|
var _getUsdPricesFromApi = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
411
|
-
var network, promises, allTypesExtendedPoolData, priceDict, _i, allTypesExtendedPoolData_1, extendedPoolData, _a, _b, pool, _c, _d, coin, _e, _f, coin;
|
|
412
|
-
var _g;
|
|
413
|
-
return __generator(this, function (
|
|
414
|
-
switch (
|
|
411
|
+
var network, promises, allTypesExtendedPoolData, priceDict, _i, allTypesExtendedPoolData_1, extendedPoolData, _a, _b, pool, lpTokenAddress, totalSupply, _c, _d, coin, _e, _f, coin;
|
|
412
|
+
var _g, _h;
|
|
413
|
+
return __generator(this, function (_j) {
|
|
414
|
+
switch (_j.label) {
|
|
415
415
|
case 0:
|
|
416
416
|
network = curve_1.curve.constants.NETWORK_NAME;
|
|
417
417
|
promises = [
|
|
@@ -422,18 +422,21 @@ var _getUsdPricesFromApi = function () { return __awaiter(void 0, void 0, void 0
|
|
|
422
422
|
];
|
|
423
423
|
return [4 /*yield*/, Promise.all(promises)];
|
|
424
424
|
case 1:
|
|
425
|
-
allTypesExtendedPoolData =
|
|
425
|
+
allTypesExtendedPoolData = _j.sent();
|
|
426
426
|
priceDict = {};
|
|
427
427
|
for (_i = 0, allTypesExtendedPoolData_1 = allTypesExtendedPoolData; _i < allTypesExtendedPoolData_1.length; _i++) {
|
|
428
428
|
extendedPoolData = allTypesExtendedPoolData_1[_i];
|
|
429
429
|
for (_a = 0, _b = extendedPoolData.poolData; _a < _b.length; _a++) {
|
|
430
430
|
pool = _b[_a];
|
|
431
|
+
lpTokenAddress = (_g = pool.lpTokenAddress) !== null && _g !== void 0 ? _g : pool.address;
|
|
432
|
+
totalSupply = pool.totalSupply / (Math.pow(10, 18));
|
|
433
|
+
priceDict[lpTokenAddress.toLowerCase()] = pool.usdTotal && totalSupply ? pool.usdTotal / totalSupply : 0;
|
|
431
434
|
for (_c = 0, _d = pool.coins; _c < _d.length; _c++) {
|
|
432
435
|
coin = _d[_c];
|
|
433
436
|
if (typeof coin.usdPrice === "number")
|
|
434
437
|
priceDict[coin.address.toLowerCase()] = coin.usdPrice;
|
|
435
438
|
}
|
|
436
|
-
for (_e = 0, _f = (
|
|
439
|
+
for (_e = 0, _f = (_h = pool.gaugeRewards) !== null && _h !== void 0 ? _h : []; _e < _f.length; _e++) {
|
|
437
440
|
coin = _f[_e];
|
|
438
441
|
if (typeof coin.tokenPrice === "number")
|
|
439
442
|
priceDict[coin.tokenAddress.toLowerCase()] = coin.tokenPrice;
|
|
@@ -464,6 +467,7 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
464
467
|
100: 'xdai',
|
|
465
468
|
137: 'polygon-pos',
|
|
466
469
|
250: 'fantom',
|
|
470
|
+
1284: 'moonbeam',
|
|
467
471
|
43114: 'avalanche',
|
|
468
472
|
42161: 'arbitrum-one',
|
|
469
473
|
}[curve_1.curve.chainId];
|
|
@@ -473,6 +477,7 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
473
477
|
100: 'xdai',
|
|
474
478
|
137: 'matic-network',
|
|
475
479
|
250: 'fantom',
|
|
480
|
+
1284: 'moonbeam',
|
|
476
481
|
43114: 'avalanche-2',
|
|
477
482
|
42161: 'ethereum',
|
|
478
483
|
}[curve_1.curve.chainId];
|
|
@@ -541,6 +546,7 @@ var getTVL = function (chainId) {
|
|
|
541
546
|
100: 'xdai',
|
|
542
547
|
137: "polygon",
|
|
543
548
|
250: "fantom",
|
|
549
|
+
1284: "moonbeam",
|
|
544
550
|
43114: "avalanche",
|
|
545
551
|
42161: "arbitrum",
|
|
546
552
|
}[chainId]) !== null && _a !== void 0 ? _a : "ethereum";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curvefi/api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "JavaScript library for curve.fi",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Macket",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@ethersproject/networks": "^5.5.0",
|
|
35
35
|
"axios": "^0.21.1",
|
|
36
36
|
"bignumber.js": "^9.0.1",
|
|
37
|
-
"ethcall": "^4.2
|
|
37
|
+
"ethcall": "^4.8.2",
|
|
38
38
|
"ethers": "^5.4.6",
|
|
39
39
|
"memoizee": "^0.4.15"
|
|
40
40
|
}
|