Skip to content

querying-assets calls a method that does not exist - #27926

Draft
jessiemongeon1 wants to merge 1 commit into
MystenLabs:mainfrom
jessiemongeon1:jessiemongeon1/docs/pas-core-api
Draft

querying-assets calls a method that does not exist#27926
jessiemongeon1 wants to merge 1 commit into
MystenLabs:mainfrom
jessiemongeon1:jessiemongeon1/docs/pas-core-api

Conversation

@jessiemongeon1

Copy link
Copy Markdown
Contributor

Description

Found while sweeping onchain-finance/ for SDK anti-patterns.

onchain-finance/pas/querying-assets.mdx reads balances with:

const regularBalances = await client.core.getAllBalances({ owner: walletAddress });

getAllBalances is not in the Core API. The contract table on sdk.mystenlabs.com/sui/clients/core lists the Coins methods as getBalance, listBalances, listCoins, getCoinMetadata. The JSON-RPC migration guide is explicit:

getAllBalances → Paginate listBalances and map its normalized response

So this is not a style nit. It is a call to a method that is not there, on the page that shows people how to read PAS balances.

Changes

  • Both getAllBalances calls → listBalances, destructuring page.balances to match the SDK's own example.

  • 2 prose mentions of getAllBalances, one of which told readers it "works on the derived address".

  • Dropped .core from getBalance and getObject. This is application code, and the Core API page says so directly:

    This page is for SDK and library authors. If you are writing application code, create a client and call its top-level methods directly. You do not need client.core.

Left alone deliberately

deepbookv3-sdk.mdx, deepbook-margin-sdk.mdx, and wallet-standard.mdx also use .core, but inside classes that hold a client (this.client.core...) or in wallet implementation code. That is the pattern the Core API page describes as its intended use, so those are correct.

listBalances is paginated where getAllBalances was not, so an application holding many coin types needs to follow cursor while hasNextPage is true. That is worth its own note on the page if PAS accounts are expected to hold many types, which I could not determine.

Test plan

  • Method availability checked against the Core API contract table and the JSON-RPC migration guide.
  • Response shape (page.balances) taken from the SDK's listBalances example.
  • No new broken links.

The page queries balances with client.core.getAllBalances. That method is
not in the Core API. The contract table on sdk.mystenlabs.com lists the
Coins methods as getBalance, listBalances, listCoins, and
getCoinMetadata, and the JSON-RPC migration guide is explicit that
getAllBalances has no direct replacement: "Paginate listBalances and map
its normalized response."

So the example is not a style problem. It calls a method that is not
there, on the page that shows people how to read PAS balances.

Switched both calls to listBalances and destructured page.balances,
matching the SDK's own example. Also updated the 2 prose mentions of
getAllBalances, one of which told readers it "works on the derived
address".

Dropped .core from getBalance and getObject on the same page. This is
application code, and the Core API page says so directly: "This page is
for SDK and library authors. If you are writing application code, create
a client and call its top-level methods directly. You do not need
client.core."

Left the .core calls in deepbookv3-sdk.mdx, deepbook-margin-sdk.mdx, and
wallet-standard.mdx alone. Those sit inside classes that hold a client,
or in wallet implementation code, which is the pattern the Core API page
describes as its intended use.
@jessiemongeon1
jessiemongeon1 deployed to sui-typescript-aws-kms-test-env September 8, 2026 23:27 — with GitHub Actions Active
@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sui-docs Ready Ready Preview Sep 8, 2026 11:31pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
multisig-toolkit Ignored Ignored Preview Sep 8, 2026 11:31pm UTC
sui-kiosk Ignored Ignored Preview Sep 8, 2026 11:31pm UTC

Request Review

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

Labels

Type: Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant