5 怎样拉起 MetaMask, 授权某个合约使用我的钱包

怎么给某个合约地址授权?

image.png

我是这么写的,但是点击按钮,没有反应:

// before all, request privilege, first
  const handleReqPri = () => {
    const w = new Web3(ether);
    const wethAdr = getWETHContract(w);
    const strBlindAuctionAdr = getBlindAuctionAddress();
    wethAdr.methods
      .approve(strBlindAuctionAdr, new BigNumber("100000000000000000"))
      .call()
      .then(function (result: any) {
        console.log("handleReqPri ===>", result);
      })
      .catch((_error: any) => {
        // If the request fails, the Promise will reject with an error.
        console.error("privilege error ? : ", _error);
      });
  };

image.png

请先 登录 后评论

最佳答案 2021-04-17 15:52

使用 call 调用不会发起交易。 这里应该是 send( 把 call 修改为 send )。

请先 登录 后评论

其它 6 个回答

PandaManCoin
请先 登录 后评论
阿白
请先 登录 后评论
阿白
请先 登录 后评论
阿白
请先 登录 后评论
阿白
请先 登录 后评论
阿白
请先 登录 后评论