Backporting to beta (#4741)

* New chains (#4720)

* Add Kovan chain.

* Fix up --testnet.

* Fix tests.

* Fix test.

* fix test

* Fix test.

* Fix to UglifyJS 2.8.2 to fix app build issues (#4723)

* Update classic bootnodes, ref #4717 (#4735)

* allow failure docker beta

* adjust pruning history default to 64 (#4709)

* backporting from master

[ci-skip]update docker-build.sh

* update gitlab.ci

fix docker hub build
[ci skip]

* update gitlab

docker beta-release->latest

* Add registry.

* Add info on forks.

* Fixed spec file

* Support both V1 & V2 DataChanged events in registry (#4734)

* Add info on forks.

* Add new registry ABI

* Import registry2 & fix exports

* Select ABI based on code hash

* Render new event types (owner not available)

* New registry.

* Rename old chain.

* Fix test.

* Another fix.

* Finish rename.

* Fixed fonts URLs (#4579)

* Fix Token Reg Dapp issues in Firefox (#4489)

* Fix overflow issues in Firefox (#4348)

* Fix wrong Promise inferance

* Add new Componennt for Token Images (#4496)

* Revert "Add new Componennt for Token Images (#4496)"

This reverts commit 6ffbdab891f85e4d988e3e8e96fc2c651bd68e04.

* Add StackEventListener (#4745)

* Update testnet detection (#4746)

* Fix Account Selection in Signer (#4744)

* Can pass FormattedMessage to Input (eg. Status // RPC Enabled)

* Simple fixed-width fix for Accoutn Selection in Parity Signer
This commit is contained in:
Arkadiy Paronyan
2017-03-04 18:54:34 +01:00
committed by GitHub
parent 659cf2bb37
commit 46ac2cb94b
27 changed files with 304 additions and 124 deletions

View File

@@ -14,34 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import badgereg from './badgereg.json';
import basiccoin from './basiccoin.json';
import basiccoinmanager from './basiccoinmanager.json';
import dappreg from './dappreg.json';
import eip20 from './eip20.json';
import emailverification from './email-verification.json';
import gavcoin from './gavcoin.json';
import githubhint from './githubhint.json';
import owned from './owned.json';
import registry from './registry.json';
import signaturereg from './signaturereg.json';
import smsverification from './sms-verification.json';
import tokenreg from './tokenreg.json';
import wallet from './wallet.json';
export {
badgereg,
basiccoin,
basiccoinmanager,
dappreg,
eip20,
emailverification,
gavcoin,
githubhint,
owned,
registry,
signaturereg,
smsverification,
tokenreg,
wallet
};
export badgereg from './badgereg.json';
export basiccoin from './basiccoin.json';
export basiccoinmanager from './basiccoinmanager.json';
export dappreg from './dappreg.json';
export eip20 from './eip20.json';
export emailverification from './email-verification.json';
export gavcoin from './gavcoin.json';
export githubhint from './githubhint.json';
export owned from './owned.json';
export registry from './registry.json';
export registry2 from './registry2.json';
export signaturereg from './signaturereg.json';
export smsverification from './sms-verification.json';
export tokenreg from './tokenreg.json';
export wallet from './wallet.json';

File diff suppressed because one or more lines are too long

View File

@@ -121,7 +121,7 @@ export function attachInstances () {
])
.then(([registryAddress, netChain]) => {
const registry = api.newContract(abis.registry, registryAddress).instance;
isTest = ['morden', 'ropsten', 'testnet'].includes(netChain);
isTest = ['kovan', 'morden', 'ropsten', 'testnet'].includes(netChain);
console.log(`contract was found at registry=${registryAddress}`);
console.log(`running on ${netChain}, isTest=${isTest}`);

View File

@@ -53,7 +53,13 @@ const renderEvent = (classNames, verb) => (e) => {
return (
<tr key={ e.key } className={ classes }>
<td>
<Address address={ e.parameters.owner.value } />
<Address
address={
e.parameters.owner
? e.parameters.owner.value
: e.from
}
/>
</td>
<td>
<abbr title={ e.transaction }>{ verb }</abbr>
@@ -79,17 +85,23 @@ const renderDataChanged = (e) => {
return (
<tr key={ e.key } className={ classNames }>
<td>
<Address address={ e.parameters.owner.value } />
<Address
address={
e.parameters.owner
? e.parameters.owner.value
: e.from
}
/>
</td>
<td>
<abbr title={ e.transaction }>updated</abbr>
</td>
<td>
{ 'key ' }
key&nbsp;
<code>
{ new Buffer(e.parameters.plainKey.value).toString('utf8') }
</code>
{ 'of ' }
&nbsp;of&nbsp;
<code>
<Hash hash={ bytesToHex(e.parameters.name.value) } />
</code>

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { registry as registryAbi } from '~/contracts/abi';
import { registry as registryAbi, registry2 as registryAbi2 } from '~/contracts/abi';
import { api } from './parity.js';
import * as addresses from './addresses/actions.js';
@@ -27,15 +27,21 @@ import * as reverse from './Reverse/actions.js';
export { addresses, accounts, lookup, events, names, records, reverse };
const REGISTRY_V1_HASHES = [
'0x34f7c51bbb1b1902fbdabfdf04811100f5c9f998f26dd535d2f6f977492c748e', // ropsten
'0x64c3ee34851517a9faecd995c102b339f03e564ad6772dc43a26f993238b20ec' // homestead
];
export const setIsTestnet = (isTestnet) => ({ type: 'set isTestnet', isTestnet });
export const fetchIsTestnet = () => (dispatch) =>
api.net.version()
.then((netVersion) => {
dispatch(setIsTestnet(
netVersion === '2' || // morden
netVersion === '3' // ropsten
));
dispatch(setIsTestnet([
'2', // morden
'3', // ropsten
'42' // kovan
].includes(netVersion)));
})
.catch((err) => {
console.error('could not check if testnet');
@@ -47,12 +53,28 @@ export const fetchIsTestnet = () => (dispatch) =>
export const setContract = (contract) => ({ type: 'set contract', contract });
export const fetchContract = () => (dispatch) =>
api.parity.registryAddress()
api.parity
.registryAddress()
.then((address) => {
const contract = api.newContract(registryAbi, address);
dispatch(setContract(contract));
dispatch(fetchFee());
dispatch(fetchOwner());
return api.eth
.getCode(address)
.then((code) => {
const codeHash = api.util.sha3(code);
const isVersion1 = REGISTRY_V1_HASHES.includes(codeHash);
console.log(`registry at ${address}, code ${codeHash}, version ${isVersion1 ? 1 : 2}`);
const contract = api.newContract(
isVersion1
? registryAbi
: registryAbi2,
address
);
dispatch(setContract(contract));
dispatch(fetchFee());
dispatch(fetchOwner());
});
})
.catch((err) => {
console.error('could not fetch contract');

View File

@@ -105,22 +105,22 @@ export default class InputText extends Component {
const validation = validate(value, validationType, contract);
if (validation instanceof Promise) {
const loadingTimeout = setTimeout(() => {
this.setState({ disabled: true, loading: true });
}, 50);
return validation
.then(validation => {
this.setValidation({
...validation,
disabled: false,
loading: false
});
return Promise.resolve(validation)
.then((validation) => {
clearTimeout(loadingTimeout);
event.target.focus();
this.setValidation({
...validation,
disabled: false,
loading: false
});
}
this.setValidation(validation);
event.target.focus();
});
}
onKeyDown = (event) => {

View File

@@ -49,7 +49,7 @@
}
.token-container {
flex: 1;
flex: 1 1 auto;
}
.full-width .token-container {

View File

@@ -288,9 +288,11 @@ export default class Status {
.then(([
netPeers, clientVersion, netVersion, defaultExtraData, netChain, netPort, rpcSettings, enode, upgradeStatus
]) => {
const isTest =
netVersion === '2' || // morden
netVersion === '3'; // ropsten
const isTest = [
'2', // morden
'3', // ropsten
'42' // kovan
].includes(netVersion);
const longStatus = {
netPeers,

View File

@@ -46,6 +46,10 @@ const UNDERLINE_FOCUSED = {
const NAME_ID = ' ';
export default class Input extends Component {
static contextTypes = {
intl: React.PropTypes.object.isRequired
};
static propTypes = {
allowCopy: PropTypes.oneOfType([
PropTypes.string,
@@ -78,7 +82,8 @@ export default class Input extends Component {
style: PropTypes.object,
value: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
PropTypes.string,
PropTypes.node
])
};
@@ -134,6 +139,13 @@ export default class Input extends Component {
? UNDERLINE_FOCUSED
: readOnly && typeof focused !== 'boolean' ? { display: 'none' } : null;
const textValue = typeof value !== 'string' && (value && value.props)
? this.context.intl.formatMessage(
value.props,
value.props.values || {}
)
: value;
return (
<div className={ styles.container } style={ style }>
{ this.renderCopyButton() }
@@ -168,7 +180,8 @@ export default class Input extends Component {
underlineStyle={ underlineStyle }
underlineFocusStyle={ underlineFocusStyle }
underlineShow={ !hideUnderline }
value={ value }>
value={ textValue }
>
{ children }
</TextField>
</div>

View File

@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import EventListener from 'react-event-listener';
import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import ReactPortal from 'react-portal';
@@ -23,6 +22,7 @@ import keycode from 'keycode';
import { nodeOrStringProptype } from '~/util/proptypes';
import { CloseIcon } from '~/ui/Icons';
import ParityBackground from '~/ui/ParityBackground';
import StackEventListener from '~/ui/StackEventListener';
import Title from '~/ui/Title';
import styles from './portal.css';
@@ -92,10 +92,7 @@ export default class Portal extends Component {
onClick={ this.stopEvent }
onKeyDown={ this.handleKeyDown }
>
<EventListener
target='window'
onKeyUp={ this.handleKeyUp }
/>
<StackEventListener onKeyUp={ this.handleKeyUp } />
<ParityBackground className={ styles.parityBackground } />
{ this.renderClose() }
<Title
@@ -174,7 +171,7 @@ export default class Portal extends Component {
switch (codeName) {
case 'esc':
event.preventDefault();
return this.handleClose();
return this.props.onClose();
}
}

View File

@@ -0,0 +1,17 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
export default from './stackEventListener';

View File

@@ -0,0 +1,56 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
import ReactEventListener from 'react-event-listener';
import React, { Component, PropTypes } from 'react';
let listenerId = 0;
let listenerIds = [];
export default class StackEventListener extends Component {
static propTypes = {
onKeyUp: PropTypes.func.isRequired
};
componentWillMount () {
// Add to the list of listeners on mount
this.id = ++listenerId;
listenerIds.push(this.id);
}
componentWillUnmount () {
// Remove from the listeners list on unmount
listenerIds = listenerIds.filter((id) => this.id !== id);
}
render () {
return (
<ReactEventListener
target='window'
onKeyUp={ this.handleKeyUp }
/>
);
}
handleKeyUp = (event) => {
// Only handle event if last of the listeners list
if (this.id !== listenerIds.slice(-1)[0]) {
return event;
}
return this.props.onKeyUp(event);
}
}

View File

@@ -55,6 +55,7 @@ $modalZ: 10001;
.container {
display: flex;
flex-direction: column;
width: 100%;
}
.overlay {
@@ -114,7 +115,8 @@ $modalZ: 10001;
flex-direction: column;
min-height: 30vh;
max-height: 80vh;
max-width: calc(100vw - 1em);
max-width: calc(100vw - 2em);
width: 960px;
.content {
flex: 1;