Skip to content

Commit

Permalink
chore(server): remove dead code (#570)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
  • Loading branch information
wolf31o2 authored Jan 9, 2025
1 parent c477035 commit 0a64f21
Show file tree
Hide file tree
Showing 28 changed files with 0 additions and 229 deletions.
81 changes: 0 additions & 81 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import url from "url";
import {
Dto,
GetDeliveredRewardsDto,
GetPoolsDto,
GetQueueDto,
ServerErrorDto,
} from "../client/src/entities/dto";
Expand All @@ -32,7 +31,6 @@ import {
getFromKoios,
getFromVM,
getPoolMetadata,
getPools,
getRewards,
postFromKoios,
sanitizeString,
Expand Down Expand Up @@ -66,76 +64,10 @@ app.use(express.json());
app.use(require("morgan")(LOG_TYPE));
app.use(cors({ origin: "*" }));

const resp200Ok = {
responses: {
200: {
description: "Success",
content: {
"application/json": {
schema: {
type: "object",
},
},
},
},
},
};

const resp200Ok500Bad = {
responses: {
200: {
description: "Success",
content: {
"application/json": {
schema: {
type: "object",
},
},
},
},
500: {
content: {
"application/json": {
schema: {
type: "object",
properties: {
error: { type: "string" },
},
},
},
},
},
},
};

app.use("/api/tx", TxRouter);
app.use("/api/util", UtilRouter);
app.use("/api/admin", AdminRouter);

app.get(
"/api/getpools",
errorHandlerWrapper(async (_req: Request, res: Response<GetPoolsDto>) => {
const pools = await getPools();
const whitelist = TOSIFEE_WHITELIST ? TOSIFEE_WHITELIST.split(",") : [];
const whitelistedPools: PoolInfo[] = [];
const regularPools: PoolInfo[] = [];
Object.values(pools).forEach((pool) => {
if (pool.visible === "f" || pool.id.includes("project_")) {
return;
}
if (whitelist.includes(pool.id)) {
whitelistedPools.push(pool);
} else {
regularPools.push(pool);
}
});
return res.status(200).send({
whitelistedPools: _.shuffle(whitelistedPools),
regularPools: _.shuffle(regularPools),
});
}),
);

app.get(
"/api/getsettings",
typedErrorHandlerWrapper<Dto.GetVmSettings>(async (_, res) => {
Expand Down Expand Up @@ -532,16 +464,6 @@ app.get(
}),
);

app.get(
"/api/getprojects",
errorHandlerWrapper(async (_req: Request, res: Response) => {
const projects = JSON.parse(
fs.readFileSync(__dirname + "/public/json/projects.json", "utf8"),
);
return res.status(200).send(projects);
}),
);

app.get(
"/api/getpopupinfo",
errorHandlerWrapper(async (_req: Request, res: Response) => {
Expand All @@ -560,9 +482,6 @@ app.get(
}),
);

// host static files such as images
app.use("/api/img", express.static(__dirname + "/public/img"));

const server = app.listen(PORT, () => {
console.log(`Server listening on ${PORT}`);
});
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed server/public/img/tosidrop-logo/tosidrop-dark.png
Binary file not shown.
Binary file removed server/public/img/tosidrop-logo/tosidrop-light.png
Binary file not shown.
Binary file removed server/public/img/tosidrop-logo/tosidrop.png
Binary file not shown.
135 changes: 0 additions & 135 deletions server/public/json/projects.json

This file was deleted.

13 changes: 0 additions & 13 deletions server/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
import { GetPricePairs } from "../../client/src/entities/min.entities";
import {
ClaimableToken,
GetPools,
GetRewardsDto,
VmDeliveredReward,
VmTokenInfoMap,
Expand Down Expand Up @@ -168,18 +167,6 @@ export async function postPoolInfo(pools: string[]) {
return postFromKoios<PoolInfo[]>("pool_info", { _pool_bech32_ids: pools });
}

export async function getPools() {
let pools = longTermCache.get("pools") as GetPools;
if (pools == null) {
pools = await getFromVM<GetPools>("get_pools");
Object.values(pools).forEach((pool) => {
pool.id = convertPoolIdToBech32(pool.id);
});
longTermCache.set("pools", pools);
}
return pools;
}

export async function getTokens(options?: {
flushCache?: boolean;
}): Promise<VmTokenInfoMap> {
Expand Down

0 comments on commit 0a64f21

Please sign in to comment.