Skip to content

json-rpc code snippets should use stellar sdks #441

Open

Description

@tomerweller

Currently the code snippets use general purpose dependencies (like json and requests in python).

However, if we expect developers to be using the respective SDKs (like stellar-sdk in python), which I think is a reasonable assumption, we should demonstrate how that's done with them instead.

Activity

  1. leighmcculloch commented on Feb 22, 2024

    @leighmcculloch
    Member

    Link?

  2. leighmcculloch commented on Feb 22, 2024

    @leighmcculloch
    Member

    Ah these pages?

    Screenshot 2024-02-22 at 10 23 51 am

    Ref: https://soroban.stellar.org/api/methods/getHealth

    I think it's helpful that we have some raw examples for how to interact with what is a simple http server. People don't need to use an SDK to talk to a http server.

    If we do add examples with the SDKs, it'd be helpful to keep the cURL and JSON tabs at least, if not the others too.

  3. tomerweller commented on Feb 22, 2024

    @tomerweller
    ContributorAuthor

    Yes, the cURL and JSON examples should remain as is, that's sufficient information for anyone who doesn't want to use an SDK.

    The JS, Python and any other programming language we add should use the canonical SDK. This is consistent with the current code examples in the non-soroban docs.

  4. leighmcculloch commented on Feb 22, 2024

    @leighmcculloch
    Member

    Or possibly add sub tabs with / without sdk.

  5. tomerweller commented on Feb 22, 2024

    @tomerweller
    ContributorAuthor

    Or possibly add sub tabs with / without sdk.

    sounds like unnecessary complexity to me

  6. ElliotFriend commented on Feb 22, 2024

    @ElliotFriend
    Contributor

    @leighmcculloch @tomerweller I think the sub-tabs would indeed be "unnecessary complexity" in our circumstance. The way we make these tabs currently is a hack of a customization using a patch on a metamask package. I think trying to shove in some sub-tabs would make it even more complex and unwieldy. To be honest, it's possible we're already deep into "unnecessary complexity" territory lol

    I really like the idea of using the SDKs though for the JS/Python/etc. examples, though. Really smart!

  7. self-assigned this
    on Feb 22, 2024
  8. moved this from To Do to Backlog in Dev Docson Jun 24, 2024
  9. moved this from Backlog to Blocked in Dev Docson Jan 7, 2025
  10. moved this from Blocked to To Do in Dev Docson Jan 9, 2025
  11. 3 remaining items

  12. moved this from Blocked to To Do in Dev Docson Jan 28, 2025
  13. self-assigned this
    on Mar 10, 2025
  14. leighmcculloch commented on Mar 11, 2025

    @leighmcculloch
    Member

    @mollykarcher I see this issue was closed, but looking at the docs, it looks like it was only completed for 3 of the 12 endpoints. For example, I only see examples for these endpoints:

    • getTransaction
    • sendTransaction
    • getLedgerEntries

    Was there discussion about adding SDK examples to the other 9 endpoints? I don't see any discussion here on this issue on reasoning to only do a couple or what the plan is.

    At the very least it'd be worthwhile adding SDK examples for the simulateTransaction, getEvents, getLedgers, and getTransactions methods.

    Note that I've opened these follow up bugs regarding the existing examples that were added:

  15. mollykarcher commented on Mar 11, 2025

    @mollykarcher
    Contributor

    Apologies, should have added a comment when closing; we were discussing this one amongst a handful of other topics on a call. I will caveat everything I'm about to say with, I don't feel incredibly strongly about keeping this ticket open, we just won't necessarily work it for this platform docpocolypse, so we could re-open and just keep removed from the board.

    I don't think examples using the SDKs should live in this section of the docs at all, but my reasons are mostly logistical:

    • They have a tendency to get out-of-date quickly and we don't update them on any real regular cadence (as is clear based on the other issues you referenced)
    • Maintaining these examples is burdensome and manual (as described by Elliot/Simon in this thread)
    • The non-SDK examples are auto-generated with the spec
    • I personally think the visual combo of raw/non-SDK examples on top, and SDK examples on bottom looks clunky/busy on the page and hurts discoverability of the SDK examples. Until you referenced those endpoints that had examples, I actually didn't even realize we had SDK examples on any live pages because I don't think I'd ever scrolled that far down 😅 (I was going off an example that simon had screenshared where he added some of these).
    • All of the SDKs have docs pages that are owned by the maintainers of the SDKs and generated/published in their languages respective doc format. I haven't audited any of these and it looks like some of them are solid and some of them are less solid. But to me this feels like the more appropriate place for SDK examples to do, and the place where they're more likely to be kept up to date since the updates live with their maintainers. We can also ask for better docs from these maintainers if we want.
  16. leighmcculloch commented on Mar 11, 2025

    @leighmcculloch
    Member

    🤔 These are all great points.

    What we have here today with the raw JSON-RPC exampes is similar to what the Ethereum documentation publish:

    https://ethereum.org/en/developers/docs/apis/json-rpc/

    However, thinking about this as a product, and being a developer reading the docs, well maintained SDK examples would improve developer experience, something akin to:

    https://docs.stripe.com/api/errors/handling?lang=python

    I understand that most of the SDKs are open source projects with their own maintainers. I don't think we need to provide examples of all of them though. At the least we could provide JS+Python, or as a stretch, JS+Python+Java+Go. After all, we maintain the JS+Go ones, we should be experts in them.

    If those SDKs already have solid example docs, like the Python SDK has here, we could also link out directly to them.

    But even the SDKs that have solid docs, they don't necessarily have solid example docs, which are helpful at getting people started. For example, the JS Stellar SDK: that's maintained by us, it's own docs are pretty difficult to navigate as a newcomer, and doesn't have clear example documentation like what was proposed here, so it's lacking too.

  17. chowbao commented on Mar 11, 2025

    @chowbao
    Contributor

    I actually didn't even realize we had SDK examples on any live pages because I don't think I'd ever scrolled that far down 😅 (I was going off an example that simon had screenshared where he added some of these).

    I also didn't realize that there were sdk examples in some endpoints

  18. added
    documentation
    on Jul 13, 2026
  19. ElliotFriend commented on Jul 13, 2026

    @ElliotFriend
    Contributor

    Hi @chowbao 👋 I'm doing a triage pass over our open issues, and this one hasn't seen activity in a while. Two quick questions:

    • Is this still relevant / still on your radar?
    • Is there anything you need to move it forward — review, context, a decision, someone to pair with?

    If it's no longer on your plate, no worries at all — just say the word and we'll open it up for other contributors. If I don't hear back in a couple weeks, I'll free up the assignment so it doesn't look claimed.

  20. kaankacar commented on Sep 7, 2026

    @kaankacar
    Contributor

    🤖 Automated message from Kaan's Automated Triage Bot.

    I am looking at this issue now. I will report what I find.

  21. kaankacar commented on Sep 7, 2026

    @kaankacar
    Contributor

    🤖 Automated message from Kaan's Automated Triage Bot.

    Decision needed: do the RPC API reference pages carry SDK code examples, and if so for which methods?

    Molly and Leigh disagreed on this in March 2025. Nobody settled it. Molly closed the issue, then reopened it in September 2025. Elliot freed the assignment on 2026-08-03.

    What I checked on main (09152f8e, read 2026-09-07):

    • There are 12 RPC method pages.
    • 3 carry SDK examples: getTransaction, sendTransaction, getLedgerEntries.
    • 9 carry none: simulateTransaction, getEvents, getLedgers, getTransactions, getHealth, getNetwork, getFeeStats, getLatestLedger, getVersionInfo.
    • This is the same 3-of-12 split Leigh reported in March 2025. Nothing moved since.

    Two facts have changed since the discussion:

    1. The sub-tab objection is now out of date. Elliot cited a patch on a MetaMask package. That patch is gone. The site now uses @stellar/open-rpc-docs-react 0.2.1, which SDF owns and publishes.
    2. The docs already hold SDK examples for these methods elsewhere, under Build > Guides. Examples: simulateTransaction Deep Dive, Submit a transaction and wait (JS), and the RPC guides.

    Molly's maintenance point is correct. The SDK examples are hand-written MDX below the generated <RpcMethod> component. The spec build does not touch them.

    Options:

    1. Complete the set. Add SDK examples to the 9 remaining methods.
    2. Do Leigh's narrower version. Add JS and Python only, and only to simulateTransaction, getEvents, getLedgers and getTransactions.
    3. Link out instead. Replace the 3 SDK sections with links to the Build > Guides pages and the SDK docs.
    4. Remove the SDK examples. Keep cURL and JSON only. This is Molly's position.

    I can build options 1, 2 or 3. Please also say which languages to keep. The current 3 pages use Python, JS and Java.

    The status quo is the one option I recommend against. 3 of 12 pages is inconsistent, and it hides the examples that do exist.

    @kaankacar @ElliotFriend

  22. added
    bot:needs-decision
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot:needs-decisiondev-reldocumentation

    Type

    No type

    Projects

    • Status
      To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions