¿Es posible agregar manualmente funciones a la ABI, específicamente las funciones getProduct y addProductToStore? ¿Hace alguna diferencia? Ya intenté eliminar la compilación + volver a compilar + volver a migrar, el mismo problema. ¿Cree que es un problema con el proceso de construcción de Truffle que corrompe los artefactos?
Similar a este problema: https://github.com/trufflesuite/truffle/issues/685
Remezcla:
[
{
"constant": true,
"inputs": [],
"name": "productIndex",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_productId",
"type": "uint256"
}
],
"name": "getProduct",
"outputs": [
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint8"
},
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_name",
"type": "string"
},
{
"name": "_category",
"type": "string"
},
{
"name": "_imageLink",
"type": "string"
},
{
"name": "_descLink",
"type": "string"
},
{
"name": "_auctionStartTime",
"type": "uint256"
},
{
"name": "_auctionEndTime",
"type": "uint256"
},
{
"name": "_startPrice",
"type": "uint256"
},
{
"name": "_productCondition",
"type": "uint256"
}
],
"name": "addProductToStore",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
]
Archivo Json local:
"abi": [
{
"constant": true,
"inputs": [],
"name": "productIndex",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
]
Se dijo que este problema se solucionó muchas veces en el pasado, pero definitivamente puede deshacerse de él degradando a truffle 3.x, eliminando la carpeta build/contracts/ (¡pero haga una copia de seguridad, por si acaso!) y listo truffle compile --all
.
Además de eso, por supuesto, puede agregar toda la información sobre las funciones al archivo JSON como desee, solo tiene que corresponder al código de solidez.
jamarcus_13
Nikita Fuchs