-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
🧭 Overview
BridgeWise executes cross-chain transfers, but network failures, rate limits, or bridge errors can cause transaction failures.
This issue introduces a Transaction Retry & Recovery System that:
- Automatically retries failed transactions when safe
- Provides developers hooks to handle retries
- Logs and reports failed attempts for analysis
- Integrates with transaction status tracking (feat: Setup Storybook documentation in apps/docs #27) and rate-limited APIs (Retry, Timeout, and Failure Recovery Logic #18)
🎯 Problem
- Failed transactions require manual intervention
- Users may unknowingly lose funds or experience delays
- Developers embedding the SDK lack automated recovery mechanisms
- Without retry/recovery, BridgeWise UX and reliability are compromised
💡 Proposed Solution
Implement a Transaction Retry & Recovery Layer that:
- Monitors failed transactions in real-time
- Automatically retries based on configurable rules (max retries, exponential backoff)
- Exposes hooks and events:
useTransactionRetry()
- Logs failure reasons and retry attempts for analytics
- Supports safe recovery without double-spending
🛠 Scope of Work
1️⃣ Retry Policy Configuration
interface TransactionRetryConfig {
maxRetries?: number; // default 3
backoffMultiplier?: number; // default 2
retryOnErrors?: string[]; // list of error codes
}- Configurable per transaction type or bridge
- Allows selective retry for recoverable errors
2️⃣ Hook Implementation
const { retryTransaction, retryCount, status, error } = useTransactionRetry(txHash, config);retryTransaction(): manual retry triggerretryCount: current retry attemptstatus: current transaction stateerror: structured error info- SSR-safe and headless mode compatible
3️⃣ Integration With Status Tracking & UI
- Automatically integrates with
useTransactionStatus()(feat: Setup Storybook documentation in apps/docs #27) <BridgeStatus />and<BridgeHistory />reflect retries and recovered states- Optional developer callbacks for custom notifications
4️⃣ Error Handling & Fallbacks
- Only retry safe-to-repeat transactions
- Graceful fallback when maximum retries are reached
- Provide detailed error logs for developers
- Avoid double execution or fund loss
📊 Expected Outcome
- Automatic recovery of failed transactions when possible
- Reduced manual intervention for users
- Developers gain hooks and analytics for failed/retried transactions
- Improved reliability and trust in BridgeWise SDK
✅ Acceptance Criteria
- Transaction retry policy implemented and configurable
-
useTransactionRetry()hook implemented and SSR-safe - Integration with
<BridgeStatus />and<BridgeHistory /> - Retry triggers follow safe policies and backoff strategy
- Structured error logging and reporting
- Fallback behavior for unrecoverable failures
- Unit tests covering retry logic, hooks, and UI integration
- Documentation updated with usage examples
📈 Measurable Impact
- Reduced failed transfer rate
- Users experience smoother cross-chain transfers
- Developers gain automated recovery and analytics
- Increased confidence in SDK reliability
🧪 Testing Requirements
- Simulate recoverable and unrecoverable transaction failures
- Verify automatic retries follow backoff strategy
- Test manual retry via
retryTransaction() - Validate UI updates for retries and recovered states
- Confirm SSR-safe and headless mode functionality
📚 Documentation Requirements
- Add “Transaction Retry & Recovery” section in README
- Provide hook usage example:
const { retryTransaction, retryCount, status, error } = useTransactionRetry(txHash, { maxRetries: 3 });- Include integration with
<BridgeStatus />and<BridgeHistory /> - Document retry policies, backoff strategy, and safe usage
Reactions are currently unavailable