@@ -124,59 +124,6 @@ async function getBlocks(req, res) {
124124 } ) ;
125125 }
126126}
127-
128- // /**
129- // * Fetches block data from the EXPLORER_BASE_URL and sends it as a response.
130- // *
131- // * @async
132- // * @function getBlocks
133- // * @param {Object } req - The HTTP request object.
134- // * @param {Object } req.query - The query parameters.
135- // * @param {number } req.query.start - The starting block number.
136- // * @param {number } req.query.end - The ending block number.
137- // * @param {Object } res - The HTTP response object.
138- // * @returns {Promise<void> } Sends the fetched data or an error response.
139- // */
140- // async function getEncodedBlocks(req, res) {
141- // const start = parseInt(req.query.start, 10);
142- // const end = parseInt(req.query.end, 10);
143-
144- // try {
145- // logger.info(`Attempting to fetch blocks from cache`);
146- // const cacheData = await getDataFromCache(start, end);
147-
148- // if (cacheData && cacheData.length > 0) {
149- // logger.info(`Cache hit for blocks, returned ${cacheData.length} records`);
150- // let modifiedData = cacheData.map(record => {
151- // return {
152- // epoch: parseTimeToUnixEpoch(record.created_at),
153- // volume: record.volume || 0
154- // };
155- // });
156-
157- // modifiedData = applyDeltaEncoding(modifiedData);
158- // return res.send({
159- // isCached: true,
160- // ...modifiedData
161- // });
162- // }
163- // logger.info(`Cache miss for blocks ${start}-${end}, falling back to API`);
164-
165- // } catch (cacheError) {
166- // logger.error('Error retrieving data from cache. Continue to API fallback', cacheError);
167- // }
168- // try {
169- // const apiData = await getDataFromApi(start, end);
170- // const modifiedData = applyDeltaEncoding(apiData);
171- // return res.send(modifiedData);
172- // } catch (error) {
173- // logger.error('Error fetching block data from API:', error);
174- // return res.status(500).send({
175- // error: 'Failed to fetch block data',
176- // details: error.message,
177- // });
178- // }
179- // }
180127// Using the function below for the graph, decoupled with pagination for the table
181128async function getAllEncodedBlocks ( req , res ) {
182129 try {
@@ -290,6 +237,5 @@ async function getDataFromApi(start, end) {
290237module . exports = {
291238 getExplorerData,
292239 getBlocks,
293- // getEncodedBlocks,
294240 getAllEncodedBlocks
295241} ;
0 commit comments