NEAR Protocol EXPERIMENTAL View Code API

The EXPERIMENTAL View Code API from NEAR Protocol — 1 operation(s) for experimental view code.

OpenAPI Specification

near-experimental-view-code-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  description: Low-latency indexed account, token, and public-key lookup APIs for wallets and explorers. Embedded portal clients may forward an optional `apiKey` query parameter, but the public FastNEAR API does not require it.
  title: FastNEAR accounts EXPERIMENTAL View Code API
  version: 3.0.3
servers:
- description: Mainnet
  url: https://api.fastnear.com
- description: Testnet
  url: https://test.api.fastnear.com
tags:
- name: EXPERIMENTAL View Code
paths:
  /EXPERIMENTAL_view_code:
    post:
      description: Returns the contract code (Wasm binary) deployed to the account.
      operationId: EXPERIMENTAL_view_code
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JsonRpcRequest_for_EXPERIMENTAL_view_code'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponse_for_RpcViewCodeResponse_and_RpcViewCodeError'
      tags:
      - EXPERIMENTAL View Code
components:
  schemas:
    CryptoHash:
      type: string
    BlockId:
      anyOf:
      - format: uint64
        minimum: 0
        title: block_height
        type: integer
      - $ref: '#/components/schemas/CryptoHash'
    RpcViewCodeRequest:
      oneOf:
      - properties:
          block_id:
            $ref: '#/components/schemas/BlockId'
        required:
        - block_id
        type: object
      - properties:
          finality:
            $ref: '#/components/schemas/Finality'
        required:
        - finality
        type: object
      - properties:
          sync_checkpoint:
            $ref: '#/components/schemas/SyncCheckpoint'
        required:
        - sync_checkpoint
        type: object
      properties:
        account_id:
          $ref: '#/components/schemas/AccountId'
      required:
      - account_id
      title: RpcViewCodeRequest
      type: object
    JsonRpcResponse_for_RpcViewCodeResponse_and_RpcViewCodeError:
      oneOf:
      - properties:
          result:
            $ref: '#/components/schemas/RpcViewCodeResponse'
        required:
        - result
        type: object
      - properties:
          error:
            $ref: '#/components/schemas/ErrorWrapper_for_RpcViewCodeError'
        required:
        - error
        type: object
      properties:
        id:
          type: string
        jsonrpc:
          type: string
      required:
      - jsonrpc
      - id
      title: JsonRpcResponse_for_RpcViewCodeResponse_and_RpcViewCodeError
      type: object
    RpcViewCodeError:
      oneOf:
      - properties:
          info:
            properties:
              block_reference:
                $ref: '#/components/schemas/BlockReference'
            required:
            - block_reference
            type: object
          name:
            enum:
            - UNKNOWN_BLOCK
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          info:
            properties:
              block_hash:
                $ref: '#/components/schemas/CryptoHash'
              block_height:
                format: uint64
                minimum: 0
                type: integer
              requested_account_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - requested_account_id
            - block_height
            - block_hash
            type: object
          name:
            enum:
            - INVALID_ACCOUNT
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          info:
            properties:
              block_hash:
                $ref: '#/components/schemas/CryptoHash'
              block_height:
                format: uint64
                minimum: 0
                type: integer
              requested_account_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - requested_account_id
            - block_height
            - block_hash
            type: object
          name:
            enum:
            - UNKNOWN_ACCOUNT
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          info:
            properties:
              block_hash:
                $ref: '#/components/schemas/CryptoHash'
              block_height:
                format: uint64
                minimum: 0
                type: integer
              contract_account_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - contract_account_id
            - block_height
            - block_hash
            type: object
          name:
            enum:
            - NO_CONTRACT_CODE
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          info:
            properties:
              error_message:
                type: string
            required:
            - error_message
            type: object
          name:
            enum:
            - INTERNAL_ERROR
            type: string
        required:
        - name
        - info
        type: object
    RpcViewCodeResponse:
      description: A view of the contract code.
      properties:
        block_hash:
          $ref: '#/components/schemas/CryptoHash'
        block_height:
          format: uint64
          minimum: 0
          type: integer
        code_base64:
          type: string
        hash:
          $ref: '#/components/schemas/CryptoHash'
      required:
      - code_base64
      - hash
      - block_height
      - block_hash
      type: object
    Finality:
      description: Different types of finality.
      enum:
      - optimistic
      - near-final
      - final
      type: string
    InternalError:
      oneOf:
      - properties:
          info:
            properties:
              error_message:
                type: string
            required:
            - error_message
            type: object
          name:
            enum:
            - INTERNAL_ERROR
            type: string
        required:
        - name
        - info
        type: object
    JsonRpcRequest_for_EXPERIMENTAL_view_code:
      properties:
        id:
          type: string
        jsonrpc:
          type: string
        method:
          enum:
          - EXPERIMENTAL_view_code
          type: string
        params:
          $ref: '#/components/schemas/RpcViewCodeRequest'
      required:
      - jsonrpc
      - id
      - params
      - method
      title: JsonRpcRequest_for_EXPERIMENTAL_view_code
      type: object
    AccountId:
      $schema: https://json-schema.org/draft/2020-12/schema
      description: 'NEAR Account Identifier.


        This is a unique, syntactically valid, human-readable account identifier on the NEAR network.


        [See the crate-level docs for information about validation.](index.html#account-id-rules)


        Also see [Error kind precedence](AccountId#error-kind-precedence).


        ## Examples


        ```

        use near_account_id::AccountId;


        let alice: AccountId = "alice.near".parse().unwrap();


        assert!("ƒelicia.near".parse::<AccountId>().is_err()); // (ƒ is not f)

        ```'
      title: AccountId
      type: string
    RpcRequestValidationErrorKind:
      oneOf:
      - properties:
          info:
            properties:
              method_name:
                type: string
            required:
            - method_name
            type: object
          name:
            enum:
            - METHOD_NOT_FOUND
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          info:
            properties:
              error_message:
                type: string
            required:
            - error_message
            type: object
          name:
            enum:
            - PARSE_ERROR
            type: string
        required:
        - name
        - info
        type: object
    SyncCheckpoint:
      enum:
      - genesis
      - earliest_available
      type: string
    BlockReference:
      oneOf:
      - additionalProperties: false
        properties:
          block_id:
            $ref: '#/components/schemas/BlockId'
        required:
        - block_id
        type: object
      - additionalProperties: false
        properties:
          finality:
            $ref: '#/components/schemas/Finality'
        required:
        - finality
        type: object
      - additionalProperties: false
        properties:
          sync_checkpoint:
            $ref: '#/components/schemas/SyncCheckpoint'
        required:
        - sync_checkpoint
        type: object
    ErrorWrapper_for_RpcViewCodeError:
      oneOf:
      - properties:
          cause:
            $ref: '#/components/schemas/RpcRequestValidationErrorKind'
          name:
            enum:
            - REQUEST_VALIDATION_ERROR
            type: string
        required:
        - name
        - cause
        type: object
      - properties:
          cause:
            $ref: '#/components/schemas/RpcViewCodeError'
          name:
            enum:
            - HANDLER_ERROR
            type: string
        required:
        - name
        - cause
        type: object
      - properties:
          cause:
            $ref: '#/components/schemas/InternalError'
          name:
            enum:
            - INTERNAL_ERROR
            type: string
        required:
        - name
        - cause
        type: object