openapi: 3.1.0
info:
  title: 'NEAR Protocol RPC: Get state changes'
  description: >-
    Returns changes for a given account, contract or contract code for given
    block height or hash
  version: 1.0.0
servers:
  - url: https://rpc.mainnet.fastnear.com
    description: Mainnet
  - url: https://rpc.testnet.fastnear.com
    description: Testnet
paths:
  /:
    post:
      operationId: changes
      summary: Get state changes
      description: >-
        Returns changes for a given account, contract or contract code for given
        block height or hash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                id:
                  type: string
                  example: fastnear
                method:
                  type: string
                  enum:
                    - changes
                params:
                  type: object
                  description: One of multiple possible types
            examples:
              mainnet:
                summary: Get state changes (Mainnet)
                value:
                  jsonrpc: '2.0'
                  id: fastnear
                  method: changes
                  params: {}
              testnet:
                summary: Get state changes (Testnet)
                value:
                  jsonrpc: '2.0'
                  id: fastnear
                  method: changes
                  params: {}
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponse'
components:
  schemas:
    JsonRpcResponse:
      type: object
      required:
        - jsonrpc
        - id
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
        id:
          oneOf:
            - type: string
            - type: number
        result:
          type: object
          properties:
            block_hash:
              type: string
              description: Base58-encoded hash
            changes:
              type: array
              items:
                type: object
                properties:
                  cause:
                    type: object
                    description: One of multiple possible types
                required:
                  - cause
          required:
            - block_hash
            - changes
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            data:
              type: object
