Skip to main content

normalize_forge_output

Function normalize_forge_output 

Source
pub fn normalize_forge_output(forge_output: Value) -> Value
Expand description

Normalize forge build --json --ast output into the canonical shape.

Forge wraps data in arrays with metadata:

  • sources[path] = [{ source_file: { id, ast }, build_id, profile, version }]
  • contracts[path][name] = [{ contract: { abi, evm, ... }, build_id, profile, version }]
  • build_infos = [{ source_id_to_path: { ... } }]

This unwraps to the canonical flat shape:

  • sources[path] = { id, ast }
  • contracts[path][name] = { abi, evm, ... }
  • source_id_to_path = { ... }