Meter Logs API

Access to event & transfer logs

OpenAPI Specification

meter-logs-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Meterest Accounts Logs API
  description: 'RESTful API to access Meter.io


    [Project Home](https://github.com/meterio)

    '
  license:
    name: LGPL 3.0
    url: https://www.gnu.org/licenses/lgpl-3.0.en.html
  version: 1.2.2
servers:
- url: /
  description: local meter node
tags:
- name: Logs
  description: Access to event & transfer logs
paths:
  /logs/event:
    post:
      tags:
      - Logs
      summary: Filter event logs
      description: 'Event logs are produced by `OP_LOG` in EVM.

        '
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventFilter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/Event'
                  - type: object
                    properties:
                      meta:
                        $ref: '#/components/schemas/LogMeta'
  /logs/transfer:
    post:
      tags:
      - Logs
      summary: Filter transfer logs
      description: 'Transfer logs are recorded on MTRG transferring.

        '
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferFilter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/Transfer'
                  - type: object
                    properties:
                      meta:
                        $ref: '#/components/schemas/LogMeta'
  /logs/events:
    post:
      deprecated: true
      tags:
      - Logs
      summary: Filter event logs
      description: 'Event logs are produced by `OP_LOG` in EVM.

        '
      parameters:
      - $ref: '#/components/parameters/FilterOrderInQuery'
      - $ref: '#/components/parameters/FilterAddressInQuery'
      requestBody:
        description: event filter criteria
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventFilterLegacy'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/Event'
                  - type: object
                    properties:
                      meta:
                        $ref: '#/components/schemas/LogMeta'
  /logs/transfers:
    post:
      deprecated: true
      tags:
      - Logs
      summary: Filter transfer logs
      description: 'Transfer logs are recorded on MTR transferring.

        '
      parameters:
      - $ref: '#/components/parameters/FilterOrderInQuery'
      requestBody:
        description: transfer log filter criteria
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferFilterLegacy'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/Transfer'
                  - type: object
                    properties:
                      meta:
                        $ref: '#/components/schemas/LogMeta'
  /events:
    post:
      deprecated: true
      tags:
      - Logs
      summary: Filter event logs
      parameters:
      - $ref: '#/components/parameters/FilterOrderInQuery'
      - $ref: '#/components/parameters/FilterAddressInQuery'
      requestBody:
        description: event filter criteria
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventFilterLegacy'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/Event'
                  - type: object
                    properties:
                      meta:
                        $ref: '#/components/schemas/LogMeta'
  /transfers:
    post:
      deprecated: true
      tags:
      - Logs
      summary: Filter transfer logs
      parameters:
      - $ref: '#/components/parameters/FilterOrderInQuery'
      requestBody:
        description: transfer log filter criteria
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferFilterLegacy'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/Transfer'
                  - type: object
                    properties:
                      meta:
                        $ref: '#/components/schemas/LogMeta'
components:
  parameters:
    FilterOrderInQuery:
      name: order
      in: query
      description: 'order of filters, defaults to `asc`

        '
      required: false
      schema:
        type: string
        enum:
        - asc
        - desc
      example: asc
    FilterAddressInQuery:
      name: address
      in: query
      description: address of account which is the events emitter
      required: false
      schema:
        type: string
      example: '0x0000000000000000000000000000456e65726779'
  schemas:
    FilterOptions:
      properties:
        offset:
          type: integer
          example: 0
          description: 'offset in matched record set

            '
        limit:
          type: integer
          example: 10
          description: 'limit of records to output

            '
      description: "pass these parameters if you need filtered results paged. e.g. \n```\n{\n  \"options\": {\n    \"offset\": 0,\n    \"limit\": 10   \n  }\n}\n```\nthe above refers that page offset is 0, and the page size is 10.\npass options `null` if you don't need to demand paging.\n"
    TransferCriteria:
      properties:
        txOrigin:
          type: string
          example: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d'
        sender:
          type: string
          example: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d'
        recipient:
          type: string
          example: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'
    AddressSetLegacy:
      properties:
        txOrigin:
          type: string
          example: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d'
        sender:
          type: string
          example: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d'
        recipient:
          type: string
          example: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'
    EventFilterLegacy:
      properties:
        range:
          $ref: '#/components/schemas/FilterRange'
        options:
          $ref: '#/components/schemas/FilterOptions'
        topicSets:
          type: array
          items:
            $ref: '#/components/schemas/TopicSetLegacy'
    Transfer:
      properties:
        sender:
          type: string
          description: address that sends tokens
          example: '0xdb4027477b2a8fe4c83c6dafe7f86678bb1b8a8d'
        recipient:
          type: string
          description: address that receives tokens
          example: '0x5034aa590125b64023a0262112b98d72e3c8e40e'
        amount:
          type: string
          description: amount of tokens
          example: '0x47fdb3c3f456c0000'
    TransferFilterLegacy:
      properties:
        range:
          $ref: '#/components/schemas/FilterRange'
        options:
          $ref: '#/components/schemas/FilterOptions'
        addressSets:
          type: array
          items:
            $ref: '#/components/schemas/AddressSetLegacy'
    LogMeta:
      description: event or transfer log meta info
      properties:
        blockID:
          type: string
          description: block identifier (bytes32)
          example: '0x0004f6cc88bb4626a92907718e82f255b8fa511453a78e8797eb8cea3393b215'
        blockNumber:
          type: integer
          format: uint32
          description: block number (height)
          example: 325324
        blockTimestamp:
          type: integer
          format: uint64
          description: block unix timestamp
          example: 1533267900
        txID:
          type: string
          description: transaction identifier
          example: '0x284bba50ef777889ff1a367ed0b38d5e5626714477c40de38d71cedd6f9fa477'
        txOrigin:
          type: string
          description: transaction origin (signer)
          example: '0xdb4027477b2a8fe4c83c6dafe7f86678bb1b8a8d'
    Event:
      properties:
        address:
          type: string
          description: the address of contract which produces the event (bytes20)
          example: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'
        topics:
          type: array
          items:
            type: string
            example: '0x4de71f2d588aa8a1ea00fe8312d92966da424d9939a511fc0be81e65fad52af8'
        data:
          type: string
          example: '0x4de71f2d588aa8a1ea00fe8312d92966da424d9939a511fc0be81e65fad52af8'
    TransferFilter:
      properties:
        range:
          $ref: '#/components/schemas/FilterRange'
        options:
          $ref: '#/components/schemas/FilterOptions'
        criteriaSet:
          type: array
          items:
            $ref: '#/components/schemas/TransferCriteria'
        order:
          description: 'order of filters, defaults to `asc`

            '
          type: string
          enum:
          - asc
          - desc
    EventCriteria:
      properties:
        address:
          type: string
          description: address of event emitter
        topic0:
          type: string
        topic1:
          type: string
        topic2:
          type: string
        topic3:
          type: string
        topic4:
          type: string
      description: "criteria to filter out event. All fields are joined with `and` operator. `null` field are ignored. e.g. \n```\n{\n  \"address\": \"0xe59d475abe695c7f67a8a2321f33a856b0b4c71d\",\n  \"topic0\": \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n}\n```\nmatches events emitted by `0xe59d475abe695c7f67a8a2321f33a856b0b4c71d` and with `topic0` equals `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`.\n"
      example:
        address: '0xe59d475abe695c7f67a8a2321f33a856b0b4c71d'
        topic0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
    TopicSetLegacy:
      properties:
        topic0:
          type: string
        topic1:
          type: string
        topic2:
          type: string
        topic3:
          type: string
        topic4:
          type: string
      description: "a set of topics joined with `and` operator. `null` topics are ignored. e.g. \n```\n{\n  \"topic0\": \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\n  \"topic1\": null\n}\n```\nmatches events whose `topic0` equals `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`.\n"
      example:
        topic0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
    FilterRange:
      properties:
        unit:
          type: string
          enum:
          - block
          - time
          example: block
          description: 'defines the unit of `from` and `to`.

            `block` means block number, `time` means block timestamp, default to `block`.

            '
        from:
          type: integer
          format: uint64
          example: 0
        to:
          type: integer
          format: uint64
          example: 100000
      description: "defines the range to filter in. e.g.\n```\n{\n  \"range\": {\n    \"unit\": \"block\",\n    \"from\": 10,\n    \"to\": 1000\n  }\n}\n```\nrefers to the range from block 10 to block 1000.\n`null` stands for the full range.\n"
    EventFilter:
      properties:
        range:
          $ref: '#/components/schemas/FilterRange'
        options:
          $ref: '#/components/schemas/FilterOptions'
        criteriaSet:
          type: array
          items:
            $ref: '#/components/schemas/EventCriteria'
        order:
          description: 'order of filters, defaults to `asc`

            '
          type: string
          enum:
          - asc
          - desc