[docs-agent] Add getBalanceByOwnerAtSlot method (Solana mainnet) - #1552
[docs-agent] Add getBalanceByOwnerAtSlot method (Solana mainnet)#1552alchemy-bot wants to merge 2 commits into
Conversation
New Solana JSON-RPC method that returns a wallet's aggregated balance of a single SPL Token or Token-2022 mint at a specific slot, sibling of getTokenAccountsByOwnerAtSlot. - Add getBalanceByOwnerAtSlot method definition to _components/solana/methods.yaml with paramStructure: by-name. - Add GetBalanceByOwnerAtSlotResult schema to _components/solana/account.yaml. - Wire the method into solana.yaml under methods: and add it to x-bot-ignore so Daikon does not strip it. - Add a table row to the Solana API overview page linking to the auto-generated endpoint page. Refs DOCS-200 Requested-by: @andreidg31
🔗 Preview Mode
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5551bbccfc
ℹ️ 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".
| getBalanceByOwnerAtSlot: | ||
| name: getBalanceByOwnerAtSlot |
There was a problem hiding this comment.
Document the method's compute-unit cost
When this endpoint is published, it will be the only one of the 84 Solana method definitions without x-compute-units; consequently, consumers that build billing or throughput metadata from the generated OpenRPC spec cannot report the cost of this method even though its requests consume CUs. Obtain the canonical value from the chain configuration and add the extension before publishing the endpoint.
Useful? React with 👍 / 👎.
Andrei confirmed the CU cost in the Slack thread; matches the sibling getTokenAccountsByOwnerAtSlot. Refs DOCS-200 Requested-by: @andreidg31
Summary
Adds documentation for a new Solana JSON-RPC method,
getBalanceByOwnerAtSlot. Sibling ofgetTokenAccountsByOwnerAtSlot: returns a wallet's total balance of a single SPL Token / Token-2022 mint as of a specific slot, already summed across every token account the wallet held of that mint at that slot.Available on Solana mainnet only.
Changes
src/openrpc/chains/_components/solana/methods.yaml— newgetBalanceByOwnerAtSlotmethod definition, inserted directly aftergetTokenAccountsByOwnerAtSlot. UsesparamStructure: by-name(recommended object form) with four flat params:wallet(Pubkey, required,owneraccepted as alias),mint(Pubkey, required),slot(integer, required, no "latest" default),scope(enumall/ata, defaultall, case-sensitive). Positional form[wallet, mint, slot, scope]documented in the method description.src/openrpc/chains/_components/solana/account.yaml— newGetBalanceByOwnerAtSlotResultschema (wallet,mint,isNative,balance,balanceRaw,decimals,slot).balanceandbalanceRaware strings so large values survive JSON parsing.src/openrpc/chains/solana/solana.yaml— add$refundermethods:and appendgetBalanceByOwnerAtSlottox-bot-ignoreso Daikon does not strip the entry on its next sync.content/api-reference/solana/solana-api-overview.mdx— new table row inserted alphabetically betweengetBalanceandgetBlock. The table is now 29 rows × 2 columns, no empty cells.Errors documented per the spec:
-32602(invalid params — malformedwallet/mint, missing/non-integerslot, unknownscope, mint not indexed),-32600(unsupported method — chain other than Solana mainnet),-32603(internal error).Validation
pnpm run generate:rpc— All OpenRPC specs generated successfully.pnpm run validate:rpc— chains + json-rpc specs both green.npx prettier --checkon the four modified files — all clean.Open question
I omitted
x-compute-unitson the method because the CU value lives in the privatechain-configtopconfig and I don't have that number. SiblinggetBalanceis 10, siblinggetTokenAccountsByOwnerAtSlotis 40 — happy to add the correct value in a follow-up commit once someone with topconfig access shares it.Linear
DOCS-200 — Add getBalanceByOwnerAtSlot documentation (Solana mainnet)
Requested by
@andreidg31 (via Slack thread)