1
- import { Static , Type } from "@sinclair/typebox" ;
2
- import { FastifyInstance } from "fastify" ;
1
+ import { Type , type Static } from "@sinclair/typebox" ;
2
+ import type { FastifyInstance } from "fastify" ;
3
3
import { StatusCodes } from "http-status-codes" ;
4
4
import { toSerializableTransaction } from "thirdweb" ;
5
5
import { TransactionDB } from "../../../db/transactions/db" ;
6
6
import { getAccount } from "../../../utils/account" ;
7
7
import { getBlockNumberish } from "../../../utils/block" ;
8
8
import { getChain } from "../../../utils/chain" ;
9
- import { msSince } from "../../../utils/date" ;
10
9
import { getChecksumAddress , maybeBigInt } from "../../../utils/primitiveTypes" ;
11
10
import { thirdwebClient } from "../../../utils/sdk" ;
12
- import { SentTransaction } from "../../../utils/transaction/types" ;
11
+ import type { SentTransaction } from "../../../utils/transaction/types" ;
13
12
import { enqueueTransactionWebhook } from "../../../utils/transaction/webhook" ;
14
- import { reportUsage } from "../../../utils/usage" ;
15
13
import { MineTransactionQueue } from "../../../worker/queues/mineTransactionQueue" ;
16
14
import { createCustomError } from "../../middleware/error" ;
17
15
import { TransactionHashSchema } from "../../schemas/address" ;
@@ -71,7 +69,7 @@ export async function syncRetryTransaction(fastify: FastifyInstance) {
71
69
"TRANSACTION_NOT_FOUND" ,
72
70
) ;
73
71
}
74
- if ( transaction . status !== "sent" || transaction . isUserOp ) {
72
+ if ( transaction . isUserOp || ! ( "nonce" in transaction ) ) {
75
73
throw createCustomError (
76
74
"Transaction cannot be retried." ,
77
75
StatusCodes . BAD_REQUEST ,
@@ -103,6 +101,7 @@ export async function syncRetryTransaction(fastify: FastifyInstance) {
103
101
// Update state if the send was successful.
104
102
const sentTransaction : SentTransaction = {
105
103
...transaction ,
104
+ status : "sent" ,
106
105
resendCount : transaction . resendCount + 1 ,
107
106
sentAt : new Date ( ) ,
108
107
sentAtBlock : await getBlockNumberish ( chainId ) ,
@@ -127,17 +126,3 @@ export async function syncRetryTransaction(fastify: FastifyInstance) {
127
126
} ,
128
127
} ) ;
129
128
}
130
-
131
- const _reportUsageSuccess = async ( sentTransaction : SentTransaction ) => {
132
- const chain = await getChain ( sentTransaction . chainId ) ;
133
- reportUsage ( [
134
- {
135
- action : "send_tx" ,
136
- input : {
137
- ...sentTransaction ,
138
- provider : chain . rpc ,
139
- msSinceQueue : msSince ( sentTransaction . queuedAt ) ,
140
- } ,
141
- } ,
142
- ] ) ;
143
- } ;
0 commit comments