Skip to content

[docs-agent] Stellar API Try It: populate working defaults for all 12 methods#1288

Open
JackReacher0807 wants to merge 1 commit into
mainfrom
docs/stellar-tryit-defaults
Open

[docs-agent] Stellar API Try It: populate working defaults for all 12 methods#1288
JackReacher0807 wants to merge 1 commit into
mainfrom
docs/stellar-tryit-defaults

Conversation

@JackReacher0807
Copy link
Copy Markdown
Collaborator

Summary

The 12 Stellar JSON-RPC methods on https://www.alchemy.com/docs/stellar/stellar-api-overview all had empty Try It defaults because the OpenRPC source carried no examples blocks. On top of that, the 5 methods sourced from _components/custom/methods.yaml were missing paramStructure: by-name, so even users supplying a real value would hit invalid parameters / cannot unmarshal array into Go value of type protocol.GetTransactionRequest because Try It serialized the request positionally.

This PR adds paramStructure: by-name (where missing) and an examples block to every method, all verified live against https://stellar-mainnet.g.alchemy.com/v2/docs-demo.

Per-method default values

Method Default value Stable?
getEvents startLedger: 62463000, native XLM SAC transfer filter, limit: 2 ~7 days (server retention)
getFeeStats no params Yes
getHealth no params Yes
getLatestLedger no params Yes
getLedgerEntries keys = [Account LedgerKey for Circle USDC issuer, ContractInstance LedgerKey for native XLM SAC] Yes
getLedgers startLedger: 60000000, limit: 2 Yes (Alchemy mainnet RPC retains full ledger history back to ledger 2)
getNetwork no params Yes
getTransaction hash: 86d85a0d…fe96 (recent successful mainnet tx) ~14 days
getTransactions startLedger: 62462511, limit: 1 ~14 days
getVersionInfo no params Yes
sendTransaction unsigned envelope calling name() on the native XLM SAC; returns status: ERROR with errorResultXdr so the response schema is fully populated without spending real funds Yes
simulateTransaction same unsigned envelope (simulation never checks signatures, sequence numbers, or time bounds); returns "native" as the SCV-encoded name() result with populated minResourceFee, transactionData, events, results Yes

Live validation

getEvents              error=null  result_present=true
getFeeStats            error=null  result_present=true
getHealth              error=null  result_present=true
getLatestLedger        error=null  result_present=true
getLedgerEntries       error=null  result_present=true
getLedgers             error=null  result_present=true
getNetwork             error=null  result_present=true
getTransaction         error=null  result_present=true
getTransactions        error=null  result_present=true
getVersionInfo         error=null  result_present=true
sendTransaction        error=null  result_present=true
simulateTransaction    error=null  result_present=true

Caveat on staleness

getEvents, getTransactions, and getTransaction rely on values within Stellar RPC's retention window (~7 days for events, ~14 days for transactions). Their example values will eventually need to be refreshed; the other 9 methods are stable indefinitely.

Files changed

  • src/openrpc/chains/_components/custom/methods.yaml — added paramStructure: by-name to getTransaction, getTransactions, sendTransaction, simulateTransaction, plus examples blocks to all 5 stellar-shared methods. Verified that no other chain refs these (only chains/stellar/stellar.yaml does).
  • src/openrpc/chains/_components/stellar/methods.yaml — added examples blocks to the 7 Stellar-specific methods.

pnpm run validate:rpc passes.

Linear

DOCS-74 — https://linear.app/alchemyapi/issue/DOCS-74/stellar-api-try-it-populate-working-default-values-fix-paramstructure

Requested by

@dexterliu (via Slack thread)

… methods

All 12 methods on the Stellar API page (https://www.alchemy.com/docs/stellar/stellar-api-overview) had empty Try It defaults because the OpenRPC source carried no `examples` blocks. The 5 methods sourced from `_components/custom/methods.yaml` (getHealth, getTransaction, getTransactions, sendTransaction, simulateTransaction) were also missing `paramStructure: by-name`, which Stellar RPC requires — Try It would have sent positional params and the server would have rejected them as "json: cannot unmarshal array into Go value of type protocol.GetTransactionRequest".

Changes:
- `_components/custom/methods.yaml`: add `paramStructure: by-name` to the 4 multi-param Stellar methods, plus an `examples` block to all 5. Only the Stellar chain spec references these methods (verified via grep), so this doesn't affect any other chain.
- `_components/stellar/methods.yaml`: add `examples` blocks to the 7 Stellar-specific methods (getEvents, getFeeStats, getLatestLedger, getLedgerEntries, getLedgers, getNetwork, getVersionInfo).

Verified live against https://stellar-mainnet.g.alchemy.com/v2/docs-demo: all 12 examples now return non-error JSON-RPC responses. The simulateTransaction example (call name() on the native XLM SAC) returns a stable "native" result indefinitely; sendTransaction submits the same unsigned envelope and returns status: ERROR with errorResultXdr — a clean schema demo without spending real funds.

Caveat: getEvents / getTransactions / getTransaction reference recent ledgers/hashes. Stellar RPC retains ~7 days of events and ~14 days of transactions, so those three example values will need periodic refresh. The other 9 methods (incl. getLedgers using ledger 60000000, getLedgerEntries using stable contract instance + USDC issuer keys) are stable indefinitely.

Refs DOCS-74

Requested-by: @dexterliu
@JackReacher0807 JackReacher0807 requested a review from a team as a code owner May 7, 2026 21:08
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🔗 Preview Mode

Name Status Preview Updated (UTC)
Alchemy Docs ✅ Ready 🔗 Visit Preview May 7, 2026, 9:09 PM

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🔍 Link Check

Status: ⏭️ Skipped (no content changes)

View workflow run

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 656e801cb5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +2037 to +2038
- name: hash
value: "86d85a0db4d7cdf2aa8e4b633e050e8c3c138deae7cac62ff4d4ff5fb732fe96"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid hard-coded retention-window defaults

These Try It defaults are static but point at data that Stellar RPC only serves within a recent retention window: the example itself notes the hash will age out, and the same pattern is used for getTransactions and getEvents start ledgers. Once that window passes, new users running the default examples will get NOT_FOUND/old-ledger errors instead of the advertised populated response shape (Stellar documents recent retention for these methods: https://developers.stellar.org/docs/data/apis/rpc/api-reference/methods/getTransaction). Consider using defaults that do not depend on expiring history, or generating/refreshing these values automatically.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Acknowledged but not changing. The staleness is a deliberate trade-off, called out in the PR description under Caveat on staleness: 9 of the 12 methods (getFeeStats, getHealth, getLatestLedger, getLedgerEntries, getLedgers, getNetwork, getVersionInfo, sendTransaction, simulateTransaction) are stable indefinitely. Only getEvents, getTransactions, and getTransaction reference values inside Stellar RPC's retention window (~7d for events, ~14d for transactions).

The alternative the bot is suggesting (synthetic defaults that don't depend on expiring history) is exactly what the PR replaces: empty/synthetic placeholders that returned no data when users clicked Try It. Real values that occasionally need refresh are a strict improvement over permanently broken examples.

Auto-refresh is the right long-term answer but it's a docs pipeline change (probably a scheduled GitHub Action that hits the live RPC, picks the latest finalized ledger / a recent successful tx hash, and rewrites the example block). Out of scope for this PR. Tracking the periodic-refresh maintenance burden in the Linear thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant