or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/web3@7.13.x
tile.json

tessl/pypi-web3

tessl install tessl/pypi-web3@7.13.0

A Python library for interacting with Ethereum blockchain

Agent Success

Agent success rate when using this tile

88%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

87%

task.mdevals/scenario-5/

Transaction Event Analyzer

Build a transaction event analyzer that processes blockchain transaction receipts and extracts event data with configurable error handling strategies.

Requirements

Your analyzer should process transaction receipts and extract event logs with flexible error handling. Different scenarios require different approaches to handling decode failures:

  • Strict mode: Fail immediately when encountering any decode errors
  • Warn mode: Log warnings but continue processing when errors occur
  • Ignore mode: Skip problematic events silently without warnings
  • Discard mode: Filter out failed events and return only successfully decoded ones

The analyzer should:

  1. Accept a transaction receipt and contract ABI
  2. Extract events matching the ABI from the receipt's logs
  3. Handle decode errors according to the specified error handling mode
  4. Return decoded event data with event names and arguments

Capabilities

Process events with strict error handling

  • Given a transaction receipt with valid event logs and a matching contract ABI, processing in strict mode returns all decoded events @test
  • Given a transaction receipt containing logs that cannot be decoded with the provided ABI, processing in strict mode raises an exception @test

Process events with warning error handling

  • Given a transaction receipt with a mix of decodable and non-decodable logs, processing in warning mode returns decoded events and logs warnings for failures @test
  • Given a transaction receipt with only valid events, processing in warning mode returns all decoded events without warnings @test

Process events with ignore error handling

  • Given a transaction receipt with decodable and non-decodable logs, processing in ignore mode returns only successfully decoded events without warnings @test

Process events with discard error handling

  • Given a transaction receipt with both valid and invalid event logs, processing in discard mode returns only valid decoded events, silently discarding failures @test

Implementation

@generates

API

from typing import Any, Dict, List, Literal
from web3.types import TxReceipt

ErrorHandlingMode = Literal["strict", "warn", "ignore", "discard"]

def process_receipt_events(
    receipt: TxReceipt,
    contract_abi: List[Dict[str, Any]],
    error_handling: ErrorHandlingMode = "strict"
) -> List[Dict[str, Any]]:
    """
    Process events from a transaction receipt with configurable error handling.

    Args:
        receipt: Transaction receipt containing event logs
        contract_abi: Contract ABI defining the events to decode
        error_handling: Error handling mode - "strict", "warn", "ignore", or "discard"

    Returns:
        List of decoded events, each containing event name and arguments

    Raises:
        Exception: In strict mode when event decoding fails
    """
    pass

Dependencies { .dependencies }

web3 { .dependency }

Provides Ethereum blockchain interaction capabilities including event processing with configurable error handling modes.