|
1 | 1 | import { type Hex, type UUID, bigIntReplacer, bigIntReviver, bigIntToZeroPadded, createUUID } from "@happy.tech/common" |
2 | 2 | import { context, trace } from "@opentelemetry/api" |
3 | 3 | import type { Insertable, Selectable } from "kysely" |
| 4 | +import { type Result, err, ok } from "neverthrow" |
4 | 5 | import { type Address, type ContractFunctionArgs, type Hash, encodeFunctionData } from "viem" |
5 | 6 | import type { ABIManager } from "./AbiManager" |
6 | 7 | import type { LatestBlock } from "./BlockMonitor" |
7 | 8 | import { Topics, eventBus } from "./EventBus.js" |
8 | 9 | import type { TransactionTable } from "./db/types.js" |
9 | 10 | import { TxmMetrics } from "./telemetry/metrics" |
10 | 11 | import { TraceMethod } from "./telemetry/traces" |
11 | | -import { err, ok, type Result } from "neverthrow" |
12 | 12 |
|
13 | 13 | export enum TransactionStatus { |
14 | 14 | /** |
@@ -283,18 +283,16 @@ export class Transaction { |
283 | 283 |
|
284 | 284 | waitForFinalization(timeout?: number): Promise<Result<Transaction, Error>> { |
285 | 285 | return new Promise((resolve) => { |
286 | | - this.waitingPromises.push(resolve); |
287 | | - |
| 286 | + this.waitingPromises.push(resolve) |
| 287 | + |
288 | 288 | if (timeout) { |
289 | 289 | setTimeout(() => { |
290 | | - this.waitingPromises = this.waitingPromises.filter( |
291 | | - p => p !== resolve |
292 | | - ); |
| 290 | + this.waitingPromises = this.waitingPromises.filter((p) => p !== resolve) |
293 | 291 |
|
294 | 292 | resolve(err(new Error(`Transaction finalization timed out after ${timeout}ms`))) |
295 | | - }, timeout); |
| 293 | + }, timeout) |
296 | 294 | } |
297 | | - }); |
| 295 | + }) |
298 | 296 | } |
299 | 297 |
|
300 | 298 | get attemptCount(): number { |
|
0 commit comments