> ## Documentation Index
> Fetch the complete documentation index at: https://www.helius.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# getCompressedTokenAccountsByOwner

> Trả về các tài khoản token nén thuộc sở hữu của một tài khoản nhất định.

## Tham số yêu cầu

<ParamField body="cursor" type="string" default="3J98t1WpEZ73CNm">
  Con trỏ phân trang để truy xuất các tập tài khoản token nén tiếp theo trong các ví Solana có số lượng tài sản lớn
</ParamField>

<ParamField body="limit" type="number">
  Số lượng tài khoản token nén tối đa được trả về cho mỗi yêu cầu (dùng để phân trang)
</ParamField>

<ParamField body="mint" type="string" default="11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9">
  Lọc các tài khoản token nén theo địa chỉ mint token Solana cụ thể
</ParamField>

<ParamField body="owner" type="string" required default="11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9">
  Khóa công khai Solana được biểu diễn dưới dạng chuỗi base58 cho địa chỉ tài khoản và ví.
</ParamField>


## OpenAPI

````yaml vi/openapi/zk-compression/getCompressedTokenAccountsByOwner.yaml POST /
openapi: 3.0.3
info:
  title: API danh mục token nén Solana
  description: >
    Trình lập chỉ mục Solana nâng cao dành cho các tài khoản token nén, sử dụng
    công nghệ nén trạng thái để lưu trữ và truy xuất token hiệu quả với chi phí
    tối ưu.

    API này cung cấp quyền truy cập được tối ưu hóa vào các token nén và NFT
    trên Solana, giúp tiết kiệm chi phí tới 1000 lần trong khi vẫn duy trì 

    đầy đủ tính bảo mật và khả năng tương thích với hệ sinh thái token Solana.
    Lý tưởng cho các ứng dụng ví, sàn giao dịch và dApp dựa trên token

    cần quản lý hiệu quả danh mục tài sản nén.
  license:
    name: Apache-2.0
  version: 0.50.0
servers:
  - url: https://mainnet.helius-rpc.com
    description: Điểm cuối RPC Mainnet
  - url: https://devnet.helius-rpc.com
    description: Điểm cuối RPC Devnet
