examples

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: Apache-2.0 Imports: 10 Imported by: 9

README

Emulator Examples

This package contains code samples that interact with the Flow Emulator.

Running the emulator with the Flow CLI

The emulator is bundled with the Flow CLI, a command-line interface for working with Flow.

Installation

Follow these steps to install the Flow CLI.

Starting the server

Start the emulator by running the following command in this directory:

flow emulator start -v

# The -v flag enables verbose log output, which is useful for testing

Running the examples

In separate process, run any of the example programs below. Watch the emulator logs to see transaction output.

# Create a new account
GO111MODULE=on go run ./create_account/main.go
# Add a key to an existing account
GO111MODULE=on go run ./add_account_key/main.go
# Deploy a contract
GO111MODULE=on go run ./deploy_contract/main.go
# Query events
GO111MODULE=on go run ./query_events/main.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccount

func CreateAccount() (flow.Address, *flow.AccountKey, crypto.Signer)

func DeployContract

func DeployContract(code []byte) flow.Address

func Handle

func Handle(err error)

func RandomPrivateKey

func RandomPrivateKey() crypto.PrivateKey

RandomPrivateKey returns a randomly generated private key.

func ReadFile

func ReadFile(path string) []byte

ReadFile reads a file from the file system.

func RootAccount

func RootAccount(flowClient *client.Client) (flow.Address, *flow.AccountKey, crypto.Signer)

func WaitForSeal

func WaitForSeal(ctx context.Context, c *client.Client, id flow.Identifier) *flow.TransactionResult

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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