Skip to content

[docs-agent] Document Solana getBalanceByOwnerAtSlot method - #1551

Open
alchemy-bot wants to merge 1 commit into
mainfrom
docs/solana-get-balance-by-owner-at-slot
Open

[docs-agent] Document Solana getBalanceByOwnerAtSlot method#1551
alchemy-bot wants to merge 1 commit into
mainfrom
docs/solana-get-balance-by-owner-at-slot

Conversation

@alchemy-bot

Copy link
Copy Markdown
Contributor

Summary

Adds an OpenRPC definition for the new Solana JSON-RPC method getBalanceByOwnerAtSlot, the aggregate counterpart to getTokenAccountsByOwnerAtSlot. It returns a wallet's summed balance of one SPL Token or Token-2022 mint at a specific slot, with an optional scope parameter selecting between:

  • all (default): sum across every token account the wallet held of that mint at that slot (portfolio value, cost basis, PnL, tax reporting, treasury reconciliation)
  • ata: the canonical Associated Token Account only, faster because it resolves one derived address instead of aggregating

Unlike getTokenAccountsByOwnerAtSlot, there is no "latest slot" default: omitting slot is an error. The method accepts either an object (recommended) or a positional array [wallet, mint, slot, scope], and the wallet field also accepts owner as an alias in the object form.

Changes

  • Method definition in src/openrpc/chains/_components/solana/methods.yaml (params, description, example, result, errors)
  • Schemas in src/openrpc/chains/_components/solana/account.yaml:
    • GetBalanceByOwnerAtSlotScope (string enum all | ata, default all, case-sensitive)
    • GetBalanceByOwnerAtSlotResult (wallet, mint, isNative, balance, balanceRaw, decimals, slot)
  • Spec registration in src/openrpc/chains/solana/solana.yaml:
    • $ref added right after getTokenAccountsByOwnerAtSlot
    • getBalanceByOwnerAtSlot added to x-bot-ignore so Daikon does not strip it before the upstream chain-config catches up
  • Overview table in content/api-reference/solana/solana-api-overview.mdx: link added alphabetically to the method table (which is now re-flowed to keep two columns per row while preserving alphabetical ordering)

Validation

  • pnpm run generate:rpc — clean
  • pnpm run validate:rpc — clean (✅ Successfully validated chains OpenRPC specs)
  • pnpm run lint:prettier — clean on new files
  • Confirmed the generated content/api-specs/chains/solana.json includes getBalanceByOwnerAtSlot with params: [wallet, mint, slot, scope], required [wallet, mint, slot], and the example result matches the requester's spec

Linear

DOCS-199 — https://linear.app/alchemyapi/issue/DOCS-199/document-new-solana-method-getbalancebyowneratslot

Requested by

@andreidg31 (via Slack thread)

Adds an OpenRPC definition for the new Solana JSON-RPC method `getBalanceByOwnerAtSlot`, the aggregate counterpart to `getTokenAccountsByOwnerAtSlot`. It returns a wallet's summed balance of one SPL Token or Token-2022 mint at a specific slot, with an optional `scope` parameter (all | ata) selecting between the wallet-wide sum and its canonical Associated Token Account.

- Method definition in `src/openrpc/chains/_components/solana/methods.yaml`
- `GetBalanceByOwnerAtSlotScope` and `GetBalanceByOwnerAtSlotResult` schemas in `src/openrpc/chains/_components/solana/account.yaml`
- `$ref` registration and `x-bot-ignore` entry in `src/openrpc/chains/solana/solana.yaml`
- Table link in `content/api-reference/solana/solana-api-overview.mdx`

Refs DOCS-199

Requested-by: @andreidg31
@alchemy-bot
alchemy-bot requested a review from a team as a code owner August 21, 2026 12:56
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

🔗 Preview Mode

Name Status Preview Updated (UTC)
Alchemy Docs ✅ Ready 🔗 Visit Preview Aug 21, 2026, 12:57 PM

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

Copy link
Copy Markdown

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: 8c7e912f75

ℹ️ 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 +355 to +357
For a wallet holding a single token account of the mint, both
scopes return the same value. For a wallet holding many, they
can differ by orders of magnitude.

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 Qualify the single-account equivalence claim

Qualify this statement to require that the sole token account is the wallet's canonical ATA. If the wallet's only account for the mint is an auxiliary or legacy non-ATA account, all includes its balance while ata resolves the separate canonical address and can return zero or a different value, so the current guidance may lead callers to choose the faster scope and receive an incomplete balance.

Useful? React with 👍 / 👎.

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