commands

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: Apache-2.0 Imports: 33 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FlagAddress           = "address"
	FlagEyes              = "eyes"
	FlagWithoutTendermint = "without-tendermint"
)

nolint

View Source
const EyesCacheSize = 10000

TODO: move to config file

View Source
const (
	FlagLogLevel = "log_level"
)

Variables

View Source
var (
	InitCmd = &cobra.Command{
		Use:   "init [address]",
		Short: "Initialize a basecoin blockchain",
		RunE:  initCmd,
	}
)

commands

View Source
var KeyJSON = `` /* 368-byte string literal not displayed */

TODO: remove this once not needed for relay

View Source
var PrivValJSON = `` /* 475-byte string literal not displayed */
View Source
var RelayCmd = &cobra.Command{
	Use:   "relay",
	Short: "Relay ibc packets between two chains",
}
View Source
var RelayInitCmd = &cobra.Command{
	Use:   "init",
	Short: "Register both chains with each other, to prepare the relayer to run",
	RunE:  relayInitCmd,
}
View Source
var RelayStartCmd = &cobra.Command{
	Use:   "start",
	Short: "Start basecoin relayer to relay IBC packets between chains",
	RunE:  relayStartCmd,
}
View Source
var RootCmd = &cobra.Command{
	Use:   "basecoin",
	Short: "A cryptocurrency framework in Golang based on Tendermint-Core",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
		level := viper.GetString(FlagLogLevel)
		logger, err = tmflags.ParseLogLevel(level, logger, defaultLogLevel)
		if err != nil {
			return err
		}
		if viper.GetBool(cli.TraceFlag) {
			logger = log.NewTracingLogger(logger)
		}
		return nil
	},
}
View Source
var StartCmd = &cobra.Command{
	Use:   "start",
	Short: "Start basecoin",
	RunE:  startCmd,
}
View Source
var UnsafeResetAllCmd = &cobra.Command{
	Use:   "unsafe_reset_all",
	Short: "Reset all blockchain data",
	RunE:  unsafeResetAllCmd,
}
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Show version info",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println(version.Version)
	},
}

Functions

func GetGenesisJSON

func GetGenesisJSON(chainID, addr string) string

GetGenesisJSON returns a new tendermint genesis with Basecoin app_options that grant a large amount of "mycoin" to a single address TODO: A better UX for generating genesis files

func NewIBCPlugin

func NewIBCPlugin() *ibc.IBCPlugin

returns a new IBC plugin to be registered with Basecoin

func Query

func Query(tmAddr string, key []byte) (*abci.ResultQuery, error)

func QuickVersionCmd

func QuickVersionCmd(version string) *cobra.Command

Returns a version command based on version input

func RegisterFlags

func RegisterFlags(c *cobra.Command, flags []Flag2Register)

register flag utils

func RegisterPersistentFlags

func RegisterPersistentFlags(c *cobra.Command, flags []Flag2Register)

func RegisterStartPlugin

func RegisterStartPlugin(name string, newPlugin func() types.Plugin)

RegisterStartPlugin is used to enable a plugin

func StripHex

func StripHex(s string) string

Types

type Address

type Address [20]byte

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(addrHex []byte) error

type Flag2Register

type Flag2Register struct {
	Pointer interface{}
	Use     string
	Value   interface{}
	Desc    string
}

Quickly registering flags can be quickly achieved through using the utility functions RegisterFlags, and RegisterPersistentFlags. Ex:

flags := []Flag2Register{
	{&myStringFlag, "mystringflag", "foobar", "description of what this flag does"},
	{&myBoolFlag, "myboolflag", false, "description of what this flag does"},
	{&myInt64Flag, "myintflag", 333, "description of what this flag does"},
}
RegisterFlags(MyCobraCmd, flags)

type Key

type Key struct {
	Address Address        `json:"address"`
	PubKey  crypto.PubKey  `json:"pub_key"`
	PrivKey crypto.PrivKey `json:"priv_key"`
}

func LoadKey

func LoadKey(keyFile string) (*Key, error)

func (*Key) Sign

func (k *Key) Sign(msg []byte) crypto.Signature

Implements Signer

Jump to

Keyboard shortcuts

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