Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fs.remove(tempd, (err) => {
if (err) reject(err)
// return all the credentials and parameters used for encryption
logger.verbose('Successfully deleted tempd!')
resolve({
salt: dcreds.salt,
key: dcreds.key,
cryptpath: tarDestPath,
tag: tag,
iv: iv
})
})
})
app.on('window-all-closed', () => {
logger.verbose('APP: window-all-closed event emitted')
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
})
.exec(function (err, transactions) {
// TODO handle error
if (err) {
logger.error('Error getting data from db', err.message, err)
return
}
logger.verbose(transactions.map(t => t.transaction.hash))
sendWalletStateChange({ webContents,
walletId,
address,
data: {
transactions
},
log: 'Transactions' })
})
})
function sendWalletStateChange ({ webContents, walletId, address, data, log }) {
pendingWalletStateChanges.push({
webContents,
log: [log],
data: {
[walletId]: {
addresses: {
[address]: data
}
}
}
})
logger.verbose(`<-//- ${log} queued`)
sendPendingWalletStateChanges()
}
private log(logLevel: LogLevel, message: string, data: any[] = []): void {
if (data && data.length > 0) {
data.forEach((param) => {
message += `, '${param && typeof param}': ${JSON.stringify(param)}`;
});
}
if (!isElectronQA) {
switch (logLevel) {
case 'error': electronLog.error(message); break;
case 'warn': electronLog.warn(message); break;
case 'info': electronLog.info(message); break;
case 'verbose': electronLog.verbose(message); break;
case 'debug': electronLog.debug(message); break;
case 'silly': electronLog.silly(message); break;
default: electronLog.info(message);
}
}
this.sendToCloud(this.formatLogMsg(logLevel, message));
}
.then(function () {
logger.verbose('Clear cache success')
restart(1)
})
.catch(err => logger.error('Clear cache failed: ', err))
window.webContents.on('did-finish-load', () => {
window.show();
if (process.env.NODE_ENV === 'production') {
window.focus();
}
log.verbose('[STARTUP] Webcontent finished loading');
});
}
.then(function (isValid) {
if (isValid) {
logger.verbose('Supplied password is valid')
} else {
logger.warn('Supplied password is invalid')
}
return isValid
})
.catch(function (err) {
.then(function (bestBlock) {
if (webContents.isDestroyed()) { return }
webContents.send('eth-block', bestBlock)
logger.verbose('<-- Current best block', bestBlock)
})
.catch(function (err) {
function callTokenMethod (method, args, waitForReceipt) {
const { password, token, from, to, value, gasPrice, gasLimit } = args
logger.verbose(`Calling ${method} of ERC20 token`, {
from,
to,
value,
token,
gasLimit,
gasPrice
})
const web3 = ethWallet.getWeb3()
const contract = new web3.eth.Contract(abi, token)
const call = contract.methods[method](to, value)
const data = call.encodeABI()
return ethWallet.sendTransaction(
{ password, from, to: token, data, gasPrice, gasLimit },
waitForReceipt