@curvefi/api 2.35.0 → 2.36.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 +31 -1
- package/lib/constants/coins/ethereum.js +1 -1
- package/lib/curve.d.ts +2 -1
- package/lib/curve.js +2 -1
- package/lib/factory/constants.js +1 -0
- package/lib/factory/deploy.d.ts +2 -2
- package/lib/factory/deploy.js +8 -2
- package/lib/index.d.ts +3 -2
- package/lib/index.js +1 -0
- package/lib/pools/utils.js +3 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -189,7 +189,7 @@ import curve from "@curvefi/api";
|
|
|
189
189
|
await curve.crvUSDFactory.fetchPools();
|
|
190
190
|
await curve.cryptoFactory.fetchPools();
|
|
191
191
|
|
|
192
|
-
curve.
|
|
192
|
+
curve.getMainPoolList();
|
|
193
193
|
// [
|
|
194
194
|
// 'compound', 'usdt', 'y', 'busd',
|
|
195
195
|
// 'susd', 'pax', 'ren', 'sbtc',
|
|
@@ -263,6 +263,36 @@ import curve from "@curvefi/api";
|
|
|
263
263
|
// 'factory-crypto-57', 'factory-crypto-58', 'factory-crypto-59',
|
|
264
264
|
// 'factory-crypto-60', 'factory-crypto-61', 'factory-crypto-62'
|
|
265
265
|
// ]
|
|
266
|
+
|
|
267
|
+
curve.getPoolList();
|
|
268
|
+
// [
|
|
269
|
+
// 'compound', 'usdt', 'y', 'busd',
|
|
270
|
+
// 'susd', 'pax', 'ren', 'sbtc',
|
|
271
|
+
// 'hbtc', '3pool', 'gusd', 'husd',
|
|
272
|
+
// 'usdk', 'usdn', 'musd', 'rsv',
|
|
273
|
+
// 'tbtc', 'dusd', 'pbtc', 'bbtc',
|
|
274
|
+
// 'obtc', 'seth', 'eurs', 'ust',
|
|
275
|
+
// 'aave', 'steth', 'saave', 'ankreth',
|
|
276
|
+
// 'usdp', 'ib', 'link', 'tusd',
|
|
277
|
+
// 'frax', 'lusd', 'busdv2', 'reth',
|
|
278
|
+
// 'alusd', 'mim', 'tricrypto2', 'eurt',
|
|
279
|
+
// 'eurtusd', 'eursusd', 'crveth', 'rai',
|
|
280
|
+
// 'cvxeth', 'xautusd', 'spelleth', 'teth',
|
|
281
|
+
// '2pool', '4pool', 'fraxusdc', 'euroc',
|
|
282
|
+
// 'frxeth', 'sbtc2', 'fraxusdp', 'wbeth',
|
|
283
|
+
// 'factory-v2-2', 'factory-v2-3', 'factory-v2-5', 'factory-v2-7',
|
|
284
|
+
// 'factory-v2-9', 'factory-v2-10', 'factory-v2-11', 'factory-v2-14',
|
|
285
|
+
// 'factory-v2-21', 'factory-v2-22', 'factory-v2-23', 'factory-v2-24',
|
|
286
|
+
// 'factory-v2-25', 'factory-v2-27', 'factory-v2-28', 'factory-v2-29',
|
|
287
|
+
// 'factory-v2-30', 'factory-v2-31', 'factory-v2-32', 'factory-v2-33',
|
|
288
|
+
// 'factory-v2-34', 'factory-v2-35', 'factory-v2-37', 'factory-v2-38',
|
|
289
|
+
// 'factory-v2-41', 'factory-v2-42', 'factory-v2-43', 'factory-v2-44',
|
|
290
|
+
// 'factory-v2-45', 'factory-v2-47', 'factory-v2-48', 'factory-v2-49',
|
|
291
|
+
// 'factory-v2-50', 'factory-v2-51', 'factory-v2-52', 'factory-v2-53',
|
|
292
|
+
// 'factory-v2-55', 'factory-v2-56', 'factory-v2-57', 'factory-v2-58',
|
|
293
|
+
// 'factory-v2-59', 'factory-v2-60', 'factory-v2-61', 'factory-v2-62',
|
|
294
|
+
// ... 493 more items
|
|
295
|
+
// ]
|
|
266
296
|
})()
|
|
267
297
|
````
|
|
268
298
|
|
|
@@ -2,7 +2,7 @@ import { lowerCaseValues } from "../utils.js";
|
|
|
2
2
|
export var COINS_ETHEREUM = lowerCaseValues({
|
|
3
3
|
crv: "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
4
4
|
// --- USD ---
|
|
5
|
-
'crvusd': "
|
|
5
|
+
'crvusd': "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E",
|
|
6
6
|
'3crv': "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
|
|
7
7
|
ycdai: "0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc",
|
|
8
8
|
ycusdc: "0x9777d7E2b60bB01759D0E2f8be2095df444cb07E",
|
package/lib/curve.d.ts
CHANGED
|
@@ -81,10 +81,11 @@ declare class Curve implements ICurve {
|
|
|
81
81
|
fetchNewCryptoFactoryPools: () => Promise<string[]>;
|
|
82
82
|
fetchRecentlyDeployedFactoryPool: (poolAddress: string) => Promise<string>;
|
|
83
83
|
fetchRecentlyDeployedCryptoFactoryPool: (poolAddress: string) => Promise<string>;
|
|
84
|
-
|
|
84
|
+
getMainPoolList: () => string[];
|
|
85
85
|
getFactoryPoolList: () => string[];
|
|
86
86
|
getCrvusdFactoryPoolList: () => string[];
|
|
87
87
|
getCryptoFactoryPoolList: () => string[];
|
|
88
|
+
getPoolList: () => string[];
|
|
88
89
|
setCustomFeeData(customFeeData: {
|
|
89
90
|
gasPrice?: number;
|
|
90
91
|
maxFeePerGas?: number;
|
package/lib/curve.js
CHANGED
|
@@ -479,10 +479,11 @@ var Curve = /** @class */ (function () {
|
|
|
479
479
|
}
|
|
480
480
|
});
|
|
481
481
|
}); };
|
|
482
|
-
this.
|
|
482
|
+
this.getMainPoolList = function () { return Object.keys(_this.constants.POOLS_DATA); };
|
|
483
483
|
this.getFactoryPoolList = function () { return Object.keys(_this.constants.FACTORY_POOLS_DATA); };
|
|
484
484
|
this.getCrvusdFactoryPoolList = function () { return Object.keys(_this.constants.CRVUSD_FACTORY_POOLS_DATA); };
|
|
485
485
|
this.getCryptoFactoryPoolList = function () { return Object.keys(_this.constants.CRYPTO_FACTORY_POOLS_DATA); };
|
|
486
|
+
this.getPoolList = function () { return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], _this.getMainPoolList(), true), _this.getFactoryPoolList(), true), _this.getCrvusdFactoryPoolList(), true), _this.getCryptoFactoryPoolList(), true); };
|
|
486
487
|
// @ts-ignore
|
|
487
488
|
this.provider = null;
|
|
488
489
|
// @ts-ignore
|
package/lib/factory/constants.js
CHANGED
|
@@ -52,6 +52,7 @@ export var implementationABIDictEthereum = lowerCaseKeys({
|
|
|
52
52
|
"0x4A4d7868390EF5CaC51cDA262888f34bD3025C3F": Plain2OptimizedABI,
|
|
53
53
|
"0xc629a01eC23AB04E1050500A3717A2a5c0701497": Plain2BasicABI,
|
|
54
54
|
"0x94b4DFd9Ba5865Cc931195c99A2db42F3fc5d45B": Plain2ETHABI,
|
|
55
|
+
"0x847ee1227A9900B73aEeb3a47fAc92c52FD54ed9": Plain2ETHABI,
|
|
55
56
|
"0x67fe41A94e779CcFa22cff02cc2957DC9C0e4286": Plain2BasicABI,
|
|
56
57
|
"0x9B52F13DF69D79Ec5aAB6D1aCe3157d29B409cC3": Plain3BasicABI,
|
|
57
58
|
"0x50b085f2e5958C4A87baf93A8AB79F6bec068494": Plain3BalancesABI,
|
package/lib/factory/deploy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
|
-
export declare const deployStablePlainPoolEstimateGas: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<number>;
|
|
3
|
-
export declare const deployStablePlainPool: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransactionResponse>;
|
|
2
|
+
export declare const deployStablePlainPoolEstimateGas: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<number>;
|
|
3
|
+
export declare const deployStablePlainPool: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<ethers.ContractTransactionResponse>;
|
|
4
4
|
export declare const getDeployedStablePlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
5
5
|
export declare const deployStableMetaPoolEstimateGas: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, implementationIdx: 0 | 1) => Promise<number>;
|
|
6
6
|
export declare const deployStableMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, implementationIdx: 0 | 1) => Promise<ethers.ContractTransactionResponse>;
|
package/lib/factory/deploy.js
CHANGED
|
@@ -68,8 +68,14 @@ assetType, implementationIdx, estimateGas) { return __awaiter(void 0, void 0, vo
|
|
|
68
68
|
throw Error("fee must be <= 1%. Passed fee = ".concat(fee));
|
|
69
69
|
if (![0, 1, 2, 3].includes(assetType))
|
|
70
70
|
throw Error("Invalid assetType. Must be one of: 0 = USD, 1 = ETH, 2 = BTC, 3 = Other");
|
|
71
|
-
if (
|
|
72
|
-
|
|
71
|
+
if (curve.chainId !== 1 || coins.length > 2) {
|
|
72
|
+
if (![0, 1, 2, 3].includes(implementationIdx))
|
|
73
|
+
throw Error("Invalid implementationIdx. Must be one 0, 1, 2 or 3");
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
if (![0, 1, 2, 3, 4, 5].includes(implementationIdx))
|
|
77
|
+
throw Error("Invalid implementationIdx. Must be one 0, 1, 2, 3, 4 or 5");
|
|
78
|
+
}
|
|
73
79
|
_A = parseUnits(A, 0);
|
|
74
80
|
_fee = parseUnits(fee, 8);
|
|
75
81
|
_coins = coins.concat(Array(4 - coins.length).fill(curve.constants.ZERO_ADDRESS));
|
package/lib/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare const curve: {
|
|
|
25
25
|
signerAddress: string;
|
|
26
26
|
setCustomFeeData: typeof setCustomFeeData;
|
|
27
27
|
getPoolList: () => string[];
|
|
28
|
+
getMainPoolList: () => string[];
|
|
28
29
|
getUserPoolListByLiquidity: (address?: string) => Promise<string[]>;
|
|
29
30
|
getUserPoolListByClaimable: (address?: string) => Promise<string[]>;
|
|
30
31
|
getUserPoolList: (address?: string, useApi?: boolean) => Promise<string[]>;
|
|
@@ -57,7 +58,7 @@ declare const curve: {
|
|
|
57
58
|
fetchPools: (useApi?: boolean) => Promise<void>;
|
|
58
59
|
fetchNewPools: () => Promise<string[]>;
|
|
59
60
|
getPoolList: () => string[];
|
|
60
|
-
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransactionResponse>;
|
|
61
|
+
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<ethers.ContractTransactionResponse>;
|
|
61
62
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<ethers.ContractTransactionResponse>;
|
|
62
63
|
deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
|
|
63
64
|
getDeployedPlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
@@ -65,7 +66,7 @@ declare const curve: {
|
|
|
65
66
|
getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
66
67
|
fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
|
|
67
68
|
estimateGas: {
|
|
68
|
-
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<number>;
|
|
69
|
+
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<number>;
|
|
69
70
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<number>;
|
|
70
71
|
deployGauge: (poolAddress: string) => Promise<number>;
|
|
71
72
|
};
|
package/lib/index.js
CHANGED
|
@@ -67,6 +67,7 @@ var curve = {
|
|
|
67
67
|
signerAddress: '',
|
|
68
68
|
setCustomFeeData: setCustomFeeData,
|
|
69
69
|
getPoolList: _curve.getPoolList,
|
|
70
|
+
getMainPoolList: _curve.getMainPoolList,
|
|
70
71
|
getUserPoolListByLiquidity: getUserPoolListByLiquidity,
|
|
71
72
|
getUserPoolListByClaimable: getUserPoolListByClaimable,
|
|
72
73
|
getUserPoolList: getUserPoolList,
|
package/lib/pools/utils.js
CHANGED
|
@@ -45,15 +45,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
-
if (ar || !(i in from)) {
|
|
51
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
-
ar[i] = from[i];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
-
};
|
|
57
48
|
import { getPool } from "./poolConstructor.js";
|
|
58
49
|
import { curve } from "../curve.js";
|
|
59
50
|
import { _getRewardsFromApi, _getUsdRate, _setContracts, toBN } from "../utils.js";
|
|
@@ -109,7 +100,7 @@ export var getUserPoolListByLiquidity = function (address) {
|
|
|
109
100
|
return __generator(this, function (_a) {
|
|
110
101
|
switch (_a.label) {
|
|
111
102
|
case 0:
|
|
112
|
-
pools =
|
|
103
|
+
pools = curve.getPoolList();
|
|
113
104
|
return [4 /*yield*/, _getUserLpBalances(pools, address, false)];
|
|
114
105
|
case 1:
|
|
115
106
|
_lpBalances = _a.sent();
|
|
@@ -405,7 +396,7 @@ export var getUserPoolListByClaimable = function (address) {
|
|
|
405
396
|
return __generator(this, function (_a) {
|
|
406
397
|
switch (_a.label) {
|
|
407
398
|
case 0:
|
|
408
|
-
pools =
|
|
399
|
+
pools = curve.getPoolList();
|
|
409
400
|
return [4 /*yield*/, _getUserClaimable(pools, address, false)];
|
|
410
401
|
case 1:
|
|
411
402
|
_claimable = _a.sent();
|
|
@@ -464,7 +455,7 @@ export var getUserPoolList = function (address, useApi) {
|
|
|
464
455
|
return __generator(this, function (_b) {
|
|
465
456
|
switch (_b.label) {
|
|
466
457
|
case 0:
|
|
467
|
-
pools =
|
|
458
|
+
pools = curve.getPoolList();
|
|
468
459
|
return [4 /*yield*/, Promise.all([
|
|
469
460
|
_getUserLpBalances(pools, address, false),
|
|
470
461
|
useApi ? _getUserClaimableUseApi(pools, address, false) : _getUserClaimable(pools, address, false),
|