Feature request: decode symbols and strings into plaintext
What problem does your feature solve?
When parsing XDR structures using the XDR viewer, it can be annoying to use multiple tools to decode base64-encoded values that you know are human-readable text. It would be better if the Laboratory decoded these as text automatically.
What would you like to see?
ScVals that are encoded as strings (scvString) and symbols (scvSymbol) should be rendered as strings rather than as base64-encoded blobs.
Note that strings don't "have" to be actual strings under the hood (i.e. they're just bytes with a string "hint"), so the error case should be handled. However, symbols MUST be ascii, so there is no error case there.
What alternatives are there?
Copy-pasting to a base64 decoder.
We're bringing this one up in planning this sprint, will keep this updated.
However, symbols MUST be ascii, so there is no error case there.
That's actually not necessarily correct in case if we want to also to be able to handle the transaction XDR, which can be arbitrarily broken, including non-valid Symbols.
There are also other potential improvements (in decreasing importance order):
- Enums are just displayed as
[Object object]which makes it impossible to figure out what the value is (at least for strings we have base64 decoder). This is important for the eventtypefield and especially for theSCErrortype and code. - Contract ids within
ScAddressand should probably be displayed withC...strkey, similarly to what we do to the account ids. - There are also explicit
contractIdfields outside of the address that can be formatted with strkey as well (e.g.contractIdfield of the event)
Any update on this?
I still see things like this when decoding Soroban transactions.
contractID and functionName both decoded as base64
invokeHostFunctionOp
hostFunction: [hostFunctionTypeInvokeContract]
invokeContract
contractAddress: [scAddressTypeContract]
contractId: HlVancuzUT+2dtyZdmjFK6bK/Cja9jkHK3Hvv7CTzNs=
functionName: ZGVwb3NpdA==
args: Array[5]
Active work is currently underway on Dev X to create a canonical JSON schema which enables XDR <=> JSON in Lab UI. I'm marking this discussion as v1 as it may become obsolete when Lab v2 is shipped.
We are decoding XDR strings into JSON, closing.