From 8aff0a8b04dbdde4787a3b03a06c7494b03c1082 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Sun, 2 Dec 2018 14:33:10 -0500 Subject: [PATCH] feature: pass network info to onReady --- src/blockchain.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blockchain.js b/src/blockchain.js index ca6e480..9693137 100644 --- a/src/blockchain.js +++ b/src/blockchain.js @@ -90,7 +90,7 @@ Blockchain.connect = function(connectionList, opts, doneCb) { Blockchain.execWhenReady = function(cb) { if (this.done) { - return cb(this.err); + return cb(this.err, this.web3); } if (!this.list) { this.list = []; @@ -104,7 +104,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])); } }) }; @@ -133,7 +133,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); }