-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fully parsed tx types #288
Comments
Hi, @lrettig. I've been trying to decode the raw transaction with 'go-scale' library into different data structures like Spend, SpendBody, SpendPayload, SpendArguments. Unfortunately , none of those has worked. I'm kindly asking if it's possible to decode address of the receiver from raw transaction. Also, I'd like to know what fields are included in the raw transaction and in which order because I've found several sources with different data structures and I'm not sure which one is correct. Thanks |
This is being handled in APIv2 now in #319; see the work in progress here: https://github.com/spacemeshos/api/pull/319/files#diff-8ebf744ee0115b17bf0e41111f7f3d9ea7c8b4205532e81f9a3e287e5c3154b9. @Avionic23 please see https://github.com/spacemeshos/wiki/wiki/Integration-guide#transactions. The authoritative code you're looking for lives in https://github.com/spacemeshos/go-spacemesh/blob/develop/genvm/vm.go. It's definitely possible to parse a raw tx into a tx type and to parse the arguments as you describe; go-spacemesh does exactly this. We don't yet have a clean SDK that makes doing this easy but hopefully we will soon. Let me know if you still have questions. |
Hey, @lrettig. Thank you for your help. I reviewed https://github.com/spacemeshos/go-spacemesh/blob/develop/genvm/vm.go and noticed that the addresses are actually 24 bytes long, but in go-scale they are still 20 bytes long. I assume that's the reason because after replacing [20]byte address to types.Address (which is underlying [24]byte data type) the receiver and amount arguments were successfully parsed. |
Right now the API only returns parsed "raw" transactions that include the principal, template, and method selector but not the method payload nor the parsed payload (which for a 'Send' tx would include recipient and amount):
api/spacemesh/v1/types.proto
Lines 45 to 58 in eebe59f
This makes reading tx data unnecessarily difficult for clients. Add one or more fully-parsed tx types (for spawn, send, etc.).
The text was updated successfully, but these errors were encountered: