Uncaught (in promise) Error: 'args.method' must be a non-empty string

Viewed 39
  1. When trying to connect the metamask wallet with my local site i am getting this error
  2. I am Using the eth_requestAccounts methord but getting the down err
inpage.js:8 Uncaught (in promise) Error: 'args.method' must be a non-empty string.
    at o (inpage.js:8:31826)
    at Object.invalidRequest (inpage.js:8:32276)
    at l.request (inpage.js:1:37391)
    at HTMLButtonElement.Connect (index.js:13:27)

this was the error being Printed on MY console

// HOW TO CONNECT YOUR METAMASK TO YOUR FRONTEND

const button = document.getElementById("ConnectButton");
//button.addEventListener('click',connect);
if (button) {
  console.log("button successfully imported");
} else {
  console.log("BUtton is not imported");
}

const Connect = async () => {
  if (typeof window.ethereum !== "undefined") {
    await window.ethereum.request({ methord: "eth_requestAccounts" });

    button.innerHTML = "Connected";
  } else {
    button.innerHTML = "Pls install metamask";
  }
};

button.addEventListener("click", Connect);

MY index.js

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>FUND ME</title>
</head>
<body>
    <h1>HELLO WORLD
    </h1>
    <button id="ConnectButton">Connect</button>
    <script src="index.js"></script>
</body>
</html> 

MY index.html

0 Answers
Related