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) {
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) {
let {host, port, type, protocol, accounts} = this.simOptions;
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) {
this.sim = getSimulator();
}
@ -189,7 +191,10 @@ class Test {
}
if (accounts) {
self.simOptions.accounts = AccountParser.parseAccountsConfig(accounts, self.web3);
} else {
self.simOptions.account = null;
}
Object.assign(self.simOptions, {
host,
port,