testkit

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestKit

type TestKit struct {
	// contains filtered or unexported fields
}

TestKit provides a simple API to test your service against a running node.

func NewTestKit

func NewTestKit(homedir string, service sdk.Service) TestKit

NewTestKit creates an in-process Tendermint node. homedir: is the directory where Tendermint will store configuration. You should use a

'defer os.RemoveAll()' at the start of your test to delete this directory
 when the test finishes

service: is you application service to test

func (TestKit) Launch

func (tk TestKit) Launch()

Launch start the Tendermint node and waits for 2 seconds to ensure the node is running

func (TestKit) Query

func (tk TestKit) Query(key []byte) (*core_types.ResultABCIQuery, error)

Query your service for the given key. The key should match what's expected when you implemented service.Query(...)

func (TestKit) SendTxAsync

func (tk TestKit) SendTxAsync(txencoded []byte) (*core_types.ResultBroadcastTx, error)

SendTxAsync can be used to send several transactions at once. It doesn't wait for commit

func (TestKit) SendTxCommit

func (tk TestKit) SendTxCommit(txencoded []byte) (*core_types.ResultBroadcastTxCommit, error)

SendTxCommit sends a transaction and waits for it to be committed

type Wallet

type Wallet struct {
	// contains filtered or unexported fields
}

Wallet provides a way to generate and sign transactions

func RandomWallet

func RandomWallet() Wallet

RandomWallet creates a new Wallet

func WalletFromSeed

func WalletFromSeed(seed string) Wallet

WalletFromSeed create a wallet based on the seed. This is a good way to create a predictable wallet with the same private key

func (Wallet) CreateTx

func (wallet Wallet) CreateTx(serviceName string, msgid uint32, message proto.Message) ([]byte, error)

CreateTx generates and signs a transaction return it as encoded bytes

func (Wallet) PubKey

func (wallet Wallet) PubKey() []byte

PubKey returns the publickey for the wallet as bytes

Jump to

Keyboard shortcuts

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