openapi: 3.1.0
info:
  title: 'NEAR Protocol RPC: Light Client Proof'
  description: Retrieve light client proof data for transaction verification
  version: 1.0.0
servers:
  - url: https://rpc.mainnet.fastnear.com
    description: Mainnet
  - url: https://rpc.testnet.fastnear.com
    description: Testnet
paths:
  /:
    post:
      operationId: light_client_proof
      summary: Get light client proof
      description: Retrieves verification proof data for light clients
      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:
                    - light_client_proof
                params:
                  type: object
                  properties:
                    light_client_head:
                      type: string
                      description: Base58-encoded hash
                    sender_id:
                      type: string
                      description: NEAR account ID
                    transaction_hash:
                      type: string
                      description: Base58-encoded hash
                    type:
                      type: string
                      enum:
                        - receipt
                    receipt_id:
                      type: string
                      description: Base58-encoded hash
                    receiver_id:
                      type: string
                      description: NEAR account ID
                  required:
                    - light_client_head
            examples:
              mainnet:
                summary: Mainnet Light Client Proof
                value:
                  jsonrpc: '2.0'
                  id: fastnear
                  method: light_client_proof
                  params:
                    type: receipt
                    transaction_hash: 8a8HR2Gf8NkLLeNcuHet4JeEz9kWa1fhs6qAnBdiewrR
                    sender_id: 0-relay.hot.tg
                    light_client_head: BnHU4MCqsNVgLRCiZteef85VYxCbNzwkWEo1cEG8Z6VX
              testnet:
                summary: Testnet Light Client Proof
                value:
                  jsonrpc: '2.0'
                  id: fastnear
                  method: light_client_proof
                  params:
                    type: receipt
                    transaction_hash: Ac5D9MWqo5wKmRBZiqQfyuJfz4SMsgc3tDCjMoQBBeRK
                    sender_id: relay.aurora
                    light_client_head: G92i6jYNUcJ6nZpPPF6TUghBoYbewqBQeUNquF3Qz38i
      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_header_lite:
              type: object
              properties:
                inner_lite:
                  type: object
                  description: >-
                    A part of a state for the current head of a light client.
                    More info [here](https://nomicon.io/ChainSpec/LightClient).
                inner_rest_hash:
                  type: string
                  description: Base58-encoded hash
                prev_block_hash:
                  type: string
                  description: Base58-encoded hash
              required:
                - prev_block_hash
                - inner_rest_hash
                - inner_lite
            block_proof:
              type: array
              items:
                type: object
            outcome_proof:
              type: object
              properties:
                block_hash:
                  type: string
                  description: Base58-encoded hash
                id:
                  type: string
                  description: Base58-encoded hash
                outcome:
                  type: object
                proof:
                  type: array
                  items:
                    type: object
              required:
                - proof
                - block_hash
                - id
                - outcome
            outcome_root_proof:
              type: array
              items:
                type: object
          required:
            - outcome_proof
            - outcome_root_proof
            - block_header_lite
            - block_proof
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            data:
              type: object
