From 9b1a78cdaa18c24f21ab737a3b0f208d49443abc Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 18 May 2018 19:00:36 -0400 Subject: [PATCH] move Contract object to blockchain module --- lib/contracts/blockchain.js | 4 ++++ lib/contracts/deploy.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/contracts/blockchain.js b/lib/contracts/blockchain.js index 352fd775..27463d19 100644 --- a/lib/contracts/blockchain.js +++ b/lib/contracts/blockchain.js @@ -90,6 +90,10 @@ class Blockchain { this.web3.eth.getBlock(blockNumber, cb); } + ContractObject(params) { + return new this.web3.eth.Contract(params.abi); + } + } module.exports = Blockchain; diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 3d957a4a..08b122ee 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -308,7 +308,7 @@ class Deploy { }); }, function createDeployObject(next) { - let contractObject = new self.web3.eth.Contract(contract.abiDefinition); + let contractObject = self.blockchain.ContractObject({abi: contract.abiDefinition}); try { const dataCode = contractCode.startsWith('0x') ? contractCode : "0x" + contractCode;