v1_1

package
v1.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractContractName

func ExtractContractName(importStr string) (string, error)

func GenerateFlixID

func GenerateFlixID(flix *InteractionTemplate) (string, error)

func ShaHex

func ShaHex(value interface{}, debugKey string) string

Types

type Argument

type Argument struct {
	Expression InteractionExpression `json:"Expression"`
	Label      string                `json:"Label"`
}

type Cadence

type Cadence struct {
	Body        string       `json:"body"`
	NetworkPins []NetworkPin `json:"network_pins"`
}

type Contract

type Contract struct {
	Contract string    `json:"contract"`
	Networks []Network `json:"networks"`
}

type ContractInfos

type ContractInfos map[string]NetworkAddressMap

Same structure as core contracts, keyed by contract name

type Data

type Data struct {
	Type         string       `json:"type"`
	Interface    string       `json:"interface"`
	Messages     []Message    `json:"messages"`
	Cadence      Cadence      `json:"cadence"`
	Dependencies []Dependency `json:"dependencies"`
	Parameters   []Parameter  `json:"parameters"`
	Output       *Parameter   `json:"output,omitempty"`
}

type Dependency

type Dependency struct {
	Contracts []Contract `json:"contracts"`
}

type Generator

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

func NewTemplateGenerator

func NewTemplateGenerator(contractInfos ContractInfos, logger output.Logger) (*Generator, error)

func (Generator) CreateTemplate

func (g Generator) CreateTemplate(ctx context.Context, code string, preFill string) (string, error)

func (*Generator) GenerateDepPinDepthFirst

func (g *Generator) GenerateDepPinDepthFirst(ctx context.Context, flowkit *flowkit.Flowkit, address string, name string, height uint64) (details *PinDetail, err error)

func (*Generator) LookupImportContractInfo

func (g *Generator) LookupImportContractInfo(contractName string) []Network

type I18n

type I18n struct {
	Tag         string `json:"tag"`
	Translation string `json:"translation"`
}

type Identifier

type Identifier struct {
	Identifier string `json:"Identifier"`
}

type IdentifierExpression

type IdentifierExpression struct {
	Identifier Identifier `json:"Identifier"`
}

type Import

type Import struct {
	Pin                string   `json:"pin"`
	PinSelf            string   `json:"pin_self"`
	PinContractName    string   `json:"pin_contract_name"`
	PinContractAddress string   `json:"pin_contract_address"`
	Imports            []Import `json:"imports"` // Recursive imports, if any
}

type InteractionExpression

type InteractionExpression struct {
	InvokedExpression IdentifierExpression    `json:"InvokedExpression"`
	Arguments         []Argument              `json:"Arguments"`
	Value             string                  `json:"Value"`  // Used for string expressions
	Type              string                  `json:"Type"`   // Used for string expressions
	Values            []InteractionExpression `json:"Values"` // Used for array expressions
}

type InteractionTemplate

type InteractionTemplate struct {
	FType    string `json:"f_type"`
	FVersion string `json:"f_version"`
	ID       string `json:"id"`
	Data     Data   `json:"data"`
}

func ParseFlix

func ParseFlix(template string) (*InteractionTemplate, error)

func (*InteractionTemplate) DetermineCadenceType

func (template *InteractionTemplate) DetermineCadenceType(program *ast.Program) error

func (InteractionTemplate) EncodeRLP

func (flix InteractionTemplate) EncodeRLP() (result string, err error)

func (*InteractionTemplate) Init

func (t *InteractionTemplate) Init()

func (*InteractionTemplate) IsScript

func (t *InteractionTemplate) IsScript() bool

func (*InteractionTemplate) IsTransaction

func (t *InteractionTemplate) IsTransaction() bool

func (*InteractionTemplate) ParsePragma

func (template *InteractionTemplate) ParsePragma(program *ast.Program) error

func (*InteractionTemplate) ProcessImports

func (template *InteractionTemplate) ProcessImports(cadenceCode string)

func (*InteractionTemplate) ProcessParameters

func (template *InteractionTemplate) ProcessParameters(program *ast.Program) error

func (*InteractionTemplate) ReplaceCadenceImports

func (t *InteractionTemplate) ReplaceCadenceImports(networkName string) (string, error)

type InteractionTemplateMessages

type InteractionTemplateMessages []Message

func (InteractionTemplateMessages) GetDescription

func (msgs InteractionTemplateMessages) GetDescription(placeholder string) string

func (InteractionTemplateMessages) GetTitle

func (msgs InteractionTemplateMessages) GetTitle(placeholder string) string

type Message

type Message struct {
	Key  string `json:"key"`
	I18n []I18n `json:"i18n"`
}

type Network

type Network struct {
	Network                  string     `json:"network"`
	Address                  string     `json:"address"`
	DependencyPinBlockHeight uint64     `json:"dependency_pin_block_height"`
	DependencyPin            *PinDetail `json:"dependency_pin,omitempty"`
}

type NetworkAddressMap

type NetworkAddressMap map[string]string

Same structure as core contracts, using config network names

type NetworkPin

type NetworkPin struct {
	Network string `json:"network"`
	PinSelf string `json:"pin_self"`
}

type Parameter

type Parameter struct {
	Label    string    `json:"label"`
	Index    int       `json:"index"`
	Type     string    `json:"type"`
	Messages []Message `json:"messages"`
}

type PinDetail

type PinDetail struct {
	Pin                string      `json:"pin"`
	PinSelf            string      `json:"pin_self"`
	PinContractName    string      `json:"pin_contract_name"`
	PinContractAddress string      `json:"pin_contract_address"`
	Imports            []PinDetail `json:"imports"`
}

func (*PinDetail) CalculatePin

func (p *PinDetail) CalculatePin(blockHeight uint64)

type PragmaDeclaration

type PragmaDeclaration struct {
	Expression InteractionExpression `json:"Expression"`
}

Jump to

Keyboard shortcuts

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