@curvefi/api 2.29.0 → 2.30.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/README.md +32 -10
- package/lib/curve.d.ts +10 -4
- package/lib/curve.js +156 -116
- package/lib/factory/constants.js +4 -0
- package/lib/factory/deploy.d.ts +6 -6
- package/lib/factory/deploy.js +51 -49
- package/lib/factory/factory-api.js +6 -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 +14 -16
- package/lib/index.js +9 -53
- package/lib/interfaces.d.ts +2 -0
- package/lib/pools/PoolTemplate.d.ts +1 -0
- package/lib/pools/PoolTemplate.js +2 -0
- package/lib/pools/utils.d.ts +0 -3
- package/lib/pools/utils.js +4 -10
- package/package.json +1 -1
|
@@ -73,6 +73,7 @@ var YEAR = 365 * DAY;
|
|
|
73
73
|
var PoolTemplate = /** @class */ (function () {
|
|
74
74
|
function PoolTemplate(id) {
|
|
75
75
|
var _this = this;
|
|
76
|
+
var _c;
|
|
76
77
|
this.statsParameters = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
77
78
|
var multicallContract, lpMulticallContract, calls, i, additionalCalls, _virtualPrice, _fee, _prices, _adminFee, _A, _lpTokenSupply, _gamma, e_1, _c, virtualPrice, fee, adminFee, A, lpTokenSupply, gamma, priceOracle, priceScale, prices, i, A_PRECISION, _d, _future_A, _initial_A, _future_A_time, _initial_A_time, _e, future_A, initial_A, future_A_time, initial_A_time;
|
|
78
79
|
var _f, _g, _h;
|
|
@@ -1140,6 +1141,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1140
1141
|
this.underlyingDecimals = poolData.underlying_decimals;
|
|
1141
1142
|
this.wrappedDecimals = poolData.wrapped_decimals;
|
|
1142
1143
|
this.useLending = poolData.use_lending || poolData.underlying_coin_addresses.map(function () { return false; });
|
|
1144
|
+
this.inApi = (_c = poolData.in_api) !== null && _c !== void 0 ? _c : false;
|
|
1143
1145
|
this.estimateGas = {
|
|
1144
1146
|
depositApprove: this.depositApproveEstimateGas.bind(this),
|
|
1145
1147
|
deposit: this.depositEstimateGas.bind(this),
|
package/lib/pools/utils.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { IDict } from "../interfaces";
|
|
2
|
-
export declare const getPoolList: () => string[];
|
|
3
|
-
export declare const getFactoryPoolList: () => string[];
|
|
4
|
-
export declare const getCryptoFactoryPoolList: () => string[];
|
|
5
2
|
export declare const getUserPoolListByLiquidity: (address?: string) => Promise<string[]>;
|
|
6
3
|
export declare const getUserLiquidityUSD: (pools: string[], address?: string) => Promise<string[]>;
|
|
7
4
|
export declare const getUserPoolListByClaimable: (address?: string) => Promise<string[]>;
|
package/lib/pools/utils.js
CHANGED
|
@@ -59,19 +59,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
59
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
60
|
};
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports._getAmplificationCoefficientsFromApi = exports.getUserPoolList = exports.getUserClaimable = exports.getUserPoolListByClaimable = exports.getUserLiquidityUSD = exports.getUserPoolListByLiquidity =
|
|
62
|
+
exports._getAmplificationCoefficientsFromApi = exports.getUserPoolList = exports.getUserClaimable = exports.getUserPoolListByClaimable = exports.getUserLiquidityUSD = exports.getUserPoolListByLiquidity = void 0;
|
|
63
63
|
var ethers_1 = require("ethers");
|
|
64
64
|
var poolConstructor_1 = require("./poolConstructor");
|
|
65
65
|
var curve_1 = require("../curve");
|
|
66
66
|
var utils_1 = require("../utils");
|
|
67
67
|
var external_api_1 = require("../external-api");
|
|
68
68
|
var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
|
|
69
|
-
var getPoolList = function () { return Object.keys(curve_1.curve.constants.POOLS_DATA); };
|
|
70
|
-
exports.getPoolList = getPoolList;
|
|
71
|
-
var getFactoryPoolList = function () { return Object.keys(curve_1.curve.constants.FACTORY_POOLS_DATA); };
|
|
72
|
-
exports.getFactoryPoolList = getFactoryPoolList;
|
|
73
|
-
var getCryptoFactoryPoolList = function () { return Object.keys(curve_1.curve.constants.CRYPTO_FACTORY_POOLS_DATA); };
|
|
74
|
-
exports.getCryptoFactoryPoolList = getCryptoFactoryPoolList;
|
|
75
69
|
// _userLpBalance: { address: { poolId: { _lpBalance: 0, time: 0 } } }
|
|
76
70
|
var _userLpBalanceCache = {};
|
|
77
71
|
var _isUserLpBalanceCacheExpired = function (address, poolId) { var _a, _b; return (((_b = (_a = _userLpBalanceCache[address]) === null || _a === void 0 ? void 0 : _a[poolId]) === null || _b === void 0 ? void 0 : _b.time) || 0) + 600000 < Date.now(); };
|
|
@@ -122,7 +116,7 @@ var getUserPoolListByLiquidity = function (address) {
|
|
|
122
116
|
return __generator(this, function (_a) {
|
|
123
117
|
switch (_a.label) {
|
|
124
118
|
case 0:
|
|
125
|
-
pools = __spreadArray(__spreadArray(__spreadArray([],
|
|
119
|
+
pools = __spreadArray(__spreadArray(__spreadArray([], curve_1.curve.getPoolList(), true), curve_1.curve.getFactoryPoolList(), true), curve_1.curve.getCryptoFactoryPoolList(), true);
|
|
126
120
|
return [4 /*yield*/, _getUserLpBalances(pools, address, false)];
|
|
127
121
|
case 1:
|
|
128
122
|
_lpBalances = _a.sent();
|
|
@@ -419,7 +413,7 @@ var getUserPoolListByClaimable = function (address) {
|
|
|
419
413
|
return __generator(this, function (_a) {
|
|
420
414
|
switch (_a.label) {
|
|
421
415
|
case 0:
|
|
422
|
-
pools = __spreadArray(__spreadArray(__spreadArray([],
|
|
416
|
+
pools = __spreadArray(__spreadArray(__spreadArray([], curve_1.curve.getPoolList(), true), curve_1.curve.getFactoryPoolList(), true), curve_1.curve.getCryptoFactoryPoolList(), true);
|
|
423
417
|
return [4 /*yield*/, _getUserClaimable(pools, address, false)];
|
|
424
418
|
case 1:
|
|
425
419
|
_claimable = _a.sent();
|
|
@@ -480,7 +474,7 @@ var getUserPoolList = function (address, useApi) {
|
|
|
480
474
|
return __generator(this, function (_b) {
|
|
481
475
|
switch (_b.label) {
|
|
482
476
|
case 0:
|
|
483
|
-
pools = __spreadArray(__spreadArray(__spreadArray([],
|
|
477
|
+
pools = __spreadArray(__spreadArray(__spreadArray([], curve_1.curve.getPoolList(), true), curve_1.curve.getFactoryPoolList(), true), curve_1.curve.getCryptoFactoryPoolList(), true);
|
|
484
478
|
return [4 /*yield*/, Promise.all([
|
|
485
479
|
_getUserLpBalances(pools, address, false),
|
|
486
480
|
useApi ? _getUserClaimableUseApi(pools, address, false) : _getUserClaimable(pools, address, false),
|