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" ;
4
4
import superjson from "superjson" ;
5
5
import {
6
- Address ,
7
- ThirdwebContract ,
8
6
eth_getBlockByNumber ,
9
7
eth_getTransactionReceipt ,
10
8
getContract ,
11
9
getRpcClient ,
10
+ type Address ,
11
+ type ThirdwebContract ,
12
12
} from "thirdweb" ;
13
13
import { resolveContractAbi } from "thirdweb/contract" ;
14
- import { Abi , Hash , decodeFunctionData } from "viem" ;
14
+ import { decodeFunctionData , type Abi , type Hash } from "viem" ;
15
15
import { bulkInsertContractTransactionReceipts } from "../../db/contractTransactionReceipts/createContractTransactionReceipts" ;
16
16
import { WebhooksEventTypes } from "../../schema/webhooks" ;
17
17
import { getChain } from "../../utils/chain" ;
@@ -20,8 +20,8 @@ import { normalizeAddress } from "../../utils/primitiveTypes";
20
20
import { redis } from "../../utils/redis/redis" ;
21
21
import { thirdwebClient } from "../../utils/sdk" ;
22
22
import {
23
- EnqueueProcessTransactionReceiptsData ,
24
23
ProcessTransactionReceiptsQueue ,
24
+ type EnqueueProcessTransactionReceiptsData ,
25
25
} from "../queues/processTransactionReceiptsQueue" ;
26
26
import { logWorkerExceptions } from "../queues/queues" ;
27
27
import { SendWebhookQueue } from "../queues/sendWebhookQueue" ;
@@ -55,9 +55,8 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
55
55
}
56
56
57
57
// Enqueue webhooks.
58
- const webhooksByContractAddress = await getWebhooksByContractAddresses (
59
- chainId ,
60
- ) ;
58
+ const webhooksByContractAddress =
59
+ await getWebhooksByContractAddresses ( chainId ) ;
61
60
for ( const transactionReceipt of insertedReceipts ) {
62
61
const webhooks =
63
62
webhooksByContractAddress [ transactionReceipt . contractAddress ] ?? [ ] ;
@@ -154,17 +153,16 @@ const getFormattedTransactionReceipts = async ({
154
153
continue ;
155
154
}
156
155
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 ;
168
166
}
169
167
170
168
// Store the transaction and receipt.
0 commit comments