2

I have this piece of code just to connect to MM, but it's saying eth_requestAcccounts does not axist/isnt available. Any tips?

    function App() {
  const innitConnection = async () => {
    if(typeof window.ethereum !== "undefined"){
      console.log("You have Metamask!");
      const accounts = await window.ethereum.request({
        method: "eth_requestAcccounts",
      });
      console.log(accounts[0]);
    } else {
        console.log("Please install Metamask");
      }
    };
  return (
    <div><button onClick={innitConnection}>Connect</button>
    </div>
  );
}

It is throwing these errors:

inpage.js:1 MetaMask - RPC Error: The method "eth_requestAcccounts" does not exist / is not available. {code: -32601, message: 'The method "eth_requestAcccounts" does not exist / is not available.', data: {…}} code: -32601 data: {origin: 'http://localhost:3000'} message: "The method "eth_requestAcccounts" does not exist / is not available." [[Prototype]]: Object

App.js:15 Uncaught (in promise) {code: -32601, message: 'The method "eth_requestAcccounts" does not exist / is not available.', data: {…}, stack: '{\n "code": -32601,\n "message": "The method \"eth…ihfbeogaeaoehlefnkodbefgpgknn/common-6.js:1:1707)'} code: -32601 data: {origin: 'http://localhost:3000'} message: "The method "eth_requestAcccounts" does not exist / is not available." stack: "{\n "code": -32601,\n "message": "The method \"eth_requestAcccounts\" does not exist / is not available.",\n "data": {\n "origin": "http://localhost:3000"\n },\n "stack": "Error: The method \"eth_requestAcccounts\" does not exist / is not available.

2 Answers 2

1

double check what you wrote there. Its: eth_requestAccounts
you wrote "Acccounts" instead of "Accounts".

0
1

change Acccounts to Accounts you are writing wrong spellings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.