error image indicates invalid address. this is on the call of the function. Ideas on why it fails? i suspect i'm missing something simple.
Function:
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);
}
}
this.state.createCredentialOrgSchoolAddress
? Can you just simplify your code down toweb3.isAddress('0x123...')
so others can reproduce it?console.log
the address right before you use it (or better yet, hardcode it as I suggested). The goal is to narrow down where the issue is. (Is that address somehow invalid? Or is the address you're checking not what you think it is?)web3.isAddress('0x1eC2c24e0110a0c0C4e0E03e694dBC95cd825162')
? It returnstrue
in web3.js 0.20.3. If it returnstrue
in your app too, that's further evidence that you're not actually passing the value you think you're passing. Once you determine you're not passing the right address, a good trick to try isconsole.log(JSON.stringify(this.state.createCredentialOrgSchoolAddress))
. That might help spot other issues, like an extra space or an invisible unicode character.from
address, so it should be usingweb3.eth.defaultAccount
. If that's undefined, then you're trying to send from an invalid address.