Reset account

This commit is contained in:
Anthony Laibe 2018-07-31 11:15:49 +01:00 committed by Iuri Matias
parent 7aae8bc798
commit 24aecc553b
1 changed files with 13 additions and 8 deletions

View File

@ -51,6 +51,16 @@ class Test {
if (this.provider) { if (this.provider) {
this.provider.stop(); this.provider.stop();
} }
if (this.simOptions.accounts) {
this.simOptions.accounts = this.simOptions.accounts.map((account) => {
if (!account.hexBalance) {
account.hexBalance = '0x8AC7230489E80000'; // 10 ether
}
return {balance: account.hexBalance, secretKey: account.privateKey};
});
}
if (this.simOptions.host) { if (this.simOptions.host) {
let {host, port, type, protocol, accounts} = this.simOptions; let {host, port, type, protocol, accounts} = this.simOptions;
if (!protocol) { if (!protocol) {
@ -84,14 +94,6 @@ class Test {
}); });
} }
if (this.simOptions.accounts) {
this.simOptions.accounts = this.simOptions.accounts.map((account) => {
if (!account.hexBalance) {
account.hexBalance = '0x8AC7230489E80000'; // 10 ether
}
return {balance: account.hexBalance, secretKey: account.privateKey};
});
}
if (!this.sim) { if (!this.sim) {
this.sim = getSimulator(); this.sim = getSimulator();
} }
@ -189,7 +191,10 @@ class Test {
} }
if (accounts) { if (accounts) {
self.simOptions.accounts = AccountParser.parseAccountsConfig(accounts, self.web3); self.simOptions.accounts = AccountParser.parseAccountsConfig(accounts, self.web3);
} else {
self.simOptions.account = null;
} }
Object.assign(self.simOptions, { Object.assign(self.simOptions, {
host, host,
port, port,