Closed brunomenezes closed 2 months ago
cc: @tuler
Hi @tuler, I am adding here the compare so you can see the current commits.
At the current point, I would point you to the tests inside decoder.test.ts
and conditionals.test.ts
to have a feel for its inner workings and what each piece accomplishes.
https://github.com/cartesi/rollups-explorer/compare/main...feature/165-add-decode-specification-v1
I will be working next in the form-ui + preview to define and play around while defining a specification, persistence and later the integration with the current input-data component we have (textarea displaying the payload in the input's table).
There is a problem with a case: if the user is prototyping in the JSON ABI mode, changes to the struct will not be reflected in the generated JSON Abi unless the parameter name of this struct is also modified. e.g. from function myFunc(Baz baz)
to function myFunc(Baz baz2)
.
More details are available in the issue created in the wevm/abitype repo: https://github.com/wevm/abitype/issues/247
cc: @tuler
📄 Context
Currently, for the input's payload, we are displaying the content in three ways: as is (i.e. Raw), as Text (trying to convert the Hex value) and JSON that leverages the result of the latter. It would be an excellent addition to provide a way for the user (i.e. developer) to describe how it should be parsed and save that specification for reuse.
PS: I am calling the feature
decode specification
because the payload may be encoded with a non-standard-packed-mode and just dropping an ABI will not work; pre-steps are necessary (e.g. Slice bytes) before you define a piece of ABI to use.✔️ Solution
Implement a UI that allows users to specify how to decode a given input payload into a human-readable form. The spec is a single or series of transformation steps, depending on the original encoding used.
when app address x and msgSender y
Raw
panel.📈 Subtasks
🎯 Definition of Done
raw
panel. Also, show the specification selected.