Read Lambda Events

After the lambda is created from the /v2/app/lambda/create or imported using /v2/app/lambda/import API call, use this API to read events emitted by lambda functions. You can specify the lambda addresses and block range to read the events from.

The API has the following restrictions:

  1. You can read events for up to 5 lambdas at a time.
  2. You can read events for a block range of up to 2,000 blocks at a time.
  3. If no block range is specified, the API will return events for the latest 100 blocks.

Request

Here are some example requests:

{
  "lambdas": [
    "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
    "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
  ]
}
{
  "lambdas": [
    "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
    "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
  ],
  "blocks": {
    "range": {
      "oldest": "46209204",
      "newest": "46209205"
    }
  }
}
{
  "lambdas": [
    "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
    "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
  ],
  "blocks": {
    "range": {
      "oldest": "LATEST",
      "newest": "LATEST"
    }
  }
}

Response

The response will have the decoded events for each lambda, sorted by the block number (newest first). If the decoding fails, only the raw event will be returned instead. Here is a sample response:

{
  "status": "SUCCESS",
  "events": [
    {
      "lambda": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
      "name": "Transfer",
      "args": {
        "to": "0x69FaAE36C33167c7ea4dFE837ac4Dd098dfF3b3e",
        "value": "1032944562685632",
        "from": "0x45dDa9cb7c25131DF268515131f647d726f50608"
      },
      "block": "46209417",
      "raw": {
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x00000000000000000000000045dda9cb7c25131df268515131f647d726f50608",
          "0x00000000000000000000000069faae36c33167c7ea4dfe837ac4dd098dff3b3e"
        ],
        "data": "0x0000000000000000000000000000000000000000000000000003ab7525bb46c0"
      }
    }
  ]
}

Here's a description of the fields in the response:

  • events: An array of events, sorted by block number (newest first).
  • event.lambda: The lambda address.
  • event.name: The name of the event. This is only returned if the event was successfully decoded.
  • event.args: The arguments of the event. This is only returned if the event was successfully decoded.
  • event.block: The block number when the event was emitted.
  • event.raw.topics: The raw topics emitted by the event.
  • event.raw.data: The raw data emitted by the event.

Error Status

🚧

Api Error Status

You can find error status returned by the api here.

© Copyright 2024, Passbird Research Inc.

Language
Authorization
Header
Click Try It! to start a request and see the response here!