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.