以下是remix-ide里的合约的details里的web3depoly直接复制过来的,我直接复制到geth控制台部署,回车后提示 TypeError: Cannot read property 'deploy' of undefined at <eval>:1:20(4)
求解,怎么解决?怎么别人的这段都是contract.new(...)的,为啥我这是contract.depoly(...)? 环境:solidity ^0.8.3
var infocontractContract = new web3.eth.Contract([{"inputs":[],"name":"getInfo","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_age","type":"uint256"}],"name":"setInfo","outputs":[],"stateMutability":"nonpayable","type":"function"}]);
var infocontract = infocontractContract.deploy({
data: '0x608060....(太长省略)',
arguments: [
]
}).send({
from: web3.eth.accounts[0],
gas: '4700000'
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})