Skip to content

Commit 35253c7

Browse files
committed
fix repl: contract call was waiting a lot to respond.
1 parent 2e85c2a commit 35253c7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "eth-cli",
33
"description": "A collection of CLI tools to help with ethereum learning and development.",
4-
"version": "1.0.0-alpha-6",
4+
"version": "1.0.0-alpha-7",
55
"contributors": [
66
"Fernando Greco",
77
"Franco Victorio",

src/helpers/startRepl.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ export function startRepl(
3535
// Add contracts into context
3636
for (let contract of contracts) {
3737
const abi = loadABI(contract.abiPath)
38-
const Contract = new web3.eth.Contract(abi, contract.address)
38+
39+
const transactionConfirmationBlocks = 3
40+
const options = {
41+
transactionConfirmationBlocks,
42+
}
43+
const Contract: any = web3.eth.Contract // ts hack: transactionConfirmationBlocks is not a valid option
44+
45+
const contractInstance = new Contract(abi, contract.address, options)
3946
let [contractName] = path.basename(contract.abiPath).split('.')
4047

4148
if (replContext[contractName]) {
@@ -48,7 +55,7 @@ export function startRepl(
4855

4956
const contractNameCamelCased = camelCase(contractName)
5057

51-
replContext[contractNameCamelCased] = Contract
58+
replContext[contractNameCamelCased] = contractInstance
5259
}
5360

5461
// Start REPL

0 commit comments

Comments
 (0)