@curvefi/api 2.29.0 → 2.30.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 +30 -10
- package/lib/curve.d.ts +10 -4
- package/lib/curve.js +153 -115
- package/lib/factory/constants.js +4 -0
- package/lib/factory/deploy.js +1 -1
- package/lib/factory/factory-api.js +2 -0
- package/lib/factory/factory-crypto.d.ts +1 -1
- package/lib/factory/factory-crypto.js +77 -175
- package/lib/factory/factory.d.ts +1 -1
- package/lib/factory/factory.js +98 -210
- package/lib/index.d.ts +8 -10
- package/lib/index.js +9 -53
- package/lib/interfaces.d.ts +1 -0
- package/lib/pools/utils.d.ts +0 -3
- package/lib/pools/utils.js +4 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@ import curve from "@curvefi/api";
|
|
|
23
23
|
await curve.init('Web3', { externalProvider: <WEB3_PROVIDER> }, { chainId: 1 });
|
|
24
24
|
|
|
25
25
|
// Fetch factory pools
|
|
26
|
-
await curve.
|
|
27
|
-
await curve.
|
|
26
|
+
await curve.factory.fetchPools();
|
|
27
|
+
await curve.cryptoFactory.fetchPools();
|
|
28
28
|
})()
|
|
29
29
|
```
|
|
30
30
|
**Note 1.** ```chainId``` parameter is optional, but you must specify it in the case you use Metamask on localhost network, because Metamask has that [bug](https://hardhat.org/metamask-issue.html)
|
|
@@ -184,8 +184,8 @@ import curve from "@curvefi/api";
|
|
|
184
184
|
|
|
185
185
|
(async () => {
|
|
186
186
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
187
|
-
await curve.
|
|
188
|
-
await curve.
|
|
187
|
+
await curve.factory.fetchPools();
|
|
188
|
+
await curve.cryptoFactory.fetchPools();
|
|
189
189
|
|
|
190
190
|
curve.getPoolList();
|
|
191
191
|
// [
|
|
@@ -204,7 +204,7 @@ import curve from "@curvefi/api";
|
|
|
204
204
|
// '2pool', '4pool'
|
|
205
205
|
// ]
|
|
206
206
|
|
|
207
|
-
curve.
|
|
207
|
+
curve.factory.getPoolList();
|
|
208
208
|
// [
|
|
209
209
|
// 'factory-v2-0', 'factory-v2-2', 'factory-v2-3', 'factory-v2-4',
|
|
210
210
|
// 'factory-v2-5', 'factory-v2-6', 'factory-v2-7', 'factory-v2-8',
|
|
@@ -234,7 +234,7 @@ import curve from "@curvefi/api";
|
|
|
234
234
|
// ... 27 more items
|
|
235
235
|
// ]
|
|
236
236
|
|
|
237
|
-
curve.
|
|
237
|
+
curve.cryptoFactory.getPoolList();
|
|
238
238
|
// [
|
|
239
239
|
// 'factory-crypto-0', 'factory-crypto-1', 'factory-crypto-2',
|
|
240
240
|
// 'factory-crypto-3', 'factory-crypto-4', 'factory-crypto-5',
|
|
@@ -267,8 +267,8 @@ import curve from "@curvefi/api";
|
|
|
267
267
|
|
|
268
268
|
(async () => {
|
|
269
269
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
270
|
-
await curve.
|
|
271
|
-
await curve.
|
|
270
|
+
await curve.factory.fetchPools();
|
|
271
|
+
await curve.cryptoFactory.fetchPools();
|
|
272
272
|
|
|
273
273
|
const pool = curve.getPool('factory-v2-11');
|
|
274
274
|
|
|
@@ -970,8 +970,8 @@ import curve from "@curvefi/api";
|
|
|
970
970
|
|
|
971
971
|
(async () => {
|
|
972
972
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
973
|
-
await curve.
|
|
974
|
-
await curve.
|
|
973
|
+
await curve.factory.fetchPools();
|
|
974
|
+
await curve.cryptoFactory.fetchPools();
|
|
975
975
|
|
|
976
976
|
await curve.getBalances(['DAI', 'CRV']);
|
|
977
977
|
// [ '9900.0', '100049.744832225238317557' ]
|
|
@@ -1283,6 +1283,26 @@ import curve from "@curvefi/api";
|
|
|
1283
1283
|
|
|
1284
1284
|
## Factory
|
|
1285
1285
|
|
|
1286
|
+
### Fetch new pools from blockchain
|
|
1287
|
+
|
|
1288
|
+
```ts
|
|
1289
|
+
import curve from "@curvefi/api";
|
|
1290
|
+
|
|
1291
|
+
(async () => {
|
|
1292
|
+
await curve.init('JsonRpc', {}, { gasPrice: 0 });
|
|
1293
|
+
|
|
1294
|
+
// Fetch pools from api (if false arg is not passed)
|
|
1295
|
+
await curve.factory.fetchPools();
|
|
1296
|
+
await curve.cryptoFactory.fetchPools();
|
|
1297
|
+
|
|
1298
|
+
// Fetch very new pools (that haven't been added to api yet) from blockchain
|
|
1299
|
+
await curve.factory.fetchNewPools();
|
|
1300
|
+
// [ 'factory-v2-285' ]
|
|
1301
|
+
await curve.cryptoFactory.fetchNewPools();
|
|
1302
|
+
// [ 'factory-crypto-232' ]
|
|
1303
|
+
})()
|
|
1304
|
+
```
|
|
1305
|
+
|
|
1286
1306
|
### Deploy stable plain pool
|
|
1287
1307
|
|
|
1288
1308
|
```ts
|
package/lib/curve.d.ts
CHANGED
|
@@ -71,10 +71,16 @@ declare class Curve implements ICurve {
|
|
|
71
71
|
}): Promise<void>;
|
|
72
72
|
setContract(address: string, abi: any): void;
|
|
73
73
|
_filterHiddenPools(pools: IDict<IPoolData>): Promise<IDict<IPoolData>>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
_updateDecimalsAndGauges(pools: IDict<IPoolData>): void;
|
|
75
|
+
fetchFactoryPools: (useApi?: boolean) => Promise<void>;
|
|
76
|
+
fetchCryptoFactoryPools: (useApi?: boolean) => Promise<void>;
|
|
77
|
+
fetchNewFactoryPools: () => Promise<string[]>;
|
|
78
|
+
fetchNewCryptoFactoryPools: () => Promise<string[]>;
|
|
79
|
+
fetchRecentlyDeployedFactoryPool: (poolAddress: string) => Promise<string>;
|
|
80
|
+
fetchRecentlyDeployedCryptoFactoryPool: (poolAddress: string) => Promise<string>;
|
|
81
|
+
getPoolList: () => string[];
|
|
82
|
+
getFactoryPoolList: () => string[];
|
|
83
|
+
getCryptoFactoryPoolList: () => string[];
|
|
78
84
|
setCustomFeeData(customFeeData: {
|
|
79
85
|
gasPrice?: number;
|
|
80
86
|
maxFeePerGas?: number;
|
package/lib/curve.js
CHANGED
|
@@ -299,6 +299,156 @@ exports.NETWORK_CONSTANTS = {
|
|
|
299
299
|
};
|
|
300
300
|
var Curve = /** @class */ (function () {
|
|
301
301
|
function Curve() {
|
|
302
|
+
var _this = this;
|
|
303
|
+
this.fetchFactoryPools = function (useApi) {
|
|
304
|
+
if (useApi === void 0) { useApi = true; }
|
|
305
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
306
|
+
var _a, _b, _c, _d, _e;
|
|
307
|
+
return __generator(this, function (_f) {
|
|
308
|
+
switch (_f.label) {
|
|
309
|
+
case 0:
|
|
310
|
+
if (this.chainId === 1313161554)
|
|
311
|
+
return [2 /*return*/];
|
|
312
|
+
if (!useApi) return [3 /*break*/, 2];
|
|
313
|
+
_a = this.constants;
|
|
314
|
+
_b = utils_1.lowerCasePoolDataAddresses;
|
|
315
|
+
return [4 /*yield*/, factory_api_1.getFactoryPoolsDataFromApi.call(this, false)];
|
|
316
|
+
case 1:
|
|
317
|
+
_a.FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
|
|
318
|
+
return [3 /*break*/, 4];
|
|
319
|
+
case 2:
|
|
320
|
+
_c = this.constants;
|
|
321
|
+
_d = utils_1.lowerCasePoolDataAddresses;
|
|
322
|
+
return [4 /*yield*/, factory_1.getFactoryPoolData.call(this)];
|
|
323
|
+
case 3:
|
|
324
|
+
_c.FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
|
|
325
|
+
_f.label = 4;
|
|
326
|
+
case 4:
|
|
327
|
+
_e = this.constants;
|
|
328
|
+
return [4 /*yield*/, this._filterHiddenPools(this.constants.FACTORY_POOLS_DATA)];
|
|
329
|
+
case 5:
|
|
330
|
+
_e.FACTORY_POOLS_DATA = _f.sent();
|
|
331
|
+
this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
|
|
332
|
+
return [4 /*yield*/, _killGauges(this.constants.FACTORY_POOLS_DATA)];
|
|
333
|
+
case 6:
|
|
334
|
+
_f.sent();
|
|
335
|
+
return [2 /*return*/];
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
this.fetchCryptoFactoryPools = function (useApi) {
|
|
341
|
+
if (useApi === void 0) { useApi = true; }
|
|
342
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
343
|
+
var _a, _b, _c, _d, _e;
|
|
344
|
+
return __generator(this, function (_f) {
|
|
345
|
+
switch (_f.label) {
|
|
346
|
+
case 0:
|
|
347
|
+
if (![1, 137, 250].includes(this.chainId))
|
|
348
|
+
return [2 /*return*/];
|
|
349
|
+
if (!useApi) return [3 /*break*/, 2];
|
|
350
|
+
_a = this.constants;
|
|
351
|
+
_b = utils_1.lowerCasePoolDataAddresses;
|
|
352
|
+
return [4 /*yield*/, factory_api_1.getFactoryPoolsDataFromApi.call(this, true)];
|
|
353
|
+
case 1:
|
|
354
|
+
_a.CRYPTO_FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
|
|
355
|
+
return [3 /*break*/, 4];
|
|
356
|
+
case 2:
|
|
357
|
+
_c = this.constants;
|
|
358
|
+
_d = utils_1.lowerCasePoolDataAddresses;
|
|
359
|
+
return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this)];
|
|
360
|
+
case 3:
|
|
361
|
+
_c.CRYPTO_FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
|
|
362
|
+
_f.label = 4;
|
|
363
|
+
case 4:
|
|
364
|
+
_e = this.constants;
|
|
365
|
+
return [4 /*yield*/, this._filterHiddenPools(this.constants.CRYPTO_FACTORY_POOLS_DATA)];
|
|
366
|
+
case 5:
|
|
367
|
+
_e.CRYPTO_FACTORY_POOLS_DATA = _f.sent();
|
|
368
|
+
this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
369
|
+
return [4 /*yield*/, _killGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA)];
|
|
370
|
+
case 6:
|
|
371
|
+
_f.sent();
|
|
372
|
+
return [2 /*return*/];
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
this.fetchNewFactoryPools = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
378
|
+
var currentPoolIds, lastPoolIdx, poolData, _a;
|
|
379
|
+
return __generator(this, function (_b) {
|
|
380
|
+
switch (_b.label) {
|
|
381
|
+
case 0:
|
|
382
|
+
if (this.chainId === 1313161554)
|
|
383
|
+
return [2 /*return*/, []];
|
|
384
|
+
currentPoolIds = Object.keys(this.constants.FACTORY_POOLS_DATA);
|
|
385
|
+
lastPoolIdx = Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
386
|
+
_a = utils_1.lowerCasePoolDataAddresses;
|
|
387
|
+
return [4 /*yield*/, factory_1.getFactoryPoolData.call(this, lastPoolIdx + 1)];
|
|
388
|
+
case 1:
|
|
389
|
+
poolData = _a.apply(void 0, [_b.sent()]);
|
|
390
|
+
this.constants.FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
|
|
391
|
+
this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
|
|
392
|
+
return [2 /*return*/, Object.keys(poolData)];
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}); };
|
|
396
|
+
this.fetchNewCryptoFactoryPools = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
397
|
+
var currentPoolIds, lastPoolIdx, poolData, _a;
|
|
398
|
+
return __generator(this, function (_b) {
|
|
399
|
+
switch (_b.label) {
|
|
400
|
+
case 0:
|
|
401
|
+
if (![1, 137, 250].includes(this.chainId))
|
|
402
|
+
return [2 /*return*/, []];
|
|
403
|
+
currentPoolIds = Object.keys(this.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
404
|
+
lastPoolIdx = Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
405
|
+
_a = utils_1.lowerCasePoolDataAddresses;
|
|
406
|
+
return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this, lastPoolIdx + 1)];
|
|
407
|
+
case 1:
|
|
408
|
+
poolData = _a.apply(void 0, [_b.sent()]);
|
|
409
|
+
this.constants.CRYPTO_FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.CRYPTO_FACTORY_POOLS_DATA), poolData);
|
|
410
|
+
this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
411
|
+
return [2 /*return*/, Object.keys(poolData)];
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
}); };
|
|
415
|
+
this.fetchRecentlyDeployedFactoryPool = function (poolAddress) { return __awaiter(_this, void 0, void 0, function () {
|
|
416
|
+
var poolData, _a;
|
|
417
|
+
return __generator(this, function (_b) {
|
|
418
|
+
switch (_b.label) {
|
|
419
|
+
case 0:
|
|
420
|
+
if (this.chainId === 1313161554)
|
|
421
|
+
return [2 /*return*/, ''];
|
|
422
|
+
_a = utils_1.lowerCasePoolDataAddresses;
|
|
423
|
+
return [4 /*yield*/, factory_1.getFactoryPoolData.call(this, 0, poolAddress)];
|
|
424
|
+
case 1:
|
|
425
|
+
poolData = _a.apply(void 0, [_b.sent()]);
|
|
426
|
+
this.constants.FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
|
|
427
|
+
this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
|
|
428
|
+
return [2 /*return*/, Object.keys(poolData)[0]]; // id
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}); };
|
|
432
|
+
this.fetchRecentlyDeployedCryptoFactoryPool = function (poolAddress) { return __awaiter(_this, void 0, void 0, function () {
|
|
433
|
+
var poolData, _a;
|
|
434
|
+
return __generator(this, function (_b) {
|
|
435
|
+
switch (_b.label) {
|
|
436
|
+
case 0:
|
|
437
|
+
if (![1, 137, 250].includes(this.chainId))
|
|
438
|
+
return [2 /*return*/, ''];
|
|
439
|
+
_a = utils_1.lowerCasePoolDataAddresses;
|
|
440
|
+
return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this, 0, poolAddress)];
|
|
441
|
+
case 1:
|
|
442
|
+
poolData = _a.apply(void 0, [_b.sent()]);
|
|
443
|
+
this.constants.CRYPTO_FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.CRYPTO_FACTORY_POOLS_DATA), poolData);
|
|
444
|
+
this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
445
|
+
return [2 /*return*/, Object.keys(poolData)[0]]; // id
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
}); };
|
|
449
|
+
this.getPoolList = function () { return Object.keys(_this.constants.POOLS_DATA); };
|
|
450
|
+
this.getFactoryPoolList = function () { return Object.keys(_this.constants.FACTORY_POOLS_DATA); };
|
|
451
|
+
this.getCryptoFactoryPoolList = function () { return Object.keys(_this.constants.CRYPTO_FACTORY_POOLS_DATA); };
|
|
302
452
|
// @ts-ignore
|
|
303
453
|
this.provider = null;
|
|
304
454
|
// @ts-ignore
|
|
@@ -543,121 +693,9 @@ var Curve = /** @class */ (function () {
|
|
|
543
693
|
});
|
|
544
694
|
});
|
|
545
695
|
};
|
|
546
|
-
Curve.prototype.
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
var _a, _b, _c, _d, _e;
|
|
550
|
-
return __generator(this, function (_f) {
|
|
551
|
-
switch (_f.label) {
|
|
552
|
-
case 0:
|
|
553
|
-
if (this.chainId === 1313161554)
|
|
554
|
-
return [2 /*return*/];
|
|
555
|
-
if (!useApi) return [3 /*break*/, 2];
|
|
556
|
-
_a = this.constants;
|
|
557
|
-
_b = utils_1.lowerCasePoolDataAddresses;
|
|
558
|
-
return [4 /*yield*/, factory_api_1.getFactoryPoolsDataFromApi.call(this, false)];
|
|
559
|
-
case 1:
|
|
560
|
-
_a.FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
|
|
561
|
-
return [3 /*break*/, 4];
|
|
562
|
-
case 2:
|
|
563
|
-
_c = this.constants;
|
|
564
|
-
_d = utils_1.lowerCasePoolDataAddresses;
|
|
565
|
-
return [4 /*yield*/, factory_1.getFactoryPoolData.call(this)];
|
|
566
|
-
case 3:
|
|
567
|
-
_c.FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
|
|
568
|
-
_f.label = 4;
|
|
569
|
-
case 4:
|
|
570
|
-
_e = this.constants;
|
|
571
|
-
return [4 /*yield*/, this._filterHiddenPools(this.constants.FACTORY_POOLS_DATA)];
|
|
572
|
-
case 5:
|
|
573
|
-
_e.FACTORY_POOLS_DATA = _f.sent();
|
|
574
|
-
this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.FACTORY_POOLS_DATA));
|
|
575
|
-
this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.FACTORY_POOLS_DATA), true);
|
|
576
|
-
return [4 /*yield*/, _killGauges(this.constants.FACTORY_POOLS_DATA)];
|
|
577
|
-
case 6:
|
|
578
|
-
_f.sent();
|
|
579
|
-
return [2 /*return*/];
|
|
580
|
-
}
|
|
581
|
-
});
|
|
582
|
-
});
|
|
583
|
-
};
|
|
584
|
-
Curve.prototype.fetchCryptoFactoryPools = function (useApi) {
|
|
585
|
-
if (useApi === void 0) { useApi = true; }
|
|
586
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
587
|
-
var _a, _b, _c, _d, _e;
|
|
588
|
-
return __generator(this, function (_f) {
|
|
589
|
-
switch (_f.label) {
|
|
590
|
-
case 0:
|
|
591
|
-
if (![1, 137, 250].includes(this.chainId))
|
|
592
|
-
return [2 /*return*/];
|
|
593
|
-
if (!useApi) return [3 /*break*/, 2];
|
|
594
|
-
_a = this.constants;
|
|
595
|
-
_b = utils_1.lowerCasePoolDataAddresses;
|
|
596
|
-
return [4 /*yield*/, factory_api_1.getFactoryPoolsDataFromApi.call(this, true)];
|
|
597
|
-
case 1:
|
|
598
|
-
_a.CRYPTO_FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
|
|
599
|
-
return [3 /*break*/, 4];
|
|
600
|
-
case 2:
|
|
601
|
-
_c = this.constants;
|
|
602
|
-
_d = utils_1.lowerCasePoolDataAddresses;
|
|
603
|
-
return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this)];
|
|
604
|
-
case 3:
|
|
605
|
-
_c.CRYPTO_FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
|
|
606
|
-
_f.label = 4;
|
|
607
|
-
case 4:
|
|
608
|
-
_e = this.constants;
|
|
609
|
-
return [4 /*yield*/, this._filterHiddenPools(this.constants.CRYPTO_FACTORY_POOLS_DATA)];
|
|
610
|
-
case 5:
|
|
611
|
-
_e.CRYPTO_FACTORY_POOLS_DATA = _f.sent();
|
|
612
|
-
this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.CRYPTO_FACTORY_POOLS_DATA));
|
|
613
|
-
this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.CRYPTO_FACTORY_POOLS_DATA), true);
|
|
614
|
-
return [4 /*yield*/, _killGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA)];
|
|
615
|
-
case 6:
|
|
616
|
-
_f.sent();
|
|
617
|
-
return [2 /*return*/];
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
});
|
|
621
|
-
};
|
|
622
|
-
Curve.prototype.fetchRecentlyDeployedFactoryPool = function (poolAddress) {
|
|
623
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
624
|
-
var poolData, _a;
|
|
625
|
-
return __generator(this, function (_b) {
|
|
626
|
-
switch (_b.label) {
|
|
627
|
-
case 0:
|
|
628
|
-
if (this.chainId === 1313161554)
|
|
629
|
-
return [2 /*return*/, ''];
|
|
630
|
-
_a = utils_1.lowerCasePoolDataAddresses;
|
|
631
|
-
return [4 /*yield*/, factory_1.getFactoryPoolData.call(this, poolAddress)];
|
|
632
|
-
case 1:
|
|
633
|
-
poolData = _a.apply(void 0, [_b.sent()]);
|
|
634
|
-
this.constants.FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
|
|
635
|
-
this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.FACTORY_POOLS_DATA));
|
|
636
|
-
this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.FACTORY_POOLS_DATA), true);
|
|
637
|
-
return [2 /*return*/, Object.keys(poolData)[0]]; // id
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
});
|
|
641
|
-
};
|
|
642
|
-
Curve.prototype.fetchRecentlyDeployedCryptoFactoryPool = function (poolAddress) {
|
|
643
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
644
|
-
var poolData, _a;
|
|
645
|
-
return __generator(this, function (_b) {
|
|
646
|
-
switch (_b.label) {
|
|
647
|
-
case 0:
|
|
648
|
-
if (![1, 137, 250].includes(this.chainId))
|
|
649
|
-
return [2 /*return*/, ''];
|
|
650
|
-
_a = utils_1.lowerCasePoolDataAddresses;
|
|
651
|
-
return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this, poolAddress)];
|
|
652
|
-
case 1:
|
|
653
|
-
poolData = _a.apply(void 0, [_b.sent()]);
|
|
654
|
-
this.constants.CRYPTO_FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.CRYPTO_FACTORY_POOLS_DATA), poolData);
|
|
655
|
-
this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.CRYPTO_FACTORY_POOLS_DATA));
|
|
656
|
-
this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.CRYPTO_FACTORY_POOLS_DATA), true);
|
|
657
|
-
return [2 /*return*/, Object.keys(poolData)[0]]; // id
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
|
-
});
|
|
696
|
+
Curve.prototype._updateDecimalsAndGauges = function (pools) {
|
|
697
|
+
this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(pools));
|
|
698
|
+
this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(pools), true);
|
|
661
699
|
};
|
|
662
700
|
Curve.prototype.setCustomFeeData = function (customFeeData) {
|
|
663
701
|
this.feeData = __assign(__assign({}, this.feeData), customFeeData);
|
package/lib/factory/constants.js
CHANGED
|
@@ -284,6 +284,10 @@ exports.basePoolIdZapDictEthereum = {
|
|
|
284
284
|
address: "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase(),
|
|
285
285
|
ABI: meta_zap_json_1.default,
|
|
286
286
|
},
|
|
287
|
+
fraxusdp: {
|
|
288
|
+
address: "0x63B709d2118Ba0389ee75A131d1F9a473e06afbD".toLowerCase(),
|
|
289
|
+
ABI: meta_zap_json_1.default,
|
|
290
|
+
},
|
|
287
291
|
sbtc: {
|
|
288
292
|
address: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
289
293
|
ABI: deposit_json_1.default,
|
package/lib/factory/deploy.js
CHANGED
|
@@ -187,7 +187,7 @@ var getDeployedStableMetaPoolAddress = function (tx) { return __awaiter(void 0,
|
|
|
187
187
|
case 0: return [4 /*yield*/, tx.wait()];
|
|
188
188
|
case 1:
|
|
189
189
|
txInfo = _a.sent();
|
|
190
|
-
return [2 /*return*/, txInfo.logs[
|
|
190
|
+
return [2 /*return*/, txInfo.logs[3].address.toLowerCase()];
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
}); };
|
|
@@ -272,6 +272,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
272
272
|
token_address: pool.address,
|
|
273
273
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress : ethers_1.ethers.constants.AddressZero,
|
|
274
274
|
deposit_address: basePoolZap.address,
|
|
275
|
+
implementation_address: pool.implementationAddress,
|
|
275
276
|
is_meta: true,
|
|
276
277
|
is_factory: true,
|
|
277
278
|
base_pool: basePoolId,
|
|
@@ -296,6 +297,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
296
297
|
swap_address: pool.address,
|
|
297
298
|
token_address: pool.address,
|
|
298
299
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress : ethers_1.ethers.constants.AddressZero,
|
|
300
|
+
implementation_address: pool.implementationAddress,
|
|
299
301
|
is_plain: true,
|
|
300
302
|
is_factory: true,
|
|
301
303
|
underlying_coins: coinNames,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IDict, IPoolData, ICurve } from "../interfaces";
|
|
2
|
-
export declare function getCryptoFactoryPoolData(this: ICurve, swapAddress?: string): Promise<IDict<IPoolData>>;
|
|
2
|
+
export declare function getCryptoFactoryPoolData(this: ICurve, fromIdx?: number, swapAddress?: string): Promise<IDict<IPoolData>>;
|