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
1 changed files with 8 additions and 4 deletions

View File

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