[docs-agent] Stellar API Try It: populate working defaults for all 12 methods#1288
[docs-agent] Stellar API Try It: populate working defaults for all 12 methods#1288JackReacher0807 wants to merge 1 commit into
Conversation
… 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
🔗 Preview Mode
|
🔍 Link CheckStatus: ⏭️ Skipped (no content changes) |
There was a problem hiding this comment.
💡 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".
| - name: hash | ||
| value: "86d85a0db4d7cdf2aa8e4b633e050e8c3c138deae7cac62ff4d4ff5fb732fe96" |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
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
examplesblocks. On top of that, the 5 methods sourced from_components/custom/methods.yamlwere missingparamStructure: by-name, so even users supplying a real value would hitinvalid parameters / cannot unmarshal array into Go value of type protocol.GetTransactionRequestbecause Try It serialized the request positionally.This PR adds
paramStructure: by-name(where missing) and anexamplesblock to every method, all verified live againsthttps://stellar-mainnet.g.alchemy.com/v2/docs-demo.Per-method default values
getEventsstartLedger: 62463000, native XLM SACtransferfilter,limit: 2getFeeStatsgetHealthgetLatestLedgergetLedgerEntrieskeys= [Account LedgerKey for Circle USDC issuer, ContractInstance LedgerKey for native XLM SAC]getLedgersstartLedger: 60000000,limit: 2getNetworkgetTransactionhash: 86d85a0d…fe96(recent successful mainnet tx)getTransactionsstartLedger: 62462511,limit: 1getVersionInfosendTransactionname()on the native XLM SAC; returnsstatus: ERRORwitherrorResultXdrso the response schema is fully populated without spending real fundssimulateTransaction"native"as the SCV-encodedname()result with populatedminResourceFee,transactionData,events,resultsLive validation
Caveat on staleness
getEvents,getTransactions, andgetTransactionrely 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— addedparamStructure: by-nametogetTransaction,getTransactions,sendTransaction,simulateTransaction, plusexamplesblocks to all 5 stellar-shared methods. Verified that no other chain refs these (onlychains/stellar/stellar.yamldoes).src/openrpc/chains/_components/stellar/methods.yaml— addedexamplesblocks to the 7 Stellar-specific methods.pnpm run validate:rpcpasses.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)