0

in Remix i execute it and it works as i expecting and when i check the value from other function it returns the expecting value

function makeadmin(string memory cityN, address adminAdress, string memory AdminName, 
string memory hash) public
    {
        require(msg.sender==0x20db1A3eD27EEF75BEBb000961d07AD47Bf58197);

        require(!(ch[cityN].AAdminAdress==adminAdress ));
         require(!(adminscitystatus[cityN]));
        require(!(adminsaddressstatus[adminAdress]));

        ch[cityN].CCityName=cityN;
        ch[cityN].AAdminAdress=adminAdress;
        ch[cityN].AAdminName=AdminName;

        ch[cityN].hashh=hash;
          ch[cityN].noofadmins.push(adminAdress);
        ch[cityN].adminsid[adminAdress]=ch[cityN].noofadmins.length-1;
      adminscitystatus[cityN]=true;
        adminsaddressstatus[adminAdress]=true;
        cityforcompany.push(cityN);
        uint comid=cityforcompany.length-1;
        companycityid[cityN]=comid;
    }

In React js it is not adding the value to respective variables in solidity contract and the variable res returns something like Result[] __proto__.constructor with 0 length

async SubmitData4 (e) {
      e.preventDefault();
      await window.ethereum.enable();
      var Acc= await web3.eth.getAccounts();


      console.log('acc',Acc);


      var res= await LandAbi.methods.makeadmin("muree","0x8057450DFC37633CF19fbaC32E1eF30E44B36007","muneeb","sdasere4e4fre").call({from: Acc[0]});

console.log("res",res);


}
  • You seem to have "found" the mistake one hour after I explained it in the answer below. How about accepting that answer then??? – goodvibration May 16 at 7:23
  • sorry brother your help is appreciative and your answer also give me information about orignal issue i donot mean it i just write it after posting question may be internet issue but your answer is good – lynn chris May 16 at 11:56
  • Since my answer has given you "information about original issue", you should accept it - by clicking on the V next to it. Instead, you posted that you found the issue, and then described exactly what had been explained in my answer prior to your findings. This description by itself shows that my answer has done more than giving you "information about original issue". – goodvibration May 16 at 13:26
  • i don't know why you are not believing me okey for you i'm going to delete that comment but i also apologise to you if i hurt you – lynn chris May 16 at 13:39
  • Did not hurt, and it's perfectly OK to add comments to your own question. But it is also custom to accept an answer which has answered your question, and according to that comment of yours, it did. – goodvibration May 16 at 13:49
0
  1. In order to actually execute the transaction, change call to send
  2. The value returned to the off-chain is the receipt of the transaction
| improve this answer | |
  • thanks brother your help really means alot to me – lynn chris May 16 at 13:40

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.