{"modulePath":"github.com/DDWS-com/node","version":"v0.1.0-beta.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package network\n\n## Functions\n\n```go\nfunc GetFreePorts(count int) ([]int, error)\n```\nGetFreePorts asks the kernel for free open ports that are ready to use.\n\n## Types\n\n```go\ntype AppConstructor = func(val ValidatorI) servertypes.Application\n```\nAppConstructor defines a function which accepts a network configuration and creates an ABCI Application to provide to Tendermint.\n\n```go\ntype Config struct {\n\tCodec             codec.Codec\n\tLegacyAmino       *codec.LegacyAmino // TODO: Remove!\n\tInterfaceRegistry codectypes.InterfaceRegistry\n\tTxConfig          sdkclient.TxConfig\n\tAccountRetriever  sdkclient.AccountRetriever\n\tAppConstructor    AppConstructor             // the ABCI application constructor\n\tGenesisState      map[string]json.RawMessage // custom genesis state to provide\n\tTimeoutCommit     time.Duration              // the consensus commitment timeout\n\tChainID           string                     // the network chain-id\n\tNumValidators     int                        // the total number of validators to create and bond\n\tMnemonics         []string                   // custom user-provided validator operator mnemonics\n\tBondDenom         string                     // the staking bond denomination\n\tDenoms            []string                   // list of additional denoms could be used on network\n\tMinGasPrices      string                     // the minimum gas prices each validator will accept\n\tAccountTokens     math.Int                   // the amount of unique validator tokens (e.g. 1000node0)\n\tStakingTokens     math.Int                   // the amount of tokens each validator has available to stake\n\tBondedTokens      math.Int                   // the amount of tokens each validator stakes\n\tPruningStrategy   string                     // the pruning strategy each validator will have\n\tEnableLogging     bool                       // enable Tendermint logging to STDOUT\n\tCleanupDir        bool                       // remove base temporary directory during cleanup\n\tSigningAlgo       string                     // signing algorithm for keys\n\tKeyringOptions    []keyring.Option\n}\n```\nConfig defines the necessary configuration used to bootstrap and start an in-process local testing network.\n\n```go\nfunc DefaultConfig(factory TestFixtureFactory, opts ...ConfigOption) Config\n```\nDefaultConfig returns a default configuration suitable for nearly all testing requirements.\n\n```go\ntype ConfigOption func(*networkConfigOptions)\n```\n\n```go\nfunc WithInterceptState(val InterceptState) ConfigOption\n```\nWithInterceptState set custom name of the log object\n\n```go\ntype InterceptState func(codec.Codec, string, json.RawMessage) json.RawMessage\n```\n\n```go\ntype Network struct {\n\tT          *testing.T\n\tBaseDir    string\n\tValidators []*Validator\n\n\tConfig Config\n}\n```\nNetwork defines a local in-process testing network using SimApp. It can be configured to start any number of validators, each with its own RPC and API clients. Typically, this test network would be used in client and integration testing where user input is expected.\n\nNote, due to Tendermint constraints in regard to RPC functionality, there may only be one test network running at a time. Thus, any caller must be sure to Cleanup after testing is finished in order to allow other tests to create networks. In addition, only the first validator will have a valid RPC and API server/client.\n\n```go\nfunc New(t *testing.T, cfg Config) *Network\n```\nNew creates a new Network for integration tests.\n\n```go\nfunc (n *Network) Cleanup()\n```\nCleanup removes the root testing (temporary) directory and stops both the Tendermint and API services. It allows other callers to create and start test networks. This method must be called when a test is finished, typically in defer.\n\n```go\nfunc (n *Network) LatestHeight() (int64, error)\n```\nLatestHeight returns the latest height of the network or an error if the query fails or no validators exist.\n\n```go\nfunc (n *Network) WaitForBlocks(blocks int64) error\n```\nWaitForBlocks waits for the next amount of blocks to be committed, returning an error upon failure.\n\n```go\nfunc (n *Network) WaitForHeight(h int64) (int64, error)\n```\nWaitForHeight performs a blocking check where it waits for a block to be committed after a given block. If that height is not reached within a timeout, an error is returned. Regardless, the latest height queried is returned.\n\n```go\nfunc (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, error)\n```\nWaitForHeightWithTimeout is the same as WaitForHeight except the caller can provide a custom timeout.\n\n```go\nfunc (n *Network) WaitForNextBlock() error\n```\nWaitForNextBlock waits for the next block to be committed, returning an error upon failure.\n\n```go\ntype TestFixture struct {\n\tAppConstructor AppConstructor\n\tGenesisState   map[string]json.RawMessage\n\tEncodingConfig sdkutil.EncodingConfig\n}\n```\n\n```go\ntype TestFixtureFactory = func(opts ...TestnetFixtureOption) TestFixture\n```\nAppConstructor defines a function which accepts a network configuration and creates an ABCI Application to provide to Tendermint.\n\n```go\ntype TestnetFixtureOption func(*TestnetFixtureOptions)\n```\n\n```go\nfunc WithEncodingConfig(val sdkutil.EncodingConfig) TestnetFixtureOption\n```\n\n```go\ntype TestnetFixtureOptions struct {\n\tEncCfg sdkutil.EncodingConfig\n}\n```\n\n```go\ntype Validator struct {\n\tAppConfig  *srvconfig.Config\n\tClientCtx  sdkclient.Context\n\tCtx        *server.Context\n\tDir        string\n\tNodeID     string\n\tPubKey     cryptotypes.PubKey\n\tMoniker    string\n\tAPIAddress string\n\tRPCAddress string\n\tP2PAddress string\n\tAddress    sdk.AccAddress\n\tValAddress sdk.ValAddress\n\tRPCClient  tmclient.Client\n\t// contains filtered or unexported fields\n}\n```\nValidator defines an in-process Tendermint validator node. Through this object, a client can make RPC and API calls and interact with any client command or handler.\n\n```go\nfunc (v Validator) GetAppConfig() *srvconfig.Config\n```\n\n```go\nfunc (v Validator) GetCtx() *server.Context\n```\n\n```go\ntype ValidatorI interface {\n\tGetCtx() *server.Context\n\tGetAppConfig() *srvconfig.Config\n}\n```\nValidatorI expose a validator's context and configuration\n\n","path":"github.com/DDWS-com/node/testutil/network","name":"network","synopsis":"","isRedistributable":true}
