Skip to content
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

View XDR stream + update Trezor deps #1178

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

quietbits
Copy link
Contributor

@quietbits quietbits commented Nov 27, 2024

XDR stream example

Type
ScSpecEntry

XDR

AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAAAwAAAAAAAAAPdG9rZW5fd2FzbV9oYXNoAAAAA+4AAAAgAAAAAAAAAAd0b2tlbl9hAAAAABMAAAAAAAAAB3Rva2VuX2IAAAAAEwAAAAAAAAAAAAAAAAAAAAhzaGFyZV9pZAAAAAAAAAABAAAAEwAAAAAAAAAAAAAAB2RlcG9zaXQAAAAABQAAAAAAAAACdG8AAAAAABMAAAAAAAAACWRlc2lyZWRfYQAAAAAAAAsAAAAAAAAABW1pbl9hAAAAAAAACwAAAAAAAAAJZGVzaXJlZF9iAAAAAAAACwAAAAAAAAAFbWluX2IAAAAAAAALAAAAAAAAAAAAAAAAAAAABHN3YXAAAAAEAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAFYnV5X2EAAAAAAAABAAAAAAAAAANvdXQAAAAACwAAAAAAAAAGaW5fbWF4AAAAAAALAAAAAAAAAAAAAAAAAAAACHdpdGhkcmF3AAAABAAAAAAAAAACdG8AAAAAABMAAAAAAAAADHNoYXJlX2Ftb3VudAAAAAsAAAAAAAAABW1pbl9hAAAAAAAACwAAAAAAAAAFbWluX2IAAAAAAAALAAAAAQAAA+0AAAACAAAACwAAAAsAAAAAAAAAAAAAAAlnZXRfcnNydnMAAAAAAAAAAAAAAQAAA+0AAAACAAAACwAAAAs=

@quietbits quietbits linked an issue Nov 27, 2024 that may be closed by this pull request
@stellar-jenkins
Copy link

Copy link

@Ifropc Ifropc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one question/suggestion

json={parseToLosslessJson(xdrJsonDecoded.jsonString)}
xdr={xdr.blob}
/>
{xdrJsonDecoded?.jsonArray?.map((j, index) => (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be array of Json objects instead of array of PrettyJsonTransaction?
I think it would be a bit more user friendly, currently I have

{
"function_v0": {...}
}

{
"function_v0":{...}
}

Which is not a valid JSON (so you can't just pass it to any of JSON parsers). Instead, maybe we can out a valid JSON array of

[
  {
    "function_v0": {...}
  },
  {
    "function_v0":{...}
  }
]

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. I'll update it to display it as a proper array of JSON objects.

Note: To get the correct JSON, you should use the "Copy JSON" button (uses direct response without any modification). We have extra elements in the UI that will make the JSON invalid if you select and copy it.

@stellar-jenkins
Copy link

Comment on lines +191 to +207
<div className="PrettyJson PrettyJson__array">
<div className="PrettyJson__inline">
<span className="PrettyJson__bracket">[</span>
<span className="PrettyJson__expandSize">{`${jsonArray.length} items`}</span>
</div>
{jsonArray.map((j, index) => (
<>
<PrettyJsonTransaction
// Using index here because we can't get something unique from the JSON
key={`pretty-json-${index}`}
json={j}
xdr={xdr}
/>
</>
))}
<span className="PrettyJson__bracket">]</span>
</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling the array styling manually here because it's the only place where we have it. If we need it someplace else, we'll create a component for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog (Not Ready)
Development

Successfully merging this pull request may close these issues.

Lab should decode XDR stream (instead of single entry)
3 participants