Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

370
Vistas
Why does my code thing deployed() is not a function?

code:

 loadContract: async ()=>{
     //Create JS version of smart contract
     const todoList = await $.getJSON('TodoList.json')
     App.contracts.TodoList = TruffleContract(todoList)
     App.contracts.TodoList = web3.setProvider(new Web3.providers.HttpProvider("http://127.0.0.1:7545"))
 
 //getting values from blockchain
 App.todoList = await App.contracts.TodoList.deployed()
 console.log(todoList)

error:

TypeError: App.contracts.TodoList.deployed is not a function

I am able to call TodoList.deployed() in the truffle dev environment but not in the JavaScript file. I am trying to to set all the data from the deployed smart contract to App.todoList so I can work with the values in the JavaScript file and render them to the HTML. I am completely stuck. When I console.log(todolist) I receive the JSON of the smart contract.

Here is my migrations file.

//need migration to update state of blockchain

const TodoList = artifacts.require("./TodoList.sol");

module.exports = function (deployer) {
  deployer.deploy(TodoList);
};
//run migration and deploy contract to blockchain
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda