0

The following code is taken from truffle unbox

      initContract: function() {
        $.getJSON("adding.json", function(addingdappfrontend) {

          App.contracts.Add = TruffleContract(addingdappfrontend);

          // we have to set provideer

            App.contracts.Add.setProvider(App.web3Provider);

adding.json is my json file which is build directory 
addingdappfrontend is the name of the folder where my code is written 

1)Why are we sending adding.json inside $.get json

2)We have never used the adding.json in your ui

3)what $.getjson() is your code

1 Answer 1

1

You're basically using $.getJSON to retrieve the ABI code from your JSON file, this will allow Truffle to initiate the contract respectively and define its functions.

Each JSON file is different from the other, several factors (different functions, compiled address, etc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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