Documentation ¶
Index ¶
- Constants
- func FormatErrorMessage(message string, useColor bool) string
- func PrettyPrintError(err error, filename string, code string, useColor bool) string
- type Address
- type AddressLocation
- type BlockValue
- func (v BlockValue) Copy() interpreter.Value
- func (BlockValue) DynamicType(*interpreter.Interpreter) interpreter.DynamicType
- func (v BlockValue) GetMember(_ *interpreter.Interpreter, _ interpreter.LocationRange, name string) interpreter.Value
- func (BlockValue) GetOwner() *common.Address
- func (BlockValue) IsValue()
- func (v BlockValue) SetMember(_ *interpreter.Interpreter, _ interpreter.LocationRange, _ string, ...)
- func (BlockValue) SetOwner(_ *common.Address)
- func (v BlockValue) String() string
- type EmptyRuntimeInterface
- func (i *EmptyRuntimeInterface) AddAccountKey(address Address, publicKey []byte) error
- func (i *EmptyRuntimeInterface) CheckCode(address Address, code []byte) error
- func (i *EmptyRuntimeInterface) CreateAccount(publicKeys [][]byte) (address Address, err error)
- func (i *EmptyRuntimeInterface) EmitEvent(event Event)
- func (i *EmptyRuntimeInterface) GenerateUUID() uint64
- func (i *EmptyRuntimeInterface) GetSigningAccounts() []Address
- func (i *EmptyRuntimeInterface) GetValue(controller, owner, key []byte) (value []byte, err error)
- func (i *EmptyRuntimeInterface) Log(message string)
- func (i *EmptyRuntimeInterface) RemoveAccountKey(address Address, index int) (publicKey []byte, err error)
- func (i *EmptyRuntimeInterface) ResolveImport(location Location) ([]byte, error)
- func (i *EmptyRuntimeInterface) SetValue(controller, owner, key, value []byte) error
- func (i *EmptyRuntimeInterface) UpdateAccountCode(address Address, code []byte, checkPermission bool) error
- func (i *EmptyRuntimeInterface) ValueExists(controller, owner, key []byte) (exists bool, err error)
- type Error
- type Event
- type FileLocation
- type ImportResolver
- type Interface
- type InterfaceV2
- type InvalidTransactionCountError
- type InvalidTransactionParameterCountError
- type InvalidTransactionParameterTypeError
- type Location
- type LocationID
- type REPL
- type REPLLocation
- type Runtime
- type ScriptLocation
- type StringLocation
- type TransactionLocation
- type Type
- type Value
Constants ¶
View Source
const ( AddressPrefix = ast.AddressPrefix TransactionPrefix string = "T" ScriptPrefix string = "S" )
Variables ¶
This section is empty.
Functions ¶
func FormatErrorMessage ¶
Types ¶
type AddressLocation ¶
type AddressLocation = ast.AddressLocation
type BlockValue ¶
type BlockValue struct { Number uint64 ID [stdlib.BlockIDSize]byte NextBlock func() *BlockValue PreviousBlock func() *BlockValue }
func (BlockValue) Copy ¶
func (v BlockValue) Copy() interpreter.Value
func (BlockValue) DynamicType ¶
func (BlockValue) DynamicType(*interpreter.Interpreter) interpreter.DynamicType
func (BlockValue) GetMember ¶
func (v BlockValue) GetMember(_ *interpreter.Interpreter, _ interpreter.LocationRange, name string) interpreter.Value
func (BlockValue) GetOwner ¶
func (BlockValue) GetOwner() *common.Address
func (BlockValue) IsValue ¶
func (BlockValue) IsValue()
func (BlockValue) SetMember ¶
func (v BlockValue) SetMember(_ *interpreter.Interpreter, _ interpreter.LocationRange, _ string, _ interpreter.Value)
func (BlockValue) SetOwner ¶
func (BlockValue) SetOwner(_ *common.Address)
func (BlockValue) String ¶
func (v BlockValue) String() string
type EmptyRuntimeInterface ¶
type EmptyRuntimeInterface struct{}
func (*EmptyRuntimeInterface) AddAccountKey ¶
func (i *EmptyRuntimeInterface) AddAccountKey(address Address, publicKey []byte) error
func (*EmptyRuntimeInterface) CheckCode ¶
func (i *EmptyRuntimeInterface) CheckCode(address Address, code []byte) error
func (*EmptyRuntimeInterface) CreateAccount ¶
func (i *EmptyRuntimeInterface) CreateAccount(publicKeys [][]byte) (address Address, err error)
func (*EmptyRuntimeInterface) EmitEvent ¶
func (i *EmptyRuntimeInterface) EmitEvent(event Event)
func (*EmptyRuntimeInterface) GenerateUUID ¶
func (i *EmptyRuntimeInterface) GenerateUUID() uint64
func (*EmptyRuntimeInterface) GetSigningAccounts ¶
func (i *EmptyRuntimeInterface) GetSigningAccounts() []Address
func (*EmptyRuntimeInterface) GetValue ¶
func (i *EmptyRuntimeInterface) GetValue(controller, owner, key []byte) (value []byte, err error)
func (*EmptyRuntimeInterface) Log ¶
func (i *EmptyRuntimeInterface) Log(message string)
func (*EmptyRuntimeInterface) RemoveAccountKey ¶
func (i *EmptyRuntimeInterface) RemoveAccountKey(address Address, index int) (publicKey []byte, err error)
func (*EmptyRuntimeInterface) ResolveImport ¶
func (i *EmptyRuntimeInterface) ResolveImport(location Location) ([]byte, error)
func (*EmptyRuntimeInterface) SetValue ¶
func (i *EmptyRuntimeInterface) SetValue(controller, owner, key, value []byte) error
func (*EmptyRuntimeInterface) UpdateAccountCode ¶
func (i *EmptyRuntimeInterface) UpdateAccountCode(address Address, code []byte, checkPermission bool) error
func (*EmptyRuntimeInterface) ValueExists ¶
func (i *EmptyRuntimeInterface) ValueExists(controller, owner, key []byte) (exists bool, err error)
type Error ¶
type Error struct {
Err error
}
Error is the containing type for all errors produced by the runtime.
type FileLocation ¶
type FileLocation string
func (FileLocation) ID ¶
func (l FileLocation) ID() ast.LocationID
func (FileLocation) String ¶
func (l FileLocation) String() string
type Interface ¶
type Interface interface { // ResolveImport resolves an import of a program. ResolveImport(Location) ([]byte, error) // GetValue gets a value for the given key in the storage, controlled and owned by the given accounts. GetValue(owner, controller, key []byte) (value []byte, err error) // SetValue sets a value for the given key in the storage, controlled and owned by the given accounts. SetValue(owner, controller, key, value []byte) (err error) // CreateAccount creates a new account with the given public keys and code. CreateAccount(publicKeys [][]byte) (address Address, err error) // AddAccountKey appends a key to an account. AddAccountKey(address Address, publicKey []byte) error // RemoveAccountKey removes a key from an account by index. RemoveAccountKey(address Address, index int) (publicKey []byte, err error) // CheckCode checks the validity of the code. CheckCode(address Address, code []byte) (err error) // UpdateAccountCode updates the code associated with an account. UpdateAccountCode(address Address, code []byte, checkPermission bool) (err error) // GetSigningAccounts returns the signing accounts. GetSigningAccounts() []Address // Log logs a string. Log(string) // EmitEvent is called when an event is emitted by the runtime. EmitEvent(Event) }
type InterfaceV2 ¶
type InvalidTransactionCountError ¶
type InvalidTransactionCountError struct {
Count int
}
func (InvalidTransactionCountError) Error ¶
func (e InvalidTransactionCountError) Error() string
type InvalidTransactionParameterCountError ¶
func (InvalidTransactionParameterCountError) Error ¶
func (e InvalidTransactionParameterCountError) Error() string
type InvalidTransactionParameterTypeError ¶
func (InvalidTransactionParameterTypeError) Error ¶
func (e InvalidTransactionParameterTypeError) Error() string
type LocationID ¶
type LocationID = ast.LocationID
type REPL ¶
type REPL struct {
// contains filtered or unexported fields
}
func (*REPL) Suggestions ¶
type REPLLocation ¶
type REPLLocation struct{}
func (REPLLocation) ID ¶
func (l REPLLocation) ID() LocationID
func (REPLLocation) String ¶
func (l REPLLocation) String() string
type Runtime ¶
type Runtime interface { // ExecuteScript executes the given script. // // This function returns an error if the program has errors (e.g syntax errors, type errors), // or if the execution fails. ExecuteScript(script []byte, runtimeInterface Interface, location Location) (Value, error) // ExecuteTransaction executes the given transaction. // // This function returns an error if the program has errors (e.g syntax errors, type errors), // or if the execution fails. ExecuteTransaction(script []byte, runtimeInterface Interface, location Location) error // ParseAndCheckProgram parses and checks the given code without executing the program. // // This function returns an error if the program contains any syntax or semantic errors. ParseAndCheckProgram(code []byte, runtimeInterface Interface, location Location) error }
Runtime is a runtime capable of executing Cadence.
func NewInterpreterRuntime ¶
func NewInterpreterRuntime() Runtime
NewInterpreterRuntime returns a interpreter-based version of the Flow runtime.
type ScriptLocation ¶
type ScriptLocation []byte
func (ScriptLocation) ID ¶
func (l ScriptLocation) ID() ast.LocationID
func (ScriptLocation) String ¶
func (l ScriptLocation) String() string
type StringLocation ¶
type StringLocation = ast.StringLocation
type TransactionLocation ¶
type TransactionLocation []byte
func (TransactionLocation) ID ¶
func (l TransactionLocation) ID() ast.LocationID
func (TransactionLocation) String ¶
func (l TransactionLocation) String() string
type Value ¶
type Value struct { interpreter.Value // contains filtered or unexported fields }
A Value is a Cadence value emitted by the runtime.
Runtime values can be converted to a simplified representation and then further encoded for transport or use in other languages and environments.
func (Value) Interpreter ¶
func (v Value) Interpreter() *interpreter.Interpreter
Source Files ¶
Click to show internal directories.
Click to hide internal directories.