@curvefi/api 2.65.12 → 2.65.14

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.
Files changed (2) hide show
  1. package/lib/router.js +2 -3
  2. package/package.json +5 -2
package/lib/router.js CHANGED
@@ -35,9 +35,8 @@ function mapDict(dict, mapper) {
35
35
  Object.entries(dict).forEach(([key, value]) => result[key] = mapper(key, value));
36
36
  return result;
37
37
  }
38
- const _buildRouteGraph = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
38
+ const _buildRouteGraph = memoize((chainId) => __awaiter(void 0, void 0, void 0, function* () {
39
39
  const constants = curve.constants;
40
- const chainId = curve.chainId;
41
40
  const allPools = Object.entries(curve.getPoolsData()).filter(([id]) => !["crveth", "y", "busd", "pax"].includes(id));
42
41
  const amplificationCoefficientDict = yield _getAmplificationCoefficientsFromApi();
43
42
  const poolTvlDict = yield entriesToDictAsync(allPools, _getTVL);
@@ -48,7 +47,7 @@ const _buildRouteGraph = memoize(() => __awaiter(void 0, void 0, void 0, functio
48
47
  maxAge: 5 * 60 * 1000, // 5m
49
48
  });
50
49
  const _findRoutes = (inputCoinAddress, outputCoinAddress) => __awaiter(void 0, void 0, void 0, function* () {
51
- const routerGraph = yield _buildRouteGraph();
50
+ const routerGraph = yield _buildRouteGraph(curve.chainId); // It's important to pass chainId to not use cache from another network
52
51
  // extract only the fields we need for the worker
53
52
  const poolData = mapDict(curve.getPoolsData(), (_, { is_lending, wrapped_coin_addresses, underlying_coin_addresses, token_address }) => ({ is_lending, wrapped_coin_addresses, underlying_coin_addresses, token_address }));
54
53
  const input = { inputCoinAddress, outputCoinAddress, routerGraph, poolData };
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.65.12",
3
+ "version": "2.65.14",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",
7
7
  "license": "MIT",
8
8
  "private": false,
9
+ "engines": {
10
+ "node": "22"
11
+ },
9
12
  "repository": {
10
13
  "type": "git",
11
- "url": "https://github.com/curvefi/curve-js.git"
14
+ "url": "git+https://github.com/curvefi/curve-js.git"
12
15
  },
13
16
  "bugs": {
14
17
  "url": "https://github.com/curvefi/curve-js/issues"