@curvefi/api 2.65.1 → 2.65.3

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
@@ -1,6 +1,6 @@
1
1
  import { ethers, Contract, Networkish, BigNumberish, Numeric, BrowserProvider, JsonRpcProvider, Signer } from "ethers";
2
2
  import { Provider as MulticallProvider, Contract as MulticallContract } from "@curvefi/ethcall";
3
- import { IPoolData, IDict, ICurve, INetworkName, IChainId, IFactoryPoolType, Abi } from "./interfaces";
3
+ import { IPoolData, IDict, ICurve, IChainId, IFactoryPoolType, Abi, INetworkConstants } from "./interfaces";
4
4
  export declare const memoizedContract: () => (address: string, abi: any, provider: BrowserProvider | JsonRpcProvider | Signer) => Contract;
5
5
  export declare const memoizedMulticallContract: () => (address: string, abi: any) => MulticallContract;
6
6
  export type ContractItem = {
@@ -32,47 +32,7 @@ declare class Curve implements ICurve {
32
32
  maxPriorityFeePerGas?: number | bigint;
33
33
  };
34
34
  L1WeightedGasPrice?: number;
35
- constants: {
36
- NATIVE_TOKEN: {
37
- symbol: string;
38
- wrappedSymbol: string;
39
- address: string;
40
- wrappedAddress: string;
41
- };
42
- NETWORK_NAME: INetworkName;
43
- ALIASES: IDict<string>;
44
- POOLS_DATA: IDict<IPoolData>;
45
- STABLE_FACTORY_CONSTANTS: {
46
- implementationABIDict?: IDict<any>;
47
- basePoolIdZapDict?: IDict<{
48
- address: string;
49
- ABI: any;
50
- }>;
51
- stableNgBasePoolZap?: string;
52
- };
53
- CRYPTO_FACTORY_CONSTANTS: {
54
- lpTokenBasePoolIdDict?: IDict<string>;
55
- basePoolIdZapDict?: IDict<{
56
- address: string;
57
- ABI: any;
58
- }>;
59
- tricryptoDeployImplementations?: IDict<string | number>;
60
- };
61
- FACTORY_POOLS_DATA: IDict<IPoolData>;
62
- CRVUSD_FACTORY_POOLS_DATA: IDict<IPoolData>;
63
- EYWA_FACTORY_POOLS_DATA: IDict<IPoolData>;
64
- CRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
65
- TWOCRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
66
- TRICRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
67
- STABLE_NG_FACTORY_POOLS_DATA: IDict<IPoolData>;
68
- BASE_POOLS: IDict<number>;
69
- LLAMMAS_DATA: IDict<IPoolData>;
70
- COINS: IDict<string>;
71
- DECIMALS: IDict<number>;
72
- GAUGES: string[];
73
- FACTORY_GAUGE_IMPLEMENTATIONS: IDict<IFactoryPoolType>;
74
- ZERO_ADDRESS: string;
75
- };
35
+ constants: INetworkConstants;
76
36
  constructor();
77
37
  init(providerType: 'JsonRpc' | 'Web3' | 'Infura' | 'Alchemy', providerSettings: {
78
38
  url?: string;
@@ -130,6 +90,7 @@ declare class Curve implements ICurve {
130
90
  formatUnits(value: BigNumberish, unit?: string | Numeric): string;
131
91
  parseUnits(value: string, unit?: string | Numeric): bigint;
132
92
  updateFeeData(): Promise<void>;
93
+ getNetworkConstants: () => INetworkConstants;
133
94
  }
134
95
  export declare const curve: Curve;
135
96
  export {};
package/lib/curve.js CHANGED
@@ -296,6 +296,9 @@ class Curve {
296
296
  };
297
297
  this.getPoolsData = () => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.constants.POOLS_DATA), this.constants.FACTORY_POOLS_DATA), this.constants.CRVUSD_FACTORY_POOLS_DATA), this.constants.EYWA_FACTORY_POOLS_DATA), this.constants.CRYPTO_FACTORY_POOLS_DATA), this.constants.STABLE_NG_FACTORY_POOLS_DATA), this.constants.TWOCRYPTO_FACTORY_POOLS_DATA), this.constants.TRICRYPTO_FACTORY_POOLS_DATA), this.constants.LLAMMAS_DATA));
298
298
  this.getGaugeImplementation = (factoryType) => this.constants.FACTORY_GAUGE_IMPLEMENTATIONS[factoryType] || this.constants.ZERO_ADDRESS;
299
+ this.getNetworkConstants = () => {
300
+ return this.constants;
301
+ };
299
302
  // @ts-ignore
300
303
  this.provider = null;
301
304
  // @ts-ignore
@@ -242,6 +242,7 @@ export const _getCurveLiteNetworks = memoize(() => __awaiter(void 0, void 0, voi
242
242
  rpcUrl: metadata.rpcUrl,
243
243
  chainId: metadata.chainId,
244
244
  explorerUrl: metadata.explorerBaseUrl,
245
+ nativeCurrencySymbol: metadata.nativeCurrencySymbol,
245
246
  };
246
247
  })
247
248
  .filter((network) => network !== null);
package/lib/index.d.ts CHANGED
@@ -63,47 +63,7 @@ declare const curve: {
63
63
  hasDepositAndStake: () => boolean;
64
64
  hasRouter: () => boolean;
65
65
  getCurveLiteNetworks: () => Promise<import("./interfaces.js").ICurveLiteNetwork[]>;
66
- constants: {
67
- NATIVE_TOKEN: {
68
- symbol: string;
69
- wrappedSymbol: string;
70
- address: string;
71
- wrappedAddress: string;
72
- };
73
- NETWORK_NAME: import("./interfaces.js").INetworkName;
74
- ALIASES: import("./interfaces.js").IDict<string>;
75
- POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
76
- STABLE_FACTORY_CONSTANTS: {
77
- implementationABIDict?: import("./interfaces.js").IDict<any> | undefined;
78
- basePoolIdZapDict?: import("./interfaces.js").IDict<{
79
- address: string;
80
- ABI: any;
81
- }> | undefined;
82
- stableNgBasePoolZap?: string | undefined;
83
- };
84
- CRYPTO_FACTORY_CONSTANTS: {
85
- lpTokenBasePoolIdDict?: import("./interfaces.js").IDict<string> | undefined;
86
- basePoolIdZapDict?: import("./interfaces.js").IDict<{
87
- address: string;
88
- ABI: any;
89
- }> | undefined;
90
- tricryptoDeployImplementations?: import("./interfaces.js").IDict<string | number> | undefined;
91
- };
92
- FACTORY_POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
93
- CRVUSD_FACTORY_POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
94
- EYWA_FACTORY_POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
95
- CRYPTO_FACTORY_POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
96
- TWOCRYPTO_FACTORY_POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
97
- TRICRYPTO_FACTORY_POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
98
- STABLE_NG_FACTORY_POOLS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
99
- BASE_POOLS: import("./interfaces.js").IDict<number>;
100
- LLAMMAS_DATA: import("./interfaces.js").IDict<import("./interfaces.js").IPoolData>;
101
- COINS: import("./interfaces.js").IDict<string>;
102
- DECIMALS: import("./interfaces.js").IDict<number>;
103
- GAUGES: string[];
104
- FACTORY_GAUGE_IMPLEMENTATIONS: import("./interfaces.js").IDict<import("./interfaces.js").IFactoryPoolType>;
105
- ZERO_ADDRESS: string;
106
- };
66
+ getNetworkConstants: () => import("./interfaces.js").INetworkConstants;
107
67
  factory: {
108
68
  fetchPools: (useApi?: boolean) => Promise<void>;
109
69
  fetchNewPools: () => Promise<string[]>;
package/lib/index.js CHANGED
@@ -57,7 +57,7 @@ const curve = {
57
57
  hasDepositAndStake,
58
58
  hasRouter,
59
59
  getCurveLiteNetworks,
60
- constants: _curve.constants,
60
+ getNetworkConstants: _curve.getNetworkConstants,
61
61
  factory: {
62
62
  fetchPools: _curve.fetchFactoryPools,
63
63
  fetchNewPools: _curve.fetchNewFactoryPools,
@@ -47,6 +47,47 @@ export interface IPoolData {
47
47
  is_gauge_killed?: boolean;
48
48
  gauge_status?: Record<string, boolean> | null;
49
49
  }
50
+ export interface INetworkConstants {
51
+ NATIVE_TOKEN: {
52
+ symbol: string;
53
+ wrappedSymbol: string;
54
+ address: string;
55
+ wrappedAddress: string;
56
+ };
57
+ NETWORK_NAME: INetworkName;
58
+ ALIASES: IDict<string>;
59
+ POOLS_DATA: IDict<IPoolData>;
60
+ STABLE_FACTORY_CONSTANTS: {
61
+ implementationABIDict?: IDict<any>;
62
+ basePoolIdZapDict?: IDict<{
63
+ address: string;
64
+ ABI: any;
65
+ }>;
66
+ stableNgBasePoolZap?: string;
67
+ };
68
+ CRYPTO_FACTORY_CONSTANTS: {
69
+ lpTokenBasePoolIdDict?: IDict<string>;
70
+ basePoolIdZapDict?: IDict<{
71
+ address: string;
72
+ ABI: any;
73
+ }>;
74
+ tricryptoDeployImplementations?: IDict<string | number>;
75
+ };
76
+ FACTORY_POOLS_DATA: IDict<IPoolData>;
77
+ STABLE_NG_FACTORY_POOLS_DATA: IDict<IPoolData>;
78
+ CRVUSD_FACTORY_POOLS_DATA: IDict<IPoolData>;
79
+ CRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
80
+ TWOCRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
81
+ TRICRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
82
+ EYWA_FACTORY_POOLS_DATA: IDict<IPoolData>;
83
+ BASE_POOLS: IDict<number>;
84
+ LLAMMAS_DATA: IDict<IPoolData>;
85
+ COINS: IDict<string>;
86
+ DECIMALS: IDict<number>;
87
+ GAUGES: string[];
88
+ FACTORY_GAUGE_IMPLEMENTATIONS: any;
89
+ ZERO_ADDRESS: string;
90
+ }
50
91
  export interface ICurve {
51
92
  provider: ethers.BrowserProvider | ethers.JsonRpcProvider;
52
93
  multicallProvider: MulticallProvider;
@@ -73,42 +114,7 @@ export interface ICurve {
73
114
  maxFeePerGas?: number | bigint;
74
115
  maxPriorityFeePerGas?: number | bigint;
75
116
  };
76
- constants: {
77
- NATIVE_TOKEN: {
78
- symbol: string;
79
- wrappedSymbol: string;
80
- address: string;
81
- wrappedAddress: string;
82
- };
83
- NETWORK_NAME: INetworkName;
84
- ALIASES: IDict<string>;
85
- POOLS_DATA: IDict<IPoolData>;
86
- STABLE_FACTORY_CONSTANTS: {
87
- implementationABIDict?: IDict<any>;
88
- basePoolIdZapDict?: IDict<{
89
- address: string;
90
- ABI: any;
91
- }>;
92
- stableNgBasePoolZap?: string;
93
- };
94
- CRYPTO_FACTORY_CONSTANTS: {
95
- lpTokenBasePoolIdDict?: IDict<string>;
96
- basePoolIdZapDict?: IDict<{
97
- address: string;
98
- ABI: any;
99
- }>;
100
- tricryptoDeployImplementations?: IDict<string | number>;
101
- };
102
- FACTORY_POOLS_DATA: IDict<IPoolData>;
103
- CRVUSD_FACTORY_POOLS_DATA: IDict<IPoolData>;
104
- CRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
105
- TRICRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
106
- BASE_POOLS: IDict<number>;
107
- LLAMMAS_DATA: IDict<IPoolData>;
108
- COINS: IDict<string>;
109
- DECIMALS: IDict<number>;
110
- GAUGES: string[];
111
- };
117
+ constants: INetworkConstants;
112
118
  setContract: (address: string | undefined, abi: any) => void;
113
119
  }
114
120
  export interface ICoinFromPoolDataApi {
@@ -287,6 +293,7 @@ export interface ICurveLiteNetwork {
287
293
  name: string;
288
294
  rpcUrl: string;
289
295
  explorerUrl: string;
296
+ nativeCurrencySymbol: string;
290
297
  }
291
298
  export type TVoteType = "PARAMETER" | "OWNERSHIP";
292
299
  export type AbiParameter = {
package/lib/utils.js CHANGED
@@ -367,9 +367,6 @@ export const _getRewardsFromApi = () => __awaiter(void 0, void 0, void 0, functi
367
367
  const _usdRatesCache = {};
368
368
  export const _getUsdRate = (assetId) => __awaiter(void 0, void 0, void 0, function* () {
369
369
  var _f, _g;
370
- if (curve.isLiteChain) {
371
- throw Error('This method is not supported for the lite version');
372
- }
373
370
  if (curve.chainId === 1 && assetId.toLowerCase() === '0x8762db106b2c2a0bccb3a80d1ed41273552616e8')
374
371
  return 0; // RSR
375
372
  const pricesFromApi = yield _getUsdPricesFromApi();
@@ -450,9 +447,6 @@ export const _getUsdRate = (assetId) => __awaiter(void 0, void 0, void 0, functi
450
447
  return _usdRatesCache[assetId]['rate'];
451
448
  });
452
449
  export const getUsdRate = (coin) => __awaiter(void 0, void 0, void 0, function* () {
453
- if (curve.isLiteChain) {
454
- throw Error('This method is not supported for the lite version');
455
- }
456
450
  const [coinAddress] = _getCoinAddressesNoCheck(coin);
457
451
  return yield _getUsdRate(coinAddress);
458
452
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.65.1",
3
+ "version": "2.65.3",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",