current position:Home>How to pull up metamask and authorize a contract to use my wallet

How to pull up metamask and authorize a contract to use my wallet

2022-02-04 00:12:57 Q & A of Denglian community

How to authorize a contract address ?

image.png

That's what I wrote , But click the button , No response :

// 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




Take the answer 1:

Use call The call does not initiate a transaction . This is supposed to be send( hold call It is amended as follows send ).






Other answers 1:


Other answers 2:


Other answers 3:


Other answers 4:


Other answers 5:

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202040012551445.html

Random recommended