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 iskysun96/aptos-agent-skills
generate-tests
Creates comprehensive test suites for Move contracts with 100% coverage requirement. Triggers on: 'generate tests',
38write-contracts
Generates secure Aptos Move V2 smart contracts with Object model, Digital Asset integration, security patterns, and
35security-audit
Audits Move contracts for security vulnerabilities before deployment using 7-category checklist. Triggers on: 'audit
32deploy-contracts
Safely deploys Move contracts to Aptos networks (devnet, testnet, mainnet) with pre-deployment verification. Triggers
32search-aptos-examples
Searches aptos-core and daily-move for reference implementations before writing contracts. Triggers on: 'search
31analyze-gas-optimization
Analyze and optimize Aptos Move contracts for gas efficiency, identifying expensive operations and suggesting
31