Documentation ¶
Index ¶
- Constants
- func FillPremineMap(premineMap map[types.Address]*chain.GenesisAccount, ...) error
- func FormatKV(in []string) string
- func FormatList(in []string) string
- func GenerateFlagDesc(flagEl string, descriptor FlagDescriptor) string
- func GenerateHelp(synopsys string, usage string, flagMap map[string]FlagDescriptor) string
- func GenerateUsage(baseCommand string, flagMap map[string]FlagDescriptor) string
- func HandleSignals(closeFn func(), ui cli.Ui) int
- func MergeMaps(maps ...map[string]interface{}) map[string]interface{}
- func WriteGenesisToDisk(chain *chain.Chain, genesisPath string) error
- type Base
- type CommandResult
- type Config
- type FlagDefiner
- type FlagDescriptor
- type FlagSetter
- type FormatterFlag
- type GRPCFlag
- type GenesisGenError
- type HelpGenerator
- type Network
- type Telemetry
- type TxPool
Constants ¶
const ( GenesisFileName = "./genesis.json" DefaultChainName = "example" DefaultChainID = 100 DefaultPremineBalance = "0x3635C9ADC5DEA00000" // 1000 ETH DefaultConsensus = "pow" DefaultMaxSlots = 4096 GenesisGasUsed = 458752 // 0x70000 GenesisGasLimit = 5242880 // 0x500000 )
const ( StatError = "StatError" ExistsError = "ExistsError" )
Variables ¶
This section is empty.
Functions ¶
func FillPremineMap ¶
func FillPremineMap( premineMap map[types.Address]*chain.GenesisAccount, premine helperFlags.ArrayFlags, ) error
FillPremineMap fills the premine map for the genesis.json file with passed in balances and accounts
func FormatList ¶
FormatList formats a list, using a specific blank value replacement
func GenerateFlagDesc ¶
func GenerateFlagDesc(flagEl string, descriptor FlagDescriptor) string
GenerateFlagDesc generates the flag descriptions in a readable format
func GenerateHelp ¶
func GenerateHelp(synopsys string, usage string, flagMap map[string]FlagDescriptor) string
GenerateHelp is a utility function called by every command's Help() method
func GenerateUsage ¶
func GenerateUsage(baseCommand string, flagMap map[string]FlagDescriptor) string
GenerateUsage is a helper function for generating command usage text
func HandleSignals ¶
HandleSignals is a helper method for handling signals sent to the console Like stop, error, etc.
Types ¶
type Base ¶
type Base struct { UI cli.Ui FlagMap map[string]FlagDescriptor }
Base has common fields for each command
func (*Base) DefineFlags ¶
func (c *Base) DefineFlags(ds ...FlagDefiner)
DefineFlags initializes and defines the common command flags
func (*Base) NewFlagSet ¶
func (m *Base) NewFlagSet(n string, ss ...FlagSetter) *flag.FlagSet
FlagSet initializes Flag Set
type CommandResult ¶
type CommandResult interface { // Return result for stdout Output() string }
type Config ¶
type Config struct { Chain string `json:"chain_config"` Secrets string `json:"secrets_config"` DataDir string `json:"data_dir"` BlockGasTarget string `json:"block_gas_target"` GRPCAddr string `json:"grpc_addr"` JSONRPCAddr string `json:"jsonrpc_addr"` Telemetry *Telemetry `json:"telemetry"` Network *Network `json:"network"` Seal bool `json:"seal"` TxPool *TxPool `json:"tx_pool"` LogLevel string `json:"log_level"` Dev bool `json:"dev_mode"` DevInterval uint64 `json:"dev_interval"` Join string `json:"join_addr"` Consensus map[string]interface{} `json:"consensus"` }
Config defines the server configuration params
func BootstrapDevCommand ¶
BootstrapDevCommand creates a config and generates the dev genesis file
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default server configuration
type FlagDefiner ¶
type FlagDefiner interface {
DefineFlags(map[string]FlagDescriptor)
}
type FlagDescriptor ¶
type FlagDescriptor struct { Description string // Flag description Arguments []string // Arguments list ArgumentsOptional bool // Flag indicating if flag arguments are optional FlagOptional bool }
FlagDescriptor contains the description elements for a command flag
func (*FlagDescriptor) AreArgumentsOptional ¶
func (fd *FlagDescriptor) AreArgumentsOptional() bool
AreArgumentsOptional checks if the flag arguments are optional
func (*FlagDescriptor) GetArgumentsList ¶
func (fd *FlagDescriptor) GetArgumentsList() []string
GetArgumentsList gets the list of arguments for the flag
func (*FlagDescriptor) GetDescription ¶
func (fd *FlagDescriptor) GetDescription() string
GetDescription gets the flag description
func (*FlagDescriptor) IsFlagOptional ¶
func (fd *FlagDescriptor) IsFlagOptional() bool
IsFlagOptional checks if the flag itself is optional
type FlagSetter ¶
type FormatterFlag ¶
FormatterFlag is a helper utility for formatter
func (*FormatterFlag) DefineFlags ¶
func (f *FormatterFlag) DefineFlags(flagMap map[string]FlagDescriptor)
DefineFlags sets some flags for json output
func (*FormatterFlag) FlagSet ¶
func (f *FormatterFlag) FlagSet(fs *flag.FlagSet)
FlagSet adds some default commands for json flag
func (*FormatterFlag) OutputError ¶
func (f *FormatterFlag) OutputError(e error)
OutputError is helper function to print output with different format
func (*FormatterFlag) OutputResult ¶
func (f *FormatterFlag) OutputResult(r CommandResult)
OutputResult is helper function to print result with different format
type GRPCFlag ¶
type GRPCFlag struct {
Addr string
}
GRPCFlag is a helper utility for GRPC flag and provides gRPC connection
func (*GRPCFlag) Conn ¶
func (g *GRPCFlag) Conn() (*grpc.ClientConn, error)
Conn returns a grpc connection
func (*GRPCFlag) DefineFlags ¶
func (g *GRPCFlag) DefineFlags(flagMap map[string]FlagDescriptor)
DefineFlags sets some flags for grpc settings
type GenesisGenError ¶
type GenesisGenError struct {
// contains filtered or unexported fields
}
GenesisGenError is a specific error type for generating genesis
func VerifyGenesisExistence ¶
func VerifyGenesisExistence(genesisPath string) *GenesisGenError
VerifyGenesisExistence checks if the genesis file at the specified path is present
func (*GenesisGenError) GetMessage ¶
func (g *GenesisGenError) GetMessage() string
GetMessage returns the message of the genesis generation error
func (*GenesisGenError) GetType ¶
func (g *GenesisGenError) GetType() string
GetType returns the type of the genesis generation error
type HelpGenerator ¶
type HelpGenerator interface {
DefineFlags()
}
type Network ¶
type Network struct { NoDiscover bool `json:"no_discover"` Addr string `json:"libp2p_addr"` NatAddr string `json:"nat_addr"` Dns string `json:"dns_addr"` MaxPeers uint64 `json:"max_peers"` }
Network defines the network configuration params