@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.
- package/README.md +57 -0
- package/lib/constants/abis/abis-ethereum.js +6 -6
- package/lib/constants/abis/json/factory-crypto/factory-crypto-pool-2.json +1112 -0
- package/lib/constants/abis/json/factory-crypto.json +635 -0
- package/lib/constants/abis/json/factory-v2/DepositZapMetaBtcPolygon.json +197 -0
- package/lib/constants/abis/json/factory-v2/DepositZapMetaUsdPolygon.json +197 -0
- package/lib/constants/abis/json/factory-v2/MetaBTC.json +919 -0
- package/lib/constants/abis/json/factory-v2/MetaBTCBalances.json +932 -0
- package/lib/constants/abis/json/factory-v2/MetaBTCBalancesRen.json +932 -0
- package/lib/constants/abis/json/factory-v2/MetaBTCRen.json +919 -0
- package/lib/constants/abis/json/factory-v2/MetaUSD.json +919 -0
- package/lib/constants/abis/json/factory-v2/MetaUSDBalances.json +932 -0
- package/lib/constants/abis/json/factory-v2/Plain2Balances.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain2Basic.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain2ETH.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain2Optimized.json +844 -0
- package/lib/constants/abis/json/factory-v2/Plain3Balances.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain3Basic.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain3ETH.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain3Optimized.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain4Balances.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain4Basic.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain4ETH.json +845 -0
- package/lib/constants/abis/json/factory-v2/Plain4Optimized.json +845 -0
- package/lib/constants/abis/json/factory.json +1063 -0
- package/lib/constants/abis/json/registry_exchange.json +207 -84
- package/lib/constants/aliases.d.ts +4 -0
- package/lib/constants/aliases.js +4 -0
- package/lib/constants/coins-polygon.js +3 -2
- package/lib/curve.d.ts +5 -0
- package/lib/curve.js +62 -0
- package/lib/factory-crypto.d.ts +32 -0
- package/lib/factory-crypto.js +377 -0
- package/lib/factory.d.ts +32 -0
- package/lib/factory.js +607 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +28 -0
- package/lib/interfaces.d.ts +28 -1
- package/lib/pools.d.ts +5 -0
- package/lib/pools.js +359 -159
- package/lib/utils.d.ts +8 -1
- package/lib/utils.js +111 -8
- 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: '',
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -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
|
}>;
|