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

getLedgerEntries: Outline building and parsing all sorts of LedgerKeys #1060

Merged
merged 13 commits into from
Mar 7, 2025

Conversation

Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Oct 25, 2024

This makes the following changes:

  1. Add a guide on building + parsing account and trustline entries
  2. Improve the guide on building + parsing contract data, instances, and WASMs

As part of (2) I tried to morph it to be in line with the way (1) is explained. Notice that I've removed all of the base64 cruft: this is intentional as these can quickly become out of date and the guide is structured to teach someone to fish rather than giving them a base64-encoded fish.

Closes #469.

For Reviewers

I recommend viewing the entire Markdown file in this PR as-is and comparing it to the existing page rather than going line-by-line as the changes are significant and hard to parse out of a diff.

Page preview link.

@Shaptic Shaptic added documentation Improvements or additions to documentation rpc-sdk-scrum labels Oct 25, 2024
@Shaptic Shaptic self-assigned this Oct 25, 2024
@Shaptic Shaptic marked this pull request as ready for review October 25, 2024 19:41
@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

2 similar comments
@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Few comments inline. Looks like there's some incomplete docs here.


If you are using the [Python](https://stellar-sdk.readthedocs.io/en/latest/) `stellar_sdk` to generate these keys, you will need to install the latest version of the SDK. This can be done like so:
1. **Account:** holistically defines a Stellar account, including its balance, signers, etc. (see [Accounts](https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts))
Copy link
Member

Choose a reason for hiding this comment

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

At the beginning of the list, the list is describe as "forms a ledger key can take," however the list describes the ledger entries, rather than the keys. For example:

Account: holistically defines a Stellar account, including its balance, signers, etc.

Maybe:

There are 10 different forms a ledger key can take and each refers one-to-one with the following ledger entries:


##### Python
<CodeExample>

```python
Copy link
Member

Choose a reason for hiding this comment

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

Some examples are Python and JavaScript, some are Python and TypeScript, and some are unlabelled and I assume just JavaScript. Can we make them consistent, maybe all JS instead of TS, and all also have Python?

Copy link
Contributor Author

@Shaptic Shaptic Mar 6, 2025

Choose a reason for hiding this comment

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

None of them are unlabeled; I'm not sure what you mean? It's all TS and/or Python. Also I don't use the Python SDK enough to make examples for them - the ones included here are copy-pasta from elsewhere iirc. Better some in Python than none imo.

Copy link
Member

Choose a reason for hiding this comment

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

By unlabelled, I mean that some code blocks have no context as to which SDK they're using:

Screenshot 2025-03-08 at 10 34 38 pm

And some code examples start with Python, then continue with JS/TS, where the first code sample is labeled as Python because of the tab, then the second one isn't:

Screen.Recording.2025-03-08.at.10.30.21.pm.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh I see what you mean by "label", I thought you meant there was no highlight. Yeah, I can see how that can be misleading. I'll add <CodeExample>s everywhere in a new PR on Monday 👍

@Shaptic Shaptic force-pushed the getLedgerEntries-guide branch from 702461e to 61ac3aa Compare March 6, 2025 15:15
@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

3 similar comments
@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@Shaptic Shaptic force-pushed the getLedgerEntries-guide branch from 724fac5 to caf2572 Compare March 6, 2025 22:58
@Shaptic Shaptic force-pushed the getLedgerEntries-guide branch from caf2572 to 424b47d Compare March 6, 2025 22:59
@stellar-jenkins
Copy link

1 similar comment
@stellar-jenkins
Copy link

@tamirms
Copy link
Contributor

tamirms commented Mar 7, 2025

I think you might want to update the description here :

For reading the current value of ledger entries directly.\n\nThis method enables the retrieval of various ledger states, such as accounts, trustlines, offers, data, claimable balances, and liquidity pools. It also provides direct access to inspect a contract's current state, its code, or any other ledger entry.

"retrieval of various ledger states" doesn't seem like the terminology. Perhaps you should change it to "retrieval of various ledger entries"

@tamirms
Copy link
Contributor

tamirms commented Mar 7, 2025

Screenshot 2025-03-07 at 3 45 15 PM

The way "LedgerKeys" and "LedgerEntries" are formatted with the backticks looks a bit strange, especially considering the plural of ledger entries is not ledgerentrys. I think it would be better to remove the back ticks for LedgerKeys

@Shaptic
Copy link
Contributor Author

Shaptic commented Mar 7, 2025

"retrieval of various ledger states" doesn't seem like the terminology. Perhaps you should change it to "retrieval of various ledger entries"

I updated it to

This method enables querying live ledger state: [the list]

Since the previous sentence mentions fetching ledger entries, already.


I think it would be better to remove the back ticks for LedgerKeys

But then you lose direct references to the XDR, no? To resolve this I added an actual direct reference and stop "pluralizing", instead, in b00970b.

@Shaptic Shaptic requested a review from tamirms March 7, 2025 18:36
@stellar-jenkins
Copy link

3 similar comments
@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

@tamirms
Copy link
Contributor

tamirms commented Mar 7, 2025

@Shaptic do you need to run yarn rpcspec:build?

Copy link
Contributor

@tamirms tamirms left a comment

Choose a reason for hiding this comment

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

not sure if you need to run yarn rpcspec:build. But other than that, everything looks good!

@Shaptic Shaptic merged commit a5e1396 into main Mar 7, 2025
1 of 2 checks passed
@Shaptic Shaptic deleted the getLedgerEntries-guide branch March 7, 2025 20:00
@stellar-jenkins
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation rpc-sdk-scrum
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

getLedgerEntries: add meaningful coding examples
4 participants