wip working

This commit is contained in:
Jonathan Rainville 2018-07-05 08:38:19 -04:00 committed by Iuri Matias
parent b6c75ce070
commit 15ad24f002
1 changed files with 9 additions and 7 deletions

View File

@ -36,19 +36,21 @@ class Provider {
self.web3.eth.accounts.wallet.add(account); self.web3.eth.accounts.wallet.add(account);
}); });
self.realAccountFunction = self.web3.eth.getAccounts; self.web3.eth.defaultAccount = self.addresses[0];
const realAccountFunction = self.web3.eth.getAccounts;
self.web3.eth.getAccounts = function (cb) { self.web3.eth.getAccounts = function (cb) {
if (!cb) { cb = cb || function () {};
cb = function () {
};
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
self.realAccountFunction((err, accounts) => { realAccountFunction((err, accounts) => {
if (err) { if (err) {
cb(err); cb(err);
return reject(err); return reject(err);
} }
accounts = accounts.concat(self.addresses); // console.log('ACOUNTS', accounts);
// console.log('My addresses', self.addresses);
// accounts = self.addresses;
accounts = [accounts[0]].concat(self.addresses);
// accounts = accounts.concat(self.addresses);
// accounts = self.addresses.concat(accounts); // accounts = self.addresses.concat(accounts);
cb(null, accounts); cb(null, accounts);
resolve(accounts); resolve(accounts);