mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Ensure correct confirm screen in case of smartcontract check fail
This commit is contained in:
parent
1d14646a4c
commit
8458873a20
@ -25,6 +25,7 @@ export default class ConfirmTransactionSwitch extends Component {
|
|||||||
methodData: PropTypes.object,
|
methodData: PropTypes.object,
|
||||||
fetchingData: PropTypes.bool,
|
fetchingData: PropTypes.bool,
|
||||||
isEtherTransaction: PropTypes.bool,
|
isEtherTransaction: PropTypes.bool,
|
||||||
|
isTokenMethod: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectToTransaction () {
|
redirectToTransaction () {
|
||||||
@ -33,6 +34,7 @@ export default class ConfirmTransactionSwitch extends Component {
|
|||||||
methodData: { name },
|
methodData: { name },
|
||||||
fetchingData,
|
fetchingData,
|
||||||
isEtherTransaction,
|
isEtherTransaction,
|
||||||
|
isTokenMethod,
|
||||||
} = this.props
|
} = this.props
|
||||||
const { id, txParams: { data } = {} } = txData
|
const { id, txParams: { data } = {} } = txData
|
||||||
|
|
||||||
@ -45,7 +47,7 @@ export default class ConfirmTransactionSwitch extends Component {
|
|||||||
return <Redirect to={{ pathname }} />
|
return <Redirect to={{ pathname }} />
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEtherTransaction) {
|
if (isEtherTransaction && !isTokenMethod) {
|
||||||
const pathname = `${CONFIRM_TRANSACTION_ROUTE}/${id}${CONFIRM_SEND_ETHER_PATH}`
|
const pathname = `${CONFIRM_TRANSACTION_ROUTE}/${id}${CONFIRM_SEND_ETHER_PATH}`
|
||||||
return <Redirect to={{ pathname }} />
|
return <Redirect to={{ pathname }} />
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import ConfirmTransactionSwitch from './confirm-transaction-switch.component'
|
import ConfirmTransactionSwitch from './confirm-transaction-switch.component'
|
||||||
|
import {
|
||||||
|
TOKEN_METHOD_TRANSFER,
|
||||||
|
TOKEN_METHOD_APPROVE,
|
||||||
|
TOKEN_METHOD_TRANSFER_FROM,
|
||||||
|
} from '../../helpers/constants/transactions'
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const {
|
const {
|
||||||
@ -16,6 +21,7 @@ const mapStateToProps = state => {
|
|||||||
methodData,
|
methodData,
|
||||||
fetchingData,
|
fetchingData,
|
||||||
isEtherTransaction: !toSmartContract,
|
isEtherTransaction: !toSmartContract,
|
||||||
|
isTokenMethod: [TOKEN_METHOD_APPROVE, TOKEN_METHOD_TRANSFER, TOKEN_METHOD_TRANSFER_FROM].includes(methodData.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user