Signer updates from global Redux state (#7452)
* Remove unused layout * Update to use pending from Redux * Update @parity/shared
This commit is contained in:
parent
1d0af99744
commit
c417f01a23
39
js/package-lock.json
generated
39
js/package-lock.json
generated
@ -256,9 +256,9 @@
|
|||||||
"version": "github:paritytech/plugin-signer-qr#c16423de5b8a8f68ebd5f1e78e084fa959329a9f"
|
"version": "github:paritytech/plugin-signer-qr#c16423de5b8a8f68ebd5f1e78e084fa959329a9f"
|
||||||
},
|
},
|
||||||
"@parity/shared": {
|
"@parity/shared": {
|
||||||
"version": "2.2.17",
|
"version": "2.2.18",
|
||||||
"resolved": "https://registry.npmjs.org/@parity/shared/-/shared-2.2.17.tgz",
|
"resolved": "https://registry.npmjs.org/@parity/shared/-/shared-2.2.18.tgz",
|
||||||
"integrity": "sha512-pB/CBkrGvFHf99+xbtdavPItSaIQKIBYaxKKulohcFoVgSXamGXlfnaDNz/tMYyjUpD5kVmwkM4hUyvFMbxKVQ==",
|
"integrity": "sha512-+PEdqdEBIDY4HtvQcYNAXoseCPVesXS+RBU1dNC2myPZkivTMfd8bFfepZT6yANJTPs6NDI9DSzwrLh9YkH1+g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@parity/ledger": "2.1.2",
|
"@parity/ledger": "2.1.2",
|
||||||
"eventemitter3": "2.0.3",
|
"eventemitter3": "2.0.3",
|
||||||
@ -310,37 +310,6 @@
|
|||||||
"loose-envify": "1.3.1",
|
"loose-envify": "1.3.1",
|
||||||
"symbol-observable": "1.1.0"
|
"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/api": "2.1.14",
|
||||||
"@parity/etherscan": "2.1.3",
|
"@parity/etherscan": "2.1.3",
|
||||||
"@parity/mobx": "1.0.4",
|
"@parity/mobx": "1.0.4",
|
||||||
"@parity/shared": "2.2.17",
|
"@parity/shared": "2.2.18",
|
||||||
"babel-runtime": "6.26.0",
|
"babel-runtime": "6.26.0",
|
||||||
"bignumber.js": "4.1.0",
|
"bignumber.js": "4.1.0",
|
||||||
"brace": "0.11.0",
|
"brace": "0.11.0",
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
"@parity/plugin-signer-default": "paritytech/plugin-signer-default",
|
"@parity/plugin-signer-default": "paritytech/plugin-signer-default",
|
||||||
"@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware",
|
"@parity/plugin-signer-hardware": "paritytech/plugin-signer-hardware",
|
||||||
"@parity/plugin-signer-qr": "paritytech/plugin-signer-qr",
|
"@parity/plugin-signer-qr": "paritytech/plugin-signer-qr",
|
||||||
"@parity/shared": "2.2.17",
|
"@parity/shared": "2.2.18",
|
||||||
"@parity/ui": "3.0.22",
|
"@parity/ui": "3.0.22",
|
||||||
"keythereum": "1.0.2",
|
"keythereum": "1.0.2",
|
||||||
"lodash.flatten": "4.4.0",
|
"lodash.flatten": "4.4.0",
|
||||||
|
@ -18,13 +18,11 @@ import React, { Component } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { observer } from 'mobx-react';
|
|
||||||
|
|
||||||
import * as RequestsActions from '@parity/shared/lib/redux/providers/signerActions';
|
import * as RequestsActions from '@parity/shared/lib/redux/providers/signerActions';
|
||||||
import Container from '@parity/ui/lib/Container';
|
import Container from '@parity/ui/lib/Container';
|
||||||
|
|
||||||
import PendingList from '../PendingList';
|
import PendingList from '../PendingList';
|
||||||
import PendingStore from '../pendingStore';
|
|
||||||
|
|
||||||
import styles from './embedded.css';
|
import styles from './embedded.css';
|
||||||
|
|
||||||
@ -32,7 +30,6 @@ const CONTAINER_STYLE = {
|
|||||||
background: 'transparent'
|
background: 'transparent'
|
||||||
};
|
};
|
||||||
|
|
||||||
@observer
|
|
||||||
class Embedded extends Component {
|
class Embedded extends Component {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
api: PropTypes.object.isRequired
|
api: PropTypes.object.isRequired
|
||||||
@ -45,13 +42,12 @@ class Embedded extends Component {
|
|||||||
startRejectRequest: PropTypes.func.isRequired
|
startRejectRequest: PropTypes.func.isRequired
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
gasLimit: PropTypes.object.isRequired,
|
gasLimit: PropTypes.object.isRequired,
|
||||||
netVersion: PropTypes.string.isRequired
|
netVersion: PropTypes.string.isRequired,
|
||||||
|
pending: PropTypes.array.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
pendingStore = PendingStore.get(this.context.api);
|
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { accounts, actions, gasLimit, netVersion } = this.props;
|
const { accounts, actions, gasLimit, netVersion, pending } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container style={ CONTAINER_STYLE }>
|
<Container style={ CONTAINER_STYLE }>
|
||||||
@ -62,7 +58,7 @@ class Embedded extends Component {
|
|||||||
netVersion={ netVersion }
|
netVersion={ netVersion }
|
||||||
onConfirm={ actions.startConfirmRequest }
|
onConfirm={ actions.startConfirmRequest }
|
||||||
onReject={ actions.startRejectRequest }
|
onReject={ actions.startRejectRequest }
|
||||||
pendingItems={ this.pendingStore.pending }
|
pendingItems={ pending }
|
||||||
/>
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
@ -72,13 +68,17 @@ class Embedded extends Component {
|
|||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
const { gasLimit, netVersion } = state.nodeStatus;
|
const { gasLimit, netVersion } = state.nodeStatus;
|
||||||
const { accounts } = state.personal;
|
const { accounts } = state.personal;
|
||||||
|
const { pending } = state.signer;
|
||||||
const { actions } = state;
|
const { actions } = state;
|
||||||
|
|
||||||
|
// TODO: Use the pending store & actions inside that store to confirm/reject, get rid of the Redux interface
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accounts,
|
accounts,
|
||||||
actions,
|
actions,
|
||||||
gasLimit,
|
gasLimit,
|
||||||
netVersion
|
netVersion,
|
||||||
|
pending
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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/>.
|
|
@ -47,8 +47,8 @@ function PendingItem ({ accounts, className, data: { date, id, isSending, payloa
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const _onConfirm = (data) => onConfirm(Object.assign({ id, payload }, data));
|
const _onConfirm = (data) => onConfirm(Object.assign({ id: id.toNumber(), payload }, data));
|
||||||
const _onReject = () => onReject(id);
|
const _onReject = () => onReject({ id: id.toNumber() });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Handler
|
<Handler
|
||||||
|
@ -64,5 +64,5 @@ PendingList.propTypes = {
|
|||||||
netVersion: PropTypes.string.isRequired,
|
netVersion: PropTypes.string.isRequired,
|
||||||
onConfirm: PropTypes.func.isRequired,
|
onConfirm: PropTypes.func.isRequired,
|
||||||
onReject: PropTypes.func.isRequired,
|
onReject: PropTypes.func.isRequired,
|
||||||
pendingItems: PropTypes.object.isRequired
|
pendingItems: PropTypes.array.isRequired
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user