Skip to content

Commit

Permalink
fix repl: contract call was waiting a lot to respond.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosampler committed Jul 18, 2019
1 parent 2e85c2a commit 35253c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
11 changes: 9 additions & 2 deletions src/helpers/startRepl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -48,7 +55,7 @@ export function startRepl(

const contractNameCamelCased = camelCase(contractName)

replContext[contractNameCamelCased] = Contract
replContext[contractNameCamelCased] = contractInstance
}

// Start REPL
Expand Down

0 comments on commit 35253c7

Please sign in to comment.