@curvefi/api 2.57.1 → 2.57.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/index.d.ts +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +33 -11
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ declare const curve: {
|
|
|
38
38
|
price: number;
|
|
39
39
|
}[][]>;
|
|
40
40
|
PoolTemplate: typeof PoolTemplate;
|
|
41
|
-
getBasePools: () => import("./interfaces.js").IBasePoolShortItem[]
|
|
41
|
+
getBasePools: () => Promise<import("./interfaces.js").IBasePoolShortItem[]>;
|
|
42
42
|
getPool: (poolId: string) => PoolTemplate;
|
|
43
43
|
getUsdRate: (coin: string) => Promise<number>;
|
|
44
44
|
getGasPriceFromL1: () => Promise<number>;
|
package/lib/utils.d.ts
CHANGED
|
@@ -64,4 +64,4 @@ export declare const isMethodExist: (contract: Contract, methodName: string) =>
|
|
|
64
64
|
export declare const getPoolName: (name: string) => string;
|
|
65
65
|
export declare const isStableNgPool: (name: string) => boolean;
|
|
66
66
|
export declare const assetTypeNameHandler: (assetTypeName: string) => REFERENCE_ASSET;
|
|
67
|
-
export declare const getBasePools: () => IBasePoolShortItem[]
|
|
67
|
+
export declare const getBasePools: () => Promise<IBasePoolShortItem[]>;
|
package/lib/utils.js
CHANGED
|
@@ -970,15 +970,37 @@ export var assetTypeNameHandler = function (assetTypeName) {
|
|
|
970
970
|
return assetTypeName.toUpperCase();
|
|
971
971
|
}
|
|
972
972
|
};
|
|
973
|
-
export var getBasePools = function () {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
973
|
+
export var getBasePools = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
974
|
+
var factoryContract, factoryMulticallContract, basePoolCount, _a, _b, _c, calls, i, basePoolList, pools, basePoolIds;
|
|
975
|
+
return __generator(this, function (_d) {
|
|
976
|
+
switch (_d.label) {
|
|
977
|
+
case 0:
|
|
978
|
+
factoryContract = curve.contracts[curve.constants.ALIASES['stable_ng_factory']].contract;
|
|
979
|
+
factoryMulticallContract = curve.contracts[curve.constants.ALIASES['stable_ng_factory']].multicallContract;
|
|
980
|
+
_a = Number;
|
|
981
|
+
_c = (_b = curve).formatUnits;
|
|
982
|
+
return [4 /*yield*/, factoryContract.base_pool_count(curve.constantOptions)];
|
|
983
|
+
case 1:
|
|
984
|
+
basePoolCount = _a.apply(void 0, [_c.apply(_b, [_d.sent(), 0])]);
|
|
985
|
+
calls = [];
|
|
986
|
+
for (i = 0; i < basePoolCount; i++) {
|
|
987
|
+
calls.push(factoryMulticallContract.base_pool_list(i));
|
|
988
|
+
}
|
|
989
|
+
return [4 /*yield*/, curve.multicallProvider.all(calls)];
|
|
990
|
+
case 2:
|
|
991
|
+
basePoolList = (_d.sent()).map(function (item) { return item.toLowerCase(); });
|
|
992
|
+
pools = __assign(__assign(__assign({}, curve.constants.STABLE_NG_FACTORY_POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.POOLS_DATA);
|
|
993
|
+
basePoolIds = Object.keys(pools).filter(function (item) { return basePoolList.includes(pools[item].swap_address); });
|
|
994
|
+
return [2 /*return*/, basePoolIds.map(function (poolId) {
|
|
995
|
+
var pool = getPool(poolId);
|
|
996
|
+
return {
|
|
997
|
+
id: poolId,
|
|
998
|
+
name: pool.name,
|
|
999
|
+
pool: pool.address,
|
|
1000
|
+
token: pool.lpToken,
|
|
1001
|
+
coins: pool.underlyingCoinAddresses,
|
|
1002
|
+
};
|
|
1003
|
+
})];
|
|
1004
|
+
}
|
|
983
1005
|
});
|
|
984
|
-
};
|
|
1006
|
+
}); };
|