Documentation ¶
Index ¶
- type Contract
- type CyclicImportError
- type FilesystemLoader
- type Loader
- type Preprocessor
- func (p *Preprocessor) AddContractSource(contractName, contractSource string, target flow.Address, args []cadence.Value) error
- func (p *Preprocessor) ContractBySource(contractSource string) *Contract
- func (p *Preprocessor) ContractDeploymentOrder() ([]*Contract, error)
- func (p *Preprocessor) ResolveImports() error
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func (*Contract) Dependencies ¶
func (*Contract) TranspiledCode ¶
type CyclicImportError ¶
type CyclicImportError struct {
Cycles [][]*Contract
}
func (*CyclicImportError) Error ¶
func (e *CyclicImportError) Error() string
type FilesystemLoader ¶
type FilesystemLoader struct {
Reader flowkit.ReaderWriter
}
FilesystemLoader defines contract loader from files.
func (FilesystemLoader) Normalize ¶
func (f FilesystemLoader) Normalize(base, relative string) string
type Loader ¶
type Loader interface { Load(source string) ([]byte, error) Normalize(base, relative string) string }
Loader defines methods for loading contract resource.
type Preprocessor ¶
type Preprocessor struct {
// contains filtered or unexported fields
}
Preprocessor loads the contract and replaces the imports with addresses.
func NewPreprocessor ¶
func NewPreprocessor(loader Loader, aliases map[string]string) *Preprocessor
NewPreprocessor creates a new preprocessor.
func (*Preprocessor) AddContractSource ¶
func (p *Preprocessor) AddContractSource( contractName, contractSource string, target flow.Address, args []cadence.Value, ) error
AddContractSource adds a new contract and the target to resolve the imports to.
func (*Preprocessor) ContractBySource ¶
func (p *Preprocessor) ContractBySource(contractSource string) *Contract
func (*Preprocessor) ContractDeploymentOrder ¶
func (p *Preprocessor) ContractDeploymentOrder() ([]*Contract, error)
func (*Preprocessor) ResolveImports ¶
func (p *Preprocessor) ResolveImports() error
ResolveImports for the contracts checking the import path and getting an alias or location of contract.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver handles resolving imports in Cadence code.
func NewResolver ¶
NewResolver creates a new resolver.
func (*Resolver) HasFileImports ¶
HasFileImports checks if there is a file import statement present in Cadence code.
func (*Resolver) ResolveImports ¶
func (r *Resolver) ResolveImports( codePath string, contracts []flowkit.Contract, aliases flowkit.Aliases, ) ([]byte, error)
ResolveImports resolves imports in code to addresses.
resolving is done based on code file path and is resolved to addresses defined in configuration for contracts or their aliases.