// 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 React, { Component, PropTypes } from 'react'; import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; import ContentClear from 'material-ui/svg-icons/content/clear'; import { BusyStep, CompletedStep, Button, IdentityIcon, Modal, TxHash } from '../../ui'; import { validateAddress } from '../../util/validation'; import DetailsStep from './DetailsStep'; export default class ExecuteContract extends Component { static contextTypes = { api: PropTypes.object.isRequired, store: PropTypes.object.isRequired } static propTypes = { isTest: PropTypes.bool, fromAddress: PropTypes.string, accounts: PropTypes.object, contract: PropTypes.object, onClose: PropTypes.func.isRequired, onFromAddressChange: PropTypes.func.isRequired } state = { amount: '0', amountError: null, func: null, funcError: null, values: [], valuesError: [], step: 0, sending: false, busyState: null, txhash: null } componentDidMount () { const { contract } = this.props; const functions = contract.functions .filter((func) => !func.constant) .sort((a, b) => a.name.localeCompare(b.name)); this.onFuncChange(null, functions[0]); } render () { const { sending } = this.state; return ( { this.renderStep() } ); } renderDialogActions () { const { onClose, fromAddress } = this.props; const { sending, step } = this.state; const cancelBtn = (