@curvefi/api 2.67.7 → 2.68.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.
@@ -1,6 +1,6 @@
1
1
  import { IDict, IPoolData } from "../interfaces.js";
2
2
  import { BigNumberish, Numeric } from "ethers";
3
- import { Curve } from "../curve";
3
+ import { type Curve } from "../curve.js";
4
4
  export declare const formatUnits: (value: BigNumberish, unit?: string | Numeric) => string;
5
5
  export declare const parseUnits: (value: string, unit?: string | Numeric) => bigint;
6
6
  export declare const lowerCasePoolDataAddresses: (poolsData: IDict<IPoolData>) => IDict<IPoolData>;
package/lib/curve.js CHANGED
@@ -53,7 +53,7 @@ import { _getHiddenPools } from "./external-api.js";
53
53
  import { L2Networks } from "./constants/L2Networks.js";
54
54
  import { getTwocryptoFactoryPoolData } from "./factory/factory-twocrypto.js";
55
55
  import { getNetworkConstants } from "./utils.js";
56
- import { _setPoolsFromApi } from "./cached";
56
+ import { _setPoolsFromApi } from "./cached.js";
57
57
  export const OLD_CHAINS = [1, 10, 56, 100, 137, 250, 1284, 2222, 8453, 42161, 42220, 43114, 1313161554]; // these chains have non-ng pools
58
58
  export const memoizedContract = () => {
59
59
  const cache = {};
@@ -665,7 +665,7 @@ export class Curve {
665
665
  }
666
666
  _filterHiddenPools(pools) {
667
667
  return __awaiter(this, void 0, void 0, function* () {
668
- const hiddenPools = (yield _getHiddenPools())[this.constants.NETWORK_NAME] || [];
668
+ const hiddenPools = (yield _getHiddenPools(this.isLiteChain))[this.constants.NETWORK_NAME] || [];
669
669
  return Object.fromEntries(Object.entries(pools).filter(([id]) => !hiddenPools.includes(id)));
670
670
  });
671
671
  }
@@ -8,7 +8,7 @@ export declare const _getVolumes: ((network: string) => Promise<IVolumeAndAPYs>)
8
8
  export declare const _getFactoryAPYs: ((network: string) => Promise<IVolumeAndAPYs>) & memoize.Memoized<(network: string) => Promise<IVolumeAndAPYs>>;
9
9
  export declare const _getAllGauges: (() => Promise<IDict<IGaugesDataFromApi>>) & memoize.Memoized<() => Promise<IDict<IGaugesDataFromApi>>>;
10
10
  export declare const _getAllGaugesFormatted: (() => Promise<IDict<any>>) & memoize.Memoized<() => Promise<IDict<any>>>;
11
- export declare const _getHiddenPools: (() => Promise<IDict<string[]>>) & memoize.Memoized<() => Promise<IDict<string[]>>>;
11
+ export declare const _getHiddenPools: ((isLiteChain: boolean) => Promise<IDict<string[]>>) & memoize.Memoized<(isLiteChain: boolean) => Promise<IDict<string[]>>>;
12
12
  export declare const _generateBoostingProof: ((block: number, address: string) => Promise<{
13
13
  block_header_rlp: string;
14
14
  proof_rlp: string;
@@ -186,7 +186,7 @@ export const _getAllGaugesFormatted = memoize(() => __awaiter(void 0, void 0, vo
186
186
  promise: true,
187
187
  maxAge: 60 * 60 * 1000, // 60m
188
188
  });
189
- export const _getHiddenPools = memoize(() => fetchData(`https://api.curve.finance/api/getHiddenPools`), {
189
+ export const _getHiddenPools = memoize((isLiteChain) => fetchData(`https://${isLiteChain ? 'api-core' : 'api'}.curve.finance/v1/getHiddenPools`), {
190
190
  promise: true,
191
191
  maxAge: 5 * 60 * 1000, // 5m
192
192
  });
@@ -1,4 +1,4 @@
1
1
  import { ICurve, IPoolDataShort } from "../interfaces";
2
- import { Curve } from "../curve";
2
+ import { type Curve } from "../curve.js";
3
3
  export declare function setFactoryZapContracts(this: ICurve, isCrypto: boolean): void;
4
4
  export declare function getPoolIdByAddress(this: Curve, poolList: IPoolDataShort[], address: string): string;
@@ -1,5 +1,5 @@
1
1
  import { IDict, IPoolData, IPoolDataShort } from "../interfaces";
2
- import { Curve } from "../curve";
2
+ import { Curve } from "../curve.js";
3
3
  export declare const BLACK_LIST: {
4
4
  [index: number]: any;
5
5
  };
@@ -16,7 +16,7 @@ import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: "jso
16
16
  import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: "json" };
17
17
  import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
18
18
  import { getPoolName, isStableNgPool } from "../utils.js";
19
- import { formatUnits } from "../constants/utils";
19
+ import { formatUnits } from "../constants/utils.js";
20
20
  export const BLACK_LIST = {
21
21
  1: [
22
22
  "0x066b6e1e93fa7dcd3f0eb7f8bac7d5a747ce0bf9",
@@ -1868,7 +1868,7 @@ export class PoolTemplate extends CorePool {
1868
1868
  return __awaiter(this, arguments, void 0, function* (useUnderlying = false) {
1869
1869
  try {
1870
1870
  const storedRatesBN = yield this._storedRatesBN(useUnderlying);
1871
- return storedRatesBN.map(rate => rate.toString());
1871
+ return storedRatesBN.map((rate) => rate.toString());
1872
1872
  }
1873
1873
  catch (error) {
1874
1874
  throw new Error(`Failed to get stored rates for pool ${this.name}`);
@@ -1,4 +1,4 @@
1
- import { IStatsPool } from "../subClasses/statsPool";
1
+ import { type IStatsPool } from "../subClasses/statsPool.js";
2
2
  export declare const poolBalancesMetaMixin: {
3
3
  underlyingBalances(this: IStatsPool): Promise<string[]>;
4
4
  };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { parseUnits } from "../../utils.js";
11
11
  import { _calcExpectedAmounts, _calcExpectedUnderlyingAmountsMeta } from "./common.js";
12
- import { formatUnits } from "../../constants/utils";
12
+ import { formatUnits } from "../../constants/utils.js";
13
13
  export const withdrawExpectedMixin = {
14
14
  withdrawExpected(lpTokenAmount) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
@@ -1,5 +1,5 @@
1
1
  import { IDict } from '../../interfaces';
2
- import { PoolTemplate } from "../PoolTemplate";
2
+ import { type PoolTemplate } from "../PoolTemplate.js";
3
3
  export interface IWalletPool {
4
4
  balances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
5
5
  lpTokenBalances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
@@ -1,5 +1,5 @@
1
1
  import type { IChainId, IDict, IPoolData, IRouteStep } from "./interfaces";
2
- import type { Curve } from "./curve";
2
+ import type { Curve } from "./curve.js";
3
3
  export type IRouteGraphInput = {
4
4
  constants: Curve['constants'];
5
5
  chainId: IChainId;
package/lib/router.js CHANGED
@@ -15,7 +15,7 @@ import { _getAmplificationCoefficientsFromApi } from "./pools/utils.js";
15
15
  import { L2Networks } from "./constants/L2Networks.js";
16
16
  import { routeFinderWorker, routeFinderWorkerCode } from "./route-finder.worker.js";
17
17
  import { routeGraphWorker, routeGraphWorkerCode } from "./route-graph.worker.js";
18
- import { memoizeMethod } from "./constants/utils";
18
+ import { memoizeMethod } from "./constants/utils.js";
19
19
  const MAX_STEPS = 5;
20
20
  const ROUTE_LENGTH = (MAX_STEPS * 2) + 1;
21
21
  function _getTVL(poolId) {
package/lib/utils.js CHANGED
@@ -17,7 +17,7 @@ import { L2Networks } from './constants/L2Networks.js';
17
17
  import { volumeNetworks } from "./constants/volumeNetworks.js";
18
18
  import { getPool } from "./pools/index.js";
19
19
  import { NETWORK_CONSTANTS } from "./constants/network_constants.js";
20
- import { formatUnits } from "./constants/utils";
20
+ import { formatUnits } from "./constants/utils.js";
21
21
  export const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
22
22
  // export const MAX_ALLOWANCE = curve.parseUnits(new BigNumber(2).pow(256).minus(1).toFixed(), 0);
23
23
  export const MAX_ALLOWANCE = BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"); // 2**256 - 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.67.7",
3
+ "version": "2.68.0",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",