emulator

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmuOptsDefault = EmuOpts{
	Name:                `default`,
	NetName:             `emulator`,
	ConfigPaths:         []string{`flow.json`},
	LogLevel:            logrus.InfoLevel,
	LogLevelClient:      output.DebugLog,
	StorageLimitEnabled: true,
}

Functions

func GetProjectAccount

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

func NewEmuServer

func NewEmuServer(cfg *EmuConfig) *server.EmulatorServer

func NewEmuServerWithOpts

func NewEmuServerWithOpts(opts *EmuOpts) (*server.EmulatorServer, error)

func ServerConf

func ServerConf(cfg *EmuConfig) *server.Config

Types

type Emu

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

func NewEmu

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

type EmuAccount

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

type EmuClient

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

func NewEmuClient

func NewEmuClient(cfg *EmuConfig) (*EmuClient, error)

func (*EmuClient) CreateAccount

func (emu *EmuClient) CreateAccount(name string) (*EmuAccount, error)

func (*EmuClient) ResolveImports

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

func (*EmuClient) TxBuild

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

func (*EmuClient) TxSend

type EmuConfig

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

func LoadEmuConfig

func LoadEmuConfig(opts *EmuOpts) (*EmuConfig, error)

type EmuOpts

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

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