/ src / components / transactions / FlowCommons / GasEstimationError.tsx
GasEstimationError.tsx
 1  import { Trans } from '@lingui/macro';
 2  import { Button, Typography } from '@mui/material';
 3  import { Warning } from 'src/components/primitives/Warning';
 4  import { TxErrorType } from 'src/ui-config/errorMapping';
 5  
 6  export const GasEstimationError = ({ txError }: { txError: TxErrorType }) => {
 7    return (
 8      <Warning severity="error" sx={{ mt: 4, mb: 0 }}>
 9        <Typography variant="description">
10          {txError.error ? (
11            <>
12              {txError.error}{' '}
13              <Button
14                sx={{ verticalAlign: 'top' }}
15                variant="text"
16                onClick={() => navigator.clipboard.writeText(txError.rawError.message.toString())}
17              >
18                <Typography variant="description">
19                  <Trans>copy the error</Trans>
20                </Typography>
21              </Button>
22            </>
23          ) : (
24            <Trans>
25              There was some error. Please try changing the parameters or{' '}
26              <Button
27                sx={{ verticalAlign: 'top' }}
28                onClick={() => navigator.clipboard.writeText(txError.rawError.message.toString())}
29              >
30                <Typography variant="description">copy the error</Typography>
31              </Button>
32            </Trans>
33          )}
34        </Typography>
35      </Warning>
36    );
37  };