querying-assets calls a method that does not exist - #27926
Draft
jessiemongeon1 wants to merge 1 commit into
Draft
Conversation
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
deployed
to
sui-typescript-aws-kms-test-env
September 8, 2026 23:27 — with
GitHub Actions
Active
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Found while sweeping
onchain-finance/for SDK anti-patterns.onchain-finance/pas/querying-assets.mdxreads balances with:getAllBalancesis not in the Core API. The contract table on sdk.mystenlabs.com/sui/clients/core lists the Coins methods asgetBalance,listBalances,listCoins,getCoinMetadata. The JSON-RPC migration guide is explicit: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
getAllBalancescalls →listBalances, destructuringpage.balancesto match the SDK's own example.2 prose mentions of
getAllBalances, one of which told readers it "works on the derived address".Dropped
.corefromgetBalanceandgetObject. This is application code, and the Core API page says so directly:Left alone deliberately
deepbookv3-sdk.mdx,deepbook-margin-sdk.mdx, andwallet-standard.mdxalso 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.listBalancesis paginated wheregetAllBalanceswas not, so an application holding many coin types needs to followcursorwhilehasNextPageis 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
page.balances) taken from the SDK'slistBalancesexample.