← Back to Gene Catalog

solidity-parser

Nativeweb3.analysis

Parse Solidity source code using regex-based analysis. Extracts contracts, functions, state variables, events, imports, inheritance, and modifier usage without external AST dependencies.

README

No documentation yet.

Gene authors can add a README when publishing.

Phenotype

Input

PropertyTypeReqDescription
sourcestring✓Solidity source code to parse
filenamestringOptional filename for context

Output

PropertyTypeReqDescription
eventsarray✓
sourcestring✓Original source passed through for downstream genes
importsarray✓
contractsarray✓
functionsarray✓
stateVariablesarray✓
Raw JSON Schema

inputSchema

{
  "type": "object",
  "required": [
    "source"
  ],
  "properties": {
    "source": {
      "type": "string",
      "description": "Solidity source code to parse"
    },
    "filename": {
      "type": "string",
      "description": "Optional filename for context"
    }
  }
}

outputSchema

{
  "type": "object",
  "required": [
    "source",
    "contracts",
    "functions",
    "stateVariables",
    "events",
    "imports"
  ],
  "properties": {
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "params": {
            "type": "string"
          }
        }
      }
    },
    "source": {
      "type": "string",
      "description": "Original source passed through for downstream genes"
    },
    "imports": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "contracts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "inherits": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "functions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "params": {
            "type": "string"
          },
          "modifiers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mutability": {
            "type": "string"
          },
          "visibility": {
            "type": "string"
          }
        }
      }
    },
    "stateVariables": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "visibility": {
            "type": "string"
          }
        }
      }
    }
  }
}