@curvefi/api 2.51.0 → 2.51.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/constants/abis/factory-stable-ng/plain-stableswap-ng.json +1331 -1
- package/lib/constants/abis/factory-stable-ng.json +996 -1
- package/lib/curve.js +0 -1
- package/lib/factory/factory-api.js +3 -3
- package/lib/pools/PoolTemplate.js +3 -5
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +8 -0
- package/package.json +1 -1
package/lib/curve.js
CHANGED
|
@@ -598,7 +598,6 @@ var Curve = /** @class */ (function () {
|
|
|
598
598
|
_c.STABLE_NG_FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
|
|
599
599
|
_f.label = 4;
|
|
600
600
|
case 4:
|
|
601
|
-
console.log(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
|
|
602
601
|
_e = this.constants;
|
|
603
602
|
return [4 /*yield*/, this._filterHiddenPools(this.constants.STABLE_NG_FACTORY_POOLS_DATA)];
|
|
604
603
|
case 5:
|
|
@@ -64,7 +64,7 @@ import { FACTORY_CONSTANTS } from "./constants.js";
|
|
|
64
64
|
import { CRYPTO_FACTORY_CONSTANTS } from "./constants-crypto.js";
|
|
65
65
|
import { setFactoryZapContracts } from "./common.js";
|
|
66
66
|
import { _getPoolsFromApi } from "../external-api.js";
|
|
67
|
-
import { getPoolName } from "../utils.js";
|
|
67
|
+
import { assetTypeNameHandler, getPoolName } from "../utils.js";
|
|
68
68
|
export var lowerCasePoolDataAddresses = function (poolsData) {
|
|
69
69
|
var _a;
|
|
70
70
|
for (var _i = 0, poolsData_1 = poolsData; _i < poolsData_1.length; _i++) {
|
|
@@ -249,7 +249,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
249
249
|
name: getPoolName(pool.name),
|
|
250
250
|
full_name: pool.name,
|
|
251
251
|
symbol: pool.symbol,
|
|
252
|
-
reference_asset: pool.assetTypeName
|
|
252
|
+
reference_asset: assetTypeNameHandler(pool.assetTypeName),
|
|
253
253
|
swap_address: pool.address,
|
|
254
254
|
token_address: pool.address,
|
|
255
255
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
|
|
@@ -276,7 +276,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
276
276
|
name: getPoolName(pool.name),
|
|
277
277
|
full_name: pool.name,
|
|
278
278
|
symbol: pool.symbol,
|
|
279
|
-
reference_asset: pool.assetTypeName
|
|
279
|
+
reference_asset: assetTypeNameHandler(pool.assetTypeName),
|
|
280
280
|
swap_address: pool.address,
|
|
281
281
|
token_address: pool.address,
|
|
282
282
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
|
|
@@ -157,7 +157,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
157
157
|
this.statsTotalLiquidity = function (useApi) {
|
|
158
158
|
if (useApi === void 0) { useApi = true; }
|
|
159
159
|
return __awaiter(_this, void 0, void 0, function () {
|
|
160
|
-
var stablecoinContract, collateralContract, ammContract, _c, _balance_x, _fee_x, _balance_y, _fee_y, collateralRate, stablecoinTvlBN, collateralTvlBN, network, poolType,
|
|
160
|
+
var stablecoinContract, collateralContract, ammContract, _c, _balance_x, _fee_x, _balance_y, _fee_y, collateralRate, stablecoinTvlBN, collateralTvlBN, network, poolType, poolsData, totalLiquidity_1, balances, promises, _i, _d, addr, prices, totalLiquidity;
|
|
161
161
|
var _this = this;
|
|
162
162
|
return __generator(this, function (_e) {
|
|
163
163
|
switch (_e.label) {
|
|
@@ -185,10 +185,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
185
185
|
network = curve.constants.NETWORK_NAME;
|
|
186
186
|
poolType = this.isCrypto ? "crypto" : "main";
|
|
187
187
|
if (this.id.startsWith("factory")) {
|
|
188
|
-
poolType =
|
|
189
|
-
|
|
190
|
-
if (factoryType !== "v2")
|
|
191
|
-
poolType += "-" + factoryType;
|
|
188
|
+
poolType = this.id.replace(/-\d+$/, '');
|
|
189
|
+
poolType = poolType.replace(/-v2$/, '');
|
|
192
190
|
}
|
|
193
191
|
return [4 /*yield*/, _getPoolsFromApi(network, poolType)];
|
|
194
192
|
case 4:
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Contract } from 'ethers';
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
-
import { IChainId, IDict, INetworkName, IRewardFromApi } from './interfaces';
|
|
3
|
+
import { IChainId, IDict, INetworkName, IRewardFromApi, REFERENCE_ASSET } from './interfaces';
|
|
4
4
|
export declare const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
5
5
|
export declare const MAX_ALLOWANCE: bigint;
|
|
6
6
|
export declare const _cutZeros: (strn: string) => string;
|
|
@@ -57,3 +57,4 @@ export declare const hasDepositAndStake: () => boolean;
|
|
|
57
57
|
export declare const hasRouter: () => boolean;
|
|
58
58
|
export declare const getCountArgsOfMethodByContract: (contract: Contract, methodName: string) => number;
|
|
59
59
|
export declare const getPoolName: (name: string) => string;
|
|
60
|
+
export declare const assetTypeNameHandler: (assetTypeName: string) => REFERENCE_ASSET;
|
package/lib/utils.js
CHANGED
|
@@ -907,3 +907,11 @@ export var getPoolName = function (name) {
|
|
|
907
907
|
return separatedName[0].trim();
|
|
908
908
|
}
|
|
909
909
|
};
|
|
910
|
+
export var assetTypeNameHandler = function (assetTypeName) {
|
|
911
|
+
if (assetTypeName.toUpperCase() === 'UNKNOWN') {
|
|
912
|
+
return 'OTHER';
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
return assetTypeName.toUpperCase();
|
|
916
|
+
}
|
|
917
|
+
};
|