-
After importing the ethers file in lesson 8, the connect button stopped working. Metamask doesn't even open up. here is my index.html: <!DOCTYPE html>
<html>
<head>
<title>Fund Me App</title>
</head>
<body>
<button id="connectButton">Connect</button>
<button id="balanceButton">getBalance</button>
<button id="withdrawButton">Withdraw</button>
<!-- <form> -->
<label for="ethAmount">ETH Amount</label>
<input id="ethAmount" placeholder="0.1" />
<button type="button" id="fundButton" > Fund </button>
<!-- </form> -->
</body>
<script src="./index.js" type="module"></script>
</html> my index.js import { ethers } from "./ethers-5.6.esm.min.js"
import {abi, contractAddress} from "./constants.js"
const connectButton = document.getElementById("connectButton")
const withdrawButton = document.getElementById("withdrawButton")
const fundButton = document.getElementById("fundButton")
const balanceButton = document.getElementById("balanceButton")
connectButton.onclick = connect
fundButton.onclick = fund
async function connect() {
if (typeof window.ethereum !== "undefined") {
try {
await ethereum.request({ method: "eth_requestAccounts" })
} catch (error) {
console.log(error)
}
connectButton.innerHTML = "Connected"
const accounts = await ethereum.request({ method: "eth_accounts" })
console.log(accounts)
} else {
connectButton.innerHTML = "Please install MetaMask"
}
}
here is my console log: The unexpected string in constants.js is the word "bytecode" ...
{
"stateMutability": "payable",
"type": "receive"
}
],
"bytecode":
... I am looking forward to getting some help. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
@clisterX : Can you send me your repo link! |
Beta Was this translation helpful? Give feedback.
-
Is this resolved? |
Beta Was this translation helpful? Give feedback.
-
I just created a Repo for the front-end Code. Here is a link to it: https://github.com/clisterX/fundMe-frontend |
Beta Was this translation helpful? Give feedback.
Is this resolved?