feat(escrow): extract reusable SlippageWarning component#350
Open
BigManly4 wants to merge 1 commit into
Open
Conversation
Extract the FX rate slippage warning UI out of FiatXlmPreview into a standalone SlippageWarning component so any escrow flow that quotes a fiat/XLM rate can reuse the same 2%/5% threshold warning and blocking acknowledgment checkbox, rather than duplicating the markup per consumer. FiatXlmPreview now composes SlippageWarning, wiring it to the existing useFiatXlmSlippage hook and fiatXlmSlippageService; behavior (2% advisory banner, 5% blocking checkbox, submission gating) is unchanged. Adds a dedicated test suite covering SlippageWarning in isolation.
|
@BigManly4 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #331
Summary
The FX rate slippage logic and warning UI required by this issue already
existed on main (useFiatXlmSlippage hook, fiatXlmSlippageService, and the
warning markup inlined inside FiatXlmPreview) -- 60-second rate variance
tracking, a non-blocking advisory at >2% variance, and a blocking
checkbox-gated acknowledgment at >5% variance were all already in place
and already covered by tests.
This PR addresses the remaining gap: the issue's implementation directory
names components/escrow/SlippageWarning.tsx specifically, and no such
standalone component existed -- the warning UI was only reachable as
markup embedded in FiatXlmPreview, so no other escrow flow that quotes a
fiat/XLM rate could reuse it.
Changes
that owns the three slippage UI states (none, >2% advisory, >5% blocking
with acknowledgment checkbox), taking the slippage result and an
acknowledgment callback as props.
the same markup, wired to the existing useFiatXlmSlippage hook. Behavior
is unchanged -- confirmed against the existing FiatXlmPreview test suite.
three states, the acknowledgment callback, and the submitting-disabled
state, in isolation from FiatXlmPreview.
Architecture: SlippageWarning (Component) -> useFiatXlmSlippage (Hook) ->
fiatXlmSlippageService -> fxService -> Backend.
Test plan
(SlippageWarning.test.tsx and FiatXlmPreview.test.tsx both green)