@curvefi/api 2.66.20 → 2.66.22
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 +3 -3
- package/lib/external-api.js +10 -10
- package/lib/router.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -341,7 +341,7 @@ import curve from "@curvefi/api";
|
|
|
341
341
|
pool.name;
|
|
342
342
|
// FEI Metapool
|
|
343
343
|
pool.fullName;
|
|
344
|
-
// Curve.
|
|
344
|
+
// Curve.finance Factory USD Metapool: FEI Metapool
|
|
345
345
|
pool.symbol;
|
|
346
346
|
// FEI3CRV3CRV-f
|
|
347
347
|
pool.referenceAsset;
|
|
@@ -2181,7 +2181,7 @@ import curve from "@curvefi/api";
|
|
|
2181
2181
|
await curve.dao.getVotingGaugeList();
|
|
2182
2182
|
// [
|
|
2183
2183
|
// {
|
|
2184
|
-
// poolUrl: 'https://curve.
|
|
2184
|
+
// poolUrl: 'https://curve.finance/#/ethereum/pools/compound/swap',
|
|
2185
2185
|
// network: 'ethereum',
|
|
2186
2186
|
// gaugeAddress: '0x7ca5b0a2910b33e9759dc7ddb0413949071d7575',
|
|
2187
2187
|
// poolAddress: '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56',
|
|
@@ -2192,7 +2192,7 @@ import curve from "@curvefi/api";
|
|
|
2192
2192
|
// isKilled: false
|
|
2193
2193
|
// },
|
|
2194
2194
|
// {
|
|
2195
|
-
// poolUrl: 'https://curve.
|
|
2195
|
+
// poolUrl: 'https://curve.finance/#/ethereum/pools/usdt/swap',
|
|
2196
2196
|
// network: 'ethereum',
|
|
2197
2197
|
// gaugeAddress: '0xbc89cd85491d81c6ad2954e6d0362ee29fca8f53',
|
|
2198
2198
|
// poolAddress: '0x52ea46506b9cc5ef470c5bf89f17dc28bb35d85c',
|
package/lib/external-api.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import memoize from "memoizee";
|
|
11
11
|
export const _getPoolsFromApi = memoize((network_1, poolType_1, ...args_1) => __awaiter(void 0, [network_1, poolType_1, ...args_1], void 0, function* (network, poolType, isLiteChain = false) {
|
|
12
12
|
var _a;
|
|
13
|
-
const api = isLiteChain ? "https://
|
|
13
|
+
const api = isLiteChain ? "https://dy9z253d96rct.cloudfront.net/v1/" : "https://api.curve.finance/api";
|
|
14
14
|
const url = `${api}/getPools/${network}/${poolType}`;
|
|
15
15
|
return (_a = yield fetchData(url)) !== null && _a !== void 0 ? _a : { poolData: [], tvl: 0, tvlAll: 0 };
|
|
16
16
|
}), {
|
|
@@ -41,7 +41,7 @@ export const _getAllPoolsFromApi = (network_1, ...args_1) => __awaiter(void 0, [
|
|
|
41
41
|
});
|
|
42
42
|
export const _getSubgraphData = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
43
|
var _a, _b, _c;
|
|
44
|
-
const data = yield fetchData(`https://api.curve.
|
|
44
|
+
const data = yield fetchData(`https://api.curve.finance/api/getSubgraphData/${network}`);
|
|
45
45
|
const poolsData = data.poolList.map((data) => ({
|
|
46
46
|
address: data.address,
|
|
47
47
|
volumeUSD: data.volumeUSD,
|
|
@@ -60,7 +60,7 @@ export const _getSubgraphData = memoize((network) => __awaiter(void 0, void 0, v
|
|
|
60
60
|
});
|
|
61
61
|
export const _getVolumes = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
62
|
var _a, _b, _c;
|
|
63
|
-
const { pools, totalVolumes } = yield fetchData(`https://api.curve.
|
|
63
|
+
const { pools, totalVolumes } = yield fetchData(`https://api.curve.finance/api/getVolumes/${network}`);
|
|
64
64
|
const poolsData = pools.map((data) => ({
|
|
65
65
|
address: data.address,
|
|
66
66
|
volumeUSD: data.volumeUSD,
|
|
@@ -78,7 +78,7 @@ export const _getVolumes = memoize((network) => __awaiter(void 0, void 0, void 0
|
|
|
78
78
|
maxAge: 5 * 60 * 1000, // 5m
|
|
79
79
|
});
|
|
80
80
|
export const _getFactoryAPYs = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
-
const [stableData, cryptoData] = yield Promise.all(['stable', 'crypto'].map((type) => fetchData(`https://api.curve.
|
|
81
|
+
const [stableData, cryptoData] = yield Promise.all(['stable', 'crypto'].map((type) => fetchData(`https://api.curve.finance/api/getFactoryAPYs/${network}/${type}`)));
|
|
82
82
|
const stableVolume = stableData.totalVolumeUsd || stableData.totalVolume || 0;
|
|
83
83
|
const cryptoVolume = cryptoData.totalVolumeUsd || cryptoData.totalVolume || 0;
|
|
84
84
|
return {
|
|
@@ -99,12 +99,12 @@ export const _getFactoryAPYs = memoize((network) => __awaiter(void 0, void 0, vo
|
|
|
99
99
|
promise: true,
|
|
100
100
|
maxAge: 5 * 60 * 1000, // 5m
|
|
101
101
|
});
|
|
102
|
-
export const _getAllGauges = memoize(() => fetchData(`https://api.curve.
|
|
102
|
+
export const _getAllGauges = memoize(() => fetchData(`https://api.curve.finance/api/getAllGauges`), {
|
|
103
103
|
promise: true,
|
|
104
104
|
maxAge: 5 * 60 * 1000, // 5m
|
|
105
105
|
});
|
|
106
106
|
export const _getAllGaugesFormatted = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
-
const data = yield fetchData(`https://api.curve.
|
|
107
|
+
const data = yield fetchData(`https://api.curve.finance/api/getAllGauges`);
|
|
108
108
|
const gaugesDict = {};
|
|
109
109
|
Object.values(data).forEach((d) => {
|
|
110
110
|
var _a, _b;
|
|
@@ -118,12 +118,12 @@ export const _getAllGaugesFormatted = memoize(() => __awaiter(void 0, void 0, vo
|
|
|
118
118
|
promise: true,
|
|
119
119
|
maxAge: 60 * 60 * 1000, // 60m
|
|
120
120
|
});
|
|
121
|
-
export const _getHiddenPools = memoize(() => fetchData(`https://api.curve.
|
|
121
|
+
export const _getHiddenPools = memoize(() => fetchData(`https://api.curve.finance/api/getHiddenPools`), {
|
|
122
122
|
promise: true,
|
|
123
123
|
maxAge: 5 * 60 * 1000, // 5m
|
|
124
124
|
});
|
|
125
125
|
export const _generateBoostingProof = memoize((block, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
126
|
-
const url = `https://prices.curve.
|
|
126
|
+
const url = `https://prices.curve.finance/v1/general/get_merkle_proof?block=${block}&account_address=${address}`;
|
|
127
127
|
const { block_header_rlp, proof_rlp } = yield fetchJson(url);
|
|
128
128
|
return { block_header_rlp, proof_rlp };
|
|
129
129
|
}), {
|
|
@@ -147,7 +147,7 @@ export const _getDaoProposal = memoize((type, id) => fetchJson(`https://api-py.l
|
|
|
147
147
|
export const _getLiteNetworksData = memoize((networkName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
148
|
var _a, _b;
|
|
149
149
|
try {
|
|
150
|
-
const url = `https://
|
|
150
|
+
const url = `https://dy9z253d96rct.cloudfront.net/v1/getDeployment/${networkName}`;
|
|
151
151
|
const response = yield fetch(url);
|
|
152
152
|
const { data } = (_a = yield response.json()) !== null && _a !== void 0 ? _a : {};
|
|
153
153
|
if (response.status !== 200 || !data) {
|
|
@@ -195,7 +195,7 @@ export const _getLiteNetworksData = memoize((networkName) => __awaiter(void 0, v
|
|
|
195
195
|
});
|
|
196
196
|
export const _getCurveLiteNetworks = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
197
197
|
var _a;
|
|
198
|
-
const response = yield fetch(`https://
|
|
198
|
+
const response = yield fetch(`https://dy9z253d96rct.cloudfront.net/v1/getPlatforms`);
|
|
199
199
|
const { data } = (_a = yield response.json()) !== null && _a !== void 0 ? _a : {};
|
|
200
200
|
if (response.status !== 200 || !(data === null || data === void 0 ? void 0 : data.platforms)) {
|
|
201
201
|
console.error('Failed to fetch Curve platforms:', response);
|
package/lib/router.js
CHANGED
|
@@ -216,7 +216,7 @@ const _getBestRoute = memoize((inputCoinAddress, outputCoinAddress, amount) => _
|
|
|
216
216
|
const [gasAmounts, outputCoinUsdRate, gasData, ethUsdRate] = yield Promise.all([
|
|
217
217
|
_estimateGasForDifferentRoutes(routes.map((r) => r.route), inputCoinAddress, outputCoinAddress, _amount),
|
|
218
218
|
_getUsdRate(outputCoinAddress),
|
|
219
|
-
fetch("https://api.curve.
|
|
219
|
+
fetch("https://api.curve.finance/api/getGas").then((res) => res.json()),
|
|
220
220
|
_getUsdRate(ETH_ADDRESS),
|
|
221
221
|
]);
|
|
222
222
|
const gasPrice = gasData.data.gas.standard;
|
package/package.json
CHANGED