【发布时间】:2020-12-13 03:39:57
【问题描述】:
我想通过调用智能合约函数来设置一个值。智能合约部署在 Ropsten 测试网上。我正在使用 Infura 而不是运行节点。
我已经读到 Infura 不支持 .send()。那么我有哪些选择?
这是我的代码:
web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/xxxxxxxxxxxxxxxxxxxxx'));
const abi = PrinterMarketplace;
const contractAddress = '0xa498b78b32755xxxxxxxxxxxxxxf3101a1b92'
contract = await new web3.eth.Contract(
abi,
contractAddress);
contract.methods.setOffer(offerprice, fileHash, client, account).send({ from: account, gas: 3000000 })
我收到以下错误:错误:返回错误:方法 eth_sendTransaction 不存在/不可用
请帮忙。
【问题讨论】:
标签: javascript node.js ethereum web3 web3js