/ src / components / transactions / Warnings / ParaswapErrorDisplay.tsx
ParaswapErrorDisplay.tsx
 1  import { Trans } from '@lingui/macro';
 2  import { Box, Typography } from '@mui/material';
 3  import { Warning } from 'src/components/primitives/Warning';
 4  import { TxErrorType } from 'src/ui-config/errorMapping';
 5  
 6  import { GasEstimationError } from '../FlowCommons/GasEstimationError';
 7  
 8  const USER_DENIED_SIGNATURE = 'MetaMask Message Signature: User denied message signature.';
 9  const USER_DENIED_TRANSACTION = 'MetaMask Tx Signature: User denied transaction signature.';
10  
11  interface ErrorProps {
12    txError: TxErrorType;
13  }
14  export const ParaswapErrorDisplay: React.FC<ErrorProps> = ({ txError }) => {
15    return (
16      <Box>
17        <GasEstimationError txError={txError} />
18        {txError.rawError.message !== USER_DENIED_SIGNATURE &&
19          txError.rawError.message !== USER_DENIED_TRANSACTION && (
20            <Box sx={{ pt: 4 }}>
21              <Warning severity="info">
22                <Typography variant="description">
23                  {' '}
24                  <Trans> Tip: Try increasing slippage or reduce input amount</Trans>
25                </Typography>
26              </Warning>
27            </Box>
28          )}
29      </Box>
30    );
31  };