1

Is it possible to manually add functions to the ABI, specifically the getProduct and addProductToStore functions? Does it make a difference? Have already tried deleting build + recompiling + remigrating, same issue. Believe it to be an problem with Truffle's build process corrupting the artifacts?

Similar to this issue: https://github.com/trufflesuite/truffle/issues/685

Remix :

[
    {
        "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"
    }
]

Local Json file:

"abi": [
    {
      "constant": true,
      "inputs": [],
      "name": "productIndex",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "constructor"
    }
  ]
1

this issue was said to be fixed many times in the past, but you can definitely get rid of it by downgrading to truffle 3.x, deleting the build/contracts/ folder (but back it up, just in case!) and do truffle compile --all.

Besides that, you can of course add all information on functions to the JSON file as you like, it just has to correspond to the solidity code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.