@curvefi/api 2.65.4 → 2.65.6

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/curve.d.ts CHANGED
@@ -91,6 +91,7 @@ declare class Curve implements ICurve {
91
91
  parseUnits(value: string, unit?: string | Numeric): bigint;
92
92
  updateFeeData(): Promise<void>;
93
93
  getNetworkConstants: () => INetworkConstants;
94
+ getIsLiteChain: () => boolean;
94
95
  }
95
96
  export declare const curve: Curve;
96
97
  export {};
package/lib/curve.js CHANGED
@@ -299,6 +299,9 @@ class Curve {
299
299
  this.getNetworkConstants = () => {
300
300
  return this.constants;
301
301
  };
302
+ this.getIsLiteChain = () => {
303
+ return this.isLiteChain;
304
+ };
302
305
  // @ts-ignore
303
306
  this.provider = null;
304
307
  // @ts-ignore
@@ -20,17 +20,26 @@ export const _getPoolsFromApi = memoize((network, poolType, isLiteChain = false)
20
20
  maxAge: 5 * 60 * 1000, // 5m
21
21
  });
22
22
  export const _getAllPoolsFromApi = (network, isLiteChain = false) => __awaiter(void 0, void 0, void 0, function* () {
23
- return yield Promise.all([
24
- _getPoolsFromApi(network, "main", isLiteChain),
25
- _getPoolsFromApi(network, "crypto", isLiteChain),
26
- _getPoolsFromApi(network, "factory", isLiteChain),
27
- _getPoolsFromApi(network, "factory-crvusd", isLiteChain),
28
- _getPoolsFromApi(network, "factory-eywa", isLiteChain),
29
- _getPoolsFromApi(network, "factory-crypto", isLiteChain),
30
- _getPoolsFromApi(network, "factory-twocrypto", isLiteChain),
31
- _getPoolsFromApi(network, "factory-tricrypto", isLiteChain),
32
- _getPoolsFromApi(network, "factory-stable-ng", isLiteChain),
33
- ]);
23
+ if (isLiteChain) {
24
+ return yield Promise.all([
25
+ _getPoolsFromApi(network, "factory-twocrypto", isLiteChain),
26
+ _getPoolsFromApi(network, "factory-tricrypto", isLiteChain),
27
+ _getPoolsFromApi(network, "factory-stable-ng", isLiteChain),
28
+ ]);
29
+ }
30
+ else {
31
+ return yield Promise.all([
32
+ _getPoolsFromApi(network, "main", isLiteChain),
33
+ _getPoolsFromApi(network, "crypto", isLiteChain),
34
+ _getPoolsFromApi(network, "factory", isLiteChain),
35
+ _getPoolsFromApi(network, "factory-crvusd", isLiteChain),
36
+ _getPoolsFromApi(network, "factory-eywa", isLiteChain),
37
+ _getPoolsFromApi(network, "factory-crypto", isLiteChain),
38
+ _getPoolsFromApi(network, "factory-twocrypto", isLiteChain),
39
+ _getPoolsFromApi(network, "factory-tricrypto", isLiteChain),
40
+ _getPoolsFromApi(network, "factory-stable-ng", isLiteChain),
41
+ ]);
42
+ }
34
43
  });
35
44
  export const _getSubgraphData = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
36
45
  var _b, _c, _d;
package/lib/index.d.ts CHANGED
@@ -64,6 +64,7 @@ declare const curve: {
64
64
  hasRouter: () => boolean;
65
65
  getCurveLiteNetworks: () => Promise<import("./interfaces.js").ICurveLiteNetwork[]>;
66
66
  getNetworkConstants: () => import("./interfaces.js").INetworkConstants;
67
+ getIsLiteChain: () => boolean;
67
68
  factory: {
68
69
  fetchPools: (useApi?: boolean) => Promise<void>;
69
70
  fetchNewPools: () => Promise<string[]>;
package/lib/index.js CHANGED
@@ -58,6 +58,7 @@ const curve = {
58
58
  hasRouter,
59
59
  getCurveLiteNetworks,
60
60
  getNetworkConstants: _curve.getNetworkConstants,
61
+ getIsLiteChain: _curve.getIsLiteChain,
61
62
  factory: {
62
63
  fetchPools: _curve.fetchFactoryPools,
63
64
  fetchNewPools: _curve.fetchNewFactoryPools,
@@ -319,7 +319,7 @@ export const getUserPoolList = (address = curve.signerAddress, useApi = true) =>
319
319
  });
320
320
  export const _getAmplificationCoefficientsFromApi = () => __awaiter(void 0, void 0, void 0, function* () {
321
321
  const network = curve.constants.NETWORK_NAME;
322
- const allTypesExtendedPoolData = yield _getAllPoolsFromApi(network);
322
+ const allTypesExtendedPoolData = yield _getAllPoolsFromApi(network, curve.isLiteChain);
323
323
  const amplificationCoefficientDict = {};
324
324
  for (const extendedPoolData of allTypesExtendedPoolData) {
325
325
  for (const pool of extendedPoolData.poolData) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.65.4",
3
+ "version": "2.65.6",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",