Add method to get transaction result (return value or revert reason) #462
Replies: 2 comments 1 reply
-
|
Solid write up! Just a quick question for now: What's the value for
|
Beta Was this translation helpful? Give feedback.
-
|
Adding a +1 here, this would be useful. My understanding of the problem is that the standard JSON-RPC interface does not provide a way to get the return value or the revert code from a It's possible to retrieve the revert data by parsing the logs, but this takes an additional JSON-RPC query (unless it's possible to set it up as some kind of subscription? I'm out of my depth here). As for the return value I'm not even sure that it's possible. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For a given transaction hash, I'd like to retrieve the result of the transaction (return value if success, error string or error data if revert). Doing this myself feels a little boilerplate-y, especially juggling the differences between viem and RPC (e.g.
fromvsaccountvssender,tovsaddress), and the code looks an awful lot like a viem's other methods.Side note that it feels very weird to me that
simulateContractis our best option here for retrieving the transaction result. A tx at the beginning of the block might have a different result than at the end, or a tx that reverted at the end may not revert at the beginning, so I assumesimulateContractisn't entirely accurate in some cases.Aside from tracing (which seems to be maybe not widely supported by RPCs or behind a specific payment tier), is there really no other way to determine the outcome of a transaction?
Beta Was this translation helpful? Give feedback.
All reactions