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: add meaningful coding examples #469

Open
6 tasks
tomerweller opened this issue Jan 25, 2024 · 4 comments · May be fixed by #1060
Open
6 tasks

getLedgerEntries: add meaningful coding examples #469

tomerweller opened this issue Jan 25, 2024 · 4 comments · May be fixed by #1060
Assignees
Labels
help wanted Extra attention is needed rpc-sdk-scrum

Comments

@tomerweller
Copy link
Contributor

tomerweller commented Jan 25, 2024

The getLedgerEntries method is pretty powerful, you can retrieve any piece of state from the ledger: accounts, trustlines, offers, data, liquidity pools, contract wasms, contract instances, contract storage, yada yada.

However, there are two challenges associated with that:

  1. building the relevant xdr key for the type of ledger entry you're looking for
  2. parsing the xdr result

However, our coding examples use pre-built keys and don't parse the results. I think that modifying our JS and Python examples in this page to include these can help unlock human potential

Tasks

Preview Give feedback
@leighmcculloch
Copy link
Member

leighmcculloch commented Jan 25, 2024

A couple thoughts:

Laboratory – I think building ledger keys would be a perfect feature to add to the Laboratory. In classic stellar days building txs was really the only thing we needed to build, and Laboratory supports that. But with Soroban, building other types is necessary. We could invest UI that auto-generated to build any XDR type also.

Soroban CLI – The stellar-xdr CLI is also now embedded into the soroban-cli, which means it's possible to construct these ledger keys and decode the responses on the command line with the tool that folks already have installed. We should include examples. Here's an example of building an account ledger key:

❯ echo '{"account":{"account_id":"GBCPWDD43RTGBLBYQGELGIAV7QN4O5CHJDWYIQJQGAWLQAXNGNERPSY6"}}' | soroban lab xdr encode --type LedgerKey
AAAAAAAAAABE+wx83GZgrDiBiLMgFfwbx3RHSO2EQTAwLLgC7TNJFw==

@kalepail
Copy link
Contributor

Plus one on adding LedgerKey encoding to the Laboratory!

@janewang
Copy link
Contributor

Where could I find a full list of ledger keys and descriptions?

@tomerweller
Copy link
Contributor Author

Not sure if ledger entries and keys are well documented anywhere but the ground truth is in the ledger entries xdr spec here: https://github.com/stellar/stellar-xdr/blob/curr/Stellar-ledger-entries.x

More specifically,

@janewang janewang added the help wanted Extra attention is needed label Jan 26, 2024
@janewang janewang transferred this issue from stellar-deprecated/soroban-docs Apr 16, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Dev Docs Apr 16, 2024
@janewang janewang moved this from Backlog to To Do in Dev Docs Apr 25, 2024
@janewang janewang moved this from Backlog to To Do in Platform Scrum May 8, 2024
@janewang janewang removed this from Dev Docs May 8, 2024
@Shaptic Shaptic self-assigned this Oct 25, 2024
@Shaptic Shaptic moved this from To Do to In Progress in Platform Scrum Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed rpc-sdk-scrum
Projects
Status: Needs Review
Development

Successfully merging a pull request may close this issue.

7 participants
@leighmcculloch @janewang @tomerweller @Shaptic @mollykarcher @kalepail and others