diff --git a/src/components/transactions/FlowCommons/Error.tsx b/src/components/transactions/FlowCommons/Error.tsx index dc984b84c5..5345a30e61 100644 --- a/src/components/transactions/FlowCommons/Error.tsx +++ b/src/components/transactions/FlowCommons/Error.tsx @@ -2,10 +2,26 @@ import { DuplicateIcon, XIcon } from '@heroicons/react/outline'; import { Trans } from '@lingui/macro'; import { Box, Button, Link, SvgIcon, Typography } from '@mui/material'; import { useModalContext } from 'src/hooks/useModal'; +import { useRootStore } from 'src/store/root'; import { TxErrorType } from 'src/ui-config/errorMapping'; +import { useShallow } from 'zustand/shallow'; export const TxErrorView = ({ txError }: { txError: TxErrorType }) => { const { close } = useModalContext(); + const [setFeedbackOpen, setSupportPrefillMessage] = useRootStore( + useShallow((state) => [state.setFeedbackOpen, state.setSupportPrefillMessage]) + ); + + const handleGetSupport = () => { + const rawMessage = txError?.rawError?.message + ? txError.rawError.message.toString() + : 'Unknown error'; + const template = `I am coming from a transaction failure with this error:\n\n"${rawMessage}"`; + + setSupportPrefillMessage(template); + setFeedbackOpen(true); + close(); + }; return ( <> @@ -47,18 +63,22 @@ export const TxErrorView = ({ txError }: { txError: TxErrorType }) => { - + + + + + +