> ## 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.

# getTokenSupply

> 返回 SPL 代币类型的总供应量。

## 请求参数

<ParamField body="address" type="string" required>
  要检索供应指标的Solana代币铸造地址（SPL代币的唯一标识符）。
</ParamField>

<ParamField body="commitment" type="string">
  请求的承诺级别。

  * `confirmed`
  * `finalized`
  * `processed`
</ParamField>


## OpenAPI

````yaml zh/openapi/rpc-http/getTokenSupply.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: 用于检索Solana区块链上任何SPL代币或可替代资产的当前流通和总供应指标的代币经济学分析API。
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: 主网RPC端点
  - url: https://devnet.helius-rpc.com
    description: 开发网RPC端点
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getTokenSupply
      description: >-
        检索 Solana 区块链上任何 SPL 代币的综合代币供应指标。这个重要的代币经济学 API
        提供准确和实时的代币流通供应、总铸造量和小数配置数据。对于需要可靠代币供应信息的代币分析仪表板、DeFi
        应用程序、市值计算、协议指标和交易平台至关重要。支持所有 SPL 代币类型，包括可替代代币和社区代币，具有适当的小数格式以确保准确显示。
      operationId: getTokenSupply
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: JSON-RPC 协议版本。
                  example: '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: 请求的唯一标识符。
                  example: '1'
                  default: '1'
                method:
                  type: string
                  enum:
                    - getTokenSupply
                  description: 要调用的 RPC 方法名称。
                  example: getTokenSupply
                  default: getTokenSupply
                params:
                  type: array
                  description: 查询代币供应的参数。
                  default:
                    - 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                  items:
                    oneOf:
                      - type: string
                        description: Solana 代币铸造地址，用于检索供应指标（SPL 代币的唯一标识符）。
                        example: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      - type: object
                        description: 配置对象。
                        properties:
                          commitment:
                            type: string
                            description: 请求的承诺级别。
                            enum:
                              - confirmed
                              - finalized
                              - processed
                            example: finalized
      responses:
        '200':
          description: 成功检索到代币供应。
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                    description: JSON-RPC 协议版本。
                    example: '2.0'
                  id:
                    type: string
                    description: 与请求匹配的标识符。
                    example: '1'
                  result:
                    type: object
                    description: 上下文和代币供应详情。
                    properties:
                      context:
                        type: object
                        description: 响应的上下文。
                        properties:
                          slot:
                            type: integer
                            description: 获取数据的槽位。
                            example: 1114
                      value:
                        type: object
                        description: 代币供应详情。
                        properties:
                          amount:
                            type: string
                            description: 原始的 Solana 代币总供应量，以精确的整数字符串表示，不带小数格式。
                            example: '100000'
                          decimals:
                            type: integer
                            description: 代币定义的小数位数，用于准确表示供应量。
                            example: 2
                          uiAmount:
                            type: number
                            description: 具有适当小数格式的人类可读代币供应量（已弃用）。
                            example: 1000
                          uiAmountString:
                            type: string
                            description: 具有正确小数位的代币总供应量的规范字符串表示。
                            example: '1000'
              examples:
                responseExample:
                  value:
                    jsonrpc: '2.0'
                    id: '1'
                    result:
                      context:
                        slot: 1114
                      value:
                        amount: '100000'
                        decimals: 2
                        uiAmount: 1000
                        uiAmountString: '1000'
        '400':
          description: 错误请求 - 请求参数无效或请求格式错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Invalid params
                id: '1'
        '401':
          description: 未授权 - API 密钥无效或缺失。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Unauthorized
                id: '1'
        '429':
          description: 请求过多 - 超出速率限制。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Too many requests
                id: '1'
        '500':
          description: 内部服务器错误 - 服务器发生错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Internal error
                id: '1'
        '503':
          description: 服务不可用 - 服务暂时不可用。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: 服务不可用
                id: '1'
        '504':
          description: 网关超时 - 请求超时。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: 网关超时
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: JSON-RPC协议版本。
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: 错误代码。
              example: -32602
            message:
              type: string
              description: 错误信息。
            data:
              type: object
              description: 关于错误的附加数据。
        id:
          type: string
          description: 与请求匹配的标识符。
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: 您的Helius API密钥。您可以在[仪表板](https://dashboard.helius.dev/api-keys)中免费获取一个。

````