Merge pull request #33 from embark-framework/feature/pass-current-network-information-to-onready

feature: pass network info to onReady
This commit is contained in:
Iuri Matias 2018-12-07 10:22:28 -05:00 committed by GitHub
commit af87171d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ Blockchain.enableEthereum = function() {
Blockchain.execWhenReady = function(cb) {
if (this.done) {
return cb(this.err);
return cb(this.err, this.web3);
}
if (!this.list) {
this.list = [];
@ -120,7 +120,7 @@ Blockchain.doFirst = function(todo) {
self.done = true;
self.err = err;
if (self.list) {
self.list.map((x) => x.apply(x, [self.err]));
self.list.map((x) => x.apply(x, [self.err, self.web3]));
}
})
};
@ -153,7 +153,7 @@ let Contract = function (options) {
let originalMethods = Object.keys(ContractClass);
Blockchain.execWhenReady(function() {
Blockchain.execWhenReady(function(err, web3) {
if(!ContractClass.currentProvider){
ContractClass.setProvider(web3.currentProvider);
}