1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

ui - tx conf - only show special token tx conf screen for token send

This commit is contained in:
kumavis 2018-03-21 13:12:59 -07:00
parent 3595d71c2d
commit 3e79941658

View File

@ -63,10 +63,14 @@ PendingTx.prototype.componentWillMount = async function () {
isFetching: false, isFetching: false,
}) })
} }
const tokenData = txParams && abiDecoder.decodeMethod(txParams.data)
const { name: tokenMethodName } = tokenData || {} // inspect tx data for supported special confirmation screens
const isTokenTransaction = ['transfer', 'approve', 'transferFrom'] let isTokenTransaction = false
.find(possibleName => tokenMethodName === possibleName) if (txParams.data) {
const tokenData = abiDecoder.decodeMethod(txParams.data)
const { name: tokenMethodName } = tokenData || {}
isTokenTransaction = (tokenMethodName === 'transfer')
}
if (isTokenTransaction) { if (isTokenTransaction) {
const token = util.getContractAtAddress(txParams.to) const token = util.getContractAtAddress(txParams.to)