Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error from undefined mainWindow.electrumServers #205

Open
sawlysawly opened this issue Jan 27, 2019 · 2 comments
Open

error from undefined mainWindow.electrumServers #205

sawlysawly opened this issue Jan 27, 2019 · 2 comments

Comments

@sawlysawly
Copy link

sawlysawly commented Jan 27, 2019

i pulled to the latest master and run all builds command properly but electron screen just white page and I get this error

Uncaught SyntaxError: Unexpected token u in JSON at position 0

after some investigations I founds that its problem in util/mainWindow.js

const mainWindow = window.require('electron').remote.getGlobal('app');
export const electrumServers = JSON.parse(JSON.stringify(mainWindow.electrumServers));
export const mainWindowNonCached = window.require('electron').remote.getCurrentWindow();

export default mainWindow;

this line: JSON.parse(JSON.stringify(mainWindow.electrumServers)) is break the JSON if mainWindow.electrumServers is undefined

for me electrumServers is undefined so this is why I get errors

if i change the line to be

export const electrumServers = undefined;

then its works

i can see in commit history there is lots of changes to spv code do you think this can be the cause @pbca26

@sawlysawly
Copy link
Author

I think electrumServers should be set here

Agama/main.js

Lines 354 to 392 in 3ec7efb

let _global = {
appConfig,
arch: localVersion[1].indexOf('-spv-only') > -1 ? 'spv-only' : arch(),
appBasicInfo,
appSessionHash,
testLocation: api.testLocation,
kmdMainPassiveMode: api.kmdMainPassiveMode,
getAppRuntimeLog: api.getAppRuntimeLog,
// nativeCoindList,
zcashParamsExist: _zcashParamsExist,
zcashParamsExistPromise: api.zcashParamsExistPromise,
appExit,
getMaxconKMDConf: api.getMaxconKMDConf,
setMaxconKMDConf: api.setMaxconKMDConf,
// getMMCacheData: api.getMMCacheData,
activeSection: 'wallets', // temp deprecated
argv: process.argv,
getAssetChainPorts: api.getAssetChainPorts,
startSPV: api.startSPV,
startKMDNative: api.startKMDNative,
getCoinByPub: api.getCoinByPub,
resetSettings: () => { api.saveLocalAppConf(__defaultAppSettings) },
createSeed: {
triggered: false,
firstLoginPH: null,
secondaryLoginPH: null,
},
checkStringEntropy: api.checkStringEntropy,
pinAccess: false,
isWatchOnly: api.isWatchOnly,
sha256: (data) => {
const crypto = require('crypto');
return crypto.createHash('sha256').update(data).digest();
},
randomBytes: (size) => {
return randomBytes(size || 32).toString('hex');
},
};
global.app = _global;

@sawlysawly
Copy link
Author

@pbca26 any feedbacks to this

did you tested on linux

util/mainWindow.js is parsing json on global thats not exist. i submit PR to make it exist but you said you dont want it on global

how should this be handled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant