This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2565 from ethcore/jg-polling
Ensure polling is only done when connected
- Loading branch information
Showing
45 changed files
with
174 additions
and
1,239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright 2015, 2016 Ethcore (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 class Signer { | ||
constructor (updateSubscriptions, api, subscriber) { | ||
this._subscriber = subscriber; | ||
this._api = api; | ||
this._updateSubscriptions = updateSubscriptions; | ||
this._started = false; | ||
} | ||
|
||
get isStarted () { | ||
return this._started; | ||
} | ||
|
||
start () { | ||
this._started = true; | ||
|
||
return Promise.all([ | ||
this._listRequests(), | ||
this._loggingSubscribe() | ||
]); | ||
} | ||
|
||
_listRequests = () => { | ||
return this._api.personal | ||
.requestsToConfirm() | ||
.then((requests) => { | ||
this._updateSubscriptions('personal_requestsToConfirm', null, requests); | ||
}); | ||
} | ||
|
||
_loggingSubscribe () { | ||
return this._subscriber.subscribe('logging', (error, data) => { | ||
if (error || !data) { | ||
return; | ||
} | ||
|
||
switch (data.method) { | ||
case 'eth_postTransaction': | ||
case 'eth_sendTranasction': | ||
case 'eth_sendRawTransaction': | ||
this._listRequests(); | ||
return; | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
js/src/views/Signer/containers/--remove-LoadingPage/LoadingPage.css
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
js/src/views/Signer/containers/--remove-LoadingPage/LoadingPage.js
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
js/src/views/Signer/containers/--remove-LoadingPage/index.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.