Backporting to beta (#4152)

* Fix broken transfer total balance (#4127)

* Add proper label to method decoding inputs (#4136)

* Another minor estimation fix (#4133)

* Return 0 instead of error with out of gas on estimate_gas

* Fix stuff up.

* Another estimate gas fix.

* Alter balance to maximum possible rather than GP=0.

* Only increase to amount strictly necessary.

* Get rid of unsafe code in ethkey, propagate incorrect Secret errors. (#4119)

* Implementing secret

* Fixing tests

* Refactor VoteCollector (#4101)

* dir

* simple validator list

* stub validator contract

* make the engine hold Weak<Client> instead of IoChannel

* validator set factory

* register weak client with ValidatorContract

* check chain security

* add address array to generator

* register provider contract

* update validator set on notify

* add validator contract spec

* simple list test

* split update and contract test

* contract change

* use client in tendermint

* fix deadlock

* step duration in params

* adapt tendermint tests

* add storage fields to test spec

* constructor spec

* execute under wrong address

* create under correct address

* revert

* validator contract constructor

* move genesis block lookup

* add removal ability to contract

* validator contract adding validators

* fix basic authority

* validator changing test

* more docs

* update sync tests

* remove env_logger

* another env_logger

* cameltoe

* hold EngineClient instead of Client

* return error on misbehaviour

* nicer return

* sprinkle docs

* Reenable mainnet update server. (#4137)

* basic tests for subscribeToEvents (#4115)

* subscribeToEvent fixtures 

* subscribeToEvent tests 

* temporarily skip failing test (#4138)

* Improvements and optimisations to estimate_gas (#4142)

* Return 0 instead of error with out of gas on estimate_gas

* Fix stuff up.

* Another estimate gas fix.

* Alter balance to maximum possible rather than GP=0.

* Only increase to amount strictly necessary.

* Improvements and optimisations to estimate_gas.

- Introduce proper error type
- Avoid building costly traces

* Fix tests.

* Actually fix testsActually fix tests

* Use estimateGas error (as per updated implementation) (#4131)

* Use estimateGas error (as per updated implementation)

* EXCEPTION_ERROR as per #4142

* Better error log reporting & handling (#4128)

* Don't pop-up notifications after network switch (#4076)

* Better notifications

* Don't pollute with notifs if switched networks

* Better connection close/open events / No more notifs on change network

* PR Grumbles

* Add close and open events to HTTP // Add tests

* Fix tests

* WIP Signer Fix

* Fix Signer // Better reconnection handling

* PR Grumbles

* PR Grumbles

* Fixes wrong fetching of balances + Notifications

* Secure API WIP

* Updated Secure API Connection + Status

* Linting

* Linting

* Updated Secure API Logic

* Proper handling of token updates // Fixing poping notifications

* PR Grumbles

* PR Grumbles

* Fixing tests

* Trim spaces from InputAddress (#4126)

* Trim spaces for addresses

* onSubmit has only value, not event

* onSubmit (again)

* Length check on trimmed value

* Remove bindActionCreators({}, dispatch) (empty) (#4135)
This commit is contained in:
Arkadiy Paronyan
2017-01-12 17:06:15 +01:00
committed by GitHub
parent 72bb687f5e
commit 1e212771b5
86 changed files with 1706 additions and 765 deletions

View File

@@ -17,7 +17,6 @@
import BigNumber from 'bignumber.js';
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import unknownImage from '../../../assets/images/contracts/unknown-64x64.png';
import styles from './balance.css';
@@ -107,11 +106,7 @@ function mapStateToProps (state) {
return { images };
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(Balance);

View File

@@ -17,7 +17,6 @@
import React, { Component, PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import styles from './blockStatus.css';
@@ -113,11 +112,7 @@ function mapStateToProps (state) {
};
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(BlockStatus);

View File

@@ -16,7 +16,6 @@
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import util from '~/api/util';
import { nodeOrStringProptype } from '~/util/proptypes';
@@ -58,7 +57,7 @@ class InputAddress extends Component {
render () {
const { accountsInfo, allowCopy, className, disabled, error, focused, hint } = this.props;
const { hideUnderline, label, onClick, onFocus, onSubmit, readOnly, small } = this.props;
const { hideUnderline, label, onClick, onFocus, readOnly, small } = this.props;
const { tabIndex, text, tokens, value } = this.props;
const account = value && (accountsInfo[value] || tokens[value]);
@@ -91,10 +90,10 @@ class InputAddress extends Component {
hideUnderline={ hideUnderline }
hint={ hint }
label={ label }
onChange={ this.handleInputChange }
onChange={ this.onChange }
onClick={ onClick }
onFocus={ onFocus }
onSubmit={ onSubmit }
onSubmit={ this.onSubmit }
readOnly={ readOnly }
tabIndex={ tabIndex }
value={
@@ -133,22 +132,34 @@ class InputAddress extends Component {
return (
<div className={ classes.join(' ') }>
<IdentityIcon
inline center
address={ value } />
address={ value }
center
inline />
</div>
);
}
handleInputChange = (event, value) => {
const isEmpty = (value.length === 0);
onChange = (event, _value) => {
let address = _value.trim();
const isEmpty = (address.length === 0);
this.setState({ isEmpty });
if (!/^0x/.test(value) && util.isAddressValid(`0x${value}`)) {
return this.props.onChange(event, `0x${value}`);
}
if (this.props.onChange) {
if (!/^0x/.test(address) && util.isAddressValid(`0x${address}`)) {
address = `0x${address}`;
}
this.props.onChange(event, value);
this.props.onChange(event, address);
}
}
onSubmit = (_value) => {
const address = _value.trim();
if (this.props.onSubmit) {
this.props.onSubmit(address);
}
}
}
@@ -162,11 +173,7 @@ function mapStateToProps (state) {
};
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(InputAddress);

View File

@@ -16,7 +16,6 @@
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import AddressSelect from '../AddressSelect';
@@ -68,11 +67,7 @@ function mapStateToProps (state) {
};
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(InputAddressSelect);

View File

@@ -62,6 +62,10 @@ export default class GasPriceEditor {
this.errorTotal = errorTotal;
}
@action setEstimatedError = (errorEstimated = ERRORS.gasException) => {
this.errorEstimated = errorEstimated;
}
@action setEstimated = (estimated) => {
transaction(() => {
const bn = new BigNumber(estimated);
@@ -69,11 +73,11 @@ export default class GasPriceEditor {
this.estimated = estimated;
if (bn.gte(MAX_GAS_ESTIMATION)) {
this.errorEstimated = ERRORS.gasException;
this.setEstimatedError(ERRORS.gasException);
} else if (bn.gte(this.gasLimit)) {
this.errorEstimated = ERRORS.gasBlockLimit;
this.setEstimatedError(ERRORS.gasBlockLimit);
} else {
this.errorEstimated = null;
this.setEstimatedError(null);
}
});
}

View File

@@ -82,6 +82,24 @@ describe('ui/GasPriceEditor/store', () => {
});
});
describe('setEstimatedError', () => {
it('sets the value as provided', () => {
store.setEstimatedError('errorTest');
expect(store.errorEstimated).to.equal('errorTest');
});
it('sets the null value as provided', () => {
store.setEstimatedError('errorTest');
store.setEstimatedError(null);
expect(store.errorEstimated).to.be.null;
});
it('sets a default error when none provided', () => {
store.setEstimatedError();
expect(store.errorEstimated).to.equal(ERRORS.gasException);
});
});
describe('setEstimated', () => {
it('sets the value', () => {
store.setEstimated('789');

View File

@@ -377,11 +377,15 @@ class MethodDecoding extends Component {
}
const inputs = methodInputs.map((input, index) => {
const label = input.name
? `${input.name}: ${input.type}`
: input.type;
return (
<TypedInput
allowCopy
className={ styles.input }
label={ input.type }
label={ label }
key={ index }
param={ input.type }
readOnly

View File

@@ -164,8 +164,8 @@ export default class MethodDecodingStore {
methodInputs = this.api.util
.decodeMethodInput(abi, paramdata)
.map((value, index) => {
const type = abi.inputs[index].type;
return { type, value };
const { name, type } = abi.inputs[index];
return { name, type, value };
});
}

View File

@@ -16,9 +16,8 @@
import { Dialog } from 'material-ui';
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import ReactDOM from 'react-dom';
import { connect } from 'react-redux';
import { nodeOrStringProptype } from '~/util/proptypes';
@@ -113,11 +112,7 @@ function mapStateToProps (state) {
return { settings };
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(Modal);

View File

@@ -16,7 +16,6 @@
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { keccak_256 } from 'js-sha3'; // eslint-disable-line camelcase
import ActionFingerprint from 'material-ui/svg-icons/action/fingerprint';
@@ -54,11 +53,7 @@ function mapStateToProps (state) {
return { secureToken };
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(SignerIcon);

View File

@@ -15,11 +15,10 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import BigNumber from 'bignumber.js';
import { LinearProgress } from 'material-ui';
import React, { Component, PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { LinearProgress } from 'material-ui';
import { txLink } from '~/3rdparty/etherscan/links';
import ShortenedHash from '../ShortenedHash';
@@ -169,11 +168,7 @@ function mapStateToProps (state) {
return { isTest };
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(TxHash);

View File

@@ -14,10 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { observer } from 'mobx-react';
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { observer } from 'mobx-react';
import Store from './store';
import TxRow from './TxRow';
@@ -92,11 +91,7 @@ function mapStateToProps (state) {
};
}
function mapDispatchToProps (dispatch) {
return bindActionCreators({}, dispatch);
}
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(TxList);