contracts

package
v0.33.1-sc-m5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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) Args

func (c *Contract) Args() []cadence.Value

func (*Contract) Code

func (c *Contract) Code() string

func (*Contract) Dependencies

func (c *Contract) Dependencies() map[string]*Contract

func (*Contract) ID

func (c *Contract) ID() int64

func (*Contract) Name

func (c *Contract) Name() string

func (*Contract) Target

func (c *Contract) Target() flow.Address

func (*Contract) TranspiledCode

func (c *Contract) TranspiledCode() string

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) Load

func (f FilesystemLoader) Load(source string) ([]byte, error)

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

func NewResolver(code []byte) (*Resolver, error)

NewResolver creates a new resolver.

func (*Resolver) HasFileImports

func (r *Resolver) HasFileImports() bool

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.

Jump to

Keyboard shortcuts

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