-
Notifications
You must be signed in to change notification settings - Fork 386
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
Should the response of an RPC realm function call have the return value? #1100
Comments
Hey @jefft0, Thank you for opening the issue. As far as I know, the Gno execution environment fills out the gno/gno.land/pkg/sdk/vm/handler.go Lines 63 to 68 in 6152030
This is propagated out to the RPC layer, so you should be able to extract the response through the I see that you are checking the Calling Realm methods through RPCSince we don't have this documented anywhere (yet!), I'm going to provide some more context on how an RPC client could handle Realm calls below: Example: If you want to call a method
You might be wondering what
As I mentioned above, since you're doing this request through the RPC layer, the response you get from the RPC query will be in fact an ABCI response object, that contains the field Luckily, you don't have to handle this on your own -- we provide support for this exact functionality via the I hope this answers several questions you might've had about this kind of Gno RPC shenanigans |
Thanks! As you suggest, I changed the print statement to:
Now it prints "(20 gno.land/r/demo/boards.PostID)" (with no need to decode base64). This format is created by the TypedValue String method. Are there utility functions or a recommended way to "unmarshal" this into a useable object? |
If you're calling it directly from Go (using the Gno client code we have), you don't need to do base64 juggling
Sadly we don't have a standard for parsing these values, you'd need to write a custom parser for them at the moment. It's part of the bigger issue I'm trying to tackle in the near future, and that's having Realms / Packages have a sort of ABI (if you're familiar with how Solidity contracts get compiled into a parsable format). I've noted it here, in under the "ABI Support for Realms" section, and we have a meta issue by @moul: #925 |
Thanks again. Our immediate issue is solved since we can now get something for the return value of a function call. And it is a known issue that the client is currently at a loss for how to parse the value, but we can track the issues you mention. Closing this as answered. |
I'm following the guide to call the board "CreateReply" realm function from the command line using a local gnoland node. The return value of this Gno function is the PostID . Indeed, in the node's ApplyBlock function I inserted a print statement:
As expected, the gnoland log output shows "Debug: abciResponses (20 gno.land/r/demo/boards.PostID)". Now, in the command-line client I insert the print statement:
The full output from calling "CreateReply" is:
The Data field is empty, but I expect it to have the return value of the realm function call. My question: When the client uses BroadcastTxCommit to do an RPC realm function call, should the the result Data field have the return value of the realm function call?
The text was updated successfully, but these errors were encountered: