fix(tangle-cloud): fix service request args and improve UX#3134
fix(tangle-cloud): fix service request args and improve UX#3134vutuanlinh2k2 wants to merge 21 commits intov2from
Conversation
Adds encodeRequestArgsFromJson which validates and encodes JSON args against a parsed blueprint schema into TLV binary format. Introduces RequestArgsEncodingError for precise per-path error reporting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetches and parses the on-chain request schema from getBlueprintDefinition. Returns parsed SchemaField[], hasRequestSchema flag, and any parse errors so consumers can gate encoding and surface friendly error messages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…st modes Adds exposureBps to ServiceRequestParams and a selectRequestFunction helper to pick between requestService, requestServiceWithExposure, and requestServiceWithSecurity based on the params. Adds validateServiceRequestParams for pre-flight checks. Updates encodeServiceConfig to use the schema-aware TLV encoder instead of throwing for non-empty args. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds requestMode (basic/exposure/security) and globalExposurePercent fields. Makes assets and securityCommitments optional by default with mode-gated validation. Removes approvalModel/minApproval fields and the now-unused formatServiceRequestData function. Passes request schema metadata through BaseDeployStepProps. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces AdvancedOptionsStep with RequestModeStep (basic/exposure/security selector with optional global exposure input). AssetConfigurationStep now hides itself in non-security modes. OperatorSelectionStep syncs security commitments only when in security mode and removes the approval model logic. RequestArgsConfigurationStep shows schema-driven field counts and parse error banners. Deploy page integrates useBlueprintRequestSchema, passes schema metadata to steps, and routes the submit to the correct contract variant with structured error handling. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Switches to a cleaner border/background treatment: rounded-xl with a thinner border and solid mono background, keeping the gradient only in dark mode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tom security requirements Adds ServiceRequestVariant type (basic/exposure/security/unknown) and detects the variant by decoding the originating transaction's calldata. Separates the default TNT security requirement from custom ones so consumers can distinguish between the two. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ad of hardcoding Replaces the hardcoded DEFAULT_TNT_MIN_EXPOSURE_BPS constant (1000) with a live contract read of defaultTntMinExposureBps so the check stays accurate if the contract value changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…erviceRequestSummary Shows the request mode (Basic / With Exposure / With Security), the per-operator requested exposure percentages for exposure-mode requests, and the default TNT collateral range when present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…el import BasicInformationStep: wires up setError/clearErrors for real-time duration range feedback, adds isInvalid and max props to the Input, and properly clears the field when empty. OperatorSelectionStep: replaces the removed getMembershipModelLabel import with getMembershipLabel from the local serviceRequest types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stDetails Decode operator addresses from service request calldata and return them alongside requestedExposureBps. Swap TangleABI-based getLogs calls for typed parseAbi/parseAbiItem signatures to avoid ambiguous overload resolution, and separate variant detection (via selector) from argument decoding so a decode failure does not discard the already-identified variant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stSummary Replace the flat comma-separated exposure list with a per-operator table that maps each exposure bps value to its operator address (shortened). Also add a human-readable "Meaning" row that explains what each request variant (basic / exposure / security / unknown) implies. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…xposure in deploy form
- Remove AssetConfigurationStep from Deployment; asset security
configuration is now consolidated inside RequestModeStep
- Replace the single globalExposurePercent slider with a per-operator
Slider row (keyed by normalised operator address) in exposure mode
- Add security mode UI: asset selector + AssetRequirementFormItem rows
with min/max exposure sliders and remove buttons
- Update deployBlueprint Zod schema from globalExposurePercent to
operatorExposurePercents record; validate that every selected operator
has an entry when requestMode === 'exposure'
- Fix ZodError path serialisation in page.tsx to use err.path.join('.')
so nested field errors (e.g. operatorExposurePercents.<addr>) are set
correctly; switch watch() to getValues() in onDeployBlueprint to read
latest committed values
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…quest UX - Add StandardApprovalInfo component for basic/exposure approval (read-only view) - Add standard approval path in ServiceRequestDetailModal for non-custom requirements - Move asset requirements selector inline with Mode selector in RequestModeStep - Replace verbose "Meaning" section with ModalSafeTooltip on variant label in ServiceRequestSummary - Add disabled state (opacity + cursor) to Slider component - Remove redundant hasRequirements variable (subsumed by hasCustomRequirements) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace static StandardApprovalInfo display with an interactive ExposureCommitmentInput for the TNT requirement, pass tntExposureBps through the form and approval tx, and add the 3-arg approveService / approveServiceWithBls ABI overloads that accept a tntExposureBps param. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…itmentSection Move ModalSafeTooltip and request variant/exposure logic from ServiceRequestSummary into CommitmentSection, removing the separate "Request Variant" section. Also update ExposureCommitmentInput to always show the operator exposure row with a "protocol default" label when exposure is 100%. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace BlueprintInfoCard with an inline blueprint link in CommitmentSection - Highlight current operator with a "(You)" label in exposure list - Move CommitmentSection above PaymentTermsSection for better info hierarchy - Fix modal layout to support scrollable body with sticky footer Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @vutuanlinh2k2's task —— View job PR Code ReviewThis is a substantial PR that implements multi-mode service requests with impressive scope and good architectural decisions. Here's my comprehensive analysis: Todo List
🟢 StrengthsArchitecture & Design
Code Quality
🟡 Issues & RecommendationsCritical Issues1. TLV Encoder Validation -
|
Summary
tntExposureBpsin standard approval flowglobalExposurePercentwith per-operator exposure in deploy formServiceRequestSummaryrequestedOperatorsfromuseServiceRequestDetailsServiceRequestSummarydefaultTntMinExposureBpsfrom contract instead of hardcodinguseBlueprintRequestSchemahook and TLV request args encoderVideos
CleanShot.2026-02-23.at.22.16.27.mp4
CleanShot.2026-02-23.at.22.12.45.mp4
Test plan
tntExposureBpsis handled correctly in approval🤖 Generated with Claude Code