@curvefi/api 2.63.10 → 2.64.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.
Files changed (77) hide show
  1. package/lib/constants/coins/arbitrum.d.ts +0 -4
  2. package/lib/constants/coins/arbitrum.js +0 -4
  3. package/lib/constants/coins/aurora.d.ts +0 -4
  4. package/lib/constants/coins/aurora.js +0 -4
  5. package/lib/constants/coins/avalanche.d.ts +0 -3
  6. package/lib/constants/coins/avalanche.js +0 -3
  7. package/lib/constants/coins/base.d.ts +0 -4
  8. package/lib/constants/coins/base.js +0 -4
  9. package/lib/constants/coins/bsc.d.ts +0 -4
  10. package/lib/constants/coins/bsc.js +0 -4
  11. package/lib/constants/coins/celo.d.ts +0 -4
  12. package/lib/constants/coins/celo.js +0 -4
  13. package/lib/constants/coins/fantom.d.ts +0 -2
  14. package/lib/constants/coins/fantom.js +0 -2
  15. package/lib/constants/coins/fraxtal.d.ts +0 -4
  16. package/lib/constants/coins/fraxtal.js +0 -4
  17. package/lib/constants/coins/index.d.ts +18 -0
  18. package/lib/constants/coins/index.js +18 -0
  19. package/lib/constants/coins/kava.d.ts +0 -4
  20. package/lib/constants/coins/kava.js +0 -4
  21. package/lib/constants/coins/mantle.d.ts +0 -4
  22. package/lib/constants/coins/mantle.js +0 -4
  23. package/lib/constants/coins/moonbeam.d.ts +0 -4
  24. package/lib/constants/coins/moonbeam.js +0 -4
  25. package/lib/constants/coins/optimism.d.ts +0 -4
  26. package/lib/constants/coins/optimism.js +0 -4
  27. package/lib/constants/coins/polygon.d.ts +0 -3
  28. package/lib/constants/coins/polygon.js +0 -3
  29. package/lib/constants/coins/xdai.d.ts +0 -4
  30. package/lib/constants/coins/xdai.js +0 -4
  31. package/lib/constants/coins/xlayer.d.ts +0 -4
  32. package/lib/constants/coins/xlayer.js +0 -4
  33. package/lib/constants/coins/zksync.d.ts +0 -4
  34. package/lib/constants/coins/zksync.js +0 -4
  35. package/lib/constants/{tricryptoDeployImplementations.d.ts → factory/crypto.d.ts} +21 -0
  36. package/lib/constants/{tricryptoDeployImplementations.js → factory/crypto.js} +85 -0
  37. package/lib/constants/factory/index.d.ts +3 -0
  38. package/lib/constants/factory/index.js +3 -0
  39. package/lib/{factory/constants.d.ts → constants/factory/stable.d.ts} +6 -52
  40. package/lib/{factory/constants.js → constants/factory/stable.js} +41 -151
  41. package/lib/constants/network_constants.d.ts +3 -0
  42. package/lib/constants/{aliases.js → network_constants.js} +253 -96
  43. package/lib/curve.d.ts +22 -16
  44. package/lib/curve.js +94 -362
  45. package/lib/external-api.d.ts +5 -3
  46. package/lib/external-api.js +86 -12
  47. package/lib/factory/common.js +2 -3
  48. package/lib/factory/deploy.js +5 -4
  49. package/lib/factory/factory-api.js +53 -61
  50. package/lib/factory/factory-crypto.js +3 -3
  51. package/lib/factory/factory-tricrypto.js +2 -2
  52. package/lib/factory/factory.js +22 -11
  53. package/lib/index.d.ts +1 -0
  54. package/lib/index.js +2 -1
  55. package/lib/interfaces.d.ts +26 -1
  56. package/lib/pools/PoolTemplate.d.ts +9 -82
  57. package/lib/pools/PoolTemplate.js +37 -379
  58. package/lib/pools/mixins/depositBalancedAmountsMixins.js +3 -3
  59. package/lib/pools/mixins/poolBalancesMixin.d.ts +3 -3
  60. package/lib/pools/mixins/poolBalancesMixin.js +11 -11
  61. package/lib/pools/poolConstructor.js +14 -7
  62. package/lib/pools/subClasses/corePool.d.ts +68 -0
  63. package/lib/pools/subClasses/corePool.js +39 -0
  64. package/lib/pools/{gaugePool.d.ts → subClasses/gaugePool.d.ts} +1 -1
  65. package/lib/pools/{gaugePool.js → subClasses/gaugePool.js} +2 -2
  66. package/lib/pools/subClasses/statsPool.d.ts +45 -0
  67. package/lib/pools/subClasses/statsPool.js +227 -0
  68. package/lib/pools/subClasses/walletPool.d.ts +19 -0
  69. package/lib/pools/subClasses/walletPool.js +72 -0
  70. package/lib/pools/utils.d.ts +1 -0
  71. package/lib/pools/utils.js +36 -0
  72. package/lib/utils.d.ts +10 -1
  73. package/lib/utils.js +45 -7
  74. package/package.json +1 -1
  75. package/lib/constants/aliases.d.ts +0 -17
  76. package/lib/factory/constants-crypto.d.ts +0 -90
  77. package/lib/factory/constants-crypto.js +0 -122
@@ -5,6 +5,7 @@ export interface IDict<T> {
5
5
  }
6
6
  export type INetworkName = "ethereum" | "optimism" | "bsc" | "xdai" | "polygon" | "x-layer" | "fantom" | "fraxtal" | "zksync" | "moonbeam" | "kava" | "mantle" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
7
7
  export type IChainId = 1 | 10 | 56 | 100 | 137 | 196 | 250 | 252 | 324 | 1284 | 2222 | 5000 | 8453 | 42161 | 42220 | 43114 | 1313161554;
8
+ export type IChainIdLite = number;
8
9
  export type IFactoryPoolType = "factory" | "factory-crvusd" | "factory-eywa" | "factory-crypto" | "factory-twocrypto" | "factory-tricrypto" | "factory-stable-ng";
9
10
  export type IPoolType = "main" | "crypto" | IFactoryPoolType;
10
11
  export type ISwapType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
@@ -52,6 +53,7 @@ export interface ICurve {
52
53
  signer: ethers.Signer | null;
53
54
  signerAddress: string;
54
55
  chainId: number;
56
+ isLiteChain: boolean;
55
57
  contracts: {
56
58
  [index: string]: {
57
59
  contract: Contract;
@@ -81,6 +83,22 @@ export interface ICurve {
81
83
  NETWORK_NAME: INetworkName;
82
84
  ALIASES: IDict<string>;
83
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
+ };
84
102
  FACTORY_POOLS_DATA: IDict<IPoolData>;
85
103
  CRVUSD_FACTORY_POOLS_DATA: IDict<IPoolData>;
86
104
  CRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
@@ -91,7 +109,7 @@ export interface ICurve {
91
109
  DECIMALS: IDict<number>;
92
110
  GAUGES: string[];
93
111
  };
94
- setContract: (address: string, abi: any) => void;
112
+ setContract: (address: string | undefined, abi: any) => void;
95
113
  }
96
114
  export interface ICoinFromPoolDataApi {
97
115
  address: string;
@@ -263,6 +281,13 @@ export interface IBasePoolShortItem {
263
281
  pool: string;
264
282
  token: string;
265
283
  }
284
+ export interface ICurveLiteNetwork {
285
+ id: string;
286
+ chainId: number;
287
+ name: string;
288
+ rpcUrl: string;
289
+ explorerUrl: string;
290
+ }
266
291
  export type TVoteType = "PARAMETER" | "OWNERSHIP";
267
292
  export type AbiParameter = {
268
293
  type: string;
@@ -1,38 +1,10 @@
1
+ import BigNumber from 'bignumber.js';
1
2
  import memoize from "memoizee";
2
- import { IDict, IReward, IProfit } from '../interfaces';
3
- import { IGaugePool } from "./gaugePool.js";
4
- export declare class PoolTemplate {
5
- id: string;
6
- name: string;
7
- fullName: string;
8
- symbol: string;
9
- referenceAsset: string;
10
- address: string;
11
- lpToken: string;
12
- gauge: IGaugePool;
13
- zap: string | null;
14
- sRewardContract: string | null;
15
- rewardContract: string | null;
16
- implementation: string | null;
17
- isPlain: boolean;
18
- isLending: boolean;
19
- isMeta: boolean;
20
- isCrypto: boolean;
21
- isFake: boolean;
22
- isFactory: boolean;
23
- isMetaFactory: boolean;
24
- isNg: boolean;
25
- isLlamma: boolean;
26
- basePool: string;
27
- metaCoinIdx: number;
28
- underlyingCoins: string[];
29
- wrappedCoins: string[];
30
- underlyingCoinAddresses: string[];
31
- wrappedCoinAddresses: string[];
32
- underlyingDecimals: number[];
33
- wrappedDecimals: number[];
34
- useLending: boolean[];
35
- inApi: boolean;
3
+ import { IDict, IProfit } from '../interfaces';
4
+ import { CorePool } from "./subClasses/corePool.js";
5
+ import { StatsPool } from "./subClasses/statsPool.js";
6
+ import { WalletPool } from "./subClasses/walletPool.js";
7
+ export declare class PoolTemplate extends CorePool {
36
8
  isGaugeKilled: () => Promise<boolean>;
37
9
  gaugeStatus: () => Promise<any>;
38
10
  estimateGas: {
@@ -63,51 +35,12 @@ export declare class PoolTemplate {
63
35
  swapWrappedApprove: (inputCoin: string | number, amount: number | string) => Promise<number | number[]>;
64
36
  swapWrapped: (inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage: number) => Promise<number | number[]>;
65
37
  };
66
- stats: {
67
- parameters: () => Promise<{
68
- lpTokenSupply: string;
69
- virtualPrice: string;
70
- fee: string;
71
- adminFee: string;
72
- A: string;
73
- future_A?: string;
74
- initial_A?: string;
75
- future_A_time?: number;
76
- initial_A_time?: number;
77
- gamma?: string;
78
- price_oracle?: string[];
79
- price_scale?: string[];
80
- }>;
81
- underlyingBalances: () => Promise<string[]>;
82
- wrappedBalances: () => Promise<string[]>;
83
- totalLiquidity: (useApi?: boolean) => Promise<string>;
84
- volume: () => Promise<string>;
85
- baseApy: () => Promise<{
86
- day: string;
87
- week: string;
88
- }>;
89
- tokenApy: (useApi?: boolean) => Promise<[baseApy: number, boostedApy: number]>;
90
- rewardsApy: (useApi?: boolean) => Promise<IReward[]>;
91
- };
92
- wallet: {
93
- balances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
94
- lpTokenBalances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
95
- underlyingCoinBalances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
96
- wrappedCoinBalances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
97
- allCoinBalances: (...addresses: string[] | string[][]) => Promise<IDict<IDict<string>> | IDict<string>>;
98
- };
38
+ stats: StatsPool;
39
+ wallet: WalletPool;
99
40
  constructor(id: string);
100
41
  hasVyperVulnerability(): boolean;
101
42
  rewardsOnly(): boolean;
102
- private statsParameters;
103
- private statsWrappedBalances;
104
- private statsUnderlyingBalances;
105
- private statsTotalLiquidity;
106
- private statsVolume;
107
- private statsBaseApy;
108
- private _calcTokenApy;
109
- private statsTokenApy;
110
- private statsRewardsApy;
43
+ _calcTokenApy: (futureWorkingSupplyBN?: BigNumber | null) => Promise<[baseApy: number, boostedApy: number]>;
111
44
  private _pureCalcLpTokenAmount;
112
45
  private _calcLpTokenAmount;
113
46
  private calcLpTokenAmount;
@@ -212,11 +145,6 @@ export declare class PoolTemplate {
212
145
  withdrawOneCoinWrappedBonus(lpTokenAmount: number | string, coin: string | number): Promise<string>;
213
146
  private withdrawOneCoinWrappedEstimateGas;
214
147
  withdrawOneCoinWrapped(lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
215
- private walletBalances;
216
- private walletLpTokenBalances;
217
- private walletUnderlyingCoinBalances;
218
- private walletWrappedCoinBalances;
219
- private walletAllCoinBalances;
220
148
  private _userLpTotalBalance;
221
149
  userBalances(address?: string): Promise<string[]>;
222
150
  userWrappedBalances(address?: string): Promise<string[]>;
@@ -258,7 +186,6 @@ export declare class PoolTemplate {
258
186
  gaugeOptimalDeposits: (...accounts: string[]) => Promise<IDict<string>>;
259
187
  private _getCoinIdx;
260
188
  private _getRates;
261
- private _balances;
262
189
  private _storedRatesBN;
263
190
  private _underlyingPrices;
264
191
  private _wrappedPrices;