-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Gearbox-protocol/lint
feat: add lint; reorganize code
- Loading branch information
Showing
46 changed files
with
4,065 additions
and
2,501 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
lib | ||
*.d.ts |
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,10 @@ | ||
{ | ||
"root": true, | ||
"extends": ["@gearbox-protocol/eslint-config/react"], | ||
"parserOptions": { | ||
"project": ["./tsconfig.json"], | ||
}, | ||
"rules": { | ||
"no-void": ["error", { "allowAsStatement": true }], | ||
}, | ||
} |
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,2 +1,3 @@ | ||
build | ||
node_modules | ||
.env |
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 @@ | ||
20 |
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,35 +1,35 @@ | ||
{ | ||
"branches": [ | ||
{ | ||
"name": "main" | ||
} | ||
"branches": [ | ||
{ | ||
"name": "main" | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"successComment": false, | ||
"failTitle": false | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"successComment": false, | ||
"failTitle": false | ||
} | ||
[ | ||
"@codedependant/semantic-release-docker", | ||
{ | ||
"dockerTags": [ | ||
"{{#if prerelease.[0]}}{{prerelease.[0]}}{{else}}latest{{/if}}", | ||
"{{version}}" | ||
], | ||
[ | ||
"@codedependant/semantic-release-docker", | ||
{ | ||
"dockerTags": [ | ||
"{{#if prerelease.[0]}}{{prerelease.[0]}}{{else}}latest{{/if}}", | ||
"{{version}}" | ||
], | ||
"dockerArgs": { | ||
"PACKAGE_VERSION": "{{version}}" | ||
}, | ||
"dockerImage": "apy-server", | ||
"dockerRegistry": "ghcr.io", | ||
"dockerProject": "gearbox-protocol", | ||
"dockerBuildQuiet": false, | ||
"dockerLogin": false | ||
} | ||
] | ||
"dockerArgs": { | ||
"PACKAGE_VERSION": "{{version}}" | ||
}, | ||
"dockerImage": "apy-server", | ||
"dockerRegistry": "ghcr.io", | ||
"dockerProject": "gearbox-protocol", | ||
"dockerBuildQuiet": false, | ||
"dockerLogin": false | ||
} | ||
] | ||
} | ||
] | ||
} |
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,7 @@ | ||
{ | ||
"recommendations": [ | ||
"esbenp.prettier-vscode", | ||
"nomicfoundation.hardhat-solidity", | ||
"dbaeumer.vscode-eslint" | ||
] | ||
} |
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,16 @@ | ||
{ | ||
"[json]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[solidity]": { | ||
"editor.defaultFormatter": "JuanBlanco.solidity" | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"eslint.validate": ["javascript", "typescript"], | ||
"files.eol": "\n" | ||
} |
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,6 +1,6 @@ | ||
import * as esbuild from 'esbuild'; | ||
import { createBuildSettings } from './settings.mjs'; | ||
import * as esbuild from "esbuild"; | ||
import { createBuildSettings } from "./settings.mjs"; | ||
|
||
const settings = createBuildSettings({ minify: true }); | ||
|
||
await esbuild.build(settings); | ||
await esbuild.build(settings); |
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,26 +1,26 @@ | ||
import { build } from "esbuild"; | ||
|
||
build({ | ||
entryPoints: ["main.ts"], | ||
outdir: "build", | ||
bundle: true, | ||
platform: "node", | ||
format: "esm", | ||
outExtension: { ".js": ".mjs" }, | ||
target: ["node20"], | ||
sourcemap: "external", | ||
banner: { | ||
js: ` | ||
entryPoints: ["main.ts"], | ||
outdir: "build", | ||
bundle: true, | ||
platform: "node", | ||
format: "esm", | ||
outExtension: { ".js": ".mjs" }, | ||
target: ["node20"], | ||
sourcemap: "external", | ||
banner: { | ||
js: ` | ||
import { createRequire } from 'module'; | ||
import { fileURLToPath } from 'url'; | ||
const require = createRequire(import.meta.url); | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
`, | ||
}, | ||
external: ["node-pty"], | ||
}, | ||
external: ["node-pty"], | ||
}).catch(e => { | ||
console.error(e); | ||
process.exit(1); | ||
console.error(e); | ||
process.exit(1); | ||
}); |
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,43 +1,52 @@ | ||
import express from 'express'; | ||
import dotenv from 'dotenv'; | ||
import { Fetcher, } from './src/fetcher'; | ||
import cors from "cors"; | ||
dotenv.config(); | ||
import { config } from "dotenv"; | ||
import express, { json } from "express"; | ||
|
||
import { checkResp, getAll, getByChainAndToken, getRewardList } from './src/endpoints' | ||
import { Fetcher } from "./src/fetcher"; | ||
config(); | ||
|
||
import { | ||
checkResp, | ||
getAll, | ||
getByChainAndToken, | ||
getRewardList, | ||
} from "./src/endpoints"; | ||
|
||
const app = express(); | ||
const port = process.env.PORT ?? 8000; | ||
app.use(express.json()); | ||
app.use(cors({ | ||
origin: '*', | ||
app.use(json()); | ||
app.use( | ||
cors({ | ||
origin: "*", | ||
credentials: true, | ||
methods: 'GET,PUT,POST,OPTIONS', | ||
allowedHeaders: 'Content-Type,Authorization' | ||
})); | ||
methods: "GET,PUT,POST,OPTIONS", | ||
allowedHeaders: "Content-Type,Authorization", | ||
}), | ||
); | ||
|
||
let f = new Fetcher(); | ||
(async function run() { | ||
await f.loop(); | ||
}()); | ||
const f = new Fetcher(); | ||
void (async function run() { | ||
await f.loop(); | ||
})(); | ||
|
||
app.get('/api/rewards/all/', (req, res) => { | ||
getAll(req, res, f) | ||
app.get("/api/rewards/all/", (req, res) => { | ||
void getAll(req, res, f); | ||
}); | ||
app.get('/api/rewards/:chainId/:tokenAddress', (req, res) => { | ||
getByChainAndToken(req, res, f) | ||
app.get("/api/rewards/:chainId/:tokenAddress", (req, res) => { | ||
void getByChainAndToken(req, res, f); | ||
}); | ||
app.post('/api/rewards/list', (req, res) => { | ||
getRewardList(req, res, f) | ||
app.post("/api/rewards/list", (req, res) => { | ||
void getRewardList(req, res, f); | ||
}); | ||
app.get('/api/rewards/list', (req, res) => { | ||
checkResp({ | ||
status: "error", | ||
description: "Method Not Allowed: use POST" | ||
}, res); | ||
app.get("/api/rewards/list", (req, res) => { | ||
checkResp( | ||
{ | ||
status: "error", | ||
description: "Method Not Allowed: use POST", | ||
}, | ||
res, | ||
); | ||
}); | ||
app.listen(port, () => { | ||
console.log(`[server]: Server is running at http://localhost:${port}`); | ||
console.log(`[server]: Server is running at http://localhost:${port}`); | ||
}); | ||
|
||
|
Oops, something went wrong.