Methods use either input or data elements

This commit is contained in:
Jaco Greeff 2016-11-29 16:36:54 +01:00
parent e667d33778
commit 6a69e22b28
2 changed files with 14 additions and 11 deletions

View File

@ -30,9 +30,9 @@
} }
.gasDetails { .gasDetails {
padding-top: 1em; padding-top: 0.75em;
font-size: 0.75em; font-size: 0.75em;
line-height: 2em; line-height: 1.5em;
opacity: 0.5; opacity: 0.5;
} }

View File

@ -135,21 +135,23 @@ class MethodDecoding extends Component {
renderInputValue () { renderInputValue () {
const { api } = this.context; const { api } = this.context;
const { transaction } = this.props; const { transaction } = this.props;
const input = transaction.input || transaction.data;
if (!/^(0x)?([0]*[1-9a-f]+[0]*)+$/.test(transaction.input)) { if (!/^(0x)?([0]*[1-9a-f]+[0]*)+$/.test(input)) {
return null; return null;
} }
const ascii = api.util.hex2Ascii(transaction.input); const ascii = api.util.hex2Ascii(input);
const text = ASCII_INPUT.test(ascii) const text = ASCII_INPUT.test(ascii)
? ascii ? ascii
: transaction.input; : input;
return ( return (
<div> <div className={ styles.description }>
<span>with the input &nbsp;</span> <div>
<code className={ styles.inputData }>{ text }</code> <span>with the input &nbsp;</span>
<code className={ styles.inputData }>{ text }</code>
</div>
</div> </div>
); );
} }
@ -385,11 +387,12 @@ class MethodDecoding extends Component {
const isReceived = transaction.to === address; const isReceived = transaction.to === address;
const contractAddress = isReceived ? transaction.from : transaction.to; const contractAddress = isReceived ? transaction.from : transaction.to;
const input = transaction.input || transaction.data;
const token = (tokens || {})[contractAddress]; const token = (tokens || {})[contractAddress];
this.setState({ token, isReceived, contractAddress }); this.setState({ token, isReceived, contractAddress });
if (!transaction.input || transaction.input === '0x') { if (!input || input === '0x') {
return; return;
} }
@ -408,7 +411,7 @@ class MethodDecoding extends Component {
return; return;
} }
const { signature, paramdata } = api.util.decodeCallData(transaction.input); const { signature, paramdata } = api.util.decodeCallData(input);
this.setState({ methodSignature: signature, methodParams: paramdata }); this.setState({ methodSignature: signature, methodParams: paramdata });
if (!signature || signature === CONTRACT_CREATE || transaction.creates) { if (!signature || signature === CONTRACT_CREATE || transaction.creates) {