Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options = {
...options,
gui: 'hyperdex',
userhome: os.homedir(),
netid: 9999, // TODO: Set this to `0` when mm v2 is production ready
rpcport: port,
rpccors: is.development ? 'http://localhost:8080' : 'app://-',
coins,
};
this.port = options.rpcport;
if (options.seedPhrase) {
// eslint-disable-next-line camelcase
options.rpc_password = await sha256(options.seedPhrase);
options.passphrase = options.seedPhrase;
delete options.seedPhrase;
} else {
throw new Error('The `seedPhrase` option is required');
}
// NOTE: It's very important that this is a different directory than mm v1, as the database is not compatible
// TODO: Update the path here when mm v2 is production ready
const cwd = await makeDir(path.join(electron.app.getPath('userData'), 'marketmaker2-test'));
logger.log('Spawning Marketmaker with options:', JSON.stringify({
...options,
passphrase: '',
rpc_password: '', // eslint-disable-line camelcase
}));
const initApi = async seedPhrase => {
let url = config.get('marketmakerUrl');
if (url) {
console.log('Using custom marketmaker URL:', url);
} else {
const port = await ipc.callMain('start-marketmaker', seedPhrase);
url = `http://127.0.0.1:${port}`;
}
return new Api({
endpoint: url,
rpcPassword: await sha256(seedPhrase),
concurrency: 10,
});
};
export async function getLicenseHash(): Promise {
const license = getLicense()
if (license) {
return await sha1(license)
}
}