Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
Conexión de metamáscara Web3 No se pueden leer las propiedades de undefined (leyendo 'ethereum')

Tengo una aplicación de reacción en la que intento conectarme a la extensión metamask a través de web3. En mi thunk.ts , estoy llamando a las funciones requeridas pero recibo un error de tipo que no puedo leer las propiedades de undefined (leyendo 'ethereum'). Aquí está el código que estoy usando

 if (window.ethereum) {//the error line window.web3 = new Web3(window.ethereum); try { await window.ethereum.enable(); updateAddress(dispatch); } catch (err) { alert("Something went wrong."); } } else if (window.web3) { window.web3 = new Web3(window.web3.currentProvider); updateAddress(dispatch); } else { alert("You have to install MetaMask !"); } };

Aquí está la captura de pantalla del error
Aquí está la captura de pantalla del error

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo resolví usando el siguiente código.

 declare global { interface Window { ethereum?: any; web3?:any } }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!