Fix inject.js & Signer store duplication (#7299)

* Remove extension mappings

* Remove duplicated pending stores
This commit is contained in:
Jaco Greeff 2017-12-15 17:52:45 +01:00 committed by GitHub
parent 8f6f6a068e
commit 509038c987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 59 deletions

View File

@ -42,11 +42,18 @@ export default class PendingStore {
} }
subscribePending = () => { subscribePending = () => {
this._api.subscribe('signer_requestsToConfirm', (error, pending) => { const callback = (error, pending) => {
if (!error) { if (error) {
this.setPending(pending); return;
} }
});
this.setPending(pending);
};
this._api
.subscribe('signer_requestsToConfirm', callback)
.then(() => this._api.signer.requestsToConfirm())
.then((pending) => callback(null, pending));
} }
static get (api) { static get (api) {

View File

@ -26,7 +26,7 @@ import Label from 'semantic-ui-react/dist/commonjs/elements/Label';
import List from 'semantic-ui-react/dist/commonjs/elements/List'; import List from 'semantic-ui-react/dist/commonjs/elements/List';
import Popup from 'semantic-ui-react/dist/commonjs/modules/Popup'; import Popup from 'semantic-ui-react/dist/commonjs/modules/Popup';
import Store from './store'; import Store from '../../Signer/pendingStore';
import ParityBarStore from '../../ParityBar/store'; import ParityBarStore from '../../ParityBar/store';
import RequestItem from './RequestItem'; import RequestItem from './RequestItem';
import styles from './signerPending.css'; import styles from './signerPending.css';

View File

@ -1,50 +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/>.
import { action, observable } from 'mobx';
let instance;
export default class Store {
@observable pending = [];
constructor (api) {
this._api = api;
this.startSubscription();
}
@action setPending = (pending = []) => {
this.pending = pending;
}
startSubscription () {
this._api.subscribe('signer_requestsToConfirm', (error, pending) => {
if (error) {
return;
}
this.setPending(pending);
});
}
static get (api) {
if (!instance) {
instance = new Store(api);
}
return instance;
}
}

View File

@ -18,8 +18,6 @@ import Api from '@parity/api';
import qs from 'query-string'; import qs from 'query-string';
import Web3 from 'web3'; import Web3 from 'web3';
import web3extensions from './web3.extensions';
function initProvider () { function initProvider () {
const path = window.location.pathname.split('/'); const path = window.location.pathname.split('/');
const query = qs.parse(window.location.search); const query = qs.parse(window.location.search);
@ -67,8 +65,6 @@ function initWeb3 (ethereum) {
web3.eth.defaultAccount = accounts[0]; web3.eth.defaultAccount = accounts[0];
}); });
web3extensions(web3).map((extension) => web3._extend(extension));
window.web3 = web3; window.web3 = web3;
} }