gas

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "gas",
	Short: "Gas utilities",
}
View Source
var PriceCommand = &cobra.Command{
	Use:    "price",
	Short:  "Gets the current gas price in Gwei",
	PreRun: cli.Connect,
	Args:   cobra.NoArgs,
	Run: func(cmd *cobra.Command, args []string) {
		price, err := cli.Conn.SuggestGasPrice(context.Background())
		cli.CheckErr(cmd, err)
		gwei := units.ConvertInt(price, units.Wei, units.Gwei)
		cmd.Printf("%s gwei\n", gwei.Text('f', 2))
	},
}

Functions

func Flag

func Flag(cmd *cobra.Command)

Flag adds the 'gasPrice' flag to the given command.

func GetFlagValue added in v0.0.3

func GetFlagValue(cmd *cobra.Command) *big.Int

GetFlagValue returns the flag value converted from Gwei to Wei.

func GetPrice

func GetPrice(cmd *cobra.Command, args []string) (*big.Int, error)

GasPrice returns the gas price flag value, or the suggested gas price when unset.

Types

This section is empty.

Jump to

Keyboard shortcuts

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