简体   繁体   中英

Trying to call send function in web3 and it returns an error => Uncaught (in promise) Error: Returned error: unknown account

I am trying to call a method of smart contract which is a write method

const temp = await goin_contract.methods
    .increaseAllowance("0xEd61D93121D0b8435f9D2AaCB7dea0A3D067c4E2", stakeValue)
    .send({ from: account });

However whenever I call this method it returns this error

*Uncaught (in promise) Error: Returned error: unknown account
    at Object.ErrorResponse (errors.js:28:1)
    at index.js:302:1
    at XMLHttpRequest.request.onreadystatechange* 

Read methods of smart-contract are working perfectly.

I have read some articles on how to solve this error but cant find a definite solution. Any help will be appreciated.

You have to use Metamask provider instead of node URL const web3 = new Web3(window.ethereum);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM