When running the following code within geth console, I am recieving the following error:
TypeError: 'deploy' is not a function
var storageContractAbi = storageOutput.contracts['contracts/29.sol:ethForAnswersBounty'].abi
var storageContract = new web3.eth.contract(JSON.parse(storageContractAbi))
var storageBinCode = "0x" + storageOutput.contracts['contracts/29.sol:ethForAnswersBounty'].bin
storageContract.deploy({
data: storageBinCode,
arguments: [29]
}).send({
from: eth.accounts[0],
gas: 1000000
})
If I am reading the manual correctly, I am not sure what I am doing wrong here. https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#deploy
The contract is created fine if I call it this way:
var storageInstance = storageContract.new({
from: eth.accounts[0],
data: storageBinCode,
gas: 1000000
})
Any help much appreciated as I would really like to use promises after the send().
Best Answer
I think this might be a limitation in the current version of geth 1.8.20. I was using geth console and piping in the javascript from my original question.
I've now rewritten my deployment pipeline in nodejs so I can pull in web3@1.0.0-beta.37 and the exact same syntax is now working fine.
Hope this helps someone else out.