);
});
@@ -200,35 +165,14 @@ export default class DetailsStep extends Component {
const { abiError, abiParsed } = validateAbi(abi, api);
if (!abiError) {
- const { inputs } = abiParsed.find((method) => method.type === 'constructor') || { inputs: [] };
+ const { inputs } = abiParsed
+ .find((method) => method.type === 'constructor') || { inputs: [] };
+
const params = [];
inputs.forEach((input) => {
- switch (input.type) {
- case 'address':
- params.push('0x');
- break;
-
- case 'bool':
- params.push(false);
- break;
-
- case 'bytes':
- params.push('0x');
- break;
-
- case 'uint':
- params.push('0');
- break;
-
- case 'string':
- params.push('');
- break;
-
- default:
- params.push('0');
- break;
- }
+ const param = parseAbiType(input.type);
+ params.push(param.default);
});
onParamsChange(params);
diff --git a/js/src/modals/DeployContract/deployContract.js b/js/src/modals/DeployContract/deployContract.js
index 768723d1f..a99b49412 100644
--- a/js/src/modals/DeployContract/deployContract.js
+++ b/js/src/modals/DeployContract/deployContract.js
@@ -101,7 +101,8 @@ export default class DeployContract extends Component {
steps={ deployError ? null : steps }
title={ deployError ? 'deployment failed' : null }
waiting={ [1] }
- visible>
+ visible
+ scroll>
{ this.renderStep() }
);
@@ -118,8 +119,22 @@ export default class DeployContract extends Component {
onClick={ this.onClose } />
);
+ const closeBtn = (
+ }
+ label='Close'
+ onClick={ this.onClose } />
+ );
+
+ const closeBtnOk = (
+ }
+ label='Close'
+ onClick={ this.onClose } />
+ );
+
if (deployError) {
- return cancelBtn;
+ return closeBtn;
}
switch (step) {
@@ -134,17 +149,10 @@ export default class DeployContract extends Component {
];
case 1:
- return [
- cancelBtn
- ];
+ return [ closeBtn ];
case 2:
- return [
- }
- label='Close'
- onClick={ this.onClose } />
- ];
+ return [ closeBtnOk ];
}
}
@@ -277,8 +285,6 @@ export default class DeployContract extends Component {
return;
}
- console.log('onDeploymentState', data);
-
switch (data.state) {
case 'estimateGas':
case 'postTransaction':
diff --git a/js/src/ui/Form/AddressSelect/addressSelect.css b/js/src/ui/Form/AddressSelect/addressSelect.css
index 98dab4355..30671db73 100644
--- a/js/src/ui/Form/AddressSelect/addressSelect.css
+++ b/js/src/ui/Form/AddressSelect/addressSelect.css
@@ -39,6 +39,10 @@
position: absolute;
left: 0;
top: 35px;
+
+ &.noLabel {
+ top: 11px;
+ }
}
.paddedInput input {
diff --git a/js/src/ui/Form/AddressSelect/addressSelect.js b/js/src/ui/Form/AddressSelect/addressSelect.js
index ac7f2da51..97195efe7 100644
--- a/js/src/ui/Form/AddressSelect/addressSelect.js
+++ b/js/src/ui/Form/AddressSelect/addressSelect.js
@@ -106,15 +106,21 @@ export default class AddressSelect extends Component {
}
renderIdentityIcon (inputValue) {
- const { error, value } = this.props;
+ const { error, value, label } = this.props;
if (error || !inputValue || value.length !== 42) {
return null;
}
+ const classes = [ styles.icon ];
+
+ if (!label) {
+ classes.push(styles.noLabel);
+ }
+
return (
);
diff --git a/js/src/ui/Form/Input/input.js b/js/src/ui/Form/Input/input.js
index 27c270834..e99b4ae6b 100644
--- a/js/src/ui/Form/Input/input.js
+++ b/js/src/ui/Form/Input/input.js
@@ -63,7 +63,9 @@ export default class Input extends Component {
hideUnderline: PropTypes.bool,
value: PropTypes.oneOfType([
PropTypes.number, PropTypes.string
- ])
+ ]),
+ min: PropTypes.any,
+ max: PropTypes.any
};
static defaultProps = {
@@ -86,7 +88,7 @@ export default class Input extends Component {
render () {
const { value } = this.state;
- const { children, className, hideUnderline, disabled, error, label, hint, multiLine, rows, type } = this.props;
+ const { children, className, hideUnderline, disabled, error, label, hint, multiLine, rows, type, min, max } = this.props;
const readOnly = this.props.readOnly || disabled;
@@ -130,6 +132,8 @@ export default class Input extends Component {
onChange={ this.onChange }
onKeyDown={ this.onKeyDown }
inputStyle={ inputStyle }
+ min={ min }
+ max={ max }
>
{ children }
diff --git a/js/src/ui/Form/TypedInput/index.js b/js/src/ui/Form/TypedInput/index.js
new file mode 100644
index 000000000..9c12bf7eb
--- /dev/null
+++ b/js/src/ui/Form/TypedInput/index.js
@@ -0,0 +1,17 @@
+// 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 .
+
+export default from './typedInput';
diff --git a/js/src/ui/Form/TypedInput/typedInput.css b/js/src/ui/Form/TypedInput/typedInput.css
new file mode 100644
index 000000000..c13206c96
--- /dev/null
+++ b/js/src/ui/Form/TypedInput/typedInput.css
@@ -0,0 +1,31 @@
+/* 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 .
+*/
+
+.inputs {
+ padding-top: 2px;
+ overflow-x: hidden;
+
+ label {
+ line-height: 22px;
+ pointer-events: none;
+ color: rgba(255, 255, 255, 0.498039);
+ -webkit-user-select: none;
+ font-size: 12px;
+ top: 11px;
+ position: relative;
+ }
+}
diff --git a/js/src/ui/Form/TypedInput/typedInput.js b/js/src/ui/Form/TypedInput/typedInput.js
new file mode 100644
index 000000000..6bcb5bbf1
--- /dev/null
+++ b/js/src/ui/Form/TypedInput/typedInput.js
@@ -0,0 +1,239 @@
+// 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 { MenuItem } from 'material-ui';
+import { range } from 'lodash';
+
+import IconButton from 'material-ui/IconButton';
+import AddIcon from 'material-ui/svg-icons/content/add';
+import RemoveIcon from 'material-ui/svg-icons/content/remove';
+
+import { Input, InputAddressSelect, Select } from '../../../ui';
+import { ABI_TYPES } from '../../../util/abi';
+
+import styles from './typedInput.css';
+
+export default class TypedInput extends Component {
+
+ static propTypes = {
+ onChange: PropTypes.func.isRequired,
+ accounts: PropTypes.object.isRequired,
+ param: PropTypes.object.isRequired,
+
+ error: PropTypes.any,
+ value: PropTypes.any,
+ label: PropTypes.string
+ };
+
+ render () {
+ const { param } = this.props;
+ const { type } = param;
+
+ if (type === ABI_TYPES.ARRAY) {
+ const { accounts, label, value = param.default } = this.props;
+ const { subtype, length } = param;
+
+ const fixedLength = !!length;
+
+ const inputs = range(length || value.length).map((_, index) => {
+ const onChange = (inputValue) => {
+ const newValues = [].concat(this.props.value);
+ newValues[index] = inputValue;
+ this.props.onChange(newValues);
+ };
+
+ return (
+
+ );
+ });
+
+ return (
+