-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ff3855
commit ca29d8d
Showing
60 changed files
with
676 additions
and
570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import tmpExcludes from '../tmp-lint-excludes.js'; | ||
|
||
// Array of file paths to process | ||
const filePaths = tmpExcludes.map(filepath => filepath); | ||
|
||
// The ESLint comment to be added | ||
const eslintComment = | ||
'// @ts-nocheck\n/* eslint-disable -- disabling this file as this was created before our strict rules */\n'; | ||
|
||
filePaths.forEach(filePath => { | ||
// Read the file | ||
fs.readFile(filePath, 'utf8', (err, data) => { | ||
console.log('TCL: err', err); | ||
console.log('TCL: data', data); | ||
// Check if the first line is already the ESLint comment | ||
const firstLine = data.split('\n')[0].trim(); | ||
if (firstLine === eslintComment.trim()) { | ||
return; | ||
} | ||
|
||
// Prepend the ESLint comment | ||
const updatedData = eslintComment + data; | ||
|
||
// Write the updated file back to the filesystem | ||
fs.writeFile(filePath, updatedData, 'utf8', () => { | ||
// eslint-disable-next-line no-console -- log | ||
console.log(`ESLint comment added to ${filePath}`); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,36 @@ | ||
// pages/api/arbs/[...params].ts | ||
|
||
import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client"; | ||
import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface"; | ||
import { NextApiRequest, NextApiResponse } from "next"; | ||
import { DexQueryServiceClient } from '@/utils/protos/services/dex/dex-query-service-client'; | ||
import { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT! | ||
const grpcEndpoint = process.env['PENUMBRA_GRPC_ENDPOINT']; | ||
if (!grpcEndpoint) { | ||
throw new Error("PENUMBRA_GRPC_ENDPOINT is not set") | ||
throw new Error('PENUMBRA_GRPC_ENDPOINT is not set'); | ||
} | ||
|
||
export default async function arbsByBlockRange(req: NextApiRequest, res: NextApiResponse) { | ||
const params = req.query.params as string[]; | ||
const params = req.query['params'] as string[]; | ||
|
||
const startHeight = params[0] || null; | ||
const endHeight = params[1] || null; | ||
const startHeight = params[0] ?? null; | ||
const endHeight = params[1] ?? null; | ||
|
||
try { | ||
if (!startHeight || !endHeight) { | ||
res.status(400).json({ error: "Invalid query parameters" }); return; | ||
} | ||
// TODO: validate StartHeight/EndHeight are numbers | ||
const dex_querier = new DexQueryServiceClient({ | ||
grpcEndpoint: grpcEndpoint, | ||
}); | ||
try { | ||
if (!startHeight || !endHeight) { | ||
res.status(400).json({ error: 'Invalid query parameters' }); | ||
return; | ||
} | ||
// TODO: validate StartHeight/EndHeight are numbers | ||
const dex_querier = new DexQueryServiceClient({ | ||
grpcEndpoint: grpcEndpoint ?? '', | ||
}); | ||
|
||
const data = await dex_querier.arbExecutions( | ||
parseInt(startHeight), | ||
parseInt(endHeight) | ||
); | ||
const data = await dex_querier.arbExecutions(parseInt(startHeight), parseInt(endHeight)); | ||
|
||
res.status(200).json(data as SwapExecutionWithBlockHeight[]); | ||
} catch (error) { | ||
console.error("Error getting liquidty positions by price grpc data:", error); | ||
res.status(500).json({ | ||
error: `Error getting liquidty positions by price grpc data: ${error}`, | ||
}); | ||
} | ||
res.status(200).json(data ?? null); | ||
} catch (error) { | ||
console.error('Error getting liquidty positions by price grpc data:', error); | ||
res.status(500).json({ | ||
error: `Error getting liquidty positions by price grpc data: ${error as string}`, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.