mirror of https://github.com/embarklabs/embark.git
fix some PR comments
This commit is contained in:
parent
09cdab7e2b
commit
4c17aa9d40
|
@ -125,6 +125,7 @@ Blockchain.prototype.initChainAndGetAddress = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var BlockchainClient = function(blockchainConfig, client, env, isDev) {
|
var BlockchainClient = function(blockchainConfig, client, env, isDev) {
|
||||||
|
// TODO add other clients at some point
|
||||||
if (client === 'geth') {
|
if (client === 'geth') {
|
||||||
return new Blockchain({blockchainConfig, client: GethCommands, env, isDev});
|
return new Blockchain({blockchainConfig, client: GethCommands, env, isDev});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,15 +29,23 @@ class AccountParser {
|
||||||
if (!accountConfig.privateKey.startsWith('0x')) {
|
if (!accountConfig.privateKey.startsWith('0x')) {
|
||||||
accountConfig.privateKey = '0x' + accountConfig.privateKey;
|
accountConfig.privateKey = '0x' + accountConfig.privateKey;
|
||||||
}
|
}
|
||||||
|
if (!web3.utils.isHexStrict(accountConfig.privateKey)) {
|
||||||
|
logger.warn(`Private key ending with ${accountConfig.privateKey.substr(accountConfig.privateKey.length - 5)} is not a HEX string`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return web3.eth.accounts.privateKeyToAccount(accountConfig.privateKey);
|
return web3.eth.accounts.privateKeyToAccount(accountConfig.privateKey);
|
||||||
}
|
}
|
||||||
if (accountConfig.privateKeyFile) {
|
if (accountConfig.privateKeyFile) {
|
||||||
let fileContent = fs.readFileSync(fs.dappPath(accountConfig.privateKeyFile)).toString();
|
let fileContent = fs.readFileSync(fs.dappPath(accountConfig.privateKeyFile)).toString();
|
||||||
fileContent = fileContent.trim().split(/[,;]/);
|
fileContent = fileContent.trim().split(/[,;]/);
|
||||||
return fileContent.map(key => {
|
return fileContent.map((key, index) => {
|
||||||
if (!key.startsWith('0x')) {
|
if (!key.startsWith('0x')) {
|
||||||
key = '0x' + key;
|
key = '0x' + key;
|
||||||
}
|
}
|
||||||
|
if (!web3.utils.isHexStrict(key)) {
|
||||||
|
logger.warn(`Private key is not a HEX string in file ${accountConfig.privateKeyFile} at index ${index}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return web3.eth.accounts.privateKeyToAccount(key);
|
return web3.eth.accounts.privateKeyToAccount(key);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue