super

package
v1.20.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCadenceDirectory = "cadence"
	ContractType            = "contract"
	TransactionType         = "transaction"
	ScriptType              = "script"
)

Variables

View Source
var DevCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "dev",
		Short:   "Build your Flow project",
		Args:    cobra.ExactArgs(0),
		Example: "flow dev",
		GroupID: "super",
	},
	Flags: &devFlags,
	RunS:  dev,
}
View Source
var FlixCmd = &cobra.Command{
	Use:              "flix",
	Short:            "execute, generate, package",
	TraverseChildren: true,
	GroupID:          "tools",
}
View Source
var GenerateCommand = &cobra.Command{
	Use:     "generate",
	Short:   "Generate template files for common Cadence code",
	GroupID: "super",
	Aliases: []string{"g"},
}
View Source
var GenerateContractCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "contract <name>",
		Short:   "Generate Cadence smart contract template",
		Example: "flow generate contract HelloWorld",
		Args:    cobra.ExactArgs(1),
	},
	Flags: &generateFlags,
	RunS:  generateContract,
}
View Source
var GenerateScriptCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "script <name>",
		Short:   "Generate a Cadence script template",
		Example: "flow generate script SomeScript",
		Args:    cobra.ExactArgs(1),
	},
	Flags: &generateFlags,
	RunS:  generateScript,
}
View Source
var GenerateTransactionCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "transaction <name>",
		Short:   "Generate a Cadence transaction template",
		Example: "flow generate transaction SomeTransaction",
		Args:    cobra.ExactArgs(1),
	},
	Flags: &generateFlags,
	RunS:  generateTransaction,
}
View Source
var SetupCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "init <project name>",
		Short:   "Start a new Flow project",
		Example: "flow setup my-project",
		Args:    cobra.MaximumNArgs(1),
		GroupID: "super",
	},
	Flags: &setupFlags,
	Run:   create,
}

TODO: Add --config-only flag

Functions

This section is empty.

Types

type Contract added in v1.20.0

type Contract struct {
	Name     string
	Template string
	Account  string
	Data     map[string]interface{}
}

Contract contains properties for contracts

func (Contract) GetAccount added in v1.20.0

func (c Contract) GetAccount() string

GetAccount returns the account of the contract

func (Contract) GetData added in v1.20.0

func (c Contract) GetData() map[string]interface{}

GetData returns the data of the contract

func (Contract) GetName added in v1.20.0

func (c Contract) GetName() string

GetName returns the name of the contract

func (Contract) GetTemplate added in v1.20.0

func (c Contract) GetTemplate() string

GetTemplate returns the template of the contract

type Generator added in v1.20.0

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator added in v1.20.0

func NewGenerator(directory string, state *flowkit.State, logger output.Logger, disableLogs, saveState bool) *Generator

func (*Generator) Create added in v1.20.0

func (g *Generator) Create(typeNames TemplateMap) error

type ScriptTemplate added in v1.20.0

type ScriptTemplate struct {
	Name     string
	Template string
	Data     map[string]interface{}
}

ScriptTemplate contains only a name property for scripts and transactions

func (ScriptTemplate) GetAccount added in v1.20.0

func (o ScriptTemplate) GetAccount() string

GetAccount returns an empty string for scripts and transactions

func (ScriptTemplate) GetData added in v1.20.0

func (o ScriptTemplate) GetData() map[string]interface{}

GetData returns the data of the script or transaction

func (ScriptTemplate) GetName added in v1.20.0

func (o ScriptTemplate) GetName() string

GetName returns the name of the script or transaction

func (ScriptTemplate) GetTemplate added in v1.20.0

func (o ScriptTemplate) GetTemplate() string

GetTemplate returns an empty string for scripts and transactions

type TemplateItem added in v1.20.0

type TemplateItem interface {
	GetName() string
	GetTemplate() string
	GetAccount() string
	GetData() map[string]interface{}
}

TemplateItem is an interface for different template types

type TemplateMap added in v1.20.0

type TemplateMap map[string][]TemplateItem

TemplateMap holds all templates with flexibility

type TransactionTemplate added in v1.20.0

type TransactionTemplate struct {
	Name     string
	Template string
	Data     map[string]interface{}
}

TransactionTemplate contains only a name property for scripts and transactions

func (TransactionTemplate) GetAccount added in v1.20.0

func (o TransactionTemplate) GetAccount() string

GetAccount returns an empty string for scripts and transactions

func (TransactionTemplate) GetData added in v1.20.0

func (o TransactionTemplate) GetData() map[string]interface{}

GetData returns the data of the script or transaction

func (TransactionTemplate) GetName added in v1.20.0

func (o TransactionTemplate) GetName() string

GetName returns the name of the script or transaction

func (TransactionTemplate) GetTemplate added in v1.20.0

func (o TransactionTemplate) GetTemplate() string

GetTemplate returns an empty string for scripts and transactions

Jump to

Keyboard shortcuts

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