Show ETH value (even 0) if ETH transfert in transaction list (#5406)

This commit is contained in:
Nicolas Gotchac 2017-04-19 16:02:24 +02:00 committed by Jaco Greeff
parent 8310877f25
commit e1e2674cd2

View File

@ -21,9 +21,10 @@ import { Link } from 'react-router';
import { txLink } from '~/3rdparty/etherscan/links'; import { txLink } from '~/3rdparty/etherscan/links';
import IdentityIcon from '../../IdentityIcon'; import IdentityIcon from '~/ui/IdentityIcon';
import IdentityName from '../../IdentityName'; import IdentityName from '~/ui/IdentityName';
import MethodDecoding from '../../MethodDecoding'; import MethodDecoding from '~/ui/MethodDecoding';
import MethodDecodingStore from '~/ui/MethodDecoding/methodDecodingStore';
import styles from '../txList.css'; import styles from '../txList.css';
@ -48,6 +49,29 @@ class TxRow extends Component {
historic: true 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 () { render () {
const { address, className, historic, netVersion, tx } = this.props; const { address, className, historic, netVersion, tx } = this.props;
@ -117,9 +141,14 @@ class TxRow extends Component {
renderEtherValue (_value) { renderEtherValue (_value) {
const { api } = this.context; 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); const value = api.util.fromWei(_value);
if (value.eq(0)) { if (value.eq(0) && !fullValue) {
return <div className={ styles.value }>{ ' ' }</div>; return <div className={ styles.value }>{ ' ' }</div>;
} }