diff --git a/src/server/listeners/update-tx-listener.ts b/src/server/listeners/update-tx-listener.ts index 150a41650..d871d0000 100644 --- a/src/server/listeners/update-tx-listener.ts +++ b/src/server/listeners/update-tx-listener.ts @@ -12,11 +12,11 @@ export const updateTxListener = async (): Promise => { 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", @@ -28,7 +28,7 @@ export const updateTxListener = async (): Promise => { (sub) => sub.requestId === parsedPayload.id, ); - if (index == -1) { + if (index === -1) { return; } @@ -55,7 +55,7 @@ export const updateTxListener = async (): Promise => { logger({ service: "server", level: "info", - message: `[updateTxListener] Connection database ended`, + message: "[updateTxListener] Connection database ended", }); knex.client.releaseConnection(connection); @@ -64,7 +64,7 @@ export const updateTxListener = async (): Promise => { logger({ service: "server", level: "info", - message: `[updateTxListener] Released database connection on end`, + message: "[updateTxListener] Released database connection on end", }); }); @@ -72,7 +72,7 @@ export const updateTxListener = async (): Promise => { logger({ service: "server", level: "error", - message: `[updateTxListener] Database connection error`, + message: "[updateTxListener] Database connection error", error: err, }); @@ -82,7 +82,7 @@ export const updateTxListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `[updateTxListener] Released database connection on error`, + message: "[updateTxListener] Released database connection on error", }); }); }; diff --git a/src/server/middleware/auth.ts b/src/server/middleware/auth.ts index 79690e376..99df90131 100644 --- a/src/server/middleware/auth.ts +++ b/src/server/middleware/auth.ts @@ -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) { @@ -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. @@ -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 }; } diff --git a/src/server/middleware/error.ts b/src/server/middleware/error.ts index f993750f9..3957f2758 100644 --- a/src/server/middleware/error.ts +++ b/src/server/middleware/error.ts @@ -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: { diff --git a/src/server/routes/auth/access-tokens/get-all.ts b/src/server/routes/auth/access-tokens/get-all.ts index d1a274833..f71adc643 100644 --- a/src/server/routes/auth/access-tokens/get-all.ts +++ b/src/server/routes/auth/access-tokens/get-all.ts @@ -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) => ({ diff --git a/src/server/routes/auth/keypair/list.ts b/src/server/routes/auth/keypair/list.ts index b5df85979..ca6bb6698 100644 --- a/src/server/routes/auth/keypair/list.ts +++ b/src/server/routes/auth/keypair/list.ts @@ -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({ diff --git a/src/server/routes/auth/permissions/get-all.ts b/src/server/routes/auth/permissions/get-all.ts index 737c195f6..2d8cab721 100644 --- a/src/server/routes/auth/permissions/get-all.ts +++ b/src/server/routes/auth/permissions/get-all.ts @@ -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, diff --git a/src/server/routes/backend-wallet/get-balance.ts b/src/server/routes/backend-wallet/get-balance.ts index 609d6a744..e569e96df 100644 --- a/src/server/routes/backend-wallet/get-balance.ts +++ b/src/server/routes/backend-wallet/get-balance.ts @@ -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: { diff --git a/src/server/routes/backend-wallet/simulate-transaction.ts b/src/server/routes/backend-wallet/simulate-transaction.ts index cffec3f82..ece15a242 100644 --- a/src/server/routes/backend-wallet/simulate-transaction.ts +++ b/src/server/routes/backend-wallet/simulate-transaction.ts @@ -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(), diff --git a/src/server/routes/chain/get-all.ts b/src/server/routes/chain/get-all.ts index c508739d7..ae716658b 100644 --- a/src/server/routes/chain/get-all.ts +++ b/src/server/routes/chain/get-all.ts @@ -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(); diff --git a/src/server/routes/configuration/auth/get.ts b/src/server/routes/configuration/auth/get.ts index 29c174b4f..0b97d971e 100644 --- a/src/server/routes/configuration/auth/get.ts +++ b/src/server/routes/configuration/auth/get.ts @@ -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: { diff --git a/src/server/routes/configuration/backend-wallet-balance/get.ts b/src/server/routes/configuration/backend-wallet-balance/get.ts index c547b40a5..59aa13d51 100644 --- a/src/server/routes/configuration/backend-wallet-balance/get.ts +++ b/src/server/routes/configuration/backend-wallet-balance/get.ts @@ -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: { diff --git a/src/server/routes/configuration/cache/get.ts b/src/server/routes/configuration/cache/get.ts index 986decc8a..9f55c7114 100644 --- a/src/server/routes/configuration/cache/get.ts +++ b/src/server/routes/configuration/cache/get.ts @@ -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: { diff --git a/src/server/routes/configuration/chains/get.ts b/src/server/routes/configuration/chains/get.ts index 1c39b7827..9c0226bdf 100644 --- a/src/server/routes/configuration/chains/get.ts +++ b/src/server/routes/configuration/chains/get.ts @@ -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[] = config.chainOverrides ? JSON.parse(config.chainOverrides) diff --git a/src/server/routes/configuration/contract-subscriptions/get.ts b/src/server/routes/configuration/contract-subscriptions/get.ts index b80669d37..624e08084 100644 --- a/src/server/routes/configuration/contract-subscriptions/get.ts +++ b/src/server/routes/configuration/contract-subscriptions/get.ts @@ -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: { diff --git a/src/server/routes/configuration/cors/get.ts b/src/server/routes/configuration/cors/get.ts index fef2c9834..0dc380626 100644 --- a/src/server/routes/configuration/cors/get.ts +++ b/src/server/routes/configuration/cors/get.ts @@ -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. diff --git a/src/server/routes/configuration/ip/get.ts b/src/server/routes/configuration/ip/get.ts index de3d71c58..2e8a3a2f4 100644 --- a/src/server/routes/configuration/ip/get.ts +++ b/src/server/routes/configuration/ip/get.ts @@ -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({ diff --git a/src/server/routes/configuration/transactions/get.ts b/src/server/routes/configuration/transactions/get.ts index 9e40d0479..e86533968 100644 --- a/src/server/routes/configuration/transactions/get.ts +++ b/src/server/routes/configuration/transactions/get.ts @@ -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: { diff --git a/src/server/routes/contract/events/get-all-events.ts b/src/server/routes/contract/events/get-all-events.ts index 240bc0f55..d8777a32d 100644 --- a/src/server/routes/contract/events/get-all-events.ts +++ b/src/server/routes/contract/events/get-all-events.ts @@ -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, diff --git a/src/server/routes/contract/extensions/account-factory/index.ts b/src/server/routes/contract/extensions/account-factory/index.ts index dae7263fc..5934ba12a 100644 --- a/src/server/routes/contract/extensions/account-factory/index.ts +++ b/src/server/routes/contract/extensions/account-factory/index.ts @@ -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"; diff --git a/src/server/routes/contract/extensions/account/index.ts b/src/server/routes/contract/extensions/account/index.ts index fc5ed960d..c50ac0855 100644 --- a/src/server/routes/contract/extensions/account/index.ts +++ b/src/server/routes/contract/extensions/account/index.ts @@ -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"; diff --git a/src/server/routes/contract/metadata/abi.ts b/src/server/routes/contract/metadata/abi.ts index 1a89be573..25407cf2b 100644 --- a/src/server/routes/contract/metadata/abi.ts +++ b/src/server/routes/contract/metadata/abi.ts @@ -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, diff --git a/src/server/routes/contract/metadata/events.ts b/src/server/routes/contract/metadata/events.ts index 65183b070..2292be868 100644 --- a/src/server/routes/contract/metadata/events.ts +++ b/src/server/routes/contract/metadata/events.ts @@ -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, diff --git a/src/server/routes/contract/metadata/extensions.ts b/src/server/routes/contract/metadata/extensions.ts index 91937dd74..99da1ebc4 100644 --- a/src/server/routes/contract/metadata/extensions.ts +++ b/src/server/routes/contract/metadata/extensions.ts @@ -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, diff --git a/src/server/routes/contract/metadata/functions.ts b/src/server/routes/contract/metadata/functions.ts index 59dd6356a..073d10d90 100644 --- a/src/server/routes/contract/metadata/functions.ts +++ b/src/server/routes/contract/metadata/functions.ts @@ -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, diff --git a/src/server/routes/contract/roles/read/get-all.ts b/src/server/routes/contract/roles/read/get-all.ts index feb579acb..adfeca05f 100644 --- a/src/server/routes/contract/roles/read/get-all.ts +++ b/src/server/routes/contract/roles/read/get-all.ts @@ -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"]; diff --git a/src/server/routes/contract/roles/read/get.ts b/src/server/routes/contract/roles/read/get.ts index 398686032..983c5b698 100644 --- a/src/server/routes/contract/roles/read/get.ts +++ b/src/server/routes/contract/roles/read/get.ts @@ -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, diff --git a/src/server/routes/contract/subscriptions/add-contract-subscription.ts b/src/server/routes/contract/subscriptions/add-contract-subscription.ts index c890b2479..57545eda0 100644 --- a/src/server/routes/contract/subscriptions/add-contract-subscription.ts +++ b/src/server/routes/contract/subscriptions/add-contract-subscription.ts @@ -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 } } diff --git a/src/server/routes/contract/subscriptions/get-contract-subscriptions.ts b/src/server/routes/contract/subscriptions/get-contract-subscriptions.ts index 562097770..747aa5870 100644 --- a/src/server/routes/contract/subscriptions/get-contract-subscriptions.ts +++ b/src/server/routes/contract/subscriptions/get-contract-subscriptions.ts @@ -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({ diff --git a/src/server/routes/deploy/contract-types.ts b/src/server/routes/deploy/contract-types.ts index 7944aa585..b9f671bf9 100644 --- a/src/server/routes/deploy/contract-types.ts +++ b/src/server/routes/deploy/contract-types.ts @@ -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"; @@ -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), }); diff --git a/src/server/routes/deploy/index.ts b/src/server/routes/deploy/index.ts index 7815ec974..641d894db 100644 --- a/src/server/routes/deploy/index.ts +++ b/src/server/routes/deploy/index.ts @@ -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"; diff --git a/src/server/routes/deploy/prebuilt.ts b/src/server/routes/deploy/prebuilt.ts index 00b159b47..883768b6d 100644 --- a/src/server/routes/deploy/prebuilt.ts +++ b/src/server/routes/deploy/prebuilt.ts @@ -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, diff --git a/src/server/routes/relayer/get-all.ts b/src/server/routes/relayer/get-all.ts index 59ce734b7..8311f3464 100644 --- a/src/server/routes/relayer/get-all.ts +++ b/src/server/routes/relayer/get-all.ts @@ -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({ diff --git a/src/server/routes/relayer/index.ts b/src/server/routes/relayer/index.ts index c93e22077..2f5883768 100644 --- a/src/server/routes/relayer/index.ts +++ b/src/server/routes/relayer/index.ts @@ -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); diff --git a/src/server/routes/system/queue.ts b/src/server/routes/system/queue.ts index 38b1c52e4..54b3adf58 100644 --- a/src/server/routes/system/queue.ts +++ b/src/server/routes/system/queue.ts @@ -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(); diff --git a/src/server/routes/transaction/blockchain/get-user-op-receipt.ts b/src/server/routes/transaction/blockchain/get-user-op-receipt.ts index 8851a252a..cee358858 100644 --- a/src/server/routes/transaction/blockchain/get-user-op-receipt.ts +++ b/src/server/routes/transaction/blockchain/get-user-op-receipt.ts @@ -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, diff --git a/src/server/routes/transaction/cancel.ts b/src/server/routes/transaction/cancel.ts index 9db14dd39..866e207eb 100644 --- a/src/server/routes/transaction/cancel.ts +++ b/src/server/routes/transaction/cancel.ts @@ -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") { diff --git a/src/server/routes/transaction/status.ts b/src/server/routes/transaction/status.ts index d597de3df..60dcb18ba 100644 --- a/src/server/routes/transaction/status.ts +++ b/src/server/routes/transaction/status.ts @@ -125,7 +125,7 @@ export async function checkTxStatus(fastify: FastifyInstance) { onError(error, connection, request); }); - connection.socket.on("message", async (message, isBinary) => { + connection.socket.on("message", async (_message, _isBinary) => { onMessage(connection, request); }); diff --git a/src/server/routes/webhooks/events.ts b/src/server/routes/webhooks/events.ts index 4ad95e28a..05feda3a1 100644 --- a/src/server/routes/webhooks/events.ts +++ b/src/server/routes/webhooks/events.ts @@ -24,7 +24,7 @@ export async function getWebhooksEventTypes(fastify: FastifyInstance) { [StatusCodes.OK]: responseBodySchema, }, }, - handler: async (req, res) => { + handler: async (_req, res) => { const eventTypesArray = Object.values(WebhooksEventTypes); res.status(StatusCodes.OK).send({ result: eventTypesArray, diff --git a/src/server/routes/webhooks/get-all.ts b/src/server/routes/webhooks/get-all.ts index a30a56194..a77db4c57 100644 --- a/src/server/routes/webhooks/get-all.ts +++ b/src/server/routes/webhooks/get-all.ts @@ -25,7 +25,7 @@ export async function getAllWebhooksData(fastify: FastifyInstance) { [StatusCodes.OK]: responseBodySchema, }, }, - handler: async (req, res) => { + handler: async (_req, res) => { const webhooks = await getAllWebhooks(); res.status(StatusCodes.OK).send({ diff --git a/src/server/schemas/erc20/index.ts b/src/server/schemas/erc20/index.ts index 76a2a98db..1b8df828d 100644 --- a/src/server/schemas/erc20/index.ts +++ b/src/server/schemas/erc20/index.ts @@ -1,4 +1,4 @@ -import { Static, Type } from "@sinclair/typebox"; +import { type Static, Type } from "@sinclair/typebox"; import { AddressSchema } from "../address"; export const erc20MetadataSchema = Type.Object({ diff --git a/src/server/schemas/nft/index.ts b/src/server/schemas/nft/index.ts index 31ae133b7..f1d646bce 100644 --- a/src/server/schemas/nft/index.ts +++ b/src/server/schemas/nft/index.ts @@ -1,5 +1,5 @@ -import { Static, Type } from "@sinclair/typebox"; -import { BigNumber } from "ethers"; +import { type Static, Type } from "@sinclair/typebox"; +import type { BigNumber } from "ethers"; import { AddressSchema } from "../address"; import { NumberStringSchema } from "../number"; diff --git a/src/server/schemas/websocket/index.ts b/src/server/schemas/websocket/index.ts index a1168fc07..77b68f082 100644 --- a/src/server/schemas/websocket/index.ts +++ b/src/server/schemas/websocket/index.ts @@ -1,5 +1,5 @@ // types.ts -import { WebSocket } from "ws"; +import type { WebSocket } from "ws"; export interface UserSubscription { socket: WebSocket; diff --git a/src/server/utils/marketplace-v3.ts b/src/server/utils/marketplace-v3.ts index b880c9e4c..9b9560cce 100644 --- a/src/server/utils/marketplace-v3.ts +++ b/src/server/utils/marketplace-v3.ts @@ -1,4 +1,4 @@ -import { DirectListingV3, EnglishAuction, OfferV3 } from "@thirdweb-dev/sdk"; +import type { DirectListingV3, EnglishAuction, OfferV3 } from "@thirdweb-dev/sdk"; export const formatDirectListingV3Result = (listing: DirectListingV3) => { return { diff --git a/src/server/utils/openapi.ts b/src/server/utils/openapi.ts index 6b6e1b06f..3dd14ea76 100644 --- a/src/server/utils/openapi.ts +++ b/src/server/utils/openapi.ts @@ -1,5 +1,5 @@ -import { FastifyInstance } from "fastify"; -import fs from "fs"; +import type { FastifyInstance } from "fastify"; +import fs from "node:fs"; export const writeOpenApiToFile = (server: FastifyInstance) => { try { diff --git a/src/server/utils/websocket.ts b/src/server/utils/websocket.ts index b18f1dd13..e01f00715 100644 --- a/src/server/utils/websocket.ts +++ b/src/server/utils/websocket.ts @@ -10,7 +10,7 @@ const timeoutDuration = 10 * 60 * 1000; export const findWSConnectionInSharedState = async ( connection: SocketStream, - request: FastifyRequest, + _request: FastifyRequest, ): Promise => { const index = subscriptionsData.findIndex( (sub) => sub.socket === connection.socket, @@ -23,7 +23,7 @@ export const removeWSFromSharedState = async ( request: FastifyRequest, ): Promise => { const index = await findWSConnectionInSharedState(connection, request); - if (index == -1) { + if (index === -1) { return -1; } subscriptionsData.splice(index, 1); @@ -38,12 +38,12 @@ export const onError = async ( logger({ service: "server", level: "error", - message: `Websocket error`, + message: "Websocket error", error, }); const index = await findWSConnectionInSharedState(connection, request); - if (index == -1) { + if (index === -1) { return; } @@ -84,7 +84,7 @@ export const onClose = async ( request: FastifyRequest, ): Promise => { const index = await findWSConnectionInSharedState(connection, request); - if (index == -1) { + if (index === -1) { return; } subscriptionsData.splice(index, 1); @@ -140,7 +140,7 @@ export const getStatusMessageAndConnectionStatus = async ( let closeConnection = false; if (!data) { - message = `Transaction not found. Make sure the provided ID is correct.`; + message = "Transaction not found. Make sure the provided ID is correct."; closeConnection = true; } else if (data.status === "mined") { message = "Transaction mined. Closing connection."; diff --git a/src/shared/db/contract-transaction-receipts/create-contract-transaction-receipts.ts b/src/shared/db/contract-transaction-receipts/create-contract-transaction-receipts.ts index ac3396516..a8843b0fc 100644 --- a/src/shared/db/contract-transaction-receipts/create-contract-transaction-receipts.ts +++ b/src/shared/db/contract-transaction-receipts/create-contract-transaction-receipts.ts @@ -1,5 +1,5 @@ -import { ContractTransactionReceipts, Prisma } from "@prisma/client"; -import { PrismaTransaction } from "../../schemas/prisma"; +import type { ContractTransactionReceipts, Prisma } from "@prisma/client"; +import type { PrismaTransaction } from "../../schemas/prisma"; import { getPrismaWithPostgresTx } from "../client"; export interface BulkInsertContractLogsParams { diff --git a/src/shared/db/keypair/delete.ts b/src/shared/db/keypair/delete.ts index 08fd6529c..f731594fb 100644 --- a/src/shared/db/keypair/delete.ts +++ b/src/shared/db/keypair/delete.ts @@ -1,4 +1,4 @@ -import { Keypairs } from "@prisma/client"; +import type { Keypairs } from "@prisma/client"; import { prisma } from "../client"; export const deleteKeypair = async ({ diff --git a/src/shared/db/keypair/get.ts b/src/shared/db/keypair/get.ts index 37e1cf00d..bc4b4997a 100644 --- a/src/shared/db/keypair/get.ts +++ b/src/shared/db/keypair/get.ts @@ -1,4 +1,4 @@ -import { Keypairs } from "@prisma/client"; +import type { Keypairs } from "@prisma/client"; import { createHash } from "crypto"; import { prisma } from "../client"; diff --git a/src/shared/db/keypair/list.ts b/src/shared/db/keypair/list.ts index cc08bbda8..0bf1dc494 100644 --- a/src/shared/db/keypair/list.ts +++ b/src/shared/db/keypair/list.ts @@ -1,4 +1,4 @@ -import { Keypairs } from "@prisma/client"; +import type { Keypairs } from "@prisma/client"; import { prisma } from "../client"; export const listKeypairs = async (): Promise => { diff --git a/src/shared/db/tokens/create-token.ts b/src/shared/db/tokens/create-token.ts index 235e00bb7..41c973155 100644 --- a/src/shared/db/tokens/create-token.ts +++ b/src/shared/db/tokens/create-token.ts @@ -16,7 +16,7 @@ export const createToken = async ({ return prisma.tokens.create({ data: { id: payload.jti, - tokenMask: jwt.slice(0, 10) + "..." + jwt.slice(-10), + tokenMask: `${jwt.slice(0, 10)}...${jwt.slice(-10)}`, walletAddress: payload.sub, expiresAt: new Date(payload.exp * 1000), isAccessToken, diff --git a/src/shared/db/transactions/db.ts b/src/shared/db/transactions/db.ts index c58dbea7b..3250e5cb2 100644 --- a/src/shared/db/transactions/db.ts +++ b/src/shared/db/transactions/db.ts @@ -33,10 +33,10 @@ import type { AnyTransaction } from "../../utils/transaction/types"; export class TransactionDB { private static transactionDetailsKey = (queueId: string) => `transaction:${queueId}`; - private static queuedTransactionsKey = `transaction:queued`; - private static minedTransactionsKey = `transaction:mined`; - private static cancelledTransactionsKey = `transaction:cancelled`; - private static erroredTransactionsKey = `transaction:errored`; + private static queuedTransactionsKey = "transaction:queued"; + private static minedTransactionsKey = "transaction:mined"; + private static cancelledTransactionsKey = "transaction:cancelled"; + private static erroredTransactionsKey = "transaction:errored"; /** * Inserts or replaces a transaction details. diff --git a/src/shared/db/wallets/delete-wallet-details.ts b/src/shared/db/wallets/delete-wallet-details.ts index 69e5fd3da..96aeb3860 100644 --- a/src/shared/db/wallets/delete-wallet-details.ts +++ b/src/shared/db/wallets/delete-wallet-details.ts @@ -1,4 +1,4 @@ -import { Address } from "thirdweb"; +import type { Address } from "thirdweb"; import { prisma } from "../client"; export const deleteWalletDetails = async (walletAddress: Address) => { diff --git a/src/shared/db/wallets/get-all-wallets.ts b/src/shared/db/wallets/get-all-wallets.ts index 5f0603e81..249ea2c1c 100644 --- a/src/shared/db/wallets/get-all-wallets.ts +++ b/src/shared/db/wallets/get-all-wallets.ts @@ -1,4 +1,4 @@ -import { PrismaTransaction } from "../../schemas/prisma"; +import type { PrismaTransaction } from "../../schemas/prisma"; import { getPrismaWithPostgresTx } from "../client"; interface GetAllWalletsParams { diff --git a/src/shared/db/webhooks/create-webhook.ts b/src/shared/db/webhooks/create-webhook.ts index 7c32a5f13..0b3ebb151 100644 --- a/src/shared/db/webhooks/create-webhook.ts +++ b/src/shared/db/webhooks/create-webhook.ts @@ -1,6 +1,6 @@ -import { Webhooks } from "@prisma/client"; +import type { Webhooks } from "@prisma/client"; import { createHash, randomBytes } from "crypto"; -import { WebhooksEventTypes } from "../../schemas/webhooks"; +import type { WebhooksEventTypes } from "../../schemas/webhooks"; import { prisma } from "../client"; interface CreateWebhooksParams { diff --git a/src/shared/db/webhooks/get-all-webhooks.ts b/src/shared/db/webhooks/get-all-webhooks.ts index 85e93eefc..1f76e76c8 100644 --- a/src/shared/db/webhooks/get-all-webhooks.ts +++ b/src/shared/db/webhooks/get-all-webhooks.ts @@ -1,4 +1,4 @@ -import { Webhooks } from "@prisma/client"; +import type { Webhooks } from "@prisma/client"; import { prisma } from "../client"; export const getAllWebhooks = async (): Promise => { diff --git a/src/shared/schemas/prisma.ts b/src/shared/schemas/prisma.ts index abe01be4c..03c088379 100644 --- a/src/shared/schemas/prisma.ts +++ b/src/shared/schemas/prisma.ts @@ -1,5 +1,5 @@ import type { Prisma, PrismaClient } from "@prisma/client"; -import { DefaultArgs } from "@prisma/client/runtime/library"; +import type { DefaultArgs } from "@prisma/client/runtime/library"; export type PrismaTransaction = Omit< PrismaClient, diff --git a/src/shared/utils/block.ts b/src/shared/utils/block.ts index 9d7f61f20..36d6bfd0c 100644 --- a/src/shared/utils/block.ts +++ b/src/shared/utils/block.ts @@ -20,9 +20,9 @@ export const getBlockNumberish = async (chainId: number): Promise => { try { const blockNumber = await eth_blockNumber(rpcRequest); // Non-blocking update to cache. - redis.set(key, blockNumber.toString()).catch((e) => {}); + redis.set(key, blockNumber.toString()).catch((_e) => {}); return blockNumber; - } catch (e) { + } catch (_e) { const cached = await redis.get(key); if (cached) { return BigInt(cached); diff --git a/src/shared/utils/cache/clear-cache.ts b/src/shared/utils/cache/clear-cache.ts index 3a8cc423d..e70fa38be 100644 --- a/src/shared/utils/cache/clear-cache.ts +++ b/src/shared/utils/cache/clear-cache.ts @@ -7,7 +7,7 @@ import { webhookCache } from "./get-webhook"; import { keypairCache } from "./keypair"; export const clearCache = async ( - service: (typeof env)["LOG_SERVICES"][0], + _service: (typeof env)["LOG_SERVICES"][0], ): Promise => { invalidateConfig(); webhookCache.clear(); diff --git a/src/shared/utils/cron/clear-cache-cron.ts b/src/shared/utils/cron/clear-cache-cron.ts index 71c620862..6fed64673 100644 --- a/src/shared/utils/cron/clear-cache-cron.ts +++ b/src/shared/utils/cron/clear-cache-cron.ts @@ -1,7 +1,7 @@ import cron from "node-cron"; import { clearCache } from "../cache/clear-cache"; import { getConfig } from "../cache/get-config"; -import { env } from "../env"; +import type { env } from "../env"; let task: cron.ScheduledTask; export const clearCacheCron = async ( diff --git a/src/shared/utils/cron/is-valid-cron.ts b/src/shared/utils/cron/is-valid-cron.ts index 67ed4b462..7615fde8e 100644 --- a/src/shared/utils/cron/is-valid-cron.ts +++ b/src/shared/utils/cron/is-valid-cron.ts @@ -5,7 +5,7 @@ import { createCustomError } from "../../../server/middleware/error"; export const isValidCron = (input: string): boolean => { try { cronParser.parseExpression(input); - } catch (error) { + } catch (_error) { throw createCustomError( "Invalid cron expression. Please check the cron expression.", StatusCodes.BAD_REQUEST, diff --git a/src/shared/utils/crypto.ts b/src/shared/utils/crypto.ts index 7b9052dd4..4086d4a9e 100644 --- a/src/shared/utils/crypto.ts +++ b/src/shared/utils/crypto.ts @@ -14,7 +14,7 @@ export const isWellFormedPublicKey = (key: string) => { try { crypto.createPublicKey(key); return true; - } catch (e) { + } catch (_e) { return false; } }; diff --git a/src/shared/utils/logger.ts b/src/shared/utils/logger.ts index 120d06ac0..3b4372bf5 100644 --- a/src/shared/utils/logger.ts +++ b/src/shared/utils/logger.ts @@ -45,9 +45,8 @@ const filterErrorsAndFatal = format((info) => { const colorizeFormat = () => { if (env.NODE_ENV === "development") { return format.colorize({ colors: customLevels.colors }); - } else { - return format.uncolorize(); } + return format.uncolorize(); }; const winstonLogger = createLogger({ @@ -104,7 +103,7 @@ export const logger = ({ prefix += `[Transaction] [${queueId}] `; } - let suffix = ``; + let suffix = ""; if (data) { suffix += ` - ${JSON.stringify(data)}`; } diff --git a/src/shared/utils/transaction/cancel-transaction.ts b/src/shared/utils/transaction/cancel-transaction.ts index d2dda52c6..52d3f432d 100644 --- a/src/shared/utils/transaction/cancel-transaction.ts +++ b/src/shared/utils/transaction/cancel-transaction.ts @@ -1,4 +1,4 @@ -import { Address, toSerializableTransaction } from "thirdweb"; +import { type Address, toSerializableTransaction } from "thirdweb"; import { getAccount } from "../account"; import { getChain } from "../chain"; import { getChecksumAddress } from "../primitive-types"; diff --git a/src/shared/utils/usage.ts b/src/shared/utils/usage.ts index 957ac669a..64ec568e8 100644 --- a/src/shared/utils/usage.ts +++ b/src/shared/utils/usage.ts @@ -136,7 +136,7 @@ export const reportUsage = (usageEvents: ReportUsageParams[]) => { logger({ service: "worker", level: "error", - message: `Error:`, + message: "Error:", error: e, }); } diff --git a/src/shared/utils/webhook.ts b/src/shared/utils/webhook.ts index f8597e9ca..c31b3e1af 100644 --- a/src/shared/utils/webhook.ts +++ b/src/shared/utils/webhook.ts @@ -31,7 +31,7 @@ export const createWebhookRequestHeaders = async ( const timestamp = Math.floor(Date.now() / 1000).toString(); const signature = generateSignature(body, timestamp, webhook.secret); - headers["Authorization"] = `Bearer ${webhook.secret}`; + headers.Authorization = `Bearer ${webhook.secret}`; headers["x-engine-signature"] = signature; headers["x-engine-timestamp"] = timestamp; } diff --git a/src/worker/listeners/config-listener.ts b/src/worker/listeners/config-listener.ts index a52483bad..9168fe9fb 100644 --- a/src/worker/listeners/config-listener.ts +++ b/src/worker/listeners/config-listener.ts @@ -8,17 +8,17 @@ export const newConfigurationListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Listening for new configuration data`, + message: "Listening for new configuration data", }); // TODO: This doesn't even need to be a listener const connection = await knex.client.acquireConnection(); - connection.query(`LISTEN new_configuration_data`); + connection.query("LISTEN new_configuration_data"); // Whenever we receive a new transaction, process it connection.on( "notification", - async (msg: { channel: string; payload: string }) => { + async (_msg: { channel: string; payload: string }) => { // Update Configs Data await getConfig(false); }, @@ -31,7 +31,7 @@ export const newConfigurationListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on end`, + message: "Released database connection on end", }); }); @@ -39,7 +39,7 @@ export const newConfigurationListener = async (): Promise => { logger({ service: "worker", level: "error", - message: `Database connection error`, + message: "Database connection error", error: err, }); @@ -49,7 +49,7 @@ export const newConfigurationListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on error`, + message: "Released database connection on error", error: err, }); }); @@ -59,22 +59,22 @@ export const updatedConfigurationListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Listening for updated configuration data`, + message: "Listening for updated configuration data", }); // TODO: This doesn't even need to be a listener const connection = await knex.client.acquireConnection(); - connection.query(`LISTEN updated_configuration_data`); + connection.query("LISTEN updated_configuration_data"); // Whenever we receive a new transaction, process it connection.on( "notification", - async (msg: { channel: string; payload: string }) => { + async (_msg: { channel: string; payload: string }) => { // Update Configs Data logger({ service: "worker", level: "info", - message: `Updated configuration data`, + message: "Updated configuration data", }); await getConfig(false); await clearCacheCron("worker"); @@ -89,7 +89,7 @@ export const updatedConfigurationListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on end`, + message: "Released database connection on end", }); }); @@ -97,7 +97,7 @@ export const updatedConfigurationListener = async (): Promise => { logger({ service: "worker", level: "error", - message: `Database connection error`, + message: "Database connection error", error: err, }); @@ -107,7 +107,7 @@ export const updatedConfigurationListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on error`, + message: "Released database connection on error", error: err, }); }); diff --git a/src/worker/listeners/webhook-listener.ts b/src/worker/listeners/webhook-listener.ts index fd1197cb2..813100f8a 100644 --- a/src/worker/listeners/webhook-listener.ts +++ b/src/worker/listeners/webhook-listener.ts @@ -6,21 +6,21 @@ export const newWebhooksListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Listening for new webhooks data`, + message: "Listening for new webhooks data", }); // TODO: This doesn't even need to be a listener const connection = await knex.client.acquireConnection(); - connection.query(`LISTEN new_webhook_data`); + connection.query("LISTEN new_webhook_data"); // Whenever we receive a new transaction, process it connection.on( "notification", - async (msg: { channel: string; payload: string }) => { + async (_msg: { channel: string; payload: string }) => { logger({ service: "worker", level: "info", - message: `Received new webhooks data`, + message: "Received new webhooks data", }); // Update Webhooks Data webhookCache.clear(); @@ -34,7 +34,7 @@ export const newWebhooksListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on end`, + message: "Released database connection on end", }); }); @@ -42,7 +42,7 @@ export const newWebhooksListener = async (): Promise => { logger({ service: "worker", level: "error", - message: `Database connection error`, + message: "Database connection error", error: err, }); @@ -52,7 +52,7 @@ export const newWebhooksListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on error`, + message: "Released database connection on error", error: err, }); }); @@ -62,22 +62,22 @@ export const updatedWebhooksListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Listening for updated webhooks data`, + message: "Listening for updated webhooks data", }); // TODO: This doesn't even need to be a listener const connection = await knex.client.acquireConnection(); - connection.query(`LISTEN updated_webhook_data`); + connection.query("LISTEN updated_webhook_data"); // Whenever we receive a new transaction, process it connection.on( "notification", - async (msg: { channel: string; payload: string }) => { + async (_msg: { channel: string; payload: string }) => { // Update Configs Data logger({ service: "worker", level: "info", - message: `Received updated webhooks data`, + message: "Received updated webhooks data", }); webhookCache.clear(); }, @@ -90,7 +90,7 @@ export const updatedWebhooksListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on end`, + message: "Released database connection on end", }); }); @@ -98,7 +98,7 @@ export const updatedWebhooksListener = async (): Promise => { logger({ service: "worker", level: "error", - message: `Database connection error`, + message: "Database connection error", error: err, }); @@ -108,7 +108,7 @@ export const updatedWebhooksListener = async (): Promise => { logger({ service: "worker", level: "info", - message: `Released database connection on error`, + message: "Released database connection on error", error: err, }); }); diff --git a/src/worker/queues/send-transaction-queue.ts b/src/worker/queues/send-transaction-queue.ts index 4f4db261b..0361da622 100644 --- a/src/worker/queues/send-transaction-queue.ts +++ b/src/worker/queues/send-transaction-queue.ts @@ -32,7 +32,7 @@ export class SendTransactionQueue { static remove = async (data: SendTransactionData) => { try { await this.q.remove(this.jobId(data)); - } catch (e) { + } catch (_e) { // Job is currently running. } }; diff --git a/src/worker/tasks/process-event-logs-worker.ts b/src/worker/tasks/process-event-logs-worker.ts index e4e43bfd2..b017b0a0c 100644 --- a/src/worker/tasks/process-event-logs-worker.ts +++ b/src/worker/tasks/process-event-logs-worker.ts @@ -261,7 +261,7 @@ const getBlockTimestamps = async ( try { const block = await eth_getBlockByHash(rpcRequest, { blockHash }); return new Date(Number(block.timestamp) * 1000); - } catch (e) { + } catch (_e) { return now; } }),