invoker

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCacheSize

func WithCacheSize(size uint64) func(*Config)

WithCacheSize specifies the size of the cache the invoker uses.

Types

type Cache

type Cache interface {
	Get(key interface{}) (interface{}, bool)
	Set(key, value interface{}, cost int64) bool
}

Cache represents a key/value store to use as a cache.

type Config

type Config struct {
	CacheSize uint64
}

Config is the configuration for an invoker.

type Invoker

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

Invoker retrieves account information from and executes Cadence scripts against the Flow virtual machine.

func New

func New(index dps.Reader, options ...func(*Config)) (*Invoker, error)

New returns a new Invoker with the given configuration.

func (*Invoker) Account

func (i *Invoker) Account(height uint64, address flow.Address) (*flow.Account, error)

Account returns the account with the given address.

func (*Invoker) Key

func (i *Invoker) Key(height uint64, address flow.Address, index int) (*flow.AccountPublicKey, error)

Key returns the public key of the account with the given address.

func (*Invoker) Script

func (i *Invoker) Script(height uint64, script []byte, arguments []cadence.Value) (cadence.Value, error)

Script executes the given Cadence script and returns its result.

type VirtualMachine

type VirtualMachine interface {
	Run(ctx fvm.Context, proc fvm.Procedure, v state.View, programs *programs.Programs) error
	GetAccount(ctx fvm.Context, address flow.Address, v state.View, programs *programs.Programs) (*flow.Account, error)
}

VirtualMachine represents a Flow Virtual Machine on which to run scripts and retrieve accounts.

Jump to

Keyboard shortcuts

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