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 ¶
- Variables
- func GetProjectAccount(proj *flowkit.State, name string) (*flowkit.Account, error)
- func NewServer(cfg *Config) *server.EmulatorServer
- func NewServerWithOpts(opts *Opts) (*server.EmulatorServer, error)
- func ServerConf(cfg *Config) *server.Config
- type Account
- type Client
- func (client *Client) AccountCfg(name string) (*flowkit.Account, error)
- func (client *Client) CreateAccount(name string) (*Account, error)
- func (client *Client) CreateAccounts(names ...string) (map[string]*Account, error)
- func (client *Client) DeployProject(update bool) ([]*contracts.Contract, error)
- func (client *Client) EventsWatch(ctx context.Context, req EventsWatchReq) <-chan []TxResult
- func (client *Client) FetchEvents(ctx context.Context, req flowClient.EventRangeQuery) ([]TxResult, error)
- func (client *Client) GetAccount(name string) (*Account, error)
- func (client *Client) ResolveCode(code string, codepath string) ([]byte, error)
- func (client *Client) ResolveImports(code []byte, codepath string) ([]byte, error)
- func (client *Client) ScriptExec(req ScriptExecReq) (cadence.Value, error)
- func (client *Client) TxBuild(req TxBuildReq) (*flowkit.Transaction, error)
- func (client *Client) TxSend(req TxSendReq) (*flow.Transaction, *flow.TransactionResult, error)
- func (client *Client) TxSetCode(req TxSetCodeReq, tx *flowkit.Transaction) error
- func (client *Client) TxSign(signer string, tx *flowkit.Transaction) error
- type Config
- type Emu
- type EventsFetchReq
- type EventsWatchReq
- type Opts
- type ScriptExecReq
- type TxBuildReq
- type TxResult
- type TxSendReq
- type TxSetCodeReq
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetProjectAccount ¶
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 ¶
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
Flow *flowClient.Client
}
func (*Client) AccountCfg ¶ added in v0.1.6
func (*Client) CreateAccount ¶ added in v0.1.2
func (*Client) CreateAccounts ¶ added in v0.1.6
func (*Client) DeployProject ¶ added in v0.1.6
func (*Client) EventsWatch ¶ added in v0.1.7
func (client *Client) EventsWatch(ctx context.Context, req EventsWatchReq) <-chan []TxResult
func (*Client) FetchEvents ¶ added in v0.1.7
func (client *Client) FetchEvents(ctx context.Context, req flowClient.EventRangeQuery) ([]TxResult, error)
func (*Client) GetAccount ¶ added in v0.1.7
func (*Client) ResolveCode ¶ added in v0.1.2
func (*Client) ResolveImports ¶ added in v0.1.2
func (*Client) ScriptExec ¶ added in v0.1.2
func (client *Client) ScriptExec(req ScriptExecReq) (cadence.Value, error)
func (*Client) TxBuild ¶ added in v0.1.2
func (client *Client) TxBuild(req TxBuildReq) (*flowkit.Transaction, error)
func (*Client) TxSend ¶ added in v0.1.2
func (client *Client) TxSend(req TxSendReq) (*flow.Transaction, *flow.TransactionResult, error)
func (*Client) TxSetCode ¶ added in v0.1.6
func (client *Client) TxSetCode(req TxSetCodeReq, tx *flowkit.Transaction) error
type Config ¶ added in v0.1.2
type Config struct {
Opts *Opts
Proj *flowkit.State
Emulator *config.Emulator
ServiceAccount *flowkit.Account
PrivateKey crypto.PrivateKey
SigAlgo crypto.SignatureAlgorithm
HashAlgo crypto.HashAlgorithm
}
func LoadConfig ¶ added in v0.1.2
type EventsFetchReq ¶ added in v0.1.7
type EventsWatchReq ¶ added in v0.1.7
type ScriptExecReq ¶ added in v0.1.1
type TxBuildReq ¶ added in v0.1.6
type TxBuildReq struct {
Account string // Config account name, overridden by Payer, Proposer, and Authorizers
GasLimit uint64
Payer string // Config account name, overrides Account
Proposer string // Config account name, overrides Account
Authorizers []string // Config account names, overrides Account
}
type TxResult ¶ added in v0.1.7
type TxResult struct {
BlockID flow.Identifier
Height uint64
TxID flow.Identifier
Events []flow.Event
Err error
}
type TxSendReq ¶
type TxSendReq struct {
Account string // Config account name, overridden by Payer, Proposer, and Authorizers
GasLimit uint64
Code string
Codepath string
Args []string
ArgsJSON string
Payer string // Config account name, overrides Account
Proposer string // Config account name, overrides Account
Authorizers []string // Config account names, overrides Account
Signer string // Config account name, overrides Account
}
Click to show internal directories.
Click to hide internal directories.