Truffle-Contract

創建數據函式的react-box呼叫返回無效地址

  • August 20, 2018

錯誤圖像表示地址無效。這是函式的呼叫。關於為什麼失敗的想法?我懷疑我錯過了一些簡單的東西。

功能:

createCredentialOrg(event){
   alert("Attempting Create");
   const credentialOrgFactoryContract = this.state.credentialOrgFactoryContract
   var checkBool = this.state.web3.isAddress(this.state.createCredentialOrgSchoolAddress)
   var a,b,c;

   if (checkBool){
     a = this.state.createCredentialOrgShortName;
     b = this.state.createCredentialOrgOfficialSchoolName;
     c = this.state.createCredentialOrgSchoolAddress

     alert(a);
     alert(b);
     alert(c);
     return credentialOrgFactoryContract.createCredentialOrg(a, b, c)
    .then(result => {
       alert(result);
       return credentialOrgFactoryContract.selectOrgCount()
    }).then ((result) => {
       alert(result)
       this.setState({credentialOrgCount: result.c[0]})

    })
  } else {
     alert("invalid address");
     alert(a);
     alert(b);
     alert(c);
  }
}

per:smartx和最後一條評論: web3.eth.defaultAccount 未定義,因此導致嘗試發送被附加到帳戶(因此地址無效)

謝謝您的幫助!

引用自:https://ethereum.stackexchange.com/questions/57000