diff --git a/.changeset/perfect-walls-turn.md b/.changeset/perfect-walls-turn.md new file mode 100644 index 000000000..f8d39f9e2 --- /dev/null +++ b/.changeset/perfect-walls-turn.md @@ -0,0 +1,5 @@ +--- +'@reservoir0x/relay-kit-ui': patch +--- + +Fix slippage ui bugs diff --git a/packages/ui/src/components/common/TransactionModal/steps/ReviewQuoteStep.tsx b/packages/ui/src/components/common/TransactionModal/steps/ReviewQuoteStep.tsx index 3144f975d..0352a41b7 100644 --- a/packages/ui/src/components/common/TransactionModal/steps/ReviewQuoteStep.tsx +++ b/packages/ui/src/components/common/TransactionModal/steps/ReviewQuoteStep.tsx @@ -116,16 +116,18 @@ export const ReviewQuoteStep: FC = ({ let breakdown: { title: string; value: ReactNode }[] = [] - if ( - minimumAmountFormatted && - quote?.details?.slippageTolerance?.destination?.percent && - quote.details.slippageTolerance.destination.percent != '0.00' - ) { + const slippage = Number( + quote?.details?.slippageTolerance?.destination?.percent ?? + quote?.details?.slippageTolerance?.origin?.percent ?? + 0 + ) + + if (minimumAmountFormatted && slippage && slippage != 0) { breakdown.push({ title: 'Min. Received', value: ( = ({ {quote?.details?.slippageTolerance?.destination?.percent ?? 0} % - + = ({ }) } - breakdown = [ - ...breakdown, - { + if (timeEstimate.time) { + breakdown.push({ title: 'Estimated time', value: ( = ({ ~ {timeEstimate?.formattedTime} ) - }, + }) + } + + breakdown = [ + ...breakdown, { title: 'Network cost', value: (