Skip to content

Commit

Permalink
fix: Show tenderly failed message if call trace error
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Jul 13, 2023
1 parent 99674a8 commit 9923765
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/tx/security/tenderly/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ const TxSimulationBlock = ({ transactions, disabled, gasLimit }: TxSimulationPro
const isDarkMode = useDarkMode()
const { safeTx } = useContext(SafeTxContext)
const {
simulation: { simulateTransaction, simulationRequestStatus, resetSimulation },
simulation: { simulation, simulateTransaction, simulationRequestStatus, resetSimulation },
} = useContext(TxInfoContext)

const isLoading = simulationRequestStatus === FETCH_STATUS.LOADING
const isSuccess = simulationRequestStatus === FETCH_STATUS.SUCCESS
const isError = simulationRequestStatus === FETCH_STATUS.ERROR

const isCallTraceError = isSuccess && getCallTraceErrors(simulation).length > 0

const handleSimulation = async () => {
if (!wallet) {
return
Expand Down Expand Up @@ -111,16 +113,16 @@ const TxSimulationBlock = ({ transactions, disabled, gasLimit }: TxSimulationPro
color: ({ palette }) => palette.text.secondary,
}}
/>
) : isError || isCallTraceError ? (
<Typography variant="body2" color="error.main" className={sharedCss.result}>
<SvgIcon component={CloseIcon} inheritViewBox fontSize="small" sx={{ verticalAlign: 'middle', mr: 1 }} />
Error
</Typography>
) : isSuccess ? (
<Typography variant="body2" color="success.main" className={sharedCss.result}>
<SvgIcon component={CheckIcon} inheritViewBox fontSize="small" sx={{ verticalAlign: 'middle', mr: 1 }} />
Success
</Typography>
) : isError ? (
<Typography variant="body2" color="error.main" className={sharedCss.result}>
<SvgIcon component={CloseIcon} inheritViewBox fontSize="small" sx={{ verticalAlign: 'middle', mr: 1 }} />
Error
</Typography>
) : (
<Button
variant="outlined"
Expand Down

0 comments on commit 9923765

Please sign in to comment.