security: []
paths:
  /:
    summary: getCompressedTokenAccountsByOwner
    post:
      description: >
        Truy xuất tất cả tài khoản token nén thuộc sở hữu của một địa chỉ ví
        Solana cụ thể. 

        Điểm cuối danh mục này cung cấp đầy đủ dữ liệu nắm giữ token SPL nén và
        NFT, đồng thời 

        tiết kiệm đáng kể chi phí nhờ công nghệ nén trạng thái của Solana. Lọc
        kết quả theo địa chỉ đúc token, 

        phân trang hiệu quả qua các bộ sưu tập lớn và truy cập dữ liệu tài khoản
        chi tiết với khả năng xác minh đầy đủ quyền sở hữu.


        Các lợi ích chính:

        - Giảm chi phí lưu trữ trên chuỗi cho tài khoản token (tiết kiệm tới
        1000 lần)

        - Hỗ trợ tích hợp ví quy mô lớn với khả năng phân trang hiệu quả

        - Tương thích với tiêu chuẩn token SPL và NFT nén của Solana

        - Lọc theo địa chỉ đúc token cho các truy vấn token có mục tiêu

        - Dữ liệu tài khoản token đầy đủ, bao gồm số dư, bên được ủy quyền và
        trạng thái
      operationId: getCompressedTokenAccountsByOwner
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  description: Phiên bản của giao thức JSON-RPC.
                  enum:
                    - '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: ID dùng để xác định yêu cầu.
                  default: '1'
                method:
                  type: string
                  description: Tên của phương thức cần gọi.
                  enum:
                    - getCompressedTokenAccountsByOwner
                  default: getCompressedTokenAccountsByOwner
                params:
                  type: object
                  required:
                    - owner
                  properties:
                    cursor:
                      allOf:
                        - $ref: '#/components/schemas/Base58String'
                      nullable: true
                      description: >-
                        Con trỏ phân trang để truy xuất các tập tài khoản token
                        nén tiếp theo trong những ví Solana nắm giữ số lượng lớn
                    limit:
                      allOf:
                        - $ref: '#/components/schemas/Limit'
                      nullable: true
                      description: >-
                        Số lượng tài khoản token nén tối đa được trả về cho mỗi
                        yêu cầu (dùng cho phân trang)
                    mint:
                      allOf:
                        - $ref: '#/components/schemas/SerializablePubkey'
                      nullable: true
                      description: >-
                        Lọc tài khoản token nén theo một địa chỉ đúc token
                        Solana cụ thể
                    owner:
                      $ref: '#/components/schemas/SerializablePubkey'
                      description: >-
                        Địa chỉ ví Solana sở hữu các tài khoản token nén cần
                        truy xuất
                  additionalProperties: false
        required: true
      responses:
        '200':
          description: >-
            Đã truy xuất thành công các tài khoản token nén từ blockchain Solana
            cho chủ sở hữu ví được chỉ định
          content:
            application/json:
              schema:
                type: object
                required:
                  - context
                  - value
                properties:
                  context:
                    $ref: '#/components/schemas/Context'
                  value:
                    $ref: '#/components/schemas/TokenAccountList'
                additionalProperties: false
        '400':
          description: >-
            Yêu cầu không hợp lệ - Tham số yêu cầu không hợp lệ hoặc yêu cầu sai
            định dạng.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Tham số không hợp lệ
                id: '1'
        '401':
          description: Không được phép - Khóa API không hợp lệ hoặc bị thiếu.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Không được phép
                id: '1'
        '429':
          description: Quá nhiều yêu cầu - Đã vượt quá giới hạn tốc độ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Quá nhiều yêu cầu
                id: '1'
        '500':
          description: Lỗi máy chủ nội bộ - Đã xảy ra lỗi trên máy chủ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Lỗi nội bộ
                id: '1'
        '503':
          description: Dịch vụ không khả dụng - Dịch vụ tạm thời không khả dụng.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: Dịch vụ không khả dụng
                id: '1'
        '504':
          description: Hết thời gian chờ cổng kết nối - Yêu cầu đã hết thời gian chờ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: Hết thời gian chờ cổng kết nối
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    Base58String:
      type: string
      description: Chuỗi được mã hóa Base58 dùng cho địa chỉ và mã định danh Solana.
      default: 3J98t1WpEZ73CNm
      example: 3J98t1WpEZ73CNm
    Limit:
      type: integer
      format: int64
      minimum: 0
      description: Số lượng tài khoản token nén tối đa được trả về trong một yêu cầu
    SerializablePubkey:
      type: string
      description: >-
        Khóa công khai Solana được biểu diễn dưới dạng chuỗi Base58 cho địa chỉ
        tài khoản và ví.
      default: 11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9
      example: 11111115q4EpJaTXAZWpCg3J2zppWGSZ46KXozzo9
    Context:
      type: object
      required:
        - slot
      properties:
        slot:
          type: integer
          default: 100
          example: 100
          description: Slot blockchain Solana hiện tại cho phản hồi này
    TokenAccountList:
      type: object
      required:
        - items
      properties:
        cursor:
          $ref: '#/components/schemas/Base58String'
          description: >-
            Con trỏ phân trang để truy xuất tập tài khoản token nén tiếp theo
            trong các yêu cầu sau
        items:
          type: array
          items:
            $ref: '#/components/schemas/TokenAcccount'
          description: >-
            Mảng các tài khoản token nén thuộc sở hữu của địa chỉ ví Solana được
            chỉ định
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: Phiên bản giao thức JSON-RPC.
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: Mã lỗi.
              example: -32602
            message:
              type: string
              description: Thông báo lỗi.
            data:
              type: object
              description: Dữ liệu bổ sung về lỗi.
        id:
          type: string
          description: Mã định danh khớp với yêu cầu.
          example: '1'
    TokenAcccount:
      type: object
      required:
        - account
        - tokenData
      properties:
        account:
          $ref: '#/components/schemas/Account'
          description: >-
            Thông tin tài khoản nén cho tài khoản token trên Solana, bao gồm vị
            trí trong cây và dữ liệu xác minh
        tokenData:
          $ref: '#/components/schemas/TokenData'
          description: >-
            Dữ liệu cụ thể liên quan đến token, bao gồm số dư, địa chỉ đúc
            token, chủ sở hữu và trạng thái ủy quyền
      additionalProperties: false
    Account:
      type: object
      required:
        - hash
        - owner
        - lamports
        - tree
        - leafIndex
        - seq
        - slotCreated
      properties:
        address:
          $ref: '#/components/schemas/SerializablePubkey'
          description: Địa chỉ duy nhất của tài khoản nén trên Solana
        data:
          $ref: '#/components/schemas/AccountData'
          description: Dữ liệu tài khoản được lưu trữ ở định dạng nén trên Solana
        hash:
          $ref: '#/components/schemas/Hash'
          description: Hàm băm mật mã của dữ liệu tài khoản nén dùng để xác minh
        lamports:
          $ref: '#/components/schemas/UnsignedInteger'
          description: Số dư tính bằng lamport liên kết với tài khoản nén
        leafIndex:
          $ref: '#/components/schemas/UnsignedInteger'
          description: Vị trí chỉ mục trong cây Merkle nơi tài khoản nén được lưu trữ
        owner:
          $ref: '#/components/schemas/SerializablePubkey'
          description: Chương trình Solana sở hữu tài khoản nén này
        seq:
          $ref: '#/components/schemas/UnsignedInteger'
          description: Số thứ tự dùng để theo dõi các bản cập nhật đối với tài khoản nén
        slotCreated:
          $ref: '#/components/schemas/UnsignedInteger'
          description: Slot blockchain Solana tại thời điểm tài khoản nén được tạo
        tree:
          $ref: '#/components/schemas/SerializablePubkey'
          description: Địa chỉ của cây Merkle chứa tài khoản nén này
      additionalProperties: false
    TokenData:
      type: object
      required:
        - mint
        - owner
        - amount
        - state
      properties:
        amount:
          $ref: '#/components/schemas/UnsignedInteger'
          description: Số dư token được giữ trong tài khoản token nén này
        delegate:
          $ref: '#/components/schemas/SerializablePubkey'
          description: >-
            Địa chỉ bên được ủy quyền tùy chọn, có quyền thực hiện các thao tác
            trên tài khoản token nén này
        mint:
          $ref: '#/components/schemas/SerializablePubkey'
          description: Địa chỉ đúc token SPL Solana mà tài khoản token nén này thuộc về
        owner:
          $ref: '#/components/schemas/SerializablePubkey'
          description: Địa chỉ ví Solana sở hữu tài khoản token nén này
        state:
          $ref: '#/components/schemas/AccountState'
          description: >-
            Trạng thái hiện tại của tài khoản token nén (đã khởi tạo hoặc bị
            đóng băng)
        tlv:
          $ref: '#/components/schemas/Base64String'
          description: >-
            Dữ liệu tùy chọn được mã hóa theo kiểu-độ dài-giá trị để cung cấp
            thông tin mở rộng về tài khoản token
    AccountData:
      type: object
      required:
        - discriminator
        - data
        - dataHash
      properties:
        data:
          $ref: '#/components/schemas/Base64String'
          description: Dữ liệu được mã hóa Base64 của tài khoản Solana nén
        dataHash:
          $ref: '#/components/schemas/Hash'
          description: Hàm băm của dữ liệu tài khoản nén dùng để xác minh tính toàn vẹn
        discriminator:
          $ref: '#/components/schemas/UnsignedInteger'
          description: Mã định danh loại tài khoản trong chương trình Solana
      additionalProperties: false
    Hash:
      type: string
      description: >-
        Hàm băm mật mã 32 byte được biểu diễn dưới dạng chuỗi Base58 để xác minh
        dữ liệu Solana.
      example: 11111112cMQwSC9qirWGjZM6gLGwW69X22mqwLLGP
    UnsignedInteger:
      type: integer
      default: 100
      example: 100
      description: >-
        Giá trị số nguyên không âm dùng cho số lượng token, số thứ tự và các giá
        trị số khác
    AccountState:
      type: string
      enum:
        - initialized
        - frozen
      description: >-
        Trạng thái hiện tại của tài khoản token nén (đã khởi tạo hoặc bị đóng
        băng)
    Base64String:
      type: string
      description: >-
        Chuỗi được mã hóa Base64 để lưu trữ dữ liệu nhị phân trong các tài khoản
        Solana nén.
      default: SGVsbG8sIFdvcmxkIQ==
      example: SGVsbG8sIFdvcmxkIQ==
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        Khóa API Helius của bạn. Bạn có thể nhận khóa miễn phí trong [bảng điều
        khiển](https://dashboard.helius.dev/api-keys).

````