I am creating a session Contract then get it's public key using event on promise function 'loadSessionContract' but it run before 'creatSessionPromise' finish transaction so I got empty address what I should do to make 'loadSessionContract' wait till 'creatSessionPromise' end the transaction? (note: I can't use .then() because it dosen't work with await and it's required to use await in all contracts function calls)

  createSession: async(_sessionName, _discription, _start, _end, _lecturers, _attendes) => {
    const Organization = await $.getJSON('Organization.json')
    App.contracts.Organization = web3.eth.contract(Organization.abi).at(App.organizationAddress)
    //make transaction      
    await App.createSessionPromise(_sessionName, _discription, _start, _end, _lecturers, _attendes, App.organizationAddress)
    // wait till transaction end
    await App.loadSessionContract()


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.