@curvefi/api 2.56.6 → 2.56.8
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/gas_oracle_optimism_blob.json +203 -0
- package/lib/constants/aliases.js +2 -0
- package/lib/curve.d.ts +1 -0
- package/lib/curve.js +4 -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 +14 -1
- package/package.json +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [],
|
|
4
|
+
"name": "DECIMALS",
|
|
5
|
+
"outputs": [
|
|
6
|
+
{
|
|
7
|
+
"internalType": "uint256",
|
|
8
|
+
"name": "",
|
|
9
|
+
"type": "uint256"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"stateMutability": "view",
|
|
13
|
+
"type": "function"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"inputs": [],
|
|
17
|
+
"name": "baseFee",
|
|
18
|
+
"outputs": [
|
|
19
|
+
{
|
|
20
|
+
"internalType": "uint256",
|
|
21
|
+
"name": "",
|
|
22
|
+
"type": "uint256"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"stateMutability": "view",
|
|
26
|
+
"type": "function"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"inputs": [],
|
|
30
|
+
"name": "baseFeeScalar",
|
|
31
|
+
"outputs": [
|
|
32
|
+
{
|
|
33
|
+
"internalType": "uint32",
|
|
34
|
+
"name": "",
|
|
35
|
+
"type": "uint32"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"stateMutability": "view",
|
|
39
|
+
"type": "function"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"inputs": [],
|
|
43
|
+
"name": "blobBaseFee",
|
|
44
|
+
"outputs": [
|
|
45
|
+
{
|
|
46
|
+
"internalType": "uint256",
|
|
47
|
+
"name": "",
|
|
48
|
+
"type": "uint256"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"stateMutability": "view",
|
|
52
|
+
"type": "function"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"inputs": [],
|
|
56
|
+
"name": "blobBaseFeeScalar",
|
|
57
|
+
"outputs": [
|
|
58
|
+
{
|
|
59
|
+
"internalType": "uint32",
|
|
60
|
+
"name": "",
|
|
61
|
+
"type": "uint32"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"stateMutability": "view",
|
|
65
|
+
"type": "function"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"inputs": [],
|
|
69
|
+
"name": "decimals",
|
|
70
|
+
"outputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "uint256",
|
|
73
|
+
"name": "",
|
|
74
|
+
"type": "uint256"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"stateMutability": "pure",
|
|
78
|
+
"type": "function"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"inputs": [],
|
|
82
|
+
"name": "gasPrice",
|
|
83
|
+
"outputs": [
|
|
84
|
+
{
|
|
85
|
+
"internalType": "uint256",
|
|
86
|
+
"name": "",
|
|
87
|
+
"type": "uint256"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"stateMutability": "view",
|
|
91
|
+
"type": "function"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"inputs": [
|
|
95
|
+
{
|
|
96
|
+
"internalType": "bytes",
|
|
97
|
+
"name": "_data",
|
|
98
|
+
"type": "bytes"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"name": "getL1Fee",
|
|
102
|
+
"outputs": [
|
|
103
|
+
{
|
|
104
|
+
"internalType": "uint256",
|
|
105
|
+
"name": "",
|
|
106
|
+
"type": "uint256"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"stateMutability": "view",
|
|
110
|
+
"type": "function"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"inputs": [
|
|
114
|
+
{
|
|
115
|
+
"internalType": "bytes",
|
|
116
|
+
"name": "_data",
|
|
117
|
+
"type": "bytes"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"name": "getL1GasUsed",
|
|
121
|
+
"outputs": [
|
|
122
|
+
{
|
|
123
|
+
"internalType": "uint256",
|
|
124
|
+
"name": "",
|
|
125
|
+
"type": "uint256"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"stateMutability": "view",
|
|
129
|
+
"type": "function"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"inputs": [],
|
|
133
|
+
"name": "isEcotone",
|
|
134
|
+
"outputs": [
|
|
135
|
+
{
|
|
136
|
+
"internalType": "bool",
|
|
137
|
+
"name": "",
|
|
138
|
+
"type": "bool"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
"stateMutability": "view",
|
|
142
|
+
"type": "function"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"inputs": [],
|
|
146
|
+
"name": "l1BaseFee",
|
|
147
|
+
"outputs": [
|
|
148
|
+
{
|
|
149
|
+
"internalType": "uint256",
|
|
150
|
+
"name": "",
|
|
151
|
+
"type": "uint256"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"stateMutability": "view",
|
|
155
|
+
"type": "function"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"inputs": [],
|
|
159
|
+
"name": "overhead",
|
|
160
|
+
"outputs": [
|
|
161
|
+
{
|
|
162
|
+
"internalType": "uint256",
|
|
163
|
+
"name": "",
|
|
164
|
+
"type": "uint256"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"stateMutability": "view",
|
|
168
|
+
"type": "function"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"inputs": [],
|
|
172
|
+
"name": "scalar",
|
|
173
|
+
"outputs": [
|
|
174
|
+
{
|
|
175
|
+
"internalType": "uint256",
|
|
176
|
+
"name": "",
|
|
177
|
+
"type": "uint256"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"stateMutability": "view",
|
|
181
|
+
"type": "function"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"inputs": [],
|
|
185
|
+
"name": "setEcotone",
|
|
186
|
+
"outputs": [],
|
|
187
|
+
"stateMutability": "nonpayable",
|
|
188
|
+
"type": "function"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"inputs": [],
|
|
192
|
+
"name": "version",
|
|
193
|
+
"outputs": [
|
|
194
|
+
{
|
|
195
|
+
"internalType": "string",
|
|
196
|
+
"name": "",
|
|
197
|
+
"type": "string"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"stateMutability": "view",
|
|
201
|
+
"type": "function"
|
|
202
|
+
}
|
|
203
|
+
]
|
package/lib/constants/aliases.js
CHANGED
|
@@ -124,6 +124,7 @@ export var ALIASES_OPTIMISM = lowerCaseValues({
|
|
|
124
124
|
"stable_ng_factory": '0x5eeE3091f747E60a045a2E715a4c71e600e31F6E',
|
|
125
125
|
"factory_admin": "",
|
|
126
126
|
"gas_oracle": '0xc0d3C0d3C0d3c0D3C0D3C0d3C0d3C0D3C0D3000f',
|
|
127
|
+
"gas_oracle_blob": '0x420000000000000000000000000000000000000f',
|
|
127
128
|
});
|
|
128
129
|
export var ALIASES_XDAI = lowerCaseValues({
|
|
129
130
|
"crv": "0x712b3d230f3c1c19db860d80619288b1f0bdd0bd",
|
|
@@ -265,6 +266,7 @@ export var ALIASES_BASE = lowerCaseValues({
|
|
|
265
266
|
"factory_admin": "0x0000000000000000000000000000000000000000",
|
|
266
267
|
"stable_ng_factory": '0xd2002373543Ce3527023C75e7518C274A51ce712',
|
|
267
268
|
"gas_oracle": '0xc0d3C0d3C0d3c0D3C0D3C0d3C0d3C0D3C0D3000f',
|
|
269
|
+
"gas_oracle_blob": '0x420000000000000000000000000000000000000f',
|
|
268
270
|
});
|
|
269
271
|
export var ALIASES_BSC = lowerCaseValues({
|
|
270
272
|
"crv": "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415",
|
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
|
@@ -87,6 +87,7 @@ import twocryptoFactoryABI from './constants/abis/factory-twocrypto-ng.json' ass
|
|
|
87
87
|
import tricryptoFactoryABI from './constants/abis/factory-tricrypto.json' assert { type: 'json' };
|
|
88
88
|
import stableNgFactoryABI from './constants/abis/factory-stable-ng.json' assert { type: 'json' };
|
|
89
89
|
import gasOracleABI from './constants/abis/gas_oracle_optimism.json' assert { type: 'json' };
|
|
90
|
+
import gasOracleBlobABI from './constants/abis/gas_oracle_optimism_blob.json' assert { type: 'json' };
|
|
90
91
|
import votingProposalABI from './constants/abis/voting_proposal.json' assert { type: 'json' };
|
|
91
92
|
import circulatingSupplyABI from './constants/abis/circulating_supply.json' assert { type: 'json' };
|
|
92
93
|
import { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, POOLS_DATA_BSC, POOLS_DATA_FRAXTAL, } from './constants/pools/index.js';
|
|
@@ -889,6 +890,7 @@ var Curve = /** @class */ (function () {
|
|
|
889
890
|
TWOCRYPTO_FACTORY_POOLS_DATA: {},
|
|
890
891
|
TRICRYPTO_FACTORY_POOLS_DATA: {},
|
|
891
892
|
STABLE_NG_FACTORY_POOLS_DATA: {},
|
|
893
|
+
BASE_POOLS: {},
|
|
892
894
|
LLAMMAS_DATA: {},
|
|
893
895
|
COINS: {},
|
|
894
896
|
DECIMALS: {},
|
|
@@ -930,6 +932,7 @@ var Curve = /** @class */ (function () {
|
|
|
930
932
|
TWOCRYPTO_FACTORY_POOLS_DATA: {},
|
|
931
933
|
TRICRYPTO_FACTORY_POOLS_DATA: {},
|
|
932
934
|
STABLE_NG_FACTORY_POOLS_DATA: {},
|
|
935
|
+
BASE_POOLS: {},
|
|
933
936
|
LLAMMAS_DATA: {},
|
|
934
937
|
COINS: {},
|
|
935
938
|
DECIMALS: {},
|
|
@@ -1138,6 +1141,7 @@ var Curve = /** @class */ (function () {
|
|
|
1138
1141
|
if (L2Networks.includes(this.chainId)) {
|
|
1139
1142
|
curveInstance_1 = this;
|
|
1140
1143
|
curveInstance_1.setContract(curveInstance_1.constants.ALIASES.gas_oracle, gasOracleABI);
|
|
1144
|
+
curveInstance_1.setContract(curveInstance_1.constants.ALIASES.gas_oracle_blob, gasOracleBlobABI);
|
|
1141
1145
|
// @ts-ignore
|
|
1142
1146
|
if (AbstractProvider.prototype.originalEstimate) {
|
|
1143
1147
|
// @ts-ignore
|
|
@@ -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
|
|
@@ -726,7 +727,7 @@ export var getGasPriceFromL2 = function () { return __awaiter(void 0, void 0, vo
|
|
|
726
727
|
return [2 /*return*/, 0.1 * 1e9]; // constant 0.1 gwei
|
|
727
728
|
}
|
|
728
729
|
if (!L2Networks.includes(curve.chainId)) return [3 /*break*/, 2];
|
|
729
|
-
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.
|
|
730
|
+
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.gas_oracle_blob].contract.gasPrice({ "gasPrice": "0x2000000" })];
|
|
730
731
|
case 1:
|
|
731
732
|
gasPrice = _a.sent();
|
|
732
733
|
return [2 /*return*/, Number(gasPrice)];
|
|
@@ -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
|
+
};
|