Skip to content

Commit

Permalink
run biome unsafe lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtycajunrice committed Dec 11, 2024
1 parent 631870f commit 5ddd7d8
Show file tree
Hide file tree
Showing 69 changed files with 119 additions and 121 deletions.
14 changes: 7 additions & 7 deletions src/server/listeners/update-tx-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export const updateTxListener = async (): Promise<void> => {
logger({
service: "server",
level: "info",
message: `Listening for updated transactions`,
message: "Listening for updated transactions",
});

const connection = await knex.client.acquireConnection();
connection.query(`LISTEN updated_transaction_data`);
connection.query("LISTEN updated_transaction_data");

connection.on(
"notification",
Expand All @@ -28,7 +28,7 @@ export const updateTxListener = async (): Promise<void> => {
(sub) => sub.requestId === parsedPayload.id,
);

if (index == -1) {
if (index === -1) {
return;
}

Expand All @@ -55,7 +55,7 @@ export const updateTxListener = async (): Promise<void> => {
logger({
service: "server",
level: "info",
message: `[updateTxListener] Connection database ended`,
message: "[updateTxListener] Connection database ended",
});

knex.client.releaseConnection(connection);
Expand All @@ -64,15 +64,15 @@ export const updateTxListener = async (): Promise<void> => {
logger({
service: "server",
level: "info",
message: `[updateTxListener] Released database connection on end`,
message: "[updateTxListener] Released database connection on end",
});
});

connection.on("error", async (err: any) => {
logger({
service: "server",
level: "error",
message: `[updateTxListener] Database connection error`,
message: "[updateTxListener] Database connection error",
error: err,
});

Expand All @@ -82,7 +82,7 @@ export const updateTxListener = async (): Promise<void> => {
logger({
service: "worker",
level: "info",
message: `[updateTxListener] Released database connection on error`,
message: "[updateTxListener] Released database connection on error",
});
});
};
9 changes: 4 additions & 5 deletions src/server/middleware/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export async function withAuth(server: FastifyInstance) {
}
// Allow this request to proceed.
return;
} else if (error) {
}if (error) {
message = error;
}
} catch (err: any) {
Expand Down Expand Up @@ -172,11 +172,10 @@ export const onRequest = async ({
const authWallet = await getAuthWallet();
if (publicKey === (await authWallet.getAddress())) {
return await handleAccessToken(jwt, req, getUser);
} else if (publicKey === THIRDWEB_DASHBOARD_ISSUER) {
}if (publicKey === THIRDWEB_DASHBOARD_ISSUER) {
return await handleDashboardAuth(jwt);
} else {
return await handleKeypairAuth({ jwt, req, publicKey });
}
return await handleKeypairAuth({ jwt, req, publicKey });
}

// Get the public key hash from the `kid` header.
Expand Down Expand Up @@ -383,7 +382,7 @@ const handleAccessToken = async (

try {
token = await getAccessToken({ jwt });
} catch (e) {
} catch (_e) {
// Missing or invalid signature. This will occur if the JWT not intended for this auth pattern.
return { isAuthed: false };
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/middleware/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const isZodError = (err: unknown): boolean => {

export function withErrorHandler(server: FastifyInstance) {
server.setErrorHandler(
(error: string | Error | CustomError | ZodError, request, reply) => {
(error: string | Error | CustomError | ZodError, _request, reply) => {
if (typeof error === "string") {
return reply.status(StatusCodes.INTERNAL_SERVER_ERROR).send({
error: {
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/auth/access-tokens/get-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function getAllAccessTokens(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const accessTokens = await getAccessTokens();
res.status(StatusCodes.OK).send({
result: accessTokens.map((token) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/auth/keypair/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function listPublicKeys(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const keypairs = await listKeypairs();

res.status(StatusCodes.OK).send({
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/auth/permissions/get-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function getAllPermissions(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const permissions = await prisma.permissions.findMany();
res.status(StatusCodes.OK).send({
result: permissions,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/backend-wallet/get-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function getBalance(fastify: FastifyInstance) {
const chainId = await getChainIdFromChain(chain);
const sdk = await getSdk({ chainId });

let balanceData = await sdk.getBalance(walletAddress);
const balanceData = await sdk.getBalance(walletAddress);

reply.status(StatusCodes.OK).send({
result: {
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/backend-wallet/simulate-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function simulateTransaction(fastify: FastifyInstance) {

const chainId = await getChainIdFromChain(chain);

let queuedTransaction: QueuedTransaction = {
const queuedTransaction: QueuedTransaction = {
status: "queued",
queueId: randomUUID(),
queuedAt: new Date(),
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/chain/get-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function getAllChainData(fastify: FastifyInstance) {
[StatusCodes.OK]: responseSchema,
},
},
handler: async (request, reply) => {
handler: async (_request, reply) => {
const allChains = (await fetchChains()) ?? [];
const config = await getConfig();

Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/configuration/auth/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function getAuthConfiguration(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig();
res.status(StatusCodes.OK).send({
result: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function getBackendWalletBalanceConfiguration(
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig();
res.status(StatusCodes.OK).send({
result: {
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/configuration/cache/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function getCacheConfiguration(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig();
res.status(StatusCodes.OK).send({
result: {
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/configuration/chains/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function getChainsConfiguration(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig();
const result: Static<typeof chainResponseSchema>[] = config.chainOverrides
? JSON.parse(config.chainOverrides)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function getContractSubscriptionsConfiguration(
[StatusCodes.OK]: responseSchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig();
res.status(StatusCodes.OK).send({
result: {
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/configuration/cors/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function getCorsConfiguration(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig(false);

// Omit required domains.
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/configuration/ip/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function getIpAllowlist(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig(false);

res.status(StatusCodes.OK).send({
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/configuration/transactions/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function getTransactionConfiguration(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const config = await getConfig();
res.status(StatusCodes.OK).send({
result: {
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/events/get-all-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function getAllEvents(fastify: FastifyInstance) {
contractAddress,
});

let returnData = await contract.events.getAllEvents({
const returnData = await contract.events.getAllEvents({
fromBlock,
toBlock,
order,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FastifyInstance } from "fastify";
import type { FastifyInstance } from "fastify";
import { getAllAccounts } from "./read/get-all-accounts";
import { getAssociatedAccounts } from "./read/get-associated-accounts";
import { isAccountDeployed } from "./read/is-account-deployed";
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/extensions/account/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FastifyInstance } from "fastify";
import type { FastifyInstance } from "fastify";
import { getAllAdmins } from "./read/get-all-admins";
import { getAllSessions } from "./read/get-all-sessions";
import { grantAdmin } from "./write/grant-admin";
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/metadata/abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function getABI(fastify: FastifyInstance) {
contractAddress,
});

let returnData = contract.abi;
const returnData = contract.abi;

reply.status(StatusCodes.OK).send({
result: returnData,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/metadata/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function extractEvents(fastify: FastifyInstance) {
contractAddress,
});

let returnData = await contract.publishedMetadata.extractEvents();
const returnData = await contract.publishedMetadata.extractEvents();

reply.status(StatusCodes.OK).send({
result: returnData,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/metadata/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function getContractExtensions(fastify: FastifyInstance) {
contractAddress,
});

let returnData = getAllDetectedExtensionNames(contract.abi);
const returnData = getAllDetectedExtensionNames(contract.abi);

reply.status(StatusCodes.OK).send({
result: returnData,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/metadata/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function extractFunctions(fastify: FastifyInstance) {
contractAddress,
});

let returnData = await contract.publishedMetadata.extractFunctions();
const returnData = await contract.publishedMetadata.extractFunctions();

reply.status(StatusCodes.OK).send({
result: returnData,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/roles/read/get-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function getAllRoles(fastify: FastifyInstance) {
contractAddress,
});

let returnData = (await contract.roles.getAll()) as Static<
const returnData = (await contract.roles.getAll()) as Static<
typeof responseSchema
>["result"];

Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/contract/roles/read/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function getRoles(fastify: FastifyInstance) {
contractAddress,
});

let returnData = await contract.roles.get(role);
const returnData = await contract.roles.get(role);

reply.status(StatusCodes.OK).send({
result: returnData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export async function addContractSubscription(fastify: FastifyInstance) {
const provider = sdk.getProvider();
const currentBlockNumber = await provider.getBlockNumber();
await upsertChainIndexer({ chainId, currentBlockNumber });
} catch (error) {
} catch (_error) {
// this is fine, must be already locked, so don't need to update current block as this will be recent
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function getContractSubscriptions(fastify: FastifyInstance) {
[StatusCodes.OK]: responseSchema,
},
},
handler: async (request, reply) => {
handler: async (_request, reply) => {
const contractSubscriptions = await getAllContractSubscriptions();

reply.status(StatusCodes.OK).send({
Expand Down
6 changes: 3 additions & 3 deletions src/server/routes/deploy/contract-types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Static, Type } from "@sinclair/typebox";
import { type Static, Type } from "@sinclair/typebox";
import { PREBUILT_CONTRACTS_MAP } from "@thirdweb-dev/sdk";
import { FastifyInstance } from "fastify";
import type { FastifyInstance } from "fastify";
import { StatusCodes } from "http-status-codes";
import { standardResponseSchema } from "../../schemas/shared-api-schemas";

Expand All @@ -25,7 +25,7 @@ export async function contractTypes(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (request, reply) => {
handler: async (_request, reply) => {
reply.status(StatusCodes.OK).send({
result: Object.keys(PREBUILT_CONTRACTS_MAP),
});
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/deploy/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FastifyInstance } from "fastify";
import type { FastifyInstance } from "fastify";
import { deployPrebuiltEdition } from "./prebuilts/edition";
import { deployPrebuiltEditionDrop } from "./prebuilts/edition-drop";
import { deployPrebuiltMarketplaceV3 } from "./prebuilts/marketplace-v3";
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/deploy/prebuilt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const requestBodySchema = Type.Object({
requestBodySchema.examples = [
{
contractMetadata: {
name: `My Contract`,
name: "My Contract",
description: "Contract deployed from thirdweb Engine",
primary_sale_recipient: "0x1946267d81Fb8aDeeEa28e6B98bcD446c8248473",
seller_fee_basis_points: 500,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/relayer/get-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function getAllRelayers(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
const relayers = await prisma.relayers.findMany();

return res.status(StatusCodes.OK).send({
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export async function relayTransaction(fastify: FastifyInstance) {
},
});
return;
} else if (req.body.type === "permit") {
}if (req.body.type === "permit") {
// EIP-2612
const { request, signature } = req.body;
const { v, r, s } = utils.splitSignature(signature);
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/system/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function queueStatus(fastify: FastifyInstance) {
[StatusCodes.OK]: responseBodySchema,
},
},
handler: async (req, res) => {
handler: async (_req, res) => {
// Get # queued and sent transactions.
const queued = await SendTransactionQueue.length();
const pending = await MineTransactionQueue.length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function getUserOpReceipt(fastify: FastifyInstance) {
reply.status(StatusCodes.OK).send({
result: json.result,
});
} catch (e) {
} catch (_e) {
throw createCustomError(
"Unable to get receipt.",
StatusCodes.INTERNAL_SERVER_ERROR,
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/transaction/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function cancelTransaction(fastify: FastifyInstance) {
);
}

let message = "Transaction successfully cancelled.";
const message = "Transaction successfully cancelled.";
let cancelledTransaction: CancelledTransaction | null = null;
if (!transaction.isUserOp) {
if (transaction.status === "queued") {
Expand Down
Loading

0 comments on commit 5ddd7d8

Please sign in to comment.