1- import { Prisma } from "@prisma/client" ;
2- import { AbiEvent } from "abitype" ;
3- import { Job , Processor , Worker } from "bullmq" ;
1+ import type { Prisma } from "@prisma/client" ;
2+ import type { AbiEvent } from "abitype" ;
3+ import { Worker , type Job , type Processor } from "bullmq" ;
44import superjson from "superjson" ;
55import {
6- Address ,
7- ThirdwebContract ,
86 eth_getBlockByNumber ,
97 eth_getTransactionReceipt ,
108 getContract ,
119 getRpcClient ,
10+ type Address ,
11+ type ThirdwebContract ,
1212} from "thirdweb" ;
1313import { resolveContractAbi } from "thirdweb/contract" ;
14- import { Abi , Hash , decodeFunctionData } from "viem" ;
14+ import { decodeFunctionData , type Abi , type Hash } from "viem" ;
1515import { bulkInsertContractTransactionReceipts } from "../../db/contractTransactionReceipts/createContractTransactionReceipts" ;
1616import { WebhooksEventTypes } from "../../schema/webhooks" ;
1717import { getChain } from "../../utils/chain" ;
@@ -20,8 +20,8 @@ import { normalizeAddress } from "../../utils/primitiveTypes";
2020import { redis } from "../../utils/redis/redis" ;
2121import { thirdwebClient } from "../../utils/sdk" ;
2222import {
23- EnqueueProcessTransactionReceiptsData ,
2423 ProcessTransactionReceiptsQueue ,
24+ type EnqueueProcessTransactionReceiptsData ,
2525} from "../queues/processTransactionReceiptsQueue" ;
2626import { logWorkerExceptions } from "../queues/queues" ;
2727import { SendWebhookQueue } from "../queues/sendWebhookQueue" ;
@@ -55,9 +55,8 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
5555 }
5656
5757 // Enqueue webhooks.
58- const webhooksByContractAddress = await getWebhooksByContractAddresses (
59- chainId ,
60- ) ;
58+ const webhooksByContractAddress =
59+ await getWebhooksByContractAddresses ( chainId ) ;
6160 for ( const transactionReceipt of insertedReceipts ) {
6261 const webhooks =
6362 webhooksByContractAddress [ transactionReceipt . contractAddress ] ?? [ ] ;
@@ -154,17 +153,16 @@ const getFormattedTransactionReceipts = async ({
154153 continue ;
155154 }
156155
157- let functionName : string | undefined = undefined ;
158- if ( config . functions . length > 0 ) {
159- functionName = await getFunctionName ( {
160- contract : config . contract ,
161- data : transaction . input ,
162- } ) ;
163-
164- if ( ! config . functions . includes ( functionName ) ) {
165- // This transaction is not for a subscribed function name.
166- continue ;
167- }
156+ const functionName = await getFunctionName ( {
157+ contract : config . contract ,
158+ data : transaction . input ,
159+ } ) ;
160+ if (
161+ config . functions . length > 0 &&
162+ ! config . functions . includes ( functionName )
163+ ) {
164+ // This transaction is not for a subscribed function name.
165+ continue ;
168166 }
169167
170168 // Store the transaction and receipt.
0 commit comments