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)
// inspect tx data for supported special confirmation screens
let isTokenTransaction = false
if (txParams.data) {
const tokenData = abiDecoder.decodeMethod(txParams.data)
const { name: tokenMethodName } = tokenData || {} const { name: tokenMethodName } = tokenData || {}
const isTokenTransaction = ['transfer', 'approve', 'transferFrom'] isTokenTransaction = (tokenMethodName === 'transfer')
.find(possibleName => tokenMethodName === possibleName) }
if (isTokenTransaction) { if (isTokenTransaction) {
const token = util.getContractAtAddress(txParams.to) const token = util.getContractAtAddress(txParams.to)