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

blocks

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:              "blocks",
	Short:            "Utilities to read blocks",
	TraverseChildren: true,
}
View Source
var GetCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "get <block_id|latest|block_height>",
		Short:   "Get block info",
		Example: "flow blocks get latest --network testnet",
		Args:    cobra.ExactArgs(1),
	},
	Flags: &blockFlags,
	Run: func(
		cmd *cobra.Command,
		args []string,
		globalFlags command.GlobalFlags,
		services *services.Services,
	) (command.Result, error) {
		if blockFlags.Latest || blockFlags.BlockID != "" || blockFlags.BlockHeight != 0 {
			return nil, fmt.Errorf("⚠️  No longer supported: use command argument.")
		}

		block, events, collections, err := services.Blocks.GetBlock(
			args[0],
			blockFlags.Events,
			blockFlags.Verbose,
		)
		if err != nil {
			return nil, err
		}

		return &BlockResult{
			block:       block,
			events:      events,
			verbose:     blockFlags.Verbose,
			collections: collections,
		}, nil
	},
}

Functions

This section is empty.

Types

type BlockResult

type BlockResult struct {
	// contains filtered or unexported fields
}

BlockResult

func (*BlockResult) JSON

func (r *BlockResult) JSON() interface{}

JSON convert result to JSON

func (*BlockResult) Oneliner

func (r *BlockResult) Oneliner() string

Oneliner show result as one liner grep friendly

func (*BlockResult) String

func (r *BlockResult) String() string

String convert result to string

Jump to

Keyboard shortcuts

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