-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add support for sendTransaction
error fetching
#59
Conversation
@jinoosss |
@zivkovicmilos In my opinion, if there's an option needed for execution, it's whether to call it with 'broadcast_tx_async' or 'broadcast_tx_sync'. And I would like to ask your opinion on throwing a clear error that can identify the type. Personally, I thought we needed something that would clearly identify the error. It would also be nice to distinguish between the source of the error and the type of error.
|
Understood, so you think we should expand the API to give users this ability to select what kind of broadcast they want? The default would of course be an
I also love this idea, but it seems tricky to implement with the way the
![]() I guess what we can do is map internally (in the library) the std errors, to specific types we can control. For example, if the error type is What do you think? |
@zivkovicmilos Thanks for thinking about this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zivkovicmilos Thank you for this work.
Using the API is explicit and looks good.
It seems to do the behavior I'm currently expecting.
I have one question.
Is there any issue with using the broadcast_tx_commit
endpoint in a production environment rather than a testnet?
There is something in the GNO RPC endpoint comments.
(https://github.com/gnolang/gno/blob/master/tm2/pkg/bft/rpc/core/mempool.go#L163-L258)
Or are there any plans for the broadcast_tx_commit
endpoint to change?
The comments that you linked are really outdated, they were from a time when you could query the transaction using the node events, which have since been deprecated. Currently there is no way for you to tap into these sorts of events, but support for it is coming soon.
I like having the ability for the user to specify in the API what kind of call they want (and if they don't care, then it defaults to a broadcast sync) I'll update this PR to include the better error handling we've discussed, that's why it's still in draft 🙏 |
Thanks for the reply. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zivkovicmilos Thanks for the good work.
It will definitely make it easier to handle errors.
It's nice to be able to differentiate between detailed errors within Tm2Error.
I left a small comment about the exception cases for error handling.
I would be grateful if you could let me know your thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work.
Description
This PR adds support for
broadcast_tx_sync
error fetching insendTransaction
(Provider
method).Based on discussions in #46, it is worth mentioning that his error check will only catch base-level transaction errors (or rather, throw them to the caller).
Additionally, this PR also introduces typed errors for transaction sends.
Resolves #46
cc @jinoosss