mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 19:10:22 +01:00
308151cd49
Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net> Co-authored-by: Dan J Miller <danjm.com@gmail.com> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
19 lines
687 B
JavaScript
19 lines
687 B
JavaScript
import { useSelector } from 'react-redux';
|
|
import { txDataSelector } from '../selectors';
|
|
|
|
/**
|
|
* Returns the simulation failure warning if a simulaiton error
|
|
* is present and user didn't acknowledge gas missing
|
|
*
|
|
* @param {boolean} userAcknowledgedGasMissing - Whether the user acknowledge gas missing
|
|
* @returns {boolean} simulation failure warning
|
|
*/
|
|
|
|
export function useSimulationFailureWarning(userAcknowledgedGasMissing) {
|
|
const txData = useSelector(txDataSelector) || {};
|
|
const hasSimulationError = Boolean(txData.simulationFails);
|
|
const renderSimulationFailureWarning =
|
|
hasSimulationError && !userAcknowledgedGasMissing;
|
|
return renderSimulationFailureWarning;
|
|
}
|