ts-sdk-view-and-query
TypeScript SDK: View and Query
Purpose
Guide read-only access to chain data in @aptos-labs/ts-sdk: view functions, balance, account info, resources, and
modules.
ALWAYS
- Use
aptos.getBalance({ accountAddress })for APT balance – not deprecatedgetAccountCoinAmount/getAccountAPTAmount. - Use
aptos.view()for Move view functions – passfunction,functionArguments, and optionaltypeArguments. - Use
bigintfor u128/u256 view return values – castresult[0]toBigInt(...)when the Move function returns u128/u256. - Pass address as string or AccountAddress – SDK accepts
AccountAddressInput(string orAccountAddress).
NEVER
- Do not use deprecated
getAccountCoinAmountorgetAccountAPTAmount– usegetBalance().
More from aptos-labs/aptos-agent-skills
use-ts-sdk
Orchestrates TypeScript SDK integration for Aptos dApps. Routes to granular skills for specific tasks (client setup,
33ts-sdk-client
How to create and configure the Aptos client (Aptos, AptosConfig) in @aptos-labs/ts-sdk. Covers Network,
33ts-sdk-account
How to create and use Account (signer) in @aptos-labs/ts-sdk. Covers Account.generate(), fromPrivateKey(),
33security-audit
Audits Move contracts for security vulnerabilities before deployment using 7-category checklist. Triggers on: 'audit
33ts-sdk-wallet-adapter
How to integrate wallet connection in React frontends using @aptos-labs/wallet-adapter-react. Covers
33ts-sdk-transactions
How to build, sign, submit, and simulate transactions in @aptos-labs/ts-sdk. Covers build.simple(),
32