From 35253c7bf406f587d017fa94d0c0c29f5b361afe Mon Sep 17 00:00:00 2001 From: nicosampler Date: Thu, 18 Jul 2019 10:27:40 -0300 Subject: [PATCH] fix repl: contract call was waiting a lot to respond. --- package.json | 2 +- src/helpers/startRepl.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e5c8144..ddd024c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "eth-cli", "description": "A collection of CLI tools to help with ethereum learning and development.", - "version": "1.0.0-alpha-6", + "version": "1.0.0-alpha-7", "contributors": [ "Fernando Greco", "Franco Victorio", diff --git a/src/helpers/startRepl.ts b/src/helpers/startRepl.ts index 69606f5..c0153ff 100644 --- a/src/helpers/startRepl.ts +++ b/src/helpers/startRepl.ts @@ -35,7 +35,14 @@ export function startRepl( // Add contracts into context for (let contract of contracts) { const abi = loadABI(contract.abiPath) - const Contract = new web3.eth.Contract(abi, contract.address) + + const transactionConfirmationBlocks = 3 + const options = { + transactionConfirmationBlocks, + } + const Contract: any = web3.eth.Contract // ts hack: transactionConfirmationBlocks is not a valid option + + const contractInstance = new Contract(abi, contract.address, options) let [contractName] = path.basename(contract.abiPath).split('.') if (replContext[contractName]) { @@ -48,7 +55,7 @@ export function startRepl( const contractNameCamelCased = camelCase(contractName) - replContext[contractNameCamelCased] = Contract + replContext[contractNameCamelCased] = contractInstance } // Start REPL