@curvefi/api 2.67.6 → 2.67.8

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 = {};
@@ -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",
@@ -188,6 +188,7 @@ export declare class PoolTemplate extends CorePool {
188
188
  _getCoinIdx: (coin: string | number, useUnderlying?: boolean) => number;
189
189
  _getRates: () => Promise<bigint[]>;
190
190
  private _storedRatesBN;
191
+ getStoredRates(useUnderlying?: boolean): Promise<string[]>;
191
192
  _underlyingPrices: () => Promise<number[]>;
192
193
  _wrappedPrices: () => Promise<number[]>;
193
194
  private getGaugeStatus;
@@ -1864,6 +1864,17 @@ export class PoolTemplate extends CorePool {
1864
1864
  throw Error(`swapWrapped method doesn't exist for pool ${this.name} (id: ${this.name})`);
1865
1865
  });
1866
1866
  }
1867
+ getStoredRates() {
1868
+ return __awaiter(this, arguments, void 0, function* (useUnderlying = false) {
1869
+ try {
1870
+ const storedRatesBN = yield this._storedRatesBN(useUnderlying);
1871
+ return storedRatesBN.map((rate) => rate.toString());
1872
+ }
1873
+ catch (error) {
1874
+ throw new Error(`Failed to get stored rates for pool ${this.name}`);
1875
+ }
1876
+ });
1877
+ }
1867
1878
  getGaugeStatus() {
1868
1879
  return __awaiter(this, void 0, void 0, function* () {
1869
1880
  const gaugeData = yield _getAllGaugesFormatted();
@@ -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.6",
3
+ "version": "2.67.8",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",