// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
import BigNumber from 'bignumber.js';
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Contracts from '../../contracts';
import IdentityIcon from '../IdentityIcon';
import IdentityName from '../IdentityName';
import { Input, InputAddress } from '../Form';
import styles from './methodDecoding.css';
const CONTRACT_CREATE = '0x60606040';
const TOKEN_METHODS = {
'0xa9059cbb': 'transfer(to,value)'
};
class MethodDecoding extends Component {
static contextTypes = {
api: PropTypes.object.isRequired
}
static propTypes = {
address: PropTypes.string.isRequired,
tokens: PropTypes.object,
transaction: PropTypes.object,
historic: PropTypes.bool
}
state = {
contractAddress: null,
method: null,
methodName: null,
methodInputs: null,
methodParams: null,
methodSignature: null,
token: null,
isContract: false,
isDeploy: false,
isReceived: false
}
componentWillMount () {
this.lookup();
}
render () {
const { transaction } = this.props;
if (!transaction) {
return null;
}
return (
{ historic ? 'Provided' : 'Provides' } { gas.toFormat(0) } gas ({ gasPrice.div(1000000).toFormat(0) }M/ETH) for a total transaction value of { this.renderEtherValue(gasValue) }
{ historic ? 'Executed' : 'Will execute' } the { methodName } function on the contract { this.renderAddressName(transaction.to) }, transferring { this.renderEtherValue(transaction.value) }, passing the following parameters: