@curvefi/api 2.52.0 → 2.52.1
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 +1 -0
- package/lib/curve.js +17 -0
- package/lib/factory/deploy.js +0 -2
- package/lib/factory/factory.js +6 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
package/lib/curve.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ declare class Curve implements ICurve {
|
|
|
90
90
|
fetchNewCryptoFactoryPools: () => Promise<string[]>;
|
|
91
91
|
fetchNewTricryptoFactoryPools: () => Promise<string[]>;
|
|
92
92
|
fetchRecentlyDeployedFactoryPool: (poolAddress: string) => Promise<string>;
|
|
93
|
+
fetchRecentlyDeployedStableNgFactoryPool: (poolAddress: string) => Promise<string>;
|
|
93
94
|
fetchRecentlyDeployedCryptoFactoryPool: (poolAddress: string) => Promise<string>;
|
|
94
95
|
fetchRecentlyDeployedTricryptoFactoryPool: (poolAddress: string) => Promise<string>;
|
|
95
96
|
getMainPoolList: () => string[];
|
package/lib/curve.js
CHANGED
|
@@ -702,6 +702,23 @@ var Curve = /** @class */ (function () {
|
|
|
702
702
|
}
|
|
703
703
|
});
|
|
704
704
|
}); };
|
|
705
|
+
this.fetchRecentlyDeployedStableNgFactoryPool = function (poolAddress) { return __awaiter(_this, void 0, void 0, function () {
|
|
706
|
+
var poolData, _a;
|
|
707
|
+
return __generator(this, function (_b) {
|
|
708
|
+
switch (_b.label) {
|
|
709
|
+
case 0:
|
|
710
|
+
if (this.chainId === 1313161554)
|
|
711
|
+
return [2 /*return*/, ''];
|
|
712
|
+
_a = lowerCasePoolDataAddresses;
|
|
713
|
+
return [4 /*yield*/, getFactoryPoolData.call(this, 0, poolAddress, this.constants.ALIASES.stable_ng_factory)];
|
|
714
|
+
case 1:
|
|
715
|
+
poolData = _a.apply(void 0, [_b.sent()]);
|
|
716
|
+
this.constants.STABLE_NG_FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.STABLE_NG_FACTORY_POOLS_DATA), poolData);
|
|
717
|
+
this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
|
|
718
|
+
return [2 /*return*/, Object.keys(poolData)[0]]; // id
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
}); };
|
|
705
722
|
this.fetchRecentlyDeployedCryptoFactoryPool = function (poolAddress) { return __awaiter(_this, void 0, void 0, function () {
|
|
706
723
|
var poolData, _a;
|
|
707
724
|
return __generator(this, function (_b) {
|
package/lib/factory/deploy.js
CHANGED
|
@@ -174,8 +174,6 @@ oracleAddresses, methodNames, estimateGas) {
|
|
|
174
174
|
throw Error("Invalid number of coins. Must be more than 1");
|
|
175
175
|
if (coins.length > 9)
|
|
176
176
|
throw Error("Invalid number of coins. Must be less than 9");
|
|
177
|
-
if (BN(fee).lt(0.04))
|
|
178
|
-
throw Error("fee must be >= 0.04%. Passed fee = ".concat(fee));
|
|
179
177
|
if (BN(fee).gt(1))
|
|
180
178
|
throw Error("fee must be <= 1%. Passed fee = ".concat(fee));
|
|
181
179
|
if (oracleAddresses.length === 0) {
|
package/lib/factory/factory.js
CHANGED
|
@@ -106,13 +106,14 @@ export function getBasePoolIds(factoryAddress, rawSwapAddresses, tmpPools) {
|
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
function getRecentlyCreatedPoolId(swapAddress) {
|
|
109
|
+
function getRecentlyCreatedPoolId(swapAddress, factoryAddress) {
|
|
110
110
|
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
-
var factoryContract, poolCount, _a, _b, _c, i, address;
|
|
111
|
+
var factoryContract, prefix, poolCount, _a, _b, _c, i, address;
|
|
112
112
|
return __generator(this, function (_e) {
|
|
113
113
|
switch (_e.label) {
|
|
114
114
|
case 0:
|
|
115
|
-
factoryContract = this.contracts[
|
|
115
|
+
factoryContract = this.contracts[factoryAddress].contract;
|
|
116
|
+
prefix = factoryAddress === this.constants.ALIASES.factory ? 'factory-v2' : 'factory-stable-ng';
|
|
116
117
|
_a = Number;
|
|
117
118
|
_c = (_b = curve).formatUnits;
|
|
118
119
|
return [4 /*yield*/, factoryContract.pool_count(this.constantOptions)];
|
|
@@ -126,7 +127,7 @@ function getRecentlyCreatedPoolId(swapAddress) {
|
|
|
126
127
|
case 3:
|
|
127
128
|
address = _e.sent();
|
|
128
129
|
if (address.toLowerCase() === swapAddress.toLowerCase())
|
|
129
|
-
return [2 /*return*/, "
|
|
130
|
+
return [2 /*return*/, "".concat(prefix, "-").concat(poolCount - i)];
|
|
130
131
|
_e.label = 4;
|
|
131
132
|
case 4:
|
|
132
133
|
i++;
|
|
@@ -335,7 +336,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
|
|
|
335
336
|
switch (_f.label) {
|
|
336
337
|
case 0:
|
|
337
338
|
if (!swapAddress) return [3 /*break*/, 2];
|
|
338
|
-
return [4 /*yield*/, getRecentlyCreatedPoolId.call(this, swapAddress)];
|
|
339
|
+
return [4 /*yield*/, getRecentlyCreatedPoolId.call(this, swapAddress, factoryAddress)];
|
|
339
340
|
case 1:
|
|
340
341
|
_b = [[_f.sent()], [swapAddress.toLowerCase()]];
|
|
341
342
|
return [3 /*break*/, 4];
|
package/lib/index.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ declare const curve: {
|
|
|
101
101
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, offpegFeeMultiplier: string | number, emaTime: number, implementationIdx: 0, assetType: 0 | 1 | 2 | 3, methodName: string, oracleAddress: string) => Promise<ethers.ContractTransactionResponse>;
|
|
102
102
|
getDeployedPlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
103
103
|
getDeployedMetaPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
104
|
+
fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
|
|
104
105
|
estimateGas: {
|
|
105
106
|
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, offpegFeeMultiplier: string | number, assetTypes: (0 | 1 | 2 | 3)[], implementationIdx: 0, emaTime: number, oracleAddresses: string[], methodNames: string[]) => Promise<number>;
|
|
106
107
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, offpegFeeMultiplier: string | number, assetType: 0 | 1 | 2 | 3, emaTime: number, implementationIdx: 0, methodName: string, oracleAddress: string) => Promise<number>;
|
package/lib/index.js
CHANGED
|
@@ -141,6 +141,7 @@ var curve = {
|
|
|
141
141
|
deployMetaPool: deployStableNgMetaPool,
|
|
142
142
|
getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress,
|
|
143
143
|
getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress,
|
|
144
|
+
fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedStableNgFactoryPool,
|
|
144
145
|
estimateGas: {
|
|
145
146
|
deployPlainPool: deployStableNgPlainPoolEstimateGas,
|
|
146
147
|
deployMetaPool: deployStableNgMetaPoolEstimateGas,
|