-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Contract.methods.myMethod.send receipt is missing on error event #1859
Comments
error
Same error. |
The contract.methods.myMethod().send().on('error', (error, receipt, confirmations) => { ... }); web3.js-1.0.0.beta-52 |
Is it possible this never made it to the 1.x branch? I don't get any further arguments apart from an This would be really helpful, at the moment I have to parse the error and extract the receipt from the message string. |
Thanks for doing that. I've just read up about the situation with the two branches. |
@mbiegert Ah! Out of curiosity, how are you connecting to the client? |
With HDWalletProvider from the trufflesuite:
For now this is the dev setup, but the advantage over
|
Thanks so much @mbiegert. |
From #2612 (and my local testing), it does seem like |
@nventuro Yeah, it's not being fired - I believe it used to be at some point in beta.30's. For logical consistency reasons it makes sense that it should fire whenever a receipt is available, regardless of status. Changing the current behavior is a little tricky because people may now be assuming that receipt and error events are mutually exclusive. |
From the events described in the docs, I'd expect .on('confirmation', (number, receipt) =>
if (number === 1) {
handler(receipt);
}
) That said, I get the intent behind trying to not break existing dependents. In that case, I'd suggest adding a replacement for |
The This implementation would be aligned with 2.x which is already in usage from some projects. Edit: |
The documentation should probably also be clarified, specifying that |
'Mined successfully' as in a successful execution? If not, shouldn't reverted (including out of gas) transactions still emit the event then? |
The error event does now also return the receipt as second parameter. Changing and adding of events as proposed by @nventuro will be done on 1.3.0 or even on 2.0. I wrote it down on my todo list and will create an issue with an idea asap. |
From docs (
http://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-send):
However, there is no second parameter and the receipt is a string and part of the error message:
The
receipt
event is never fired for this transaction.Used version: 1.0.0-beta.35
The text was updated successfully, but these errors were encountered: