2021-02-04 19:15:23 +01:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { I18nContext } from '../../../../contexts/i18n';
|
|
|
|
import InfoTooltip from '../../../../components/ui/info-tooltip';
|
|
|
|
import ExchangeRateDisplay from '../../exchange-rate-display';
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
const QuoteDetails = ({
|
|
|
|
slippage,
|
|
|
|
sourceTokenValue,
|
|
|
|
sourceTokenSymbol,
|
|
|
|
destinationTokenValue,
|
|
|
|
destinationTokenSymbol,
|
|
|
|
liquiditySourceKey,
|
|
|
|
minimumAmountReceived,
|
|
|
|
feeInEth,
|
|
|
|
networkFees,
|
2020-10-22 16:58:19 +02:00
|
|
|
metaMaskFee,
|
2020-10-06 20:28:38 +02:00
|
|
|
}) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const t = useContext(I18nContext);
|
2020-10-06 20:28:38 +02:00
|
|
|
return (
|
|
|
|
<div className="quote-details">
|
|
|
|
<div className="quote-details__row">
|
|
|
|
<div className="quote-details__detail-header">{t('swapRate')}</div>
|
|
|
|
<div className="quote-details__detail-content">
|
|
|
|
<ExchangeRateDisplay
|
2020-11-03 00:41:28 +01:00
|
|
|
primaryTokenValue={sourceTokenValue}
|
|
|
|
primaryTokenDecimals={1}
|
|
|
|
primaryTokenSymbol={sourceTokenSymbol}
|
|
|
|
secondaryTokenValue={destinationTokenValue}
|
|
|
|
secondaryTokenDecimals={1}
|
|
|
|
secondaryTokenSymbol={destinationTokenSymbol}
|
2020-10-06 20:28:38 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="quote-details__row">
|
|
|
|
<div className="quote-details__detail-header">
|
|
|
|
{t('swapMaxSlippage')}
|
|
|
|
<InfoTooltip
|
|
|
|
position="bottom"
|
|
|
|
contentText={t('swapQuoteDetailsSlippageInfo')}
|
|
|
|
/>
|
|
|
|
</div>
|
2020-11-03 00:41:28 +01:00
|
|
|
<div className="quote-details__detail-content">{`${slippage}%`}</div>
|
2020-10-06 20:28:38 +02:00
|
|
|
</div>
|
|
|
|
<div className="quote-details__row">
|
|
|
|
<div className="quote-details__detail-header">
|
|
|
|
{t('swapAmountReceived')}
|
|
|
|
<InfoTooltip
|
|
|
|
position="bottom"
|
|
|
|
contentText={t('swapAmountReceivedInfo')}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="quote-details__detail-content">
|
2020-11-03 00:41:28 +01:00
|
|
|
<span>{minimumAmountReceived}</span>
|
|
|
|
<span className="quote-details__bold">{` ${destinationTokenSymbol}`}</span>
|
2020-10-06 20:28:38 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="quote-details__row">
|
|
|
|
<div className="quote-details__detail-header">
|
|
|
|
{t('swapEstimatedNetworkFees')}
|
|
|
|
<InfoTooltip
|
|
|
|
position="bottom"
|
|
|
|
contentText={t('swapEstimatedNetworkFeesInfo')}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="quote-details__detail-content">
|
2020-11-03 00:41:28 +01:00
|
|
|
<span>{feeInEth}</span>
|
|
|
|
<span className="quote-details__light-grey">{` (${networkFees})`}</span>
|
2020-10-06 20:28:38 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="quote-details__row">
|
|
|
|
<div className="quote-details__detail-header">
|
|
|
|
{t('swapSource')}
|
2020-11-03 00:41:28 +01:00
|
|
|
<InfoTooltip position="bottom" contentText={t('swapSourceInfo')} />
|
2020-10-06 20:28:38 +02:00
|
|
|
</div>
|
|
|
|
<div className="quote-details__detail-content">
|
|
|
|
{t(liquiditySourceKey)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="quote-details__row quote-details__row--high">
|
|
|
|
<div className="quote-details__detail-header">
|
2020-11-03 00:41:28 +01:00
|
|
|
<img
|
2021-05-25 02:20:09 +02:00
|
|
|
src="./images/logo/metamask-fox.svg"
|
2020-11-03 00:41:28 +01:00
|
|
|
className="quote-details__metafox-logo"
|
2020-11-11 16:38:15 +01:00
|
|
|
alt=""
|
2020-11-03 00:41:28 +01:00
|
|
|
/>
|
2020-10-06 20:28:38 +02:00
|
|
|
{t('swapMetaMaskFee')}
|
|
|
|
</div>
|
|
|
|
<div className="quote-details__detail-content">
|
|
|
|
{t('swapMetaMaskFeeDescription', [metaMaskFee])}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
QuoteDetails.propTypes = {
|
2020-10-09 17:38:01 +02:00
|
|
|
slippage: PropTypes.number.isRequired,
|
2020-10-06 20:28:38 +02:00
|
|
|
sourceTokenValue: PropTypes.string.isRequired,
|
|
|
|
sourceTokenSymbol: PropTypes.string.isRequired,
|
|
|
|
destinationTokenValue: PropTypes.string.isRequired,
|
|
|
|
destinationTokenSymbol: PropTypes.string.isRequired,
|
|
|
|
liquiditySourceKey: PropTypes.string.isRequired,
|
|
|
|
minimumAmountReceived: PropTypes.string.isRequired,
|
|
|
|
feeInEth: PropTypes.string.isRequired,
|
|
|
|
networkFees: PropTypes.string.isRequired,
|
2020-10-22 16:58:19 +02:00
|
|
|
metaMaskFee: PropTypes.number.isRequired,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export default QuoteDetails;
|