ts-sdk-view-and-query

Query Aptos on-chain data using the @aptos-labs/ts-sdk.

19|8|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/aptos-labs/aptos-agent-skills --skill ts-sdk-view-and-query
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts-sdk-view-and-query
Source: https://github.com/aptos-labs/aptos-agent-skills/tree/main/skills/sdk/typescript/ts-sdk-view-and-query
Command: npx skills add https://github.com/aptos-labs/aptos-agent-skills --skill ts-sdk-view-and-query

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies reading on-chain data from the Aptos blockchain using the TypeScript SDK, enabling developers to easily retrieve balances, account information, and view function results.

Core Features & Use Cases

  • APT Balance Retrieval: Get the native APT balance for any account.
  • Account Information: Fetch details like sequence number and authentication key.
  • Move View Functions: Execute read-only Move functions and retrieve their results, handling various return types including BigInt for large numbers.
  • Resource & Module Querying: Inspect account resources and deployed modules.
  • Use Case: Display a user's APT balance on a dApp frontend or fetch the current state of a smart contract's data.

Quick Start

Use the ts-sdk-view-and-query skill to get the APT balance for the account address 0x1.

Frequently Asked Questions about ts-sdk-view-and-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query APT balances and account details using the Aptos TypeScript SDK?

To query APT balances and account details with the Aptos TypeScript SDK, use the @aptos-labs/ts-sdk to fetch sequence numbers, authentication keys, and native APT balances for any account address on-chain.

Can I execute Move view functions read-only using the Aptos TypeScript SDK?

Yes, you can execute Move view functions read-only using the Aptos TypeScript SDK to retrieve smart contract state without modifying the blockchain, handling various return types including BigInt for u128 and u256 values.

What is the best way to retrieve account resources and deployed modules on Aptos?

The best way to retrieve account resources and deployed modules on Aptos is using the @aptos-labs/ts-sdk to inspect resource data structures and module code directly from any account address.

Does the Aptos TypeScript SDK support querying large on-chain numbers like u256?

Yes, the Aptos TypeScript SDK supports querying large on-chain numbers by handling u128 and u256 values as BigInt, ensuring accurate data retrieval for large balances and values from Move view functions.

Why should I use view functions instead of standard queries for Aptos on-chain data?

Use view functions instead of standard queries for Aptos on-chain data when you need to execute custom read-only Move logic to compute and return specific smart contract states without modifying the blockchain or paying gas fees.