0

I'm having a problem with my JS code pausing on the let result line.

Metamask prompts me to approve the transaction initiated in the line (which I do), but then doesn't proceed any further.

As the await keyword forces the code to pause until the promise is fulfilled, it appears as if the promise is not being fulfilled.

handleButtonPress: async function(event) {

    console.log(1);

    let account = await web3.eth.getAccounts();

    console.log(account);

    let result = await App.contracts.Marketplace.methods.createStorefront('store2', 'shoe store2').send({from: account[0]});

    console.log(2);

}

Any ideas? Cheers.

  • "it appears as if the promise is not being fulfilled" - how exactly does that appear? console.log(2) never executed? It might take some time if you're on a public network. – goodvibration Jan 22 at 9:51
  • @goodvibration. I appreciate the question. As you correctly surmise, console.log(2) is never executed. To clarify, I'm using Ganache as a local blockchain, Metamask to connect to it, and lite-server. Cheers. – Fisticuffs Jan 22 at 12:11
  • And what do you see on Ganache console? – goodvibration Jan 22 at 12:29

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.