analyzer

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisResult

type AnalysisResult struct {
	FileName   string      `json:"fileName"`
	Type       string      `json:"type"`
	Parameters []Parameter `json:"parameters"`
	ReturnType string      `json:"returnType,omitempty"`
	Imports    []Import    `json:"imports"`
	Base64     string      `json:"base64,omitempty"`
	Tag        string      `json:"tag,omitempty"`
}

AnalysisResult represents the analysis result of a single Cadence file

type Analyzer

type Analyzer struct {
	Transactions  map[string]AnalysisResult
	Scripts       map[string]AnalysisResult
	Structs       map[string]Struct
	IncludeBase64 bool
	AddressesPath string // New field for storing addresses.json path
}

Analyzer is responsible for analyzing Cadence files

func New

func New() *Analyzer

New creates a new Analyzer instance

func (*Analyzer) AnalyzeDirectory

func (a *Analyzer) AnalyzeDirectory(dirPath string) error

AnalyzeDirectory analyzes all Cadence files in a directory and its subdirectories

func (*Analyzer) AnalyzeFile

func (a *Analyzer) AnalyzeFile(filePath string) (*AnalysisResult, error)

AnalyzeFile analyzes a single Cadence file and returns its analysis result

func (*Analyzer) FetchContractFromChain added in v0.0.3

func (a *Analyzer) FetchContractFromChain(contractName string, network string) error

FetchContractFromChain fetches contract code from Flow blockchain and analyzes its structures

func (*Analyzer) FetchContractFromChainSelective added in v0.0.3

func (a *Analyzer) FetchContractFromChainSelective(contractName string, network string, structNames map[string]bool) error

FetchContractFromChainSelective fetches contract code and analyzes only specific structures

func (*Analyzer) GetReport

func (a *Analyzer) GetReport() *Report

func (*Analyzer) ResolveNestedTypes added in v0.0.3

func (a *Analyzer) ResolveNestedTypes(network string) error

ResolveNestedTypes resolves nested type references by fetching contracts from chain

func (*Analyzer) SetIncludeBase64

func (a *Analyzer) SetIncludeBase64(include bool)

SetIncludeBase64 sets whether to include base64-encoded content in the analysis results

type Field

type Field struct {
	Name     string `json:"name"`
	TypeStr  string `json:"typeStr"`
	Optional bool   `json:"optional"`
	Access   string `json:"access"`
}

Field represents a field in a struct

type Import

type Import struct {
	Contract string `json:"contract"`
	Address  string `json:"address"`
}

Import represents a Cadence import statement

type Parameter

type Parameter struct {
	Name     string `json:"name"`
	TypeStr  string `json:"typeStr"`
	Optional bool   `json:"optional"`
}

Parameter represents a single parameter in a Cadence transaction or script

type Report

type Report struct {
	Transactions  map[string]AnalysisResult `json:"transactions"`
	Scripts       map[string]AnalysisResult `json:"scripts"`
	Structs       map[string]Struct         `json:"structs"`
	Addresses     map[string]interface{}    `json:"addresses,omitempty"`
	IncludeBase64 bool                      `json:"-"`
}

Report represents the complete analysis report

type SimpleMemoryGauge

type SimpleMemoryGauge struct{}

SimpleMemoryGauge implements common.MemoryGauge

func (*SimpleMemoryGauge) MeterMemory

func (g *SimpleMemoryGauge) MeterMemory(size common.MemoryUsage) error

type Struct

type Struct struct {
	Name     string  `json:"name"`
	Fields   []Field `json:"fields"`
	Access   string  `json:"access"`
	FileName string  `json:"fileName"`
}

Struct represents a Cadence struct declaration

Jump to

Keyboard shortcuts

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