You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
building the relevant xdr key for the type of ledger entry you're looking for
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
- [x] Add a full list of keys and description for each key
- [x] Add examples for how to use the keys to retrieve accounts and balances
- [x] Add examples for how to use the keys to retrieve trustlines
- [x] Add examples for how to use the keys to retrieve contract wasms
- [x] Add examples for how to use the keys to retreive contract state / storage
- [x] Add examples for how to use the keys to retrieve contract instances
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:
Activity
leighmcculloch commentedon 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:
kalepail commentedon Jan 25, 2024
Plus one on adding LedgerKey encoding to the Laboratory!
janewang commentedon Jan 25, 2024
Where could I find a full list of ledger keys and descriptions?
tomerweller commentedon Jan 26, 2024
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,