CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-py-solc-x

Python wrapper and version management tool for the solc Solidity compiler.

77

1.05x

Evaluation77%

1.05x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-2/

Solidity Combined JSON Compiler

Build a helper that compiles in-memory Solidity source strings into combined JSON outputs and optionally persists them.

Capabilities

Compile single source string

  • Given a Solidity source string defining contract Counter, calling the compiler returns a mapping keyed by Counter with abi (list) and bin (hex string) entries; bytecode must not be empty. @test

Multi-contract source support

  • When the source string defines contracts Alpha and Beta, the combined JSON data includes separate entries for both names, each with its requested outputs populated. @test

Output selection control

  • When requested outputs are abi, bin, and metadata, the returned data includes only those keys for each contract and omits unrequested combined-json fields. @test

Persist combined output

  • When an output directory is provided, the combined JSON artifact is written to combined.json inside that directory while still returning the parsed data; writing to an existing directory overwrites the file. @test

Implementation

@generates

API

from pathlib import Path
from typing import Any, Dict, Iterable, Optional

def compile_combined_json(
    source: str,
    outputs: Iterable[str],
    output_dir: Optional[Path] = None,
) -> Dict[str, Dict[str, Any]]:
    """
    Compile the provided Solidity source string using the active compiler and return
    combined-json outputs keyed by contract name.
    outputs: list of combined-json fields to include (e.g., "abi", "bin", "metadata").
    output_dir: optional directory where the combined-json artifact will be written.
    Raises a descriptive exception when compilation fails.
    """

Dependencies { .dependencies }

py-solc-x { .dependency }

Solidity compiler wrapper providing combined-json outputs for in-memory sources. @satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-py-solc-x

tile.json