@curvefi/api 2.56.5 → 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 +1 -0
- package/lib/curve.js +2 -0
- package/lib/factory/constants-crypto.d.ts +5 -0
- package/lib/factory/constants-crypto.js +6 -0
- package/lib/factory/factory-api.js +2 -0
- package/lib/factory/factory-crypto.js +1 -0
- package/lib/factory/factory.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/interfaces.d.ts +8 -0
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +13 -0
- package/package.json +1 -1
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: {},
|
|
@@ -12,6 +12,7 @@ export declare const lpTokenBasePoolIdDictCelo: IDict<string>;
|
|
|
12
12
|
export declare const lpTokenBasePoolIdDictZkSync: IDict<string>;
|
|
13
13
|
export declare const lpTokenBasePoolIdDictBase: IDict<string>;
|
|
14
14
|
export declare const lpTokenBasePoolIdDictBsc: IDict<string>;
|
|
15
|
+
export declare const lpTokenBasePoolIdDictFraxtal: IDict<string>;
|
|
15
16
|
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
16
17
|
address: string;
|
|
17
18
|
ABI: any;
|
|
@@ -64,6 +65,10 @@ export declare const basePoolIdZapDictBsc: IDict<{
|
|
|
64
65
|
address: string;
|
|
65
66
|
ABI: any;
|
|
66
67
|
}>;
|
|
68
|
+
export declare const basePoolIdZapDictFraxtal: IDict<{
|
|
69
|
+
address: string;
|
|
70
|
+
ABI: any;
|
|
71
|
+
}>;
|
|
67
72
|
export declare const CRYPTO_FACTORY_CONSTANTS: {
|
|
68
73
|
[index: number]: {
|
|
69
74
|
lpTokenBasePoolIdDict: IDict<string>;
|
|
@@ -21,6 +21,7 @@ export var lpTokenBasePoolIdDictCelo = lowerCaseKeys({});
|
|
|
21
21
|
export var lpTokenBasePoolIdDictZkSync = lowerCaseKeys({});
|
|
22
22
|
export var lpTokenBasePoolIdDictBase = lowerCaseKeys({});
|
|
23
23
|
export var lpTokenBasePoolIdDictBsc = lowerCaseKeys({});
|
|
24
|
+
export var lpTokenBasePoolIdDictFraxtal = lowerCaseKeys({});
|
|
24
25
|
export var basePoolIdZapDictEthereum = {
|
|
25
26
|
'3pool': {
|
|
26
27
|
address: "0x97aDC08FA1D849D2C48C5dcC1DaB568B169b0267".toLowerCase(),
|
|
@@ -48,6 +49,7 @@ export var basePoolIdZapDictCelo = {};
|
|
|
48
49
|
export var basePoolIdZapDictZkSync = {};
|
|
49
50
|
export var basePoolIdZapDictBase = {};
|
|
50
51
|
export var basePoolIdZapDictBsc = {};
|
|
52
|
+
export var basePoolIdZapDictFraxtal = {};
|
|
51
53
|
export var CRYPTO_FACTORY_CONSTANTS = {
|
|
52
54
|
1: {
|
|
53
55
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictEthereum,
|
|
@@ -73,6 +75,10 @@ export var CRYPTO_FACTORY_CONSTANTS = {
|
|
|
73
75
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictFantom,
|
|
74
76
|
basePoolIdZapDict: basePoolIdZapDictFantom,
|
|
75
77
|
},
|
|
78
|
+
252: {
|
|
79
|
+
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictFraxtal,
|
|
80
|
+
basePoolIdZapDict: basePoolIdZapDictFraxtal,
|
|
81
|
+
},
|
|
76
82
|
324: {
|
|
77
83
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictZkSync,
|
|
78
84
|
basePoolIdZapDict: basePoolIdZapDictZkSync,
|
|
@@ -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],
|
package/lib/factory/factory.js
CHANGED
|
@@ -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,
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -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
|
+
};
|