Signer updates from global Redux state (#7452)

* Remove unused layout

* Update to use pending from Redux

* Update @parity/shared
This commit is contained in:
Jaco Greeff 2018-01-04 13:13:15 +01:00 committed by GitHub
parent 1d0af99744
commit c417f01a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 63 deletions

39
js/package-lock.json generated
View File

@ -256,9 +256,9 @@
"version": "github:paritytech/plugin-signer-qr#c16423de5b8a8f68ebd5f1e78e084fa959329a9f"
},
"@parity/shared": {
"version": "2.2.17",
"resolved": "https://registry.npmjs.org/@parity/shared/-/shared-2.2.17.tgz",
"integrity": "sha512-pB/CBkrGvFHf99+xbtdavPItSaIQKIBYaxKKulohcFoVgSXamGXlfnaDNz/tMYyjUpD5kVmwkM4hUyvFMbxKVQ==",
"version": "2.2.18",
"resolved": "https://registry.npmjs.org/@parity/shared/-/shared-2.2.18.tgz",
"integrity": "sha512-+PEdqdEBIDY4HtvQcYNAXoseCPVesXS+RBU1dNC2myPZkivTMfd8bFfepZT6yANJTPs6NDI9DSzwrLh9YkH1+g==",
"requires": {
"@parity/ledger": "2.1.2",
"eventemitter3": "2.0.3",
@ -310,37 +310,6 @@
"loose-envify": "1.3.1",
"symbol-observable": "1.1.0"
}
},
"solc": {
"version": "github:ngotchac/solc-js#04eb38cc3003fba8cb3656653a7941ed36408818",
"requires": {
"memorystream": "0.3.1",
"require-from-string": "1.2.1",
"yargs": "4.8.1"
},
"dependencies": {
"yargs": {
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz",
"integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=",
"requires": {
"cliui": "3.2.0",
"decamelize": "1.2.0",
"get-caller-file": "1.0.2",
"lodash.assign": "4.2.0",
"os-locale": "1.4.0",
"read-pkg-up": "1.0.1",
"require-directory": "2.1.1",
"require-main-filename": "1.0.1",
"set-blocking": "2.0.0",
"string-width": "1.0.2",
"which-module": "1.0.0",
"window-size": "0.2.0",
"y18n": "3.2.1",
"yargs-parser": "2.4.1"
}
}
}
}
}
},
@ -352,7 +321,7 @@
"@parity/api": "2.1.14",
"@parity/etherscan": "2.1.3",
"@parity/mobx": "1.0.4",
"@parity/shared": "2.2.17",
"@parity/shared": "2.2.18",
"babel-runtime": "6.26.0",
"bignumber.js": "4.1.0",
"brace": "0.11.0",

View File

@ -145,7 +145,7 @@
"@parity/plugin-signer-default": "paritytech/plugin-signer-default",
"@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware",
"@parity/plugin-signer-qr": "paritytech/plugin-signer-qr",
"@parity/shared": "2.2.17",
"@parity/shared": "2.2.18",
"@parity/ui": "3.0.22",
"keythereum": "1.0.2",
"lodash.flatten": "4.4.0",

View File

@ -18,13 +18,11 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { observer } from 'mobx-react';
import * as RequestsActions from '@parity/shared/lib/redux/providers/signerActions';
import Container from '@parity/ui/lib/Container';
import PendingList from '../PendingList';
import PendingStore from '../pendingStore';
import styles from './embedded.css';
@ -32,7 +30,6 @@ const CONTAINER_STYLE = {
background: 'transparent'
};
@observer
class Embedded extends Component {
static contextTypes = {
api: PropTypes.object.isRequired
@ -45,13 +42,12 @@ class Embedded extends Component {
startRejectRequest: PropTypes.func.isRequired
}).isRequired,
gasLimit: PropTypes.object.isRequired,
netVersion: PropTypes.string.isRequired
netVersion: PropTypes.string.isRequired,
pending: PropTypes.array.isRequired
};
pendingStore = PendingStore.get(this.context.api);
render () {
const { accounts, actions, gasLimit, netVersion } = this.props;
const { accounts, actions, gasLimit, netVersion, pending } = this.props;
return (
<Container style={ CONTAINER_STYLE }>
@ -62,7 +58,7 @@ class Embedded extends Component {
netVersion={ netVersion }
onConfirm={ actions.startConfirmRequest }
onReject={ actions.startRejectRequest }
pendingItems={ this.pendingStore.pending }
pendingItems={ pending }
/>
</Container>
);
@ -72,13 +68,17 @@ class Embedded extends Component {
function mapStateToProps (state) {
const { gasLimit, netVersion } = state.nodeStatus;
const { accounts } = state.personal;
const { pending } = state.signer;
const { actions } = state;
// TODO: Use the pending store & actions inside that store to confirm/reject, get rid of the Redux interface
return {
accounts,
actions,
gasLimit,
netVersion
netVersion,
pending
};
}

View File

@ -1,15 +0,0 @@
// 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/>.

View File

@ -47,8 +47,8 @@ function PendingItem ({ accounts, className, data: { date, id, isSending, payloa
);
}
const _onConfirm = (data) => onConfirm(Object.assign({ id, payload }, data));
const _onReject = () => onReject(id);
const _onConfirm = (data) => onConfirm(Object.assign({ id: id.toNumber(), payload }, data));
const _onReject = () => onReject({ id: id.toNumber() });
return (
<Handler

View File

@ -64,5 +64,5 @@ PendingList.propTypes = {
netVersion: PropTypes.string.isRequired,
onConfirm: PropTypes.func.isRequired,
onReject: PropTypes.func.isRequired,
pendingItems: PropTypes.object.isRequired
pendingItems: PropTypes.array.isRequired
};