From e1e2674cd23e5db4902eb85fcb8784e321dd2c19 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Wed, 19 Apr 2017 16:02:24 +0200 Subject: [PATCH] Show ETH value (even 0) if ETH transfert in transaction list (#5406) --- js/src/ui/TxList/TxRow/txRow.js | 37 +++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/js/src/ui/TxList/TxRow/txRow.js b/js/src/ui/TxList/TxRow/txRow.js index 8d123c13c..1fcf54396 100644 --- a/js/src/ui/TxList/TxRow/txRow.js +++ b/js/src/ui/TxList/TxRow/txRow.js @@ -21,9 +21,10 @@ import { Link } from 'react-router'; import { txLink } from '~/3rdparty/etherscan/links'; -import IdentityIcon from '../../IdentityIcon'; -import IdentityName from '../../IdentityName'; -import MethodDecoding from '../../MethodDecoding'; +import IdentityIcon from '~/ui/IdentityIcon'; +import IdentityName from '~/ui/IdentityName'; +import MethodDecoding from '~/ui/MethodDecoding'; +import MethodDecodingStore from '~/ui/MethodDecoding/methodDecodingStore'; import styles from '../txList.css'; @@ -48,6 +49,29 @@ class TxRow extends Component { historic: true }; + state = { + isContract: false, + isDeploy: false + }; + + methodDecodingStore = MethodDecodingStore.get(this.context.api); + + componentWillMount () { + const { address, tx } = this.props; + + this + .methodDecodingStore + .lookup(address, tx) + .then((lookup) => { + const newState = { + isContract: lookup.contract, + isDeploy: lookup.deploy + }; + + this.setState(newState); + }); + } + render () { const { address, className, historic, netVersion, tx } = this.props; @@ -117,9 +141,14 @@ class TxRow extends Component { renderEtherValue (_value) { const { api } = this.context; + const { isContract, isDeploy } = this.state; + + // Always show the value if ETH transfer, ie. not + // a contract or a deployment + const fullValue = !(isContract || isDeploy); const value = api.util.fromWei(_value); - if (value.eq(0)) { + if (value.eq(0) && !fullValue) { return
{ ' ' }
; }