Skip to content

Add timeout handling for transaction waiting in wrapWithToast utility #11

@coderabbitai

Description

@coderabbitai

Context

Currently, the wrapWithToast function in web/src/utils/wrapWithToast.ts waits indefinitely for transaction receipts using publicClient.waitForTransactionReceipt({ hash, confirmations: 2 }). This could potentially lead to poor user experience if transactions take an unusually long time to be mined.

Suggested Improvement

Add a timeout mechanism that rejects the wait if the transaction receipt is not received within a reasonable time limit (e.g., 5 minutes). This can be implemented by wrapping the waitForTransactionReceipt call in a Promise.race with a timeout promise.

Benefits

  • Prevents indefinite waiting
  • Improves user experience with clear timeout messaging
  • Allows users to take appropriate action if transactions are delayed

Related Discussion

This issue was created following a code review suggestion to discuss the implementation approach and timing for this enhancement.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions