From e4fcf4da2b2bbc646063683da3443519586bcd7e Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 3 Nov 2016 12:23:25 +0100 Subject: [PATCH] Add basic validation for contract execute values (#3118) --- .../modals/ExecuteContract/executeContract.js | 20 +++++++++----- js/src/util/validation.js | 27 ++++++++++++++++++- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/js/src/modals/ExecuteContract/executeContract.js b/js/src/modals/ExecuteContract/executeContract.js index 67f350feb..e0462982d 100644 --- a/js/src/modals/ExecuteContract/executeContract.js +++ b/js/src/modals/ExecuteContract/executeContract.js @@ -19,7 +19,7 @@ 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 { validateAddress, validateUint } from '../../util/validation'; import DetailsStep from './DetailsStep'; @@ -41,6 +41,7 @@ export default class ExecuteContract extends Component { state = { amount: '0', amountError: null, + fromAddressError: null, func: null, funcError: null, values: [], @@ -77,7 +78,8 @@ export default class ExecuteContract extends Component { renderDialogActions () { const { onClose, fromAddress } = this.props; - const { sending, step } = this.state; + const { sending, step, fromAddressError, valuesError } = this.state; + const hasError = fromAddressError || valuesError.find((error) => error); const cancelBtn = (