Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

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

Merged
merged 1 commit into from
Apr 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions js/src/ui/TxList/TxRow/txRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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;

Expand Down Expand Up @@ -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 <div className={ styles.value }>{ ' ' }</div>;
}

Expand Down