appkit

package
v0.0.0-...-a84b4ea Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Overview

Package appkit is a wrapper around the App Client and Cosmos's Server cmds

In order to ease the calling of commands like the end user does through CLI, this package is providing easy to use functions for more readability for the test scenario.

To start using the wrapped style CLI, you need to initialise the struct AppKit. A returned cmd contains functions that returns an output from StdOut pipeline (e.g. like the end user will see in the terminal) as well as errors if something bad happened while executing a command

Other functionality in appkit is an easy-to-modify values in .toml(e.g. config.toml) This can help the test user to modify what is needed for a scenario without a boilerplate code from viper

Last but not least is the REST API calls. Appkit takes care of all boilerplate code for doing simple http requests

wrappedCmd := appkit.New() output, err := wrappedCmd.InitChain("moniker", "test-chain", "/path/to/store") err = appkit.ChangeNodeMode("/path/to/config.toml", "seed") hash, err = appkit.GetBlockByHeight(net.Parse("127.0.0.1"), 10)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPersistentPeers

func AddPersistentPeers(path string, peers []string) error

AddPersistentPeers modifies the respective field in the config.toml to allow the peer to always connect to a set of defined peers

func AddSeedPeers

func AddSeedPeers(path string, peers []string) error

func ChangeConfigParam

func ChangeConfigParam(path, section, mode string, value interface{}) error

func ChangeRPCServerAddress

func ChangeRPCServerAddress(path string, ip net.IP) error

func GetBlockHashByHeight

func GetBlockHashByHeight(ip net.IP, height int) (string, error)

func GetLatestsBlockSize

func GetLatestsBlockSize(ip net.IP) (int, error)

Types

type AppKit

type AppKit struct {
	AccountAddress string
	ChainId        string
	Cmd            *cobra.Command
	// contains filtered or unexported fields
}

func New

func New(path, chainId string) *AppKit

func (*AppKit) AddGenAccount

func (ak *AppKit) AddGenAccount(addr, amount string) (string, error)

func (*AppKit) CollectGenTxs

func (ak *AppKit) CollectGenTxs() (string, error)

func (*AppKit) CreateKey

func (ak *AppKit) CreateKey(name, krbackend, krpath string) (string, error)

func (*AppKit) FundAccounts

func (ak *AppKit) FundAccounts(accAdr, amount, krbackend, krpath string, accAddrs ...string) error

func (*AppKit) GetHomePath

func (ak *AppKit) GetHomePath() string

func (*AppKit) GetNodeId

func (ak *AppKit) GetNodeId() (string, error)

func (*AppKit) InitChain

func (ak *AppKit) InitChain(moniker string) (string, error)

func (*AppKit) PayForData

func (ak *AppKit) PayForData(accAdr string, msg int, krbackend, krpath string) error

func (*AppKit) SignGenTx

func (ak *AppKit) SignGenTx(accName, amount, krbackend, krpath string) (string, error)

func (*AppKit) StartNode

func (ak *AppKit) StartNode(loglvl string) error

type ValidatorNode

type ValidatorNode struct {
	PubKey string
	IP     net.IP
}

Jump to

Keyboard shortcuts

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