Skip to content

Commit

Permalink
Prettify code
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzdogan committed Sep 19, 2024
1 parent 30a7ae9 commit fdf88a5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ export function updateUnused(unused: string[], session: Session) {
session.unusedSources = unused;
}

export const checkContractsInSession = async (solc: ISolidityCompiler,session: Session) => {
export const checkContractsInSession = async (
solc: ISolidityCompiler,
session: Session,
) => {
const pathBuffers: PathBuffer[] = [];
for (const id in session.inputFiles) {
const pathContent = session.inputFiles[id];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const router: Router = Router();
router.route("/verify").post(safeHandler(legacyVerifyEndpoint));

router.route("/verify-deprecated").post((req, res, next) => {
const verifyDeprecatedEnabled = req.app.get('verifyDeprecated') as boolean;
const verifyDeprecatedEnabled = req.app.get("verifyDeprecated") as boolean;
if (verifyDeprecatedEnabled) {
safeHandler(verifyDeprecated)(req, res, next);
} else {
Expand Down
2 changes: 1 addition & 1 deletion services/server/src/server/services/StorageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class StorageService {
const sourcifyDatabase = new SourcifyDatabaseService(
this,
options.sourcifyDatabaseServiceOptions,
options.repositoryV1ServiceOptions.repositoryServerUrl
options.repositoryV1ServiceOptions.repositoryServerUrl,
);
this.rwServices[sourcifyDatabase.IDENTIFIER] = sourcifyDatabase;
} else {
Expand Down
5 changes: 3 additions & 2 deletions services/server/src/server/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import session from "express-session";
import logger from "../common/logger";
import { NextFunction, Request, Response } from "express";


export default function getSessionMiddleware(sessionOptions: session.SessionOptions) {
export default function getSessionMiddleware(
sessionOptions: session.SessionOptions,
) {
const sessionMiddleware = session(sessionOptions);
// We need to wrap the sessionMiddleware in a middleware to prevent it from returning all the postgresql errors in the 500 request
return (req: Request, res: Response, next: NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion services/server/src/sourcify-chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ if (missingChains.length > 0) {
}
}

export { sourcifyChainsMap }
export { sourcifyChainsMap };
21 changes: 14 additions & 7 deletions services/server/test/unit/utils/contract-creation-util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { ChainRepository } from "../../../src/sourcify-chain-repository";

describe("contract creation util", function () {
it("should run getCreatorTx with chainId 40", async function () {
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap).sourcifyChainsArray;
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap)
.sourcifyChainsArray;
const sourcifyChain = sourcifyChainsArray.find(
(sourcifyChain) => sourcifyChain.chainId === 40,
);
Expand Down Expand Up @@ -43,7 +44,8 @@ describe("contract creation util", function () {
// });

it("should run getCreatorTx with chainId 83", async function () {
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap).sourcifyChainsArray;
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap)
.sourcifyChainsArray;
const sourcifyChain = sourcifyChainsArray.find(
(sourcifyChain) => sourcifyChain.chainId === 83,
);
Expand All @@ -62,7 +64,8 @@ describe("contract creation util", function () {
});

it("should run getCreatorTx with chainId 335", async function () {
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap).sourcifyChainsArray;
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap)
.sourcifyChainsArray;
const sourcifyChain = sourcifyChainsArray.find(
(sourcifyChain) => sourcifyChain.chainId === 335,
);
Expand All @@ -81,7 +84,8 @@ describe("contract creation util", function () {
});

it("should run getCreatorTx with regex for new Blockscout", async function () {
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap).sourcifyChainsArray;
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap)
.sourcifyChainsArray;
const sourcifyChain = sourcifyChainsArray.find(
(sourcifyChain) => sourcifyChain.chainId === 100,
);
Expand All @@ -100,7 +104,8 @@ describe("contract creation util", function () {
});

it("should run getCreatorTx with regex for old Blockscout", async function () {
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap).sourcifyChainsArray;
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap)
.sourcifyChainsArray;
const sourcifyChain = sourcifyChainsArray.find(
(sourcifyChain) => sourcifyChain.chainId === 57,
);
Expand All @@ -124,7 +129,8 @@ describe("contract creation util", function () {
return;
}

const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap).sourcifyChainsArray;
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap)
.sourcifyChainsArray;
const sourcifyChain = sourcifyChainsArray.find(
(sourcifyChain) => sourcifyChain.chainId === 1,
);
Expand All @@ -143,7 +149,8 @@ describe("contract creation util", function () {
});

it("should run getCreatorTx with nexusApi for Nexus", async function () {
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap).sourcifyChainsArray;
const sourcifyChainsArray = new ChainRepository(sourcifyChainsMap)
.sourcifyChainsArray;
const sourcifyChain = sourcifyChainsArray.find(
(sourcifyChain) => sourcifyChain.chainId === 23294,
);
Expand Down

0 comments on commit fdf88a5

Please sign in to comment.