UNPKG

@reservoir0x/relay-kit-ui

Version:

Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.

38 lines 1.79 kB
import { jsx as _jsx } from "react/jsx-runtime"; import * as React from 'react'; import { Text } from '../primitives/index.js'; const ErrorWell = ({ error, hasTxHashes, fromChain }) => { const renderedErrorMessage = React.useMemo(() => { if (error && error.response?.data?.message) { return error.response?.data?.message; } if (error?.message?.includes('An internal error was received.') || !error?.message) { return 'Oops! Something went wrong while processing your transaction.'; } else if (error?.name && (error?.message?.includes('does not support chain') || error?.message?.match(/Chain \d+ not supported/))) { return `Your wallet does not support ${fromChain?.displayName ?? 'this chain'}`; } if (!hasTxHashes || error?.message?.includes('Deposit transaction with hash')) { return 'Oops, something went wrong while initiating the swap. Your request was not submitted. Please try again.'; } else if (error?.message?.includes('solver status check')) { return 'This transaction is taking longer than usual to process. Please visit the transaction page for more details.'; } else if (error.name === 'TransactionConfirmationError') { return 'Transaction Failed. Try adjusting slippage or gas limits and try again.'; } return error?.message; }, [error?.message, hasTxHashes]); return (_jsx(Text, { style: "subtitle1", css: { my: '4', textAlign: 'center', width: '100%', wordBreak: 'break-word' }, children: renderedErrorMessage })); }; export default ErrorWell; //# sourceMappingURL=ErrorWell.js.map