Commit 9263ec47 authored by Amaury Martiny's avatar Amaury Martiny
Browse files

Add more debug messages

parent d3b9dbc2
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
import { action, observable } from 'mobx'; import { action, observable } from 'mobx';
import Debug from '../utils/debug';
import parityStore from './parityStore'; import parityStore from './parityStore';
const debug = Debug('createAccountStore');
export class CreateAccountStore { export class CreateAccountStore {
@observable address = null; @observable address = null;
@observable isImport = false; // Are we creating a new account, or importing via phrase? @observable isImport = false; // Are we creating a new account, or importing via phrase?
...@@ -22,10 +25,12 @@ export class CreateAccountStore { ...@@ -22,10 +25,12 @@ export class CreateAccountStore {
} }
generateNewAccount = () => { generateNewAccount = () => {
debug('Generating new account.');
return parityStore.api.parity.generateSecretPhrase().then(this.setPhrase); return parityStore.api.parity.generateSecretPhrase().then(this.setPhrase);
}; };
saveAccountToParity = password => { saveAccountToParity = password => {
debug('Saving account to Parity.');
return parityStore.api.parity return parityStore.api.parity
.newAccountFromPhrase(this.phrase, password) .newAccountFromPhrase(this.phrase, password)
.then(() => .then(() =>
......
...@@ -12,7 +12,7 @@ import store from 'store'; ...@@ -12,7 +12,7 @@ import store from 'store';
import Debug from '../utils/debug'; import Debug from '../utils/debug';
import LS_PREFIX from './utils/lsPrefix'; import LS_PREFIX from './utils/lsPrefix';
const debug = Debug('sendStore'); const debug = Debug('parityStore');
const electron = isElectron() ? window.require('electron') : null; const electron = isElectron() ? window.require('electron') : null;
const LS_KEY = `${LS_PREFIX}::secureToken`; const LS_KEY = `${LS_PREFIX}::secureToken`;
...@@ -64,6 +64,7 @@ export class ParityStore { ...@@ -64,6 +64,7 @@ export class ParityStore {
defaultPort}`; defaultPort}`;
} }
debug(`Connecting to ${provider}.`);
const api = new Api( const api = new Api(
new Api.Provider.Ws( new Api.Provider.Ws(
provider, provider,
...@@ -78,8 +79,8 @@ export class ParityStore { ...@@ -78,8 +79,8 @@ export class ParityStore {
this.api = api; this.api = api;
// TODO This is not working // TODO This is not working
// api.on('connected', () => ...); // api.on('connected', () => this.setIsApiConnected(true));
// api.on('disconnected', () => ...); // api.on('disconnected', () => this.setIsApiConnected(false));
// So instead, we poll every 1s // So instead, we poll every 1s
setInterval(() => { setInterval(() => {
this.setIsApiConnected(api.isConnected); this.setIsApiConnected(api.isConnected);
...@@ -90,6 +91,7 @@ export class ParityStore { ...@@ -90,6 +91,7 @@ export class ParityStore {
const { ipcRenderer } = electron; const { ipcRenderer } = electron;
// Request new token from Electron // Request new token from Electron
debug('Requesting new token.');
ipcRenderer.send('asynchronous-message', 'signer-new-token'); ipcRenderer.send('asynchronous-message', 'signer-new-token');
ipcRenderer.once('asynchronous-reply', (_, token) => { ipcRenderer.once('asynchronous-reply', (_, token) => {
if (!token) { if (!token) {
...@@ -111,7 +113,7 @@ export class ParityStore { ...@@ -111,7 +113,7 @@ export class ParityStore {
if (isApiConnected === this.isApiConnected) { if (isApiConnected === this.isApiConnected) {
return; return;
} }
debug(`Api is now ${isApiConnected ? 'connected' : 'disconnected'}.`);
this.isApiConnected = isApiConnected; this.isApiConnected = isApiConnected;
}; };
...@@ -135,6 +137,7 @@ export class ParityStore { ...@@ -135,6 +137,7 @@ export class ParityStore {
return; return;
} }
debug(`Setting token in localStorage.`);
this.token = token; this.token = token;
// If we receive a new token, then we try to connect to the Api with this // If we receive a new token, then we try to connect to the Api with this
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment