Merge pull request #890 from embark-framework/misc_fixes

Misc fixes
This commit is contained in:
Iuri Matias 2018-09-21 18:27:04 -04:00 committed by GitHub
commit 2c280456e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -94,7 +94,7 @@ class Cmd {
.description(__('New Application')) .description(__('New Application'))
.option('--simple', __('create a barebones project meant only for contract development')) .option('--simple', __('create a barebones project meant only for contract development'))
.option('--locale [locale]', __('language to use (default: en)')) .option('--locale [locale]', __('language to use (default: en)'))
.option('--template [url]', __('download template from a GitHub repository')) .option('--template [name/url]', __('download a template using a known name or a GitHub repository URL'))
.action(function(name, options) { .action(function(name, options) {
i18n.setOrDetectLocale(options.locale); i18n.setOrDetectLocale(options.locale);
if (name === undefined) { if (name === undefined) {
@ -300,7 +300,7 @@ class Cmd {
upload() { upload() {
program program
.command('upload [environment]') .command('upload [environment]')
.option('--ens [ensDomain]', __('ENS domain to associate to')) //.option('--ens [ensDomain]', __('ENS domain to associate to'))
.option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none')) .option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none'))
.option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug') .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug')
.option('--locale [locale]', __('language to use (default: en)')) .option('--locale [locale]', __('language to use (default: en)'))
@ -401,7 +401,7 @@ class Cmd {
.action(function(cmd) { .action(function(cmd) {
console.log((__('unknown command') + ' "%s"').red, cmd); console.log((__('unknown command') + ' "%s"').red, cmd);
let utils = require('../lib/utils/utils.js'); let utils = require('../lib/utils/utils.js');
let dictionary = ['new', 'demo', 'build', 'run', 'blockchain', 'simulator', 'test', 'upload', 'version']; let dictionary = ['new', 'demo', 'build', 'run', 'blockchain', 'simulator', 'test', 'upload', 'version', 'console', 'eject-webpack', 'graph', 'help', 'reset'];
let suggestion = utils.proposeAlternative(cmd, dictionary); let suggestion = utils.proposeAlternative(cmd, dictionary);
if (suggestion) { if (suggestion) {
console.log((__('did you mean') + ' "%s"?').green, suggestion); console.log((__('did you mean') + ' "%s"?').green, suggestion);

View File

@ -140,7 +140,7 @@ class BlockchainConnector {
self.web3._requestManager.send({method: 'web3_clientVersion', params: []}, (err, version) => { self.web3._requestManager.send({method: 'web3_clientVersion', params: []}, (err, version) => {
if (err) { if (err) {
self.isWeb3Ready = false; self.isWeb3Ready = false;
return next(null, {name: "Ethereum node (version unknown)", status: 'on'}); return next(null, {name: "Ethereum node not found", status: 'off'});
} }
if (version.indexOf("/") < 0) { if (version.indexOf("/") < 0) {
self.events.emit(WEB3_READY); self.events.emit(WEB3_READY);

View File

@ -245,7 +245,7 @@ class ContractDeployer {
deployObject = self.blockchain.deployContractObject(contractObject, {arguments: contractParams, data: dataCode}); deployObject = self.blockchain.deployContractObject(contractObject, {arguments: contractParams, data: dataCode});
} catch(e) { } catch(e) {
if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) { if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) {
return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className))); return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className)) + ". " + __("check if there are any params defined for this contract in this environment in the contracts configuration file"));
} }
return next(new Error(e)); return next(new Error(e));
} }
@ -267,7 +267,6 @@ class ContractDeployer {
let estimatedCost = contract.gas * contract.gasPrice; let estimatedCost = contract.gas * contract.gasPrice;
self.logFunction(contract)(__("deploying") + " " + contract.className.bold.cyan + " " + __("with").green + " " + contract.gas + " " + __("gas at the price of").green + " " + contract.gasPrice + " " + __("Wei, estimated cost:").green + " " + estimatedCost + " Wei".green); self.logFunction(contract)(__("deploying") + " " + contract.className.bold.cyan + " " + __("with").green + " " + contract.gas + " " + __("gas at the price of").green + " " + contract.gasPrice + " " + __("Wei, estimated cost:").green + " " + estimatedCost + " Wei".green);
self.blockchain.deployContractFromObject(deployObject, { self.blockchain.deployContractFromObject(deployObject, {
from: contract.deploymentAccount, from: contract.deploymentAccount,
gas: contract.gas, gas: contract.gas,
@ -276,6 +275,9 @@ class ContractDeployer {
if (error) { if (error) {
contract.error = error.message; contract.error = error.message;
self.events.emit("deploy:contract:error", contract); self.events.emit("deploy:contract:error", contract);
if (error.message && error.message.indexOf('replacement transaction underpriced')) {
self.logger.warn("replacement transaction underpriced: This warning typically means a transaction exactly like this one is still pending on the blockchain")
}
return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message)); return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message));
} }
self.logFunction(contract)(contract.className.bold.cyan + " " + __("deployed at").green + " " + receipt.contractAddress.bold.cyan + " " + __("using").green + " " + receipt.gasUsed + " " + __("gas").green); self.logFunction(contract)(contract.className.bold.cyan + " " + __("deployed at").green + " " + receipt.contractAddress.bold.cyan + " " + __("using").green + " " + receipt.gasUsed + " " + __("gas").green);