mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 14:34:40 +00:00
add 0x if private key doesn't have it
This commit is contained in:
parent
7b1a219b51
commit
c5f80c72b9
@ -60,12 +60,18 @@ class Provider {
|
||||
|
||||
getAccount(accountConfig) {
|
||||
if (accountConfig.privateKey) {
|
||||
if (!accountConfig.privateKey.startsWith('0x')) {
|
||||
accountConfig.privateKey = '0x' + accountConfig.privateKey;
|
||||
}
|
||||
return this.web3.eth.accounts.privateKeyToAccount(accountConfig.privateKey);
|
||||
}
|
||||
if (accountConfig.privateKeyFile) {
|
||||
let fileContent = fs.readFileSync(fs.dappPath(accountConfig.privateKeyFile)).toString();
|
||||
fileContent = fileContent.trim().split(/[,;]/);
|
||||
return fileContent.map(key => {
|
||||
if (!key.startsWith('0x')) {
|
||||
key = '0x' + key;
|
||||
}
|
||||
return this.web3.eth.accounts.privateKeyToAccount(key);
|
||||
});
|
||||
}
|
||||
|
@ -92,5 +92,7 @@
|
||||
"Development blockchain has changed to use the --dev option.": "Development blockchain has changed to use the --dev option.",
|
||||
"You can reset your workspace to fix the problem with": "You can reset your workspace to fix the problem with",
|
||||
"Otherwise, you can change your data directory in blockchain.json (datadir)": "Otherwise, you can change your data directory in blockchain.json (datadir)",
|
||||
"tip: you can resize the terminal or disable the dashboard with": "tip: you can resize the terminal or disable the dashboard with"
|
||||
"tip: you can resize the terminal or disable the dashboard with": "tip: you can resize the terminal or disable the dashboard with",
|
||||
"help": "help",
|
||||
"quit": "quit"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user