@curvefi/api 1.17.2 → 1.20.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 (43) hide show
  1. package/README.md +57 -0
  2. package/lib/constants/abis/abis-ethereum.js +6 -6
  3. package/lib/constants/abis/json/factory-crypto/factory-crypto-pool-2.json +1112 -0
  4. package/lib/constants/abis/json/factory-crypto.json +635 -0
  5. package/lib/constants/abis/json/factory-v2/DepositZapMetaBtcPolygon.json +197 -0
  6. package/lib/constants/abis/json/factory-v2/DepositZapMetaUsdPolygon.json +197 -0
  7. package/lib/constants/abis/json/factory-v2/MetaBTC.json +919 -0
  8. package/lib/constants/abis/json/factory-v2/MetaBTCBalances.json +932 -0
  9. package/lib/constants/abis/json/factory-v2/MetaBTCBalancesRen.json +932 -0
  10. package/lib/constants/abis/json/factory-v2/MetaBTCRen.json +919 -0
  11. package/lib/constants/abis/json/factory-v2/MetaUSD.json +919 -0
  12. package/lib/constants/abis/json/factory-v2/MetaUSDBalances.json +932 -0
  13. package/lib/constants/abis/json/factory-v2/Plain2Balances.json +845 -0
  14. package/lib/constants/abis/json/factory-v2/Plain2Basic.json +845 -0
  15. package/lib/constants/abis/json/factory-v2/Plain2ETH.json +845 -0
  16. package/lib/constants/abis/json/factory-v2/Plain2Optimized.json +844 -0
  17. package/lib/constants/abis/json/factory-v2/Plain3Balances.json +845 -0
  18. package/lib/constants/abis/json/factory-v2/Plain3Basic.json +845 -0
  19. package/lib/constants/abis/json/factory-v2/Plain3ETH.json +845 -0
  20. package/lib/constants/abis/json/factory-v2/Plain3Optimized.json +845 -0
  21. package/lib/constants/abis/json/factory-v2/Plain4Balances.json +845 -0
  22. package/lib/constants/abis/json/factory-v2/Plain4Basic.json +845 -0
  23. package/lib/constants/abis/json/factory-v2/Plain4ETH.json +845 -0
  24. package/lib/constants/abis/json/factory-v2/Plain4Optimized.json +845 -0
  25. package/lib/constants/abis/json/factory.json +1063 -0
  26. package/lib/constants/abis/json/registry_exchange.json +207 -84
  27. package/lib/constants/aliases.d.ts +4 -0
  28. package/lib/constants/aliases.js +4 -0
  29. package/lib/constants/coins-polygon.js +3 -2
  30. package/lib/curve.d.ts +5 -0
  31. package/lib/curve.js +62 -0
  32. package/lib/factory-crypto.d.ts +32 -0
  33. package/lib/factory-crypto.js +377 -0
  34. package/lib/factory.d.ts +32 -0
  35. package/lib/factory.js +607 -0
  36. package/lib/index.d.ts +7 -0
  37. package/lib/index.js +28 -0
  38. package/lib/interfaces.d.ts +28 -1
  39. package/lib/pools.d.ts +5 -0
  40. package/lib/pools.js +359 -159
  41. package/lib/utils.d.ts +8 -1
  42. package/lib/utils.js +111 -8
  43. package/package.json +4 -2
package/lib/index.js CHANGED
@@ -57,12 +57,40 @@ function init(providerType, providerSettings, options) {
57
57
  });
58
58
  });
59
59
  }
60
+ function fetchFactoryPools() {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ return __generator(this, function (_a) {
63
+ switch (_a.label) {
64
+ case 0: return [4 /*yield*/, curve_1.curve.fetchFactoryPools()];
65
+ case 1:
66
+ _a.sent();
67
+ return [2 /*return*/];
68
+ }
69
+ });
70
+ });
71
+ }
72
+ function fetchCryptoFactoryPools() {
73
+ return __awaiter(this, void 0, void 0, function () {
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0: return [4 /*yield*/, curve_1.curve.fetchCryptoFactoryPools()];
77
+ case 1:
78
+ _a.sent();
79
+ return [2 /*return*/];
80
+ }
81
+ });
82
+ });
83
+ }
60
84
  function setCustomFeeData(customFeeData) {
61
85
  curve_1.curve.setCustomFeeData(customFeeData);
62
86
  }
63
87
  var curve = {
64
88
  init: init,
89
+ fetchFactoryPools: fetchFactoryPools,
90
+ fetchCryptoFactoryPools: fetchCryptoFactoryPools,
65
91
  getPoolList: utils_1.getPoolList,
92
+ getFactoryPoolList: utils_1.getFactoryPoolList,
93
+ getCryptoFactoryPoolList: utils_1.getCryptoFactoryPoolList,
66
94
  getUsdRate: utils_1.getUsdRate,
67
95
  setCustomFeeData: setCustomFeeData,
68
96
  signerAddress: '',
@@ -1,8 +1,9 @@
1
+ import { ethers } from "ethers";
1
2
  export interface DictInterface<T> {
2
3
  [index: string]: T;
3
4
  }
4
5
  export interface PoolDataInterface {
5
- reference_asset: 'USD' | 'EUR' | 'BTC' | 'ETH' | 'LINK' | 'CRYPTO';
6
+ reference_asset: 'USD' | 'EUR' | 'BTC' | 'ETH' | 'LINK' | 'CRYPTO' | 'OTHER';
6
7
  N_COINS: number;
7
8
  underlying_decimals: number[];
8
9
  decimals: number[];
@@ -38,6 +39,9 @@ export interface PoolDataInterface {
38
39
  meta_coin_addresses?: string[];
39
40
  all_coin_addresses?: string[];
40
41
  is_factory?: boolean;
42
+ is_plain_factory?: boolean;
43
+ is_meta_factory?: boolean;
44
+ is_crypto_factory?: boolean;
41
45
  adapter_abi?: any;
42
46
  old_adapter_address?: string;
43
47
  adapter_biconomy_address?: string;
@@ -57,3 +61,26 @@ export interface RewardsApyInterface {
57
61
  symbol: string;
58
62
  apy: string;
59
63
  }
64
+ export interface IPoolStats {
65
+ volume: number;
66
+ apy: {
67
+ day: number;
68
+ week: number;
69
+ month: number;
70
+ total: number;
71
+ };
72
+ }
73
+ export interface IStats {
74
+ [index: string]: IPoolStats;
75
+ }
76
+ export interface ISinglePoolSwapData {
77
+ poolName: string;
78
+ poolAddress: string;
79
+ i: number;
80
+ j: number;
81
+ swapType: 1 | 2 | 3 | 4;
82
+ swapAddress: string;
83
+ }
84
+ export interface ISinglePoolSwapDataAndOutput extends ISinglePoolSwapData {
85
+ _output: ethers.BigNumber;
86
+ }
package/lib/pools.d.ts CHANGED
@@ -21,6 +21,9 @@ export declare class Pool {
21
21
  isCrypto: boolean;
22
22
  basePool: string;
23
23
  isFactory: boolean;
24
+ isMetaFactory: boolean;
25
+ isPlainFactory: boolean;
26
+ isCryptoFactory: boolean;
24
27
  rewardTokens: string[];
25
28
  estimateGas: {
26
29
  addLiquidityApprove: (amounts: string[]) => Promise<number>;
@@ -76,6 +79,7 @@ export declare class Pool {
76
79
  private getPoolBalances;
77
80
  private getPoolWrappedBalances;
78
81
  private getTotalLiquidity;
82
+ private _getPoolStats;
79
83
  private getVolume;
80
84
  private getBaseApy;
81
85
  private getTokenApy;
@@ -218,6 +222,7 @@ export declare class Pool {
218
222
  private _getExchangeOutputWrapped;
219
223
  }
220
224
  export declare const getBestPoolAndOutput: (inputCoin: string, outputCoin: string, amount: string) => Promise<{
225
+ poolName: string;
221
226
  poolAddress: string;
222
227
  output: string;
223
228
  }>;