From f248a6786d669aefb0116ab00888f10f440ba0cf Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Wed, 11 Dec 2024 20:28:30 -0600 Subject: [PATCH] fix all biome errors --- .github/workflows/build.yml | 5 +- .github/workflows/lint.yml | 5 +- .github/workflows/npm-publish.yml | 3 + package.json | 1 + src/polyfill.ts | 3 +- src/server/listeners/update-tx-listener.ts | 2 +- src/server/middleware/auth.ts | 2 +- src/server/middleware/error.ts | 12 +- .../routes/backend-wallet/sign-transaction.ts | 5 +- .../extensions/erc20/read/allowance-of.ts | 2 +- .../contract/extensions/erc20/read/get.ts | 4 +- .../blockchain/send-signed-user-op.ts | 30 ++-- src/server/utils/convertor.ts | 15 +- src/shared/db/transactions/queue-tx.ts | 2 +- src/shared/utils/ethers.ts | 15 +- src/shared/utils/logger.ts | 4 +- .../simulate-queued-transaction.ts | 6 +- src/shared/utils/transaction/types.ts | 2 +- src/worker/listeners/config-listener.ts | 4 +- src/worker/listeners/webhook-listener.ts | 4 +- src/worker/queues/send-webhook-queue.ts | 2 +- .../tasks/cancel-recycled-nonces-worker.ts | 2 +- src/worker/tasks/mine-transaction-worker.ts | 2 +- src/worker/tasks/nonce-resync-worker.ts | 2 +- src/worker/tasks/process-event-logs-worker.ts | 6 +- .../process-transaction-receipts-worker.ts | 2 +- src/worker/tasks/prune-transactions-worker.ts | 2 +- src/worker/tasks/send-webhook-worker.ts | 4 +- tests/e2e/config.ts | 2 +- tests/e2e/scripts/counter.ts | 6 +- tests/e2e/tests/extensions.test.ts | 6 +- tests/e2e/tests/load.test.ts | 4 +- tests/unit/auth.test.ts | 8 +- yarn.lock | 134 ++++++++++++------ 34 files changed, 185 insertions(+), 123 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de1d50875..cf7d88320 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,10 @@ jobs: with: node-version: "18" cache: "yarn" - + + - name: Enable Corepack + run: corepack enable + - name: Install dependencies run: yarn install diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c0fd0379f..a98d70bca 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,10 @@ jobs: with: node-version: "18" cache: "yarn" - + + - name: Enable Corepack + run: corepack enable + - name: Install dependencies run: yarn install diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 3f407a043..1f1a90854 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -18,6 +18,9 @@ jobs: node-version: "18" cache: "yarn" + - name: Enable Corepack + run: corepack enable + - name: Install dependencies run: yarn install diff --git a/package.json b/package.json index 3bfa61465..c3fb327b1 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "superjson": "^2.2.1", "thirdweb": "^5.71.0", "uuid": "^9.0.1", + "viem": "^2.21.54", "winston": "^3.14.1", "zod": "^3.23.8" }, diff --git a/src/polyfill.ts b/src/polyfill.ts index 029207c32..f1df8ef43 100644 --- a/src/polyfill.ts +++ b/src/polyfill.ts @@ -1,5 +1,6 @@ import * as crypto from "node:crypto"; if (typeof globalThis.crypto === "undefined") { - (globalThis as any).crypto = crypto; + // @ts-expect-error + globalThis.crypto = crypto; } diff --git a/src/server/listeners/update-tx-listener.ts b/src/server/listeners/update-tx-listener.ts index d871d0000..e7302fd0e 100644 --- a/src/server/listeners/update-tx-listener.ts +++ b/src/server/listeners/update-tx-listener.ts @@ -68,7 +68,7 @@ export const updateTxListener = async (): Promise => { }); }); - connection.on("error", async (err: any) => { + connection.on("error", async (err: unknown) => { logger({ service: "server", level: "error", diff --git a/src/server/middleware/auth.ts b/src/server/middleware/auth.ts index 99df90131..f29804e70 100644 --- a/src/server/middleware/auth.ts +++ b/src/server/middleware/auth.ts @@ -126,7 +126,7 @@ export async function withAuth(server: FastifyInstance) { }if (error) { message = error; } - } catch (err: any) { + } catch (err: unknown) { logger({ service: "server", level: "warn", diff --git a/src/server/middleware/error.ts b/src/server/middleware/error.ts index 3957f2758..92dbf8200 100644 --- a/src/server/middleware/error.ts +++ b/src/server/middleware/error.ts @@ -42,7 +42,7 @@ export const badChainError = (chain: string | number): CustomError => "INVALID_CHAIN", ); -const flipObject = (data: any) => +const flipObject = (data: object) => Object.fromEntries(Object.entries(data).map(([key, value]) => [value, key])); const isZodError = (err: unknown): boolean => { @@ -72,7 +72,7 @@ export function withErrorHandler(server: FastifyInstance) { message: "code" in error ? error.code : error.message, reason: error.message, statusCode: 400, - stack: env.NODE_ENV !== "production" ? error.stack : undefined, + stack: env.NODE_ENV === "production" ? undefined : error.stack, }, }); } @@ -80,7 +80,7 @@ export function withErrorHandler(server: FastifyInstance) { // Zod Typings Errors if (isZodError(error)) { const _error = error as ZodError; - let parsedMessage: any[] = []; + let parsedMessage: unknown; try { parsedMessage = JSON.parse(_error.message); @@ -98,7 +98,7 @@ export function withErrorHandler(server: FastifyInstance) { message: errorObject.message ?? "Invalid Request", reason: errorObject ?? undefined, statusCode: 400, - stack: env.NODE_ENV !== "production" ? _error.stack : undefined, + stack: env.NODE_ENV === "production" ? undefined : _error.stack, }, }); } @@ -118,7 +118,7 @@ export function withErrorHandler(server: FastifyInstance) { code, message, statusCode, - stack: env.NODE_ENV !== "production" ? error.stack : undefined, + stack: env.NODE_ENV === "production" ? undefined : error.stack, }, }); } @@ -128,7 +128,7 @@ export function withErrorHandler(server: FastifyInstance) { statusCode: 500, code: "INTERNAL_SERVER_ERROR", message: error.message || ReasonPhrases.INTERNAL_SERVER_ERROR, - stack: env.NODE_ENV !== "production" ? error.stack : undefined, + stack: env.NODE_ENV === "production" ? undefined : error.stack, }, }); }, diff --git a/src/server/routes/backend-wallet/sign-transaction.ts b/src/server/routes/backend-wallet/sign-transaction.ts index fbdf1bec4..d599ce403 100644 --- a/src/server/routes/backend-wallet/sign-transaction.ts +++ b/src/server/routes/backend-wallet/sign-transaction.ts @@ -2,6 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Hex } from "thirdweb"; +import type { TransactionSerializable } from "viem"; import { getAccount } from "../../../shared/utils/account"; import { getChecksumAddress, @@ -71,7 +72,7 @@ export async function signTransaction(fastify: FastifyInstance) { } // @TODO: Assert type to viem TransactionSerializable. - const serializableTransaction: any = { + const serializableTransaction = { chainId: transaction.chainId, to: getChecksumAddress(transaction.to), nonce: maybeInt(transaction.nonce), @@ -86,7 +87,7 @@ export async function signTransaction(fastify: FastifyInstance) { maxFeePerGas: maybeBigInt(transaction.maxFeePerGas), maxPriorityFeePerGas: maybeBigInt(transaction.maxPriorityFeePerGas), ccipReadEnabled: transaction.ccipReadEnabled, - }; + } as TransactionSerializable; const signature = await account.signTransaction(serializableTransaction); reply.status(StatusCodes.OK).send({ diff --git a/src/server/routes/contract/extensions/erc20/read/allowance-of.ts b/src/server/routes/contract/extensions/erc20/read/allowance-of.ts index cb8b8a53b..3020eecee 100644 --- a/src/server/routes/contract/extensions/erc20/read/allowance-of.ts +++ b/src/server/routes/contract/extensions/erc20/read/allowance-of.ts @@ -67,7 +67,7 @@ export async function erc20AllowanceOf(fastify: FastifyInstance) { chainId, contractAddress, }); - const returnData: any = await contract.erc20.allowanceOf( + const returnData = await contract.erc20.allowanceOf( ownerWallet ? ownerWallet : "", spenderWallet ? spenderWallet : "", ); diff --git a/src/server/routes/contract/extensions/erc20/read/get.ts b/src/server/routes/contract/extensions/erc20/read/get.ts index d2e783afd..dbd3b933b 100644 --- a/src/server/routes/contract/extensions/erc20/read/get.ts +++ b/src/server/routes/contract/extensions/erc20/read/get.ts @@ -54,12 +54,12 @@ export async function erc20GetMetadata(fastify: FastifyInstance) { chainId, contractAddress, }); - const returnData: any = await contract.erc20.get(); + const returnData = await contract.erc20.get(); reply.status(StatusCodes.OK).send({ result: { symbol: returnData.symbol, name: returnData.name, - decimals: returnData.decimals, + decimals: returnData.decimals.toString(), }, }); }, diff --git a/src/server/routes/transaction/blockchain/send-signed-user-op.ts b/src/server/routes/transaction/blockchain/send-signed-user-op.ts index cdccaf42d..4b267de24 100644 --- a/src/server/routes/transaction/blockchain/send-signed-user-op.ts +++ b/src/server/routes/transaction/blockchain/send-signed-user-op.ts @@ -1,5 +1,6 @@ import { Type, type Static } from "@sinclair/typebox"; import { Value } from "@sinclair/typebox/value"; +import { TransformDecodeError } from "@sinclair/typebox/value/transform"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { env } from "../../../../shared/utils/env"; @@ -47,15 +48,15 @@ const responseBodySchema = Type.Union([ type RpcResponse = | { - result: string; - error: undefined; - } + result: string; + error: undefined; +} | { - result: undefined; - error: { - message: string; - }; - }; + result: undefined; + error: { + message: string; + }; +}; export async function sendSignedUserOp(fastify: FastifyInstance) { fastify.route<{ @@ -68,7 +69,7 @@ export async function sendSignedUserOp(fastify: FastifyInstance) { schema: { summary: "Send a signed user operation", description: "Send a signed user operation", - tags: ["Transaction"], + tags: [ "Transaction" ], operationId: "sendSignedUserOp", params: walletChainParamSchema, body: requestBodySchema, @@ -86,10 +87,11 @@ export async function sendSignedUserOp(fastify: FastifyInstance) { if (typeof signedUserOp === "string") { try { userOp = Value.Decode(UserOpString, signedUserOp); - } catch (err: any) { + } catch (err: unknown) { + const msg = err instanceof TransformDecodeError ? err.message : err; return res.status(400).send({ error: { - message: `Invalid signed user operation. - ${err.message || err}`, + message: `Invalid signed user operation. - ${msg}`, }, }); } @@ -109,12 +111,14 @@ export async function sendSignedUserOp(fastify: FastifyInstance) { id: 1, jsonrpc: "2.0", method: "eth_sendUserOperation", - params: [userOp, entryPointAddress], + params: [ userOp, entryPointAddress ], }), }); const { result: userOpHash, error } = - (await userOpRes.json()) as RpcResponse; + ( + await userOpRes.json() + ) as RpcResponse; if (error) { return res.status(400).send({ diff --git a/src/server/utils/convertor.ts b/src/server/utils/convertor.ts index 7082e53c9..5f0334679 100644 --- a/src/server/utils/convertor.ts +++ b/src/server/utils/convertor.ts @@ -1,14 +1,13 @@ import { BigNumber } from "ethers"; -export const bigNumberReplacer = (value: any): any => { +const isHexBigNumber = (value: unknown) => { + const isNonNullObject = typeof value === "object" && value !== null; + const hasType = isNonNullObject && "type" in value; + return hasType && value.type === "BigNumber" && "hex" in value +} +export const bigNumberReplacer = (value: unknown): unknown => { // if we find a BigNumber then make it into a string (since that is safe) - if ( - BigNumber.isBigNumber(value) || - (typeof value === "object" && - value !== null && - value.type === "BigNumber" && - "hex" in value) - ) { + if (BigNumber.isBigNumber(value) || isHexBigNumber(value)) { return BigNumber.from(value).toString(); } diff --git a/src/shared/db/transactions/queue-tx.ts b/src/shared/db/transactions/queue-tx.ts index e6a63843b..0bd1d4a8a 100644 --- a/src/shared/db/transactions/queue-tx.ts +++ b/src/shared/db/transactions/queue-tx.ts @@ -9,7 +9,7 @@ import { parseTransactionOverrides } from "../../../server/utils/transaction-ove interface QueueTxParams { // we should move away from Transaction type (v4 SDK) - tx: Transaction | DeployTransaction; + tx: Transaction | DeployTransaction; chainId: number; extension: ContractExtension; // TODO: These shouldn't be in here diff --git a/src/shared/utils/ethers.ts b/src/shared/utils/ethers.ts index 15f1ff095..a430c467a 100644 --- a/src/shared/utils/ethers.ts +++ b/src/shared/utils/ethers.ts @@ -20,7 +20,7 @@ export interface EthersError extends Error { * * This is generally helpful mostly for human-based debugging. */ - info?: Record; + info?: Record; /** * Any related error. @@ -35,17 +35,14 @@ export const ETHERS_ERROR_CODES = new Set(Object.values(ethers.errors)); * @param error * @returns EthersError | null */ -export const parseEthersError = (error: any): EthersError | null => { - if ( - error && - typeof error === "object" && - "code" in error && - ETHERS_ERROR_CODES.has(error.code) - ) { +export const parseEthersError = (error: unknown): EthersError | null => { + const isNonNullObject = error && typeof error === "object"; + const hasCodeProperty = isNonNullObject && "code" in error; + if (hasCodeProperty && ETHERS_ERROR_CODES.has(error.code as ethers.errors)) { return error as EthersError; } return null; }; -export const isEthersErrorCode = (error: any, code: ethers.errors) => +export const isEthersErrorCode = (error: unknown, code: ethers.errors) => parseEthersError(error)?.code === code; diff --git a/src/shared/utils/logger.ts b/src/shared/utils/logger.ts index 3b4372bf5..f743b2d23 100644 --- a/src/shared/utils/logger.ts +++ b/src/shared/utils/logger.ts @@ -82,8 +82,8 @@ interface LoggerParams { level: (typeof env)["LOG_LEVEL"]; message: string; queueId?: string | null; - error?: any; - data?: any; + error?: unknown; + data?: unknown; } export const logger = ({ diff --git a/src/shared/utils/transaction/simulate-queued-transaction.ts b/src/shared/utils/transaction/simulate-queued-transaction.ts index 2a39a8575..7fdbd5156 100644 --- a/src/shared/utils/transaction/simulate-queued-transaction.ts +++ b/src/shared/utils/transaction/simulate-queued-transaction.ts @@ -1,3 +1,4 @@ +import { TransactionError } from "@thirdweb-dev/sdk"; import { prepareTransaction, simulateTransaction, @@ -70,7 +71,10 @@ export const doSimulateTransaction = async ( account, }); return null; - } catch (e: any) { + } catch (e: unknown) { + if (!(e instanceof TransactionError)) { + throw e; + } // Error should be of type TransactionError in the thirdweb SDK. return `${e.name}: ${e.message}`; } diff --git a/src/shared/utils/transaction/types.ts b/src/shared/utils/transaction/types.ts index d4846a4a8..4509dc18b 100644 --- a/src/shared/utils/transaction/types.ts +++ b/src/shared/utils/transaction/types.ts @@ -23,7 +23,7 @@ export type InsertedTransaction = { data?: Hex; functionName?: string; - functionArgs?: any[]; + functionArgs?: unknown[]; // User-provided overrides. overrides?: { diff --git a/src/worker/listeners/config-listener.ts b/src/worker/listeners/config-listener.ts index 9168fe9fb..bda2e9c9f 100644 --- a/src/worker/listeners/config-listener.ts +++ b/src/worker/listeners/config-listener.ts @@ -35,7 +35,7 @@ export const newConfigurationListener = async (): Promise => { }); }); - connection.on("error", async (err: any) => { + connection.on("error", async (err: unknown) => { logger({ service: "worker", level: "error", @@ -93,7 +93,7 @@ export const updatedConfigurationListener = async (): Promise => { }); }); - connection.on("error", async (err: any) => { + connection.on("error", async (err: unknown) => { logger({ service: "worker", level: "error", diff --git a/src/worker/listeners/webhook-listener.ts b/src/worker/listeners/webhook-listener.ts index 813100f8a..759182170 100644 --- a/src/worker/listeners/webhook-listener.ts +++ b/src/worker/listeners/webhook-listener.ts @@ -38,7 +38,7 @@ export const newWebhooksListener = async (): Promise => { }); }); - connection.on("error", async (err: any) => { + connection.on("error", async (err: unknown) => { logger({ service: "worker", level: "error", @@ -94,7 +94,7 @@ export const updatedWebhooksListener = async (): Promise => { }); }); - connection.on("error", async (err: any) => { + connection.on("error", async (err: unknown) => { logger({ service: "worker", level: "error", diff --git a/src/worker/queues/send-webhook-queue.ts b/src/worker/queues/send-webhook-queue.ts index 273e2827e..0a636a52e 100644 --- a/src/worker/queues/send-webhook-queue.ts +++ b/src/worker/queues/send-webhook-queue.ts @@ -71,7 +71,7 @@ export class SendWebhookQueue { logger({ service: "worker", level: "warn", - message: `Unexpected webhook type: ${(data as any).type}`, + message: `Unexpected webhook type: ${(data as { type: unknown }).type}`, }); } }; diff --git a/src/worker/tasks/cancel-recycled-nonces-worker.ts b/src/worker/tasks/cancel-recycled-nonces-worker.ts index 0757cdb9f..7a3629375 100644 --- a/src/worker/tasks/cancel-recycled-nonces-worker.ts +++ b/src/worker/tasks/cancel-recycled-nonces-worker.ts @@ -31,7 +31,7 @@ export const initCancelRecycledNoncesWorker = () => { /** * Sends a cancel transaction for all recycled nonces. */ -const handler: Processor = async (job: Job) => { +const handler: Processor = async (job: Job) => { const keys = await redis.keys("nonce-recycled:*"); for (const key of keys) { diff --git a/src/worker/tasks/mine-transaction-worker.ts b/src/worker/tasks/mine-transaction-worker.ts index e0c649f1c..69d8b0184 100644 --- a/src/worker/tasks/mine-transaction-worker.ts +++ b/src/worker/tasks/mine-transaction-worker.ts @@ -50,7 +50,7 @@ import { SendWebhookQueue } from "../queues/send-webhook-queue"; * * If an EOA transaction is not mined after some time, resend it. */ -const handler: Processor = async (job: Job) => { +const handler: Processor = async (job: Job) => { const { queueId } = superjson.parse(job.data); // Assert valid transaction state. diff --git a/src/worker/tasks/nonce-resync-worker.ts b/src/worker/tasks/nonce-resync-worker.ts index d7ccfe553..caf8af26f 100644 --- a/src/worker/tasks/nonce-resync-worker.ts +++ b/src/worker/tasks/nonce-resync-worker.ts @@ -39,7 +39,7 @@ export const initNonceResyncWorker = async () => { * * This is to unblock a wallet that has been stuck due to one or more skipped nonces. */ -const handler: Processor = async (job: Job) => { +const handler: Processor = async (job: Job) => { const sentNoncesKeys = await redis.keys("nonce-sent:*"); if (sentNoncesKeys.length === 0) { job.log("No active wallets."); diff --git a/src/worker/tasks/process-event-logs-worker.ts b/src/worker/tasks/process-event-logs-worker.ts index b017b0a0c..95e3c9859 100644 --- a/src/worker/tasks/process-event-logs-worker.ts +++ b/src/worker/tasks/process-event-logs-worker.ts @@ -30,7 +30,7 @@ import { import { logWorkerExceptions } from "../queues/queues"; import { SendWebhookQueue } from "../queues/send-webhook-queue"; -const handler: Processor = async (job: Job) => { +const handler: Processor = async (job: Job) => { const { chainId, filters = [], @@ -274,7 +274,7 @@ const getBlockTimestamps = async ( return res; }; -const logArgToString = (arg: any): string => { +const logArgToString = (arg: unknown): string => { if (arg === null) { return ""; } @@ -284,7 +284,7 @@ const logArgToString = (arg: any): string => { if (Array.isArray(arg)) { return arg.map(logArgToString).join(","); } - return arg.toString(); + return String(arg); }; // Must be explicitly called for the worker to run on this host. diff --git a/src/worker/tasks/process-transaction-receipts-worker.ts b/src/worker/tasks/process-transaction-receipts-worker.ts index 8605cb257..1d4e64703 100644 --- a/src/worker/tasks/process-transaction-receipts-worker.ts +++ b/src/worker/tasks/process-transaction-receipts-worker.ts @@ -27,7 +27,7 @@ import { logWorkerExceptions } from "../queues/queues"; import { SendWebhookQueue } from "../queues/send-webhook-queue"; import { getWebhooksByContractAddresses } from "./process-event-logs-worker"; -const handler: Processor = async (job: Job) => { +const handler: Processor = async (job: Job) => { const { chainId, filters = [], diff --git a/src/worker/tasks/prune-transactions-worker.ts b/src/worker/tasks/prune-transactions-worker.ts index 160f70e02..4bac12a27 100644 --- a/src/worker/tasks/prune-transactions-worker.ts +++ b/src/worker/tasks/prune-transactions-worker.ts @@ -6,7 +6,7 @@ import { redis } from "../../shared/utils/redis/redis"; import { PruneTransactionsQueue } from "../queues/prune-transactions-queue"; import { logWorkerExceptions } from "../queues/queues"; -const handler: Processor = async (job: Job) => { +const handler: Processor = async (job: Job) => { const numTransactionsDeleted = await TransactionDB.pruneTransactionDetailsAndLists( env.TRANSACTION_HISTORY_COUNT, diff --git a/src/worker/tasks/send-webhook-worker.ts b/src/worker/tasks/send-webhook-worker.ts index b2bcf5147..dda1f1f5b 100644 --- a/src/worker/tasks/send-webhook-worker.ts +++ b/src/worker/tasks/send-webhook-worker.ts @@ -20,7 +20,7 @@ import { } from "../../shared/utils/webhook"; import { SendWebhookQueue, type WebhookJob } from "../queues/send-webhook-queue"; -const handler: Processor = async (job: Job) => { +const handler: Processor = async (job: Job) => { const { data, webhook } = superjson.parse(job.data); let resp: WebhookResponse | undefined; @@ -28,7 +28,7 @@ const handler: Processor = async (job: Job) => { case WebhooksEventTypes.CONTRACT_SUBSCRIPTION: { let webhookBody: { type: "event-log" | "transaction-receipt"; - data: any; + data: unknown; }; if (data.eventLog) { webhookBody = { diff --git a/tests/e2e/config.ts b/tests/e2e/config.ts index 83cd7d067..f1a111e49 100644 --- a/tests/e2e/config.ts +++ b/tests/e2e/config.ts @@ -1,4 +1,4 @@ -import assert from "assert"; +import assert from "node:assert"; import { anvil, type Chain } from "thirdweb/chains"; assert(process.env.ENGINE_URL, "ENGINE_URL is required"); diff --git a/tests/e2e/scripts/counter.ts b/tests/e2e/scripts/counter.ts index b0c40f50e..121e894e1 100644 --- a/tests/e2e/scripts/counter.ts +++ b/tests/e2e/scripts/counter.ts @@ -16,9 +16,9 @@ async function countLines(file: string) { if (!line.trim()) { continue; } - - if (statements.has(line)) { - statements.set(line, statements.get(line)! + 1); + const statement = statements.get(line); + if (statement !== undefined) { + statements.set(line, statement + 1); } else { statements.set(line, 1); } diff --git a/tests/e2e/tests/extensions.test.ts b/tests/e2e/tests/extensions.test.ts index ed0674da8..4fdb3c89c 100644 --- a/tests/e2e/tests/extensions.test.ts +++ b/tests/e2e/tests/extensions.test.ts @@ -38,8 +38,9 @@ describe("Extensions", () => { let mined = false; + assert(res.result.queueId, "Queue ID is not defined"); while (!mined) { - const statusRes = await engine.transaction.status(res.result.queueId!); + const statusRes = await engine.transaction.status(res.result.queueId); mined = statusRes.result.status === "mined"; await sleep(1000); } @@ -68,10 +69,11 @@ describe("Extensions", () => { ); expect(res.result.queueId).toBeDefined(); + assert(res.result.queueId, "Queue ID is not defined"); let mined = false; while (!mined) { - const status = await engine.transaction.status(res.result.queueId!); + const status = await engine.transaction.status(res.result.queueId); mined = !!status.result.minedAt; await sleep(1000); } diff --git a/tests/e2e/tests/load.test.ts b/tests/e2e/tests/load.test.ts index 0cdea6317..24eb798a2 100644 --- a/tests/e2e/tests/load.test.ts +++ b/tests/e2e/tests/load.test.ts @@ -79,8 +79,10 @@ describe("Load Test Transactions", () => { assert(nftContractAddress, "NFT contract address is not defined"); + assert(deployRes.result.queueId, "Queue ID is not defined"); + // Wait for the contract to be deployed - await pollTransactionStatus(engine, deployRes.result.queueId!); + await pollTransactionStatus(engine, deployRes.result.queueId); const timings = []; for ( diff --git a/tests/unit/auth.test.ts b/tests/unit/auth.test.ts index c7597e08d..744b6a221 100644 --- a/tests/unit/auth.test.ts +++ b/tests/unit/auth.test.ts @@ -278,10 +278,10 @@ describe("Websocket requests", () => { session: { permissions: Permission.Admin }, }); - const mockSocket = { - write: vi.fn(), - destroy: vi.fn(), - }; + // const mockSocket = { + // write: vi.fn(), + // destroy: vi.fn(), + // }; const defaultConfig = await getConfig(); mockGetConfig.mockResolvedValueOnce({ diff --git a/yarn.lock b/yarn.lock index 2cdf0a79b..be290c21e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3532,6 +3532,15 @@ __metadata: languageName: node linkType: hard +"@noble/curves@npm:1.7.0, @noble/curves@npm:^1.6.0, @noble/curves@npm:~1.7.0": + version: 1.7.0 + resolution: "@noble/curves@npm:1.7.0" + dependencies: + "@noble/hashes": "npm:1.6.0" + checksum: 10c0/3317ec9b7699d2476707a89ceb3ddce60e69bac287561a31dd533669408633e093860fea5067eb9c54e5a7ced0705da1cba8859b6b1e0c48d3afff55fe2e77d0 + languageName: node + linkType: hard + "@noble/curves@npm:^1.4.0": version: 1.5.0 resolution: "@noble/curves@npm:1.5.0" @@ -3541,15 +3550,6 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:^1.6.0, @noble/curves@npm:~1.7.0": - version: 1.7.0 - resolution: "@noble/curves@npm:1.7.0" - dependencies: - "@noble/hashes": "npm:1.6.0" - checksum: 10c0/3317ec9b7699d2476707a89ceb3ddce60e69bac287561a31dd533669408633e093860fea5067eb9c54e5a7ced0705da1cba8859b6b1e0c48d3afff55fe2e77d0 - languageName: node - linkType: hard - "@noble/hashes@npm:1.3.2": version: 1.3.2 resolution: "@noble/hashes@npm:1.3.2" @@ -3585,7 +3585,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:^1.5.0, @noble/hashes@npm:~1.6.0": +"@noble/hashes@npm:1.6.1, @noble/hashes@npm:^1.5.0, @noble/hashes@npm:~1.6.0": version: 1.6.1 resolution: "@noble/hashes@npm:1.6.1" checksum: 10c0/27643cd8b551bc933b57cc29aa8c8763d586552fc4c3e06ecf7897f55be3463c0c9dff7f6ebacd88e5ce6d0cdb5415ca4874d0cf4359b5ea4a85be21ada03aab @@ -3872,49 +3872,49 @@ __metadata: languageName: node linkType: hard -"@prisma/debug@npm:5.17.0": - version: 5.17.0 - resolution: "@prisma/debug@npm:5.17.0" - checksum: 10c0/10aca89c8cd3a96c7f1153792110f33d96d1875e4af807002b9ca061eda255b1aa21e757b9e7a1690ac0676fb2312c441191cdb357acf45617dd658678984053 +"@prisma/debug@npm:5.22.0": + version: 5.22.0 + resolution: "@prisma/debug@npm:5.22.0" + checksum: 10c0/ff7c5e84d9f9b568a2a1992eb39fc7c3ab6d9e326c77fdefec1655ccfbf6c0ee268a5dcf087867848eb00a0328c9cc75a164880ec7cd60f7fd634e2fca2943d9 languageName: node linkType: hard -"@prisma/engines-version@npm:5.17.0-31.393aa359c9ad4a4bb28630fb5613f9c281cde053": - version: 5.17.0-31.393aa359c9ad4a4bb28630fb5613f9c281cde053 - resolution: "@prisma/engines-version@npm:5.17.0-31.393aa359c9ad4a4bb28630fb5613f9c281cde053" - checksum: 10c0/164b4cd6965da770bcd085fa0596466b092060d19eb8a4ba3402e66bd9b2e813cae417eeca99422b66a3a05a65cfe6d0e0339083b53644acf553ac138693232d +"@prisma/engines-version@npm:5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2": + version: 5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2 + resolution: "@prisma/engines-version@npm:5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2" + checksum: 10c0/95df49c6f35f99c0977e9690d9ae0776327df07c6f035e8c4a247a9c21108f0760c02ca6dbe63a35013e5cd1eb77a896edb340f1e28ea04373c6cefc4ce09b51 languageName: node linkType: hard -"@prisma/engines@npm:5.17.0": - version: 5.17.0 - resolution: "@prisma/engines@npm:5.17.0" +"@prisma/engines@npm:5.22.0": + version: 5.22.0 + resolution: "@prisma/engines@npm:5.22.0" dependencies: - "@prisma/debug": "npm:5.17.0" - "@prisma/engines-version": "npm:5.17.0-31.393aa359c9ad4a4bb28630fb5613f9c281cde053" - "@prisma/fetch-engine": "npm:5.17.0" - "@prisma/get-platform": "npm:5.17.0" - checksum: 10c0/b1d48c39fbe16680947685960be615894ccc1a2ca40263fc6d1ac4599e3100f2f31e71b02bd000c0f3269cd045f38817dfbddd37fefcb8a4dec6155a6df48e2f + "@prisma/debug": "npm:5.22.0" + "@prisma/engines-version": "npm:5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2" + "@prisma/fetch-engine": "npm:5.22.0" + "@prisma/get-platform": "npm:5.22.0" + checksum: 10c0/81a439e5064a1036e05da8feaf7ffb19b5dba98d5ea68dc385f7e24e3cc25ef9f0b78a1aa1d7d7234a9afd916ee18b707863cee48274912315bc933429f26ce7 languageName: node linkType: hard -"@prisma/fetch-engine@npm:5.17.0": - version: 5.17.0 - resolution: "@prisma/fetch-engine@npm:5.17.0" +"@prisma/fetch-engine@npm:5.22.0": + version: 5.22.0 + resolution: "@prisma/fetch-engine@npm:5.22.0" dependencies: - "@prisma/debug": "npm:5.17.0" - "@prisma/engines-version": "npm:5.17.0-31.393aa359c9ad4a4bb28630fb5613f9c281cde053" - "@prisma/get-platform": "npm:5.17.0" - checksum: 10c0/b5c554e8a637871fd6497e656d67e649d9eea3a06be325b68a686b707c78d200ba9ba20bd76b0a3408e5cb78f6e34bab535ce161174273db377353a01368806e + "@prisma/debug": "npm:5.22.0" + "@prisma/engines-version": "npm:5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2" + "@prisma/get-platform": "npm:5.22.0" + checksum: 10c0/0d3dcaffbadcf9185cca37bb50ce3a92fad2a205451731e5c3d02b1ee96a918dde99a9ce231e62bddde5ec8dcb3035338ff1312f8416f2cdaf31a69a19448baf languageName: node linkType: hard -"@prisma/get-platform@npm:5.17.0": - version: 5.17.0 - resolution: "@prisma/get-platform@npm:5.17.0" +"@prisma/get-platform@npm:5.22.0": + version: 5.22.0 + resolution: "@prisma/get-platform@npm:5.22.0" dependencies: - "@prisma/debug": "npm:5.17.0" - checksum: 10c0/8687736c6e18737e29544bc1f98653b75b4dcb85c1ffe02686da100e843bb30041dd9d00146a2178517d34b783a650c8b76bdde5029d1675bd28c2be6ee6565a + "@prisma/debug": "npm:5.22.0" + checksum: 10c0/b934f9bbba1e8dae01721a213a5b166a4dd9f35bf04ad93fb9e24afb67945c09562d4e2c5b4d33b1830cdc7adeb03775309c55ab2c470048ed4cfc947fe495f5 languageName: node linkType: hard @@ -5115,7 +5115,7 @@ __metadata: languageName: node linkType: hard -"@scure/bip32@npm:^1.5.0": +"@scure/bip32@npm:1.6.0, @scure/bip32@npm:^1.5.0": version: 1.6.0 resolution: "@scure/bip32@npm:1.6.0" dependencies: @@ -5156,7 +5156,7 @@ __metadata: languageName: node linkType: hard -"@scure/bip39@npm:^1.4.0": +"@scure/bip39@npm:1.5.0, @scure/bip39@npm:^1.4.0": version: 1.5.0 resolution: "@scure/bip39@npm:1.5.0" dependencies: @@ -7518,6 +7518,21 @@ __metadata: languageName: node linkType: hard +"abitype@npm:1.0.7": + version: 1.0.7 + resolution: "abitype@npm:1.0.7" + peerDependencies: + typescript: ">=5.0.4" + zod: ^3 >=3.22.0 + peerDependenciesMeta: + typescript: + optional: true + zod: + optional: true + checksum: 10c0/de63055e27bcc8ec14e810c8525c2a61658a1b01dc1e5882af45c96a966ad3911d50dd16d97dfb49c106fb323638a906bcaf1e48f4f1b9c5bf4926dc217a81e1 + languageName: node + linkType: hard + "abort-controller@npm:^3.0.0": version: 3.0.0 resolution: "abort-controller@npm:3.0.0" @@ -9281,6 +9296,7 @@ __metadata: thirdweb: "npm:^5.71.0" typescript: "npm:^5.1.3" uuid: "npm:^9.0.1" + viem: "npm:^2.21.54" vitest: "npm:^2.0.3" winston: "npm:^3.14.1" zod: "npm:^3.23.8" @@ -10314,7 +10330,7 @@ __metadata: languageName: node linkType: hard -"fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": +"fsevents@npm:2.3.3, fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": version: 2.3.3 resolution: "fsevents@npm:2.3.3" dependencies: @@ -10324,7 +10340,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": +"fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": version: 2.3.3 resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" dependencies: @@ -13585,13 +13601,17 @@ __metadata: linkType: hard "prisma@npm:^5.14.0": - version: 5.17.0 - resolution: "prisma@npm:5.17.0" + version: 5.22.0 + resolution: "prisma@npm:5.22.0" dependencies: - "@prisma/engines": "npm:5.17.0" + "@prisma/engines": "npm:5.22.0" + fsevents: "npm:2.3.3" + dependenciesMeta: + fsevents: + optional: true bin: prisma: build/index.js - checksum: 10c0/30546a8576ffadf66d6f34cd833e25e21eec99847db92c4d88f6c9dbbc401abbd3f699f9e0f0dbcd9d5229ccba47c6aadb42ba6cd6e29afb7335689c7257c964 + checksum: 10c0/63d1fe828394d1a1fabc0d29245ae35be53c1bdb26da4dbcfaf17fba3733c1c120b72f28b548dba47b2b80ff7fad670717be1316c1ea4bb12ebe1937415a1ddb languageName: node linkType: hard @@ -15834,6 +15854,28 @@ __metadata: languageName: node linkType: hard +"viem@npm:^2.21.54": + version: 2.21.54 + resolution: "viem@npm:2.21.54" + dependencies: + "@noble/curves": "npm:1.7.0" + "@noble/hashes": "npm:1.6.1" + "@scure/bip32": "npm:1.6.0" + "@scure/bip39": "npm:1.5.0" + abitype: "npm:1.0.7" + isows: "npm:1.0.6" + ox: "npm:0.1.2" + webauthn-p256: "npm:0.0.10" + ws: "npm:8.18.0" + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/d4d77f47de89248a6c2e43dc0729517b1b5cb5afd372f97ae2f5b37170d9df131c92955efcc0776bd6e75980bd19bc38f0daa1026e2059204ad8593b5f383e55 + languageName: node + linkType: hard + "vite-node@npm:2.0.3": version: 2.0.3 resolution: "vite-node@npm:2.0.3"