I am working on a ethereum dapp and am struck with the following errors, concerned code pieces have been attached.


  async loadBlockchainData() {
    const web3 = window.web3
    const networkId = await web3.eth.net.getId()
    const networkData = DStock.networks[networkId]
    if(networkData) {
      const dstock = new web3.eth.Contract(DStock.abi, networkData.address)
      this.setState({ dstock })
     //const myId = await dstock.getMyId[this.state.account].call().call()
     const myId  = await dstock.methods.getMyId[this.state.account].call()

Solidity code

mapping (address=> uint256) public getMyId;

Error recieved

Unhandled Rejection (TypeError): Cannot read property '0x14677494C6Dc1E83122A942E07fE79C3cba33D27' of undefined


Unhandled Rejection (TypeError): Cannot read property 'call' of undefined

respectively on uncommenting the last two lines of the javascript code

Your Answer

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

Browse other questions tagged or ask your own question.