emulator

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package emulator provides helpful wrappers around flow-cli packages and types, providing a high-level interface for common flow development tasks such as running an emulator with non-default configuration settings, creating accounts, deploying contracts, replacing import statements in cadence files, and sending transactions and script executions to the emulator.

Index

Constants

This section is empty.

Variables

View Source
var OptsDefault = Opts{
	Name:                `default`,
	NetName:             `emulator`,
	ConfigPaths:         []string{`flow.json`},
	LogLevel:            logrus.InfoLevel,
	LogLevelClient:      output.InfoLog,
	StorageLimitEnabled: true,
	ClientOnly:          false,
}

Functions

func GetProjectAccount

func GetProjectAccount(proj *project.Project, name string) (*project.Account, error)

func NewServer added in v0.1.2

func NewServer(cfg *Config) *server.EmulatorServer

func NewServerWithOpts added in v0.1.2

func NewServerWithOpts(opts *Opts) (*server.EmulatorServer, error)

func ServerConf

func ServerConf(cfg *Config) *server.Config

Types

type Account added in v0.1.2

type Account struct {
	Name    string
	Key     crypto.PrivateKey
	Account *flow.Account
}

type Client added in v0.1.2

type Client struct {
	Net      *config.Network
	Gateway  *gateway.GrpcGateway
	Services *services.Services
	Logger   output.Logger
	Config   *Config
}

func NewClient added in v0.1.2

func NewClient(cfg *Config) (*Client, error)

func (*Client) CreateAccount added in v0.1.2

func (emu *Client) CreateAccount(name string) (*Account, error)

func (*Client) ResolveCode added in v0.1.2

func (emu *Client) ResolveCode(code string, codepath string) ([]byte, error)

func (*Client) ResolveImports added in v0.1.2

func (emu *Client) ResolveImports(code []byte, codepath string) ([]byte, error)

func (*Client) ScriptExec added in v0.1.2

func (emu *Client) ScriptExec(req ScriptExecReq) (cadence.Value, error)

func (*Client) TxBuild added in v0.1.2

func (emu *Client) TxBuild(
	accountName string,
	gasLimit uint64,
) (*project.Transaction, *project.Account, error)

func (*Client) TxSend added in v0.1.2

func (emu *Client) TxSend(req TxSendReq) (*flow.Transaction, *flow.TransactionResult, error)

type Config added in v0.1.2

type Config struct {
	Opts           *Opts
	Proj           *project.Project
	Emulator       *config.Emulator
	ServiceAccount *project.Account
	PrivateKey     crypto.PrivateKey
	SigAlgo        crypto.SignatureAlgorithm
	HashAlgo       crypto.HashAlgorithm
}

func LoadConfig added in v0.1.2

func LoadConfig(opts *Opts) (*Config, error)

type Emu

type Emu struct {
	Config *Config
	Server *server.EmulatorServer
	Client *Client
}

func NewEmu

func NewEmu(opts *Opts) (*Emu, error)

type Opts added in v0.1.2

type Opts struct {
	Name                string
	NetName             string
	ConfigPaths         []string
	LogLevel            logrus.Level
	LogLevelClient      int
	StorageLimitEnabled bool
	ClientOnly          bool
}

type ScriptExecReq added in v0.1.1

type ScriptExecReq struct {
	Code     string
	Codepath string
	Args     []string
	ArgsJSON string
}

type TxSendReq

type TxSendReq struct {
	Code        string
	Codepath    string
	AccountName string
	GasLimit    uint64
	Args        []string
	ArgsJSON    string
}

Jump to

Keyboard shortcuts

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