Fix confirmation+execution check

This commit is contained in:
Germán Martínez 2019-11-22 12:24:23 +01:00
parent 88d0453168
commit 0bd9353e60
1 changed files with 4 additions and 4 deletions

View File

@ -64,10 +64,10 @@ const ApproveTxModal = ({
enqueueSnackbar, enqueueSnackbar,
closeSnackbar, closeSnackbar,
}: Props) => { }: Props) => {
const [approveAndExecute, setApproveAndExecute] = useState<boolean>(true) const oneConfirmationLeft = !thresholdReached && tx.confirmations.size + 1 === threshold
const [approveAndExecute, setApproveAndExecute] = useState<boolean>(oneConfirmationLeft || thresholdReached)
const [gasCosts, setGasCosts] = useState<string>('< 0.001') const [gasCosts, setGasCosts] = useState<string>('< 0.001')
const { title, description } = getModalTitleAndDescription(thresholdReached) const { title, description } = getModalTitleAndDescription(thresholdReached)
const oneConfirmationLeft = tx.confirmations.size + 1 === threshold
useEffect(() => { useEffect(() => {
let isCurrent = true let isCurrent = true
@ -107,7 +107,7 @@ const ApproveTxModal = ({
TX_NOTIFICATION_TYPES.CONFIRMATION_TX, TX_NOTIFICATION_TYPES.CONFIRMATION_TX,
enqueueSnackbar, enqueueSnackbar,
closeSnackbar, closeSnackbar,
approveAndExecute, approveAndExecute && oneConfirmationLeft,
) )
onClose() onClose()
} }
@ -131,7 +131,7 @@ const ApproveTxModal = ({
<br /> <br />
<Bold className={classes.nonceNumber}>{tx.nonce}</Bold> <Bold className={classes.nonceNumber}>{tx.nonce}</Bold>
</Paragraph> </Paragraph>
{!thresholdReached && oneConfirmationLeft && ( {oneConfirmationLeft && (
<> <>
<Paragraph color="error"> <Paragraph color="error">
Approving this transaction executes it right away. If you want approve but execute the transaction Approving this transaction executes it right away. If you want approve but execute the transaction