我一直通过web3.js和ensutils.js与ens一起工作,但我只能使用startAuctionsAndBid函数。
如果我试着:
var sbid = ethRegistrar.shaBid(web3.sha3('name'), eth.accounts[8], web3.toWei(0.01, 'ether'), web3.sha3('my secret phrase'))
ethRegistrar.startAuctionsAndBid(0x12345670159e0506114fee112628a969f587bf4b7bf4a728661705c08fa9ce82, sbid);我得到了:
TypeError: 'forEach' is not a function
at web3.js:1553:13
at web3.js:694:16
at map (<native code>)
at web3.js:693:20
at web3.js:4059:46
at web3.js:4130:19
at apply (<native code>)
at web3.js:4223:16
at <anonymous>:1:1其他函数,如startAuction、newBid、unsealBid按预期工作,只有startAuctionsAndBid给出了一个错误。
知道为什么吗?
forEach错误是通过提供array作为第一个参数来修正的。这个函数现在被执行,但是它是合同执行失败
startAuctionsAndBid需要两个参数:
hashes bytes32[]
sealedBid bytes32如何构造hashes数组的元素?
我试过hashes = [web3.sha3('name')],但没有运气。
发布于 2018-02-04 13:47:22
您必须引用必须是字符串的地址。Javascript本机不支持这么大的数字。
ethRegistrar.startAuctionsAndBid("0x12345670159e0506114fee112628a969f587bf4b7bf4a728661705c08fa9ce82", sbid);发布于 2018-02-04 16:48:50
你的代码可能有两个问题,
https://ethereum.stackexchange.com/questions/38507
复制相似问题