feat(tangle-cloud): manage service requests with approval flow#3116
feat(tangle-cloud): manage service requests with approval flow#3116
Conversation
…mitments (Flow 4) - Implement useServiceApproveTx with support for simple approval (restaking %) and approval with security commitments (per-asset exposure) - Implement useServiceRejectTx for rejecting service requests - Add useServiceRequestSecurityRequirements hook to query security requirements from contract and resolve token metadata - Add ExposureCommitmentInput component for per-asset exposure commitment slider - Update ApproveConfirmationModal to support both simple and commitments modes with proper loading states and validation - Update PendingInstanceTable to show operator approval/rejection status and pending approval count - Add approvedOperators and rejectedOperators fields to ServiceRequest - Add success/error snackbar notifications to useContractWrite - Update .gitignore to exclude docs/cloud-qa Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add minimum 1% exposure validation (contract rejects 0) - Improve permitted caller input placeholder clarity - Fix asset info layout with consistent widths and truncation - Update slider defaults to match contract requirements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace seconds-only input with a user-friendly duration input that supports hours, days, and weeks. Users can now enter values like "7 days" instead of calculating "604800 seconds". - Add DURATION_UNITS constant with hours/days/weeks conversion - Add toSeconds/fromSeconds utility functions - Update schema to track duration value and unit separately - Add dynamic validation based on selected unit (min 1 hour, max 365 days) - Update UI with Input + Select combo for value and unit selection - Show dynamic helper text with valid range for selected unit Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add operator stake querying to show how many tokens are at risk when approving service requests. The ExposureCommitmentInput now displays the delegated amount and calculates/displays "tokens at risk" based on the selected exposure percentage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…e request The TTL value was being passed directly to the contract without converting based on the selected duration unit (hours/days/weeks). This caused TTLBelowMinimum errors when deploying blueprints since entering "1 hour" sent 1 second instead of 3600 seconds. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tor access - Fix service ID validation to properly handle ID 0 (BigInt zero is falsy) - Add useServicesByOperator to allow operators to access service details - Refactor approve/reject hooks to use onSuccess callbacks instead of useEffect Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…days Replace weeks with seconds and minutes for more granular duration control. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…legationsByAsset Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…types Add new data hooks for fetching service request details: - useServiceRequestDetails: fetch contract details for a service request - useBlueprintConfig: fetch blueprint configuration (membership model, pricing) - useTokenMetadata: fetch token name, symbol, and decimals Extend useServices GraphQL hook: - Add approvalCount and securityRequirements fields to ServiceRequest - Add useOperatorActedServiceRequests hook for requests operator has acted on Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add reusable components for displaying service request information: - BlueprintInfoCard: display blueprint metadata - CommitmentSection: display security commitment requirements - OperatorStatusSection: show operator approval/rejection status - PaymentTermsSection: display pricing and payment terms - SecurityRequirementsSection: display asset security requirements - ServiceRequestSummary: summary component for key request details Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add types and utility functions for service requests: - MembershipModel enum (Fixed/Dynamic) - OperatorApprovalStatus and OperatorWithStatus types - formatTtl, formatCreatedAt, getMembershipLabel utilities Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…request detail modal Refactor service request approval flow: - Replace separate ApproveConfirmationModal and RejectConfirmationModal with unified ServiceRequestDetailModal - Add ApprovedInstanceTable to show requests operator has approved/rejected - Update PendingInstanceTable to filter out requests operator has already acted on - Add "Review" button instead of separate Approve/Reject buttons - Add new "Approved" tab in instances page for operator's acted requests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Improve deployment flow by fetching blueprint configuration from contract: - Fetch blueprint config (membership model, min operators) using useBlueprintConfig - Auto-set approval model and min approval based on blueprint's membership model - Show membership model indicator (Fixed/Dynamic) in operator selection step - Improve form handling for instance duration input - Set default minExposurePercent to 1 (minimum required by schema) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolve conflict in ClaimableRewardsCard.tsx by accepting v2 changes and applying button text update to "Claim All Rewards" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@claude review this PR |
|
Claude finished @vutuanlinh2k2's task —— View job PR Review Complete ✅I've conducted a comprehensive review of this service request management PR with approval flow implementation. Here are my findings: Review Progress:
Overall Assessment: ✅ Excellent ImplementationThis is a well-architected PR that successfully implements a comprehensive service request management system. The code quality is high and follows React/TypeScript best practices. Strengths 💪1. Excellent Component Architecture
2. Robust Data Layer
3. Strong TypeScript Implementation
4. Smart Security Requirements Logic
5. Good Error Handling Patterns
Areas for Improvement 🔧1. Minor: Magic Numbers// In useServiceRequestSecurityRequirements.ts:16-17
const DEFAULT_TNT_MIN_EXPOSURE_BPS = 1000; // 10%
const DEFAULT_TNT_MAX_EXPOSURE_BPS = 10000; // 100%Suggestion: Consider moving these to a shared constants file if used elsewhere. 2. Minor: Error Message ConsistencyServiceRequestDetailModal.tsx:360: Form validation errors could use more consistent messaging patterns across all inputs. 3. Minor: Component SizeServiceRequestDetailModal.tsx is quite large (479 lines). Consider extracting the approval form logic into a separate component. Security Considerations ✅
Technical Debt Assessment ✅
Test Coverage Recommendations 📋While I didn't see test files in this PR, consider adding tests for:
Conclusion 🎯This is a high-quality implementation that successfully adds comprehensive service request management functionality. The code is well-structured, type-safe, and follows React best practices. The approval flow logic is robust and handles both simple and complex security requirement scenarios effectively. Recommendation: ✅ Approve - This PR is ready for merge after addressing any minor feedback. |
Summary
Video
CleanShot.2026-02-04.at.21.49.16.mp4
Test plan
🤖 Generated with Claude Code