cadence-codegen

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 1 Imported by: 0

README

Cadence Codegen

A tool for analyzing Cadence smart contracts and generating code. It extracts transaction and script information, including parameters, imports, and return types.

Features

  • Analyzes Cadence files (.cdc)
  • Extracts transaction and script information
  • Parses import statements
  • Generates structured JSON output

Installation

go install github.com/outblock/cadence-codegen@latest

Usage

analyzer := analyzer.New()

// Analyze a single file
result, err := analyzer.AnalyzeFile("path/to/contract.cdc")

// Analyze a directory
err := analyzer.AnalyzeDirectory("path/to/contracts")

// Get the complete report
report := analyzer.GetReport()

Output Format

{
  "transactions": {
    "filename.cdc": {
      "fileName": "filename.cdc",
      "type": "transaction",
      "parameters": [
        {
          "name": "amount",
          "typeStr": "UFix64",
          "optional": false
        }
      ],
      "imports": [
        {
          "contract": "FungibleToken",
          "address": "0xFungibleToken"
        }
      ]
    }
  },
  "scripts": {
    // Similar structure for scripts
  }
}

License

MIT License

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL