From c417f01a23ac1b61268bdb507758c7de694b0222 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 4 Jan 2018 13:13:15 +0100 Subject: [PATCH] Signer updates from global Redux state (#7452) * Remove unused layout * Update to use pending from Redux * Update @parity/shared --- js/package-lock.json | 39 +++--------------------- js/package.json | 2 +- js/src/Signer/Embedded/embedded.js | 18 +++++------ js/src/Signer/Layout/layout.js | 15 --------- js/src/Signer/PendingItem/pendingItem.js | 4 +-- js/src/Signer/PendingList/pendingList.js | 2 +- 6 files changed, 17 insertions(+), 63 deletions(-) delete mode 100644 js/src/Signer/Layout/layout.js diff --git a/js/package-lock.json b/js/package-lock.json index dae4fd060..9eadf4052 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -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", diff --git a/js/package.json b/js/package.json index 999b04597..c88bbcf18 100644 --- a/js/package.json +++ b/js/package.json @@ -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", diff --git a/js/src/Signer/Embedded/embedded.js b/js/src/Signer/Embedded/embedded.js index aee61f25e..8fa0524fe 100644 --- a/js/src/Signer/Embedded/embedded.js +++ b/js/src/Signer/Embedded/embedded.js @@ -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 ( @@ -62,7 +58,7 @@ class Embedded extends Component { netVersion={ netVersion } onConfirm={ actions.startConfirmRequest } onReject={ actions.startRejectRequest } - pendingItems={ this.pendingStore.pending } + pendingItems={ pending } /> ); @@ -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 }; } diff --git a/js/src/Signer/Layout/layout.js b/js/src/Signer/Layout/layout.js deleted file mode 100644 index 1d5bd5640..000000000 --- a/js/src/Signer/Layout/layout.js +++ /dev/null @@ -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 . diff --git a/js/src/Signer/PendingItem/pendingItem.js b/js/src/Signer/PendingItem/pendingItem.js index fa5ef062b..79981cc02 100644 --- a/js/src/Signer/PendingItem/pendingItem.js +++ b/js/src/Signer/PendingItem/pendingItem.js @@ -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 (