Documentation ¶
Index ¶
- Variables
- func AddCommands(ctx *Context, cdc *codec.Codec, rootCmd *cobra.Command, appInit AppInit, ...)
- func ExportCmd(ctx *Context, cdc *codec.Codec, appExporter AppExporter) *cobra.Command
- func ExternalIP() (string, error)
- func FreeTCPAddr() (addr, port string, err error)
- func GenerateCoinKey() (sdk.AccAddress, string, error)
- func GenerateSaveCoinKey(clientRoot, keyName, keyPass string, overwrite bool) (sdk.AccAddress, string, error)
- func InsertKeyJSON(cdc *codec.Codec, baseJSON []byte, key string, value json.RawMessage) ([]byte, error)
- func PersistentPreRunEFn(context *Context) func(*cobra.Command, []string) error
- func SetupViper(t *testing.T) func()
- func ShowAddressCmd(ctx *Context) *cobra.Command
- func ShowNodeIDCmd(ctx *Context) *cobra.Command
- func ShowValidatorCmd(ctx *Context) *cobra.Command
- func SimpleAppGenState(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)
- func SimpleAppGenTx(cdc *codec.Codec, pk crypto.PubKey) (appGenTx, cliPrint json.RawMessage, validator types.GenesisValidator, ...)
- func StartCmd(ctx *Context, appCreator AppCreator) *cobra.Command
- func TrapSignal(cleanupFunc func())
- func UnsafeResetAllCmd(ctx *Context) *cobra.Command
- type AppCreator
- type AppExporter
- type AppInit
- type Context
- type SimpleGenTx
Constants ¶
This section is empty.
Variables ¶
var DefaultAppInit = AppInit{ AppGenState: SimpleAppGenState, }
simple default application init
Functions ¶
func AddCommands ¶
func AddCommands( ctx *Context, cdc *codec.Codec, rootCmd *cobra.Command, appInit AppInit, appCreator AppCreator, appExport AppExporter)
add server commands
func ExternalIP ¶
https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go TODO there must be a better way to get external IP
func FreeTCPAddr ¶
Get a free address for a test tendermint server protocol is either tcp, http, etc
func GenerateCoinKey ¶
func GenerateCoinKey() (sdk.AccAddress, string, error)
GenerateCoinKey returns the address of a public key, along with the secret phrase to recover the private key.
func GenerateSaveCoinKey ¶
func GenerateSaveCoinKey(clientRoot, keyName, keyPass string, overwrite bool) (sdk.AccAddress, string, error)
GenerateSaveCoinKey returns the address of a public key, along with the secret phrase to recover the private key.
func InsertKeyJSON ¶
func InsertKeyJSON(cdc *codec.Codec, baseJSON []byte, key string, value json.RawMessage) ([]byte, error)
InsertKeyJSON inserts a new JSON field/key with a given value to an existing JSON message. An error is returned if any serialization operation fails.
NOTE: The ordering of the keys returned as the resulting JSON message is non-deterministic, so the client should not rely on key ordering.
func PersistentPreRunEFn ¶
PersistentPreRunEFn returns a PersistentPreRunE function for cobra that initailizes the passed in context with a properly configured logger and config object.
func SetupViper ¶
SetupViper creates a homedir to run inside, and returns a cleanup function to defer
func ShowAddressCmd ¶
ShowAddressCmd - show this node's validator address
func ShowNodeIDCmd ¶
ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout
func ShowValidatorCmd ¶
ShowValidator - ported from Tendermint, show this node's validator info
func SimpleAppGenState ¶ added in v0.16.0
func SimpleAppGenState(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) ( appState json.RawMessage, err error)
create the genesis app state
func SimpleAppGenTx ¶ added in v0.16.0
func SimpleAppGenTx(cdc *codec.Codec, pk crypto.PubKey) ( appGenTx, cliPrint json.RawMessage, validator types.GenesisValidator, err error)
Generate a genesis transaction
func StartCmd ¶
func StartCmd(ctx *Context, appCreator AppCreator) *cobra.Command
StartCmd runs the service passed in, either stand-alone or in-process with Tendermint.
func TrapSignal ¶
func TrapSignal(cleanupFunc func())
TrapSignal traps SIGINT and SIGTERM and terminates the server correctly.
func UnsafeResetAllCmd ¶
UnsafeResetAllCmd - extension of the tendermint command, resets initialization
Types ¶
type AppCreator ¶
AppCreator is a function that allows us to lazily initialize an application using various configurations.
type AppExporter ¶
type AppExporter func(log.Logger, dbm.DB, io.Writer) (json.RawMessage, []tmtypes.GenesisValidator, error)
AppExporter is a function that dumps all app state to JSON-serializable structure and returns the current validator set.
type AppInit ¶ added in v0.16.0
type AppInit struct { // AppGenState creates the core parameters initialization. It takes in a // pubkey meant to represent the pubkey of the validator of this machine. AppGenState func(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) ( appState json.RawMessage, err error) }
Core functionality passed from the application to the server init command
type SimpleGenTx ¶ added in v0.16.0
type SimpleGenTx struct {
Addr sdk.AccAddress `json:"addr"`
}
SimpleGenTx is a simple genesis tx