Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

myContract.methods.myMethod().send() does not fire receipt #3

Open
kuabhish opened this issue Mar 28, 2020 · 6 comments
Open

myContract.methods.myMethod().send() does not fire receipt #3

kuabhish opened this issue Mar 28, 2020 · 6 comments

Comments

@kuabhish
Copy link

myContract.methods.myMethod().send() does not fire receipt.
and since it is not going inside the receipt function, it is not reloading the page.

createProduct(name, price) {
this.setState({ loading: true })
this.state.marketplace.methods.createProduct(name, price).send({ from: this.state.account })
.once('receipt', (receipt) => {
this.setState({ loading: false })
})
}

In this it is not going till the setstate {loading : false } condition..

How to solve this?

@ravi-kumar-1010
Copy link

I am facing the same problem.
Please let me know if you find any fix.

@ravi-kumar-1010
Copy link

solved It:
first 'truffle migrate'
then 'npm start'

@kuabhish
Copy link
Author

kuabhish commented Apr 3, 2020

@ravi-kumar-1010 In my case as I understand the receipt is not firirng. So i called transactionhash instead of receipt. It worked.

@hartej-s
Copy link

hartej-s commented Apr 7, 2020

hi im having the same issue, ive changed:

createProduct(name, price) {
this.setState({ loading: true })
this.state.marketplace.methods.createProduct(name, price).send({ from: this.state.account })
.once('receipt', (receipt) => {
this.setState({ loading: false })
})
}

to:

createProduct(name, price) {
this.setState({ loading: true })
this.state.marketplace.methods.createProduct(name, price).send({ from: this.state.account })
.once('transactionHash', (transactionHash) => {
this.setState({ loading: false })
})
}

and it still does not work, am I doing something wrong

@kuabhish
Copy link
Author

kuabhish commented Apr 7, 2020

https://web3js.readthedocs.io/en/v1.2.6/web3-eth-contract.html#id36

check this

you can also use confirmation.

@devgreek
Copy link

@hartej-s just copy from the repo directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants