diff --git a/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js b/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js index 082fac6a7..b4488729a 100644 --- a/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js +++ b/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js @@ -17,7 +17,8 @@ import React, { Component, PropTypes } from 'react'; import { MenuItem } from 'material-ui'; -import { AddressSelect, Form, Input, InputAddressSelect, Select } from '~/ui'; +import { AddressSelect, Form, Input, Select, TypedInput } from '~/ui'; +import { parseAbiType } from '~/util/abi'; import styles from '../executeContract.css'; @@ -74,7 +75,7 @@ export default class DetailsStep extends Component { const functions = contract.functions .filter((func) => !func.constant) - .sort((a, b) => a.name.localeCompare(b.name)) + .sort((a, b) => (a.name || '').localeCompare(b.name || '')) .map((func) => { const params = (func.abi.inputs || []) .map((input, index) => { @@ -125,56 +126,22 @@ export default class DetailsStep extends Component { } return (func.abi.inputs || []).map((input, index) => { - const onChange = (event, value) => onValueChange(event, index, value); - const onSelect = (event, _index, value) => onValueChange(event, index, value); - const onSubmit = (value) => onValueChange(null, index, value); + const onChange = (value) => onValueChange(null, index, value); const label = `${input.name}: ${input.type}`; - let inputbox; - - switch (input.type) { - case 'address': - inputbox = ( - - ); - break; - - case 'bool': - const boolitems = ['false', 'true'].map((bool) => { - return ( - { bool } - ); - }); - inputbox = ( - - ); - break; - - default: - inputbox = ( - - ); - } return ( -
- { inputbox } +
+
); }); diff --git a/js/src/modals/ExecuteContract/executeContract.js b/js/src/modals/ExecuteContract/executeContract.js index c3b64d738..4a708d17a 100644 --- a/js/src/modals/ExecuteContract/executeContract.js +++ b/js/src/modals/ExecuteContract/executeContract.js @@ -23,6 +23,7 @@ import ContentClear from 'material-ui/svg-icons/content/clear'; import { BusyStep, CompletedStep, Button, IdentityIcon, Modal, TxHash } from '~/ui'; import { MAX_GAS_ESTIMATION } from '../../util/constants'; import { validateAddress, validateUint } from '../../util/validation'; +import { parseAbiType } from '~/util/abi'; import DetailsStep from './DetailsStep'; @@ -66,7 +67,7 @@ class ExecuteContract extends Component { const { contract } = this.props; const functions = contract.functions .filter((func) => !func.constant) - .sort((a, b) => a.name.localeCompare(b.name)); + .sort((a, b) => (a.name || '').localeCompare(b.name || '')); this.onFuncChange(null, functions[0]); } @@ -111,7 +112,7 @@ class ExecuteContract extends Component {