-
Notifications
You must be signed in to change notification settings - Fork 23
Description
🧭 Overview
BridgeWise aggregates bridge data, but developers embedding the SDK currently lack visibility into usage and performance metrics.
This issue introduces a Bridge Analytics Dashboard Integration that exposes:
- Number of transfers per route
- Average settlement times
- Bridge success/failure rates
- Slippage statistics
- User activity insights
This enables developers to monitor BridgeWise usage and optimize UX.
🎯 Problem
- Developers cannot track which routes are most used.
- Performance issues may go undetected.
- No visibility into user behavior across bridges.
- Limited feedback reduces the ability to improve the dApp experience.
Without analytics, BridgeWise cannot provide actionable insights to its integrators.
💡 Proposed Solution
Integrate BridgeWise with a dashboard layer that collects and presents metrics including:
- Transfer counts per bridge and route
- Average fees and settlement times
- Reliability/failure rates
- Slippage statistics
- Trend charts for usage over time
Provide both SDK-level hooks and REST API endpoints for developers to consume metrics.
🛠 Scope of Work
1️⃣ Define Analytics Data Model
interface BridgeAnalytics {
bridgeName: string;
sourceChain: string;
destinationChain: string;
totalTransfers: number;
successfulTransfers: number;
failedTransfers: number;
averageSettlementTimeMs: number;
averageFee: number;
averageSlippagePercent: number;
lastUpdated: Date;
}- Store aggregated statistics
- Track per route and per bridge
2️⃣ Implement Data Collection
-
Hook into:
useBridgeExecution()for transactions- Reliability and slippage modules
-
Update metrics in real-time or batched intervals
-
Store in database (or local storage for client-only analytics)
3️⃣ Expose Metrics API
- REST endpoint:
GET /api/v1/bridge-analytics - Return metrics per bridge and per route
- Support filtering by time range
4️⃣ Dashboard Visualization (Optional SDK Demo)
-
Simple React dashboard component
-
Display:
- Usage charts
- Top-performing bridges
- Slippage and failure trends
-
Supports light/dark theme integration
5️⃣ Integration with Hooks
-
Create
useBridgeAnalytics()hook -
Return:
analyticsDataloadingerror
-
SSR-safe for Next.js integration
📊 Expected Outcome
- Developers gain actionable insights
- Ability to optimize bridge selection and UX
- Visibility into failed or high-slippage routes
- Enhanced adoption due to data-driven decisions
✅ Acceptance Criteria
- Analytics data model defined and implemented
- Data collection integrated with execution and reliability modules
- REST API endpoint available and functional
-
useBridgeAnalytics()hook implemented - Dashboard demo component available
- SSR-safe implementation for Next.js
- Aggregated metrics are accurate and up-to-date
- Unit tests for data collection, API, and hooks
- Documentation updated with usage examples
📈 Measurable Impact
- Increased developer visibility into BridgeWise performance
- Faster detection of problematic bridges/routes
- Improved decision-making for dApp UX optimization
- Reduced failed transfer complaints
🧪 Testing Requirements
- Simulate multiple transactions per bridge
- Validate aggregated metrics calculations
- Test REST API response structure
- Test hook returns correct metrics
- Confirm dashboard displays accurate charts
- Verify SSR-safe rendering in Next.js
📚 Documentation Requirements
- Add “Analytics Dashboard Integration” section in README
- Provide API response examples
- Document
useBridgeAnalytics()hook - Include dashboard usage example in demo app