@@ -56,7 +56,7 @@ var addFunctionsToContract = function (contract, abi) {
5656 abi . filter ( function ( json ) {
5757 return json . type === 'function' ;
5858 } ) . map ( function ( json ) {
59- return new SolidityFunction ( json , contract . address ) ;
59+ return new SolidityFunction ( contract . _web3 , json , contract . address ) ;
6060 } ) . forEach ( function ( f ) {
6161 f . attachToContract ( contract ) ;
6262 } ) ;
@@ -74,11 +74,11 @@ var addEventsToContract = function (contract, abi) {
7474 return json . type === 'event' ;
7575 } ) ;
7676
77- var All = new AllEvents ( events , contract . address ) ;
77+ var All = new AllEvents ( contract . _web3 , events , contract . address ) ;
7878 All . attachToContract ( contract ) ;
7979
8080 events . map ( function ( json ) {
81- return new SolidityEvent ( json , contract . address ) ;
81+ return new SolidityEvent ( contract . _web3 , json , contract . address ) ;
8282 } ) . forEach ( function ( e ) {
8383 e . attachToContract ( contract ) ;
8484 } ) ;
@@ -98,7 +98,7 @@ var checkForContractAddress = function(contract, callback){
9898 callbackFired = false ;
9999
100100 // wait for receipt
101- var filter = web3 . eth . filter ( 'latest' , function ( e ) {
101+ var filter = contract . _web3 . eth . filter ( 'latest' , function ( e ) {
102102 if ( ! e && ! callbackFired ) {
103103 count ++ ;
104104
@@ -116,7 +116,7 @@ var checkForContractAddress = function(contract, callback){
116116
117117 } else {
118118
119- web3 . eth . getTransactionReceipt ( contract . transactionHash , function ( e , receipt ) {
119+ contract . _web3 . eth . getTransactionReceipt ( contract . transactionHash , function ( e , receipt ) {
120120 if ( receipt && ! callbackFired ) {
121121
122122 web3 . eth . getCode ( receipt . contractAddress , function ( e , code ) {
@@ -185,7 +185,7 @@ var ContractFactory = function (web3, abi) {
185185 * @returns {Contract } returns contract instance
186186 */
187187ContractFactory . prototype . new = function ( ) {
188- var contract = new Contract ( this . abi ) ;
188+ var contract = new Contract ( this . web3 , this . abi ) ;
189189
190190 // parse arguments
191191 var options = { } ; // required!
@@ -240,7 +240,7 @@ ContractFactory.prototype.new = function () {
240240 * otherwise calls callback function (err, contract)
241241 */
242242ContractFactory . prototype . at = function ( address , callback ) {
243- var contract = new Contract ( this . abi , address ) ;
243+ var contract = new Contract ( this . web3 , this . abi , address ) ;
244244
245245 if ( callback ) {
246246 callback ( null , contract ) ;
@@ -255,7 +255,8 @@ ContractFactory.prototype.at = function (address, callback) {
255255 * @param {Array } abi
256256 * @param {Address } contract address
257257 */
258- var Contract = function ( abi , address ) {
258+ var Contract = function ( web3 , abi , address ) {
259+ this . _web3 = web3 ;
259260 this . _transactionHash = null ;
260261 this . address = address ;
261262
0 commit comments