Change connection
This commit is contained in:
parent
d0555fe23c
commit
9ed162bc26
|
@ -177,28 +177,26 @@ class Test {
|
||||||
|
|
||||||
checkDeploymentOptions(options, callback) {
|
checkDeploymentOptions(options, callback) {
|
||||||
const self = this;
|
const self = this;
|
||||||
self.simOptions = {};
|
self.resetServices = false;
|
||||||
let resetServices = false;
|
const {host, port, type, accounts} = options.deployment || {};
|
||||||
if (options.deployment) {
|
|
||||||
if (options.deployment.accounts) {
|
if (host && port && !['rpc', 'ws'].includes(type)) {
|
||||||
// Account setup
|
callback(__("contracts config error: unknown deployment type %s", type));
|
||||||
self.simOptions.accounts = AccountParser.parseAccountsConfig(options.deployment.accounts, self.web3);
|
|
||||||
resetServices = true;
|
|
||||||
}
|
|
||||||
if (options.deployment.host && options.deployment.port && options.deployment.type) {
|
|
||||||
if (options.deployment.type !== 'rpc' && options.deployment.type !== 'ws') {
|
|
||||||
callback(__("contracts config error: unknown deployment type %s", options.deployment.type));
|
|
||||||
}
|
|
||||||
Object.assign(self.simOptions, {
|
|
||||||
host: options.deployment.host,
|
|
||||||
port: options.deployment.port,
|
|
||||||
type: options.deployment.type
|
|
||||||
});
|
|
||||||
resetServices = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resetServices && !self.firstRunConfig) {
|
if(accounts || port !== this.simOptions.port || type !== this.simOptions.type || host !== this.simOptions.host) {
|
||||||
|
self.resetServices = true;
|
||||||
|
}
|
||||||
|
if (accounts) {
|
||||||
|
self.simOptions.accounts = AccountParser.parseAccountsConfig(accounts, self.web3);
|
||||||
|
}
|
||||||
|
Object.assign(self.simOptions, {
|
||||||
|
host,
|
||||||
|
port,
|
||||||
|
type
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!self.resetServices && !self.firstRunConfig) {
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,14 +229,8 @@ class Test {
|
||||||
function checkDeploymentOpts(next) {
|
function checkDeploymentOpts(next) {
|
||||||
self.checkDeploymentOptions(options, next);
|
self.checkDeploymentOptions(options, next);
|
||||||
},
|
},
|
||||||
function resetContracts(next) {
|
|
||||||
self.engine.contractsManager.contracts = cloneDeep(self.builtContracts);
|
|
||||||
self.engine.contractsManager.compiledContracts = cloneDeep(self.compiledContracts);
|
|
||||||
self.engine.contractsManager.contractDependencies = {};
|
|
||||||
next();
|
|
||||||
},
|
|
||||||
function compileContracts(next) {
|
function compileContracts(next) {
|
||||||
if (Object.keys(self.builtContracts).length > 0) {
|
if (Object.keys(self.builtContracts).length > 0 && !self.resetServices) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
console.info('Compiling contracts'.cyan);
|
console.info('Compiling contracts'.cyan);
|
||||||
|
@ -252,6 +244,12 @@ class Test {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
function resetContracts(next) {
|
||||||
|
self.engine.contractsManager.contracts = cloneDeep(self.builtContracts);
|
||||||
|
self.engine.contractsManager.compiledContracts = cloneDeep(self.compiledContracts);
|
||||||
|
self.engine.contractsManager.contractDependencies = {};
|
||||||
|
next();
|
||||||
|
},
|
||||||
function deploy(next) {
|
function deploy(next) {
|
||||||
self._deploy(options, (err, accounts) => {
|
self._deploy(options, (err, accounts) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -12,7 +12,10 @@ config({
|
||||||
"mnemonic": "example exile argue silk regular smile grass bomb merge arm assist farm",
|
"mnemonic": "example exile argue silk regular smile grass bomb merge arm assist farm",
|
||||||
balance: "5ether"
|
balance: "5ether"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 8545,
|
||||||
|
"type": "rpc"
|
||||||
},
|
},
|
||||||
contracts: {
|
contracts: {
|
||||||
"SimpleStorage": {
|
"SimpleStorage": {
|
||||||
|
|
Loading…
Reference in New Issue