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 (
-
- );
- });
- 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 {
}
onClick={ this.postTransaction } />
];
@@ -174,23 +175,9 @@ class ExecuteContract extends Component {
}
onFuncChange = (event, func) => {
- const values = func.inputs.map((input) => {
- switch (input.kind.type) {
- case 'address':
- return '0x';
-
- case 'bool':
- return false;
-
- case 'bytes':
- return '0x';
-
- case 'uint':
- return '0';
-
- default:
- return '';
- }
+ const values = (func.abi.inputs || []).map((input) => {
+ const parsedType = parseAbiType(input.type);
+ return parsedType.default;
});
this.setState({
diff --git a/js/src/redux/providers/compilerWorker.js b/js/src/redux/providers/compilerWorker.js
index 247333f5e..f624a4e5f 100644
--- a/js/src/redux/providers/compilerWorker.js
+++ b/js/src/redux/providers/compilerWorker.js
@@ -92,7 +92,7 @@ function findImports (path) {
return { error: 'File not found' };
}
-function compile (data) {
+function compile (data, optimized = 1) {
const { sourcecode, build } = data;
const { longVersion } = build;
@@ -109,7 +109,7 @@ function compile (data) {
'': sourcecode
};
- const compiled = compiler.compile({ sources: input }, 0, findImports);
+ const compiled = compiler.compile({ sources: input }, optimized, findImports);
self.lastCompile = {
version: longVersion, result: compiled,
diff --git a/js/src/redux/providers/walletActions.js b/js/src/redux/providers/walletActions.js
index 10f6a278e..8e13ac1a0 100644
--- a/js/src/redux/providers/walletActions.js
+++ b/js/src/redux/providers/walletActions.js
@@ -58,7 +58,7 @@ function modifyOperation (method, address, owner, operation) {
contract.instance[method]
.estimateGas(options, values)
.then((gas) => {
- options.gas = gas;
+ options.gas = gas.mul(1.2);
return contract.instance[method].postTransaction(options, values);
})
.then((requestId) => {
diff --git a/js/src/views/Contract/Events/events.js b/js/src/views/Contract/Events/events.js
index f0bee3e25..69ae8fd6a 100644
--- a/js/src/views/Contract/Events/events.js
+++ b/js/src/views/Contract/Events/events.js
@@ -15,6 +15,7 @@
// along with Parity. If not, see
.
import React, { Component, PropTypes } from 'react';
+import { uniq } from 'lodash';
import { Container } from '~/ui';
@@ -38,7 +39,10 @@ export default class Events extends Component {
return null;
}
- const list = events.map((event) => {
+ const eventsKey = uniq(events.map((e) => e.key));
+ const list = eventsKey.map((eventKey) => {
+ const event = events.find((e) => e.key === eventKey);
+
return (