@curvefi/api 2.56.6 → 2.56.7

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 CHANGED
@@ -54,6 +54,7 @@ declare class Curve implements ICurve {
54
54
  TWOCRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
55
55
  TRICRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
56
56
  STABLE_NG_FACTORY_POOLS_DATA: IDict<IPoolData>;
57
+ BASE_POOLS: IDict<number>;
57
58
  LLAMMAS_DATA: IDict<IPoolData>;
58
59
  COINS: IDict<string>;
59
60
  DECIMALS: IDict<number>;
package/lib/curve.js CHANGED
@@ -889,6 +889,7 @@ var Curve = /** @class */ (function () {
889
889
  TWOCRYPTO_FACTORY_POOLS_DATA: {},
890
890
  TRICRYPTO_FACTORY_POOLS_DATA: {},
891
891
  STABLE_NG_FACTORY_POOLS_DATA: {},
892
+ BASE_POOLS: {},
892
893
  LLAMMAS_DATA: {},
893
894
  COINS: {},
894
895
  DECIMALS: {},
@@ -930,6 +931,7 @@ var Curve = /** @class */ (function () {
930
931
  TWOCRYPTO_FACTORY_POOLS_DATA: {},
931
932
  TRICRYPTO_FACTORY_POOLS_DATA: {},
932
933
  STABLE_NG_FACTORY_POOLS_DATA: {},
934
+ BASE_POOLS: {},
933
935
  LLAMMAS_DATA: {},
934
936
  COINS: {},
935
937
  DECIMALS: {},
@@ -234,6 +234,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
234
234
  var basePoolCoinAddresses = __spreadArray([], allPoolsData[basePoolId].underlying_coin_addresses, true);
235
235
  var basePoolDecimals = __spreadArray([], allPoolsData[basePoolId].underlying_decimals, true);
236
236
  var basePoolZap = basePoolIdZapDict[basePoolId];
237
+ _this.constants.BASE_POOLS[basePoolId] = _this.constants.BASE_POOLS[basePoolId] ? _this.constants.BASE_POOLS[basePoolId] + 1 : 1;
237
238
  FACTORY_POOLS_DATA[pool.id] = {
238
239
  name: getPoolName(pool.name),
239
240
  full_name: pool.name,
@@ -289,6 +290,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
289
290
  var implementationABIDict = FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
290
291
  var allPoolsData = __assign(__assign({}, _this.constants.POOLS_DATA), FACTORY_POOLS_DATA);
291
292
  var basePoolId = getPoolIdByAddress(rawPoolList, pool.basePoolAddress);
293
+ _this.constants.BASE_POOLS[basePoolId] = _this.constants.BASE_POOLS[basePoolId] ? _this.constants.BASE_POOLS[basePoolId] + 1 : 1;
292
294
  var basePoolCoinNames = (_a = allPoolsData[basePoolId]) === null || _a === void 0 ? void 0 : _a.underlying_coins;
293
295
  var basePoolCoinAddresses = (_b = allPoolsData[basePoolId]) === null || _b === void 0 ? void 0 : _b.underlying_coin_addresses;
294
296
  var basePoolDecimals = (_c = allPoolsData[basePoolId]) === null || _c === void 0 ? void 0 : _c.underlying_decimals;
@@ -357,6 +357,7 @@ export function getCryptoFactoryPoolData(fromIdx, swapAddress) {
357
357
  basePoolCoinAddresses = __spreadArray([], allPoolsData[basePoolId].underlying_coin_addresses, true);
358
358
  basePoolDecimals = __spreadArray([], allPoolsData[basePoolId].underlying_decimals, true);
359
359
  basePoolZap = basePoolIdZapDict[basePoolId];
360
+ this.constants.BASE_POOLS[basePoolId] = this.constants.BASE_POOLS[basePoolId] ? this.constants.BASE_POOLS[basePoolId] + 1 : 1;
360
361
  CRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
361
362
  name: poolNames[i].split(": ")[1].trim(),
362
363
  full_name: poolNames[i],
@@ -432,6 +432,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
432
432
  // @ts-ignore
433
433
  var basePoolIdDecimalsDict = Object.fromEntries(basePools.ids.map(function (poolId) { var _a; return [poolId, (_a = allPoolsData_1[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_decimals]; }));
434
434
  var basePoolIdZapDict = FACTORY_CONSTANTS[this_1.chainId].basePoolIdZapDict;
435
+ this_1.constants.BASE_POOLS[basePools.ids[i]] = this_1.constants.BASE_POOLS[basePools.ids[i]] ? this_1.constants.BASE_POOLS[basePools.ids[i]] + 1 : 1;
435
436
  var basePoolZap = isStableNgPool(basePools.ids[i]) ? FACTORY_CONSTANTS[this_1.chainId].stableNgBasePoolZap : basePoolIdZapDict[basePools.ids[i]];
436
437
  if (isStableNgPool(basePools.ids[i])) {
437
438
  this_1.setContract(FACTORY_CONSTANTS[this_1.chainId].stableNgBasePoolZap.address, FACTORY_CONSTANTS[this_1.chainId].stableNgBasePoolZap.ABI);
package/lib/index.d.ts CHANGED
@@ -38,6 +38,7 @@ declare const curve: {
38
38
  price: number;
39
39
  }[][]>;
40
40
  PoolTemplate: typeof PoolTemplate;
41
+ getBasePools: () => import("./interfaces.js").IBasePoolShortItem[];
41
42
  getPool: (poolId: string) => PoolTemplate;
42
43
  getUsdRate: (coin: string) => Promise<number>;
43
44
  getGasPriceFromL1: () => Promise<number>;
package/lib/index.js CHANGED
@@ -39,7 +39,7 @@ import { getUserPoolListByLiquidity, getUserPoolListByClaimable, getUserPoolList
39
39
  import { getBestRouteAndOutput, getArgs, swapExpected, swapRequired, swapPriceImpact, swapIsApproved, swapApproveEstimateGas, swapApprove, swapEstimateGas, swap, getSwappedAmount, } from "./router.js";
40
40
  import { curve as _curve } from "./curve.js";
41
41
  import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, lastEthBlock, getAnycallBalance, topUpAnycall, topUpAnycallEstimateGas, lastBlockSent, blockToSend, sendBlockhash, sendBlockhashEstimateGas, submitProof, submitProofEstimateGas, } from "./boosting.js";
42
- import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL1, getGasPriceFromL2, getTVL, getCoinsData, getVolume, hasDepositAndStake, hasRouter, } from "./utils.js";
42
+ import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL1, getGasPriceFromL2, getTVL, getCoinsData, getVolume, hasDepositAndStake, hasRouter, getBasePools, } from "./utils.js";
43
43
  import { deployStablePlainPool, deployStablePlainPoolEstimateGas, getDeployedStablePlainPoolAddress, setOracle, setOracleEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, getDeployedStableMetaPoolAddress, deployCryptoPool, deployCryptoPoolEstimateGas, getDeployedCryptoPoolAddress, deployTricryptoPool, deployTricryptoPoolEstimateGas, getDeployedTricryptoPoolAddress, deployGauge, deployGaugeEstimateGas, getDeployedGaugeAddress, deployGaugeSidechain, deployGaugeSidechainEstimateGas, deployGaugeMirror, deployGaugeMirrorEstimateGas, getDeployedGaugeMirrorAddress, getDeployedGaugeMirrorAddressByTx, deployStableNgPlainPool, deployStableNgPlainPoolEstimateGas, deployStableNgMetaPool, deployStableNgMetaPoolEstimateGas, deployTwocryptoPool, deployTwocryptoPoolEstimateGas, getDeployedTwocryptoPoolAddress, } from './factory/deploy.js';
44
44
  import { crvSupplyStats, userCrv, userVeCrv, crvLockIsApproved, crvLockApproveEstimateGas, crvLockApprove, calcCrvUnlockTime, createCrvLockEstimateGas, createCrvLock, increaseCrvLockedAmountEstimateGas, increaseCrvLockedAmount, increaseCrvUnlockTimeEstimateGas, increaseCrvUnlockTime, withdrawLockedCrvEstimateGas as daoWithdrawLockedCrvEstimateGas, withdrawLockedCrv as daoWithdrawLockedCrv, claimableFees as daoClaimableFees, claimFeesEstimateGas as daoClaimFeesEstimateGas, claimFees as daoClaimFees, getVotingGaugeList, userGaugeVotes, voteForGaugeNextTime, voteForGaugeEstimateGas, voteForGauge, getProposalList, getProposal, userProposalVotes, voteForProposalEstimateGas, voteForProposal, } from "./dao.js";
45
45
  function init(providerType, providerSettings, options) {
@@ -75,6 +75,7 @@ var curve = {
75
75
  getUserLiquidityUSD: getUserLiquidityUSD,
76
76
  getUserClaimable: getUserClaimable,
77
77
  PoolTemplate: PoolTemplate,
78
+ getBasePools: getBasePools,
78
79
  getPool: getPool,
79
80
  getUsdRate: getUsdRate,
80
81
  getGasPriceFromL1: getGasPriceFromL1,
@@ -85,6 +85,7 @@ export interface ICurve {
85
85
  CRVUSD_FACTORY_POOLS_DATA: IDict<IPoolData>;
86
86
  CRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
87
87
  TRICRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
88
+ BASE_POOLS: IDict<number>;
88
89
  LLAMMAS_DATA: IDict<IPoolData>;
89
90
  COINS: IDict<string>;
90
91
  DECIMALS: IDict<number>;
@@ -259,3 +260,10 @@ export interface IVolumeAndAPYs {
259
260
  cryptoShare: number;
260
261
  poolsData: IVolumeAndAPYsPoolData[];
261
262
  }
263
+ export interface IBasePoolShortItem {
264
+ coins: string[];
265
+ id: string;
266
+ name: string;
267
+ pool: string;
268
+ token: string;
269
+ }
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, IVolumeAndAPYs, REFERENCE_ASSET } from './interfaces';
3
+ import { IBasePoolShortItem, IChainId, IDict, INetworkName, IRewardFromApi, IVolumeAndAPYs, 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;
@@ -62,3 +62,4 @@ export declare const isMethodExist: (contract: Contract, methodName: string) =>
62
62
  export declare const getPoolName: (name: string) => string;
63
63
  export declare const isStableNgPool: (name: string) => boolean;
64
64
  export declare const assetTypeNameHandler: (assetTypeName: string) => REFERENCE_ASSET;
65
+ export declare const getBasePools: () => IBasePoolShortItem[];
package/lib/utils.js CHANGED
@@ -63,6 +63,7 @@ import { _getAllPoolsFromApi, _getFactoryAPYs, _getSubgraphData, _getVolumes, }
63
63
  import ERC20Abi from './constants/abis/ERC20.json' assert { type: 'json' };
64
64
  import { L2Networks } from './constants/L2Networks.js';
65
65
  import { volumeNetworks } from "./constants/volumeNetworks.js";
66
+ import { getPool } from "./pools/index.js";
66
67
  export var ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
67
68
  // export const MAX_ALLOWANCE = curve.parseUnits(new BigNumber(2).pow(256).minus(1).toFixed(), 0);
68
69
  export var MAX_ALLOWANCE = BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"); // 2**256 - 1
@@ -931,3 +932,15 @@ export var assetTypeNameHandler = function (assetTypeName) {
931
932
  return assetTypeName.toUpperCase();
932
933
  }
933
934
  };
935
+ export var getBasePools = function () {
936
+ return Object.keys(curve.constants.BASE_POOLS).map(function (poolId) {
937
+ var pool = getPool(poolId);
938
+ return {
939
+ id: poolId,
940
+ name: pool.name,
941
+ pool: pool.address,
942
+ token: pool.lpToken,
943
+ coins: pool.underlyingCoinAddresses,
944
+ };
945
+ });
946
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.56.6",
3
+ "version": "2.56.7",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",