-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programfrontendgood first issueGood for newcomersGood for newcomers
Description
🧭 Overview
BridgeWise executes cross-chain transfers, and slippage can negatively impact users by:
- Increasing the effective cost
- Causing partial or failed transactions
This issue introduces a Slippage Alert & Notification System that:
- Monitors slippage thresholds in real-time
- Notifies users if slippage exceeds acceptable limits
- Integrates with
<BridgeCompare />,<BridgeStatus />, anduseBridgeQuotes() - Provides developers with hooks and callbacks for custom handling
🎯 Problem
- Users may unknowingly initiate transfers with high slippage
- High slippage reduces user trust
- Developers currently cannot provide proactive warnings
- Lack of notifications leads to failed or suboptimal transactions
Without slippage alerts, BridgeWise risks poor UX and decreased adoption.
💡 Proposed Solution
Implement a system that:
- Tracks slippage for all active quotes and routes
- Compares slippage against configurable thresholds
- Provides user-facing notifications via UI components
- Exposes hook
useSlippageAlert()for developer integration - Supports automatic blocking of transfers exceeding maximum slippage (optional)
🛠 Scope of Work
1️⃣ Define Slippage Alert Configuration
interface SlippageAlertConfig {
maxSlippagePercent: number; // default 1%
notifyUser?: boolean; // display alert in UI
onAlert?: (data: { bridge: string; slippage: number }) => void;
}- Configurable per dApp
- Optional callback for custom notifications
2️⃣ Implement Slippage Monitoring
- Integrate with
useBridgeQuotes()and real-time refresh (Issue Transaction Validation & Pre-Flight Checks #17) - Track calculated slippage for each route
- Compare against configured thresholds
- Trigger alerts or callbacks when exceeded
3️⃣ Integrate With Components
-
<BridgeCompare />:- Highlight routes with high slippage
-
<BridgeStatus />:- Show slippage warning during execution
-
Provide optional toast notifications or banners
4️⃣ Hook Implementation
-
useSlippageAlert(config: SlippageAlertConfig):-
Returns:
alertsarraydismissAlert()function
-
SSR-safe
-
Works with headless mode
-
5️⃣ Error Handling & Fallbacks
- Graceful handling if slippage data is unavailable
- Ensure alerts do not block UI
- Optional suppression of alerts for certain routes
📊 Expected Outcome
- Users are proactively warned of high slippage
- Reduced failed or unexpectedly expensive transfers
- Developers have control over alerting behavior
- Integration with existing UI and hooks is seamless
✅ Acceptance Criteria
- Slippage monitoring implemented for all active quotes
- Configurable alert thresholds supported
-
useSlippageAlert()hook implemented - Integration with
<BridgeCompare />and<BridgeStatus /> - Optional toast/banner notifications functional
- Alerts can be dismissed or programmatically managed
- SSR-safe implementation
- Unit tests for monitoring, alerts, and hooks
- Documentation updated with usage examples
📈 Measurable Impact
- Increased user trust in cross-chain transfers
- Reduced financial loss due to slippage
- Higher adoption among professional dApp teams
- Developers can provide proactive UX improvements
🧪 Testing Requirements
- Simulate routes with slippage above and below thresholds
- Verify alerts trigger correctly
- Test integration with UI components
- Validate hook behavior in headless mode
- Confirm SSR-safe operation
- Test dismiss and callback functionality
📚 Documentation Requirements
- Add “Slippage Alerts” section to README
- Provide usage example with hook:
const { alerts, dismissAlert } = useSlippageAlert({ maxSlippagePercent: 1 });- Include examples in demo app
- Document integration with
<BridgeCompare />and<BridgeStatus />
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programfrontendgood first issueGood for newcomersGood for newcomers