|
1 | 1 | // status = Network Mismatch, Not Connected, Connected, Standby, Syncing |
2 | 2 |
|
3 | | -const { powerMonitor } = require('electron') |
| 3 | +const { app, powerMonitor } = require('electron') |
4 | 4 | const EventEmitter = require('events') |
5 | 5 | const { addHexPrefix } = require('@ethereumjs/util') |
6 | 6 | const { Hardfork } = require('@ethereumjs/common') |
@@ -604,19 +604,21 @@ class Chains extends EventEmitter { |
604 | 604 | }) |
605 | 605 | } |
606 | 606 |
|
607 | | - powerMonitor.on('resume', () => { |
608 | | - const activeConnections = Object.keys(this.connections) |
609 | | - .map((type) => Object.keys(this.connections[type]).map((chainId) => `${type}:${chainId}`)) |
610 | | - .flat() |
| 607 | + app.on('ready', () => { |
| 608 | + powerMonitor.on('resume', () => { |
| 609 | + const activeConnections = Object.keys(this.connections) |
| 610 | + .map((type) => Object.keys(this.connections[type]).map((chainId) => `${type}:${chainId}`)) |
| 611 | + .flat() |
611 | 612 |
|
612 | | - log.info('System resuming, resetting active connections', { chains: activeConnections }) |
| 613 | + log.info('System resuming, resetting active connections', { chains: activeConnections }) |
613 | 614 |
|
614 | | - activeConnections.forEach((id) => { |
615 | | - const [type, chainId] = id.split(':') |
616 | | - removeConnection(chainId, type) |
617 | | - }) |
| 615 | + activeConnections.forEach((id) => { |
| 616 | + const [type, chainId] = id.split(':') |
| 617 | + removeConnection(chainId, type) |
| 618 | + }) |
618 | 619 |
|
619 | | - updateConnections() |
| 620 | + updateConnections() |
| 621 | + }) |
620 | 622 | }) |
621 | 623 |
|
622 | 624 | store.observer(updateConnections, 'chains:connections') |
|
0 commit comments