报错Error: Invalid JSON RPC response: TypeError: t is not a function

有这样一段代码,功能是监听一个表单的提交事件。可是点击提交时,就会报错

$("#bidding").submit(event=>{
   $("#msg").hide();
   let amount = $("#bid-amount").val();
   let sendAmount = $("#bid-send-amount").val();
   let secretText = $("#secret-text").val();
   let sealedBid = web3.sha3(web3.fromWei(amount, 'ether').toString() + secretText);
   let productId = $("#product-id").val();
   //console.log(sealedBid + " for " + productId);
   EcommerceStore.deployed().then(i=>{
console.log(amount )
console.log(sendAmount )
console.log(parseInt(productId))
//前面应该没有问题,应该是下面有问题,可是不知道怎么错了
//bid为合约中这样一个函数function bid(uint _productId, bytes32 _bid) payable public returns (bool)
    i.bid(parseInt(productId), sealedBid, {from: web3.eth.accounts[0],value: web3.toWei(sendAmount,'ether') }).then(
     function(f) {
      $("#msg").html("Your bid has been successfully submitted!");
      $("#msg").show();
      console.log(f)
     }
    )
   });
   event.preventDefault();
});

报错如下

Error: Invalid JSON RPC response:

TypeError: t is not a function
请先 登录 后评论

最佳答案 2020-08-18 22:34

是不是没有设置provider?

请先 登录 后评论

其它 1 个回答

依北风
请先 登录 后评论
  • 2 关注
  • 0 收藏,4135 浏览
  • 依北风 提出于 2020-08-17 00:27

相似问题