Help us shape the future of Go! Take the 2026 Go Developer Survey

get

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "get <block_id>",
	Short: "Get block info",
	Run: func(cmd *cobra.Command, args []string) {
		var block *flow.Block
		projectConf := new(cli.Config)
		if conf.Host == "" {
			projectConf = cli.LoadConfig()
		}
		host := projectConf.HostWithOverride(conf.Host)
		if conf.Latest {
			block = cli.GetLatestBlock(host)
		} else if len(conf.BlockID) > 0 {
			blockID := flow.HexToID(conf.BlockID)
			block = cli.GetBlockByID(host, blockID)
		} else if len(args) > 0 && len(args[0]) > 0 {
			blockID := flow.HexToID(args[0])
			block = cli.GetBlockByID(host, blockID)
		} else {
			block = cli.GetBlockByHeight(host, conf.BlockHeight)
		}
		printBlock(block, conf.Verbose)
		if conf.Events != "" {
			cli.GetBlockEvents(host, block.Height, conf.Events)
		}
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Host        string `flag:"host" info:"Flow Access API host address"`
	Latest      bool   `default:"false" flag:"latest" info:"Display latest block"`
	BlockID     string `default:"" flag:"id" info:"Display block by id"`
	BlockHeight uint64 `default:"0" flag:"height" info:"Display block by height"`
	Events      string `default:"" flag:"events" info:"List events of this type for the block"`
	Verbose     bool   `default:"false" flag:"verbose" info:"Display transactions in block"`
}

Jump to

Keyboard shortcuts

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