Lesson 8 (Error Uncaught (in promise) Error: invalid ENS name (argument="name", value=1.3241613105987439e+48, code=INVALID_ARGUMENT, version=providers/5.1.2) #5388
-
Hi. Team. I'm getting the following error when I click the "fund" button on my front-end interface... Uncaught (in promise) Error: invalid ENS name (argument="name", value=1.3241613105987439e+48, code=INVALID_ARGUMENT, version=providers/5.1.2) Here is my code import { ethers } from "./ethers-5.6.esm.min.js"
import { abi, contractAddress } from "./constants.js"
const connectButton = document.getElementById("connectButton")
const fundButton = document.getElementById("fundButton")
connectButton.onclick = connect
fundButton.onclick = fund
async function connect() {
if (typeof window.ethereum !== "undefined") {
console.log("I see a metamask")
await window.ethereum.request({ method: "eth_requestAccounts" })
console.log("We're connected")
connectButton.innerHTML = "Connected"
} else {
console.log("I don't see a metamask")
connectButton.innerHTML = "Install Metamask"
}
}
async function fund() {
const ethAmount = "77"
console.log(`Funding with: ${ethAmount} ETH`)
if (typeof window.ethereum !== "undefined") {
//provider / connection with the blockchain
//signer / wallet / Someone with gas
//A contract to interact with (its ABI & Address)
const provider = new ethers.providers.Web3Provider(window.ethereum)
const signer = await provider.getSigner()
//const signerAddress = await signer.getAddress()
//console.log(signerAddress)
const contract = new ethers.Contract(contractAddress, abi, signer)
const transactionResponse = await contract.fund({
value: ethers.utils.parseEther(ethAmount),
})
}
} I tried several options but all af them makes a different error such as... Uncaught (in promise) Error: invalid signer or provider (argument="signerOrProvider", value={}, code=INVALID_ARGUMENT, version=contracts/5.1.1) .Which according to another question-answer the third parameter (signer) should be an address.... so I tried with .... const contract = new ethers.Contract(contractAddress, abi, signer.getAddress() didn't work either. I tried to use theContractFactory object instead ... " new ethers.ContractFactory( interface , bytecode [ , signer ] ) " ... however I couldn't export the bytecode's contract on the "constant.js" because there is a limit on the VSCode settings (Tokenization is skipped for long lines for performance reasons. This can be configured via editor.maxTokenizationLineLength. Is there any problem with the ethers web-browser version? anyways... I tried options but now I'm completely lost and not sure what the solutions is yet. Thanks in advance =D |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hello @BalamRamGas Script in |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
@BalamRamGas wrap it in quotes and check
"0xe7f1725e7734ce288f8367e1bb143e90bb3f0512"
, may be javascript automatically converting it to hexadecimal value.