bnsdtest

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const TendermintLocalAddr = "localhost:46657"

Variables

This section is empty.

Functions

func MustBroadcastTx

func MustBroadcastTx(t testing.TB, env *EnvConf, tx *bnsd.Tx) *coretypes.ResultBroadcastTxCommit

MustBroadcastTx submits given transaction to the network and returns broadcast response. This function fails the test if any operation was not successful or broadcast response contain an error.

func MustSignTx

func MustSignTx(t testing.TB, env *EnvConf, tx *bnsd.Tx, pk *crypto.PrivateKey)

MustSignTx will modify given transaction by signing it with provided private key. This function fails the test if any operation was not successful.

func SeedAccountWithTokens

func SeedAccountWithTokens(t testing.TB, env *EnvConf, dest weave.Address)

SeedAccountWithTokens acts as a faucet that sends tokens to the given address.

func WaitCronTask added in v0.19.0

func WaitCronTask(t testing.TB, env *EnvConf, timeout time.Duration, taskID []byte) cron.TaskResult

func WaitCronTaskSuccess added in v0.19.0

func WaitCronTaskSuccess(t testing.TB, env *EnvConf, timeout time.Duration, taskID []byte)

Types

type EnvConf

type EnvConf struct {
	Alice       *client.PrivateKey
	ChainID     string
	AntiSpamFee coin.Coin
	MinFee      coin.Coin

	Client client.Client

	MultiSigContract  weave.Condition
	EscrowContract    weave.Condition
	DistrContractAddr weave.Address
	Node              *nm.Node
	Logger            log.Logger
	RpcAddress        string
	// contains filtered or unexported fields
}

EnvConf is a work in progress collection of previously global variables. This is to be cleaned up in the following updates.

func StartBnsd

func StartBnsd(t testing.TB, opts ...StartBnsdOption) (env *EnvConf, cleanup func())

func (*EnvConf) IsRemote

func (e *EnvConf) IsRemote() bool

IsRemote returns true if we connect to a remote chain (not local CI test), in order to skip some tests

type StartBnsdOption

type StartBnsdOption func(*EnvConf)

func WithAntiSpamFee

func WithAntiSpamFee(c coin.Coin) StartBnsdOption

func WithGovernance

func WithGovernance(votingPeriod weave.UnixDuration, electors []weave.Address) StartBnsdOption

WithGovernance sets given group of weave addresses as the electorate for the first electorate instance created. First address is used as the admin for the electorate and the governance rule.

func WithLogger

func WithLogger(out io.Writer) StartBnsdOption

func WithMinFee

func WithMinFee(c coin.Coin) StartBnsdOption

func WithMsgFee

func WithMsgFee(msgPath string, fee coin.Coin) StartBnsdOption

func WithThrottle

func WithThrottle(frequency time.Duration) StartBnsdOption

func WithUsername added in v0.18.0

func WithUsername(name string, token username.Token) StartBnsdOption

type ThrottledClient

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

ThrottleClient implements bnsd Client interface. All operations are throttled and executed at most with given frequency to avoid server throttling. Throttling is transparent for the client as all method calls are blocking.

func (*ThrottledClient) AbciQuery

func (t *ThrottledClient) AbciQuery(path string, data []byte) (client.AbciResponse, error)

func (*ThrottledClient) BroadcastTx

func (t *ThrottledClient) BroadcastTx(tx weave.Tx) client.BroadcastTxResponse

func (*ThrottledClient) BroadcastTxAsync

func (t *ThrottledClient) BroadcastTxAsync(tx weave.Tx, out chan<- client.BroadcastTxResponse)

func (*ThrottledClient) BroadcastTxSync

func (t *ThrottledClient) BroadcastTxSync(tx weave.Tx, timeout time.Duration) client.BroadcastTxResponse

func (*ThrottledClient) Close

func (t *ThrottledClient) Close()

Close free resources. Closing twice will cause panic.

func (*ThrottledClient) GetUser

func (t *ThrottledClient) GetUser(addr weave.Address) (*client.UserResponse, error)

func (*ThrottledClient) GetWallet

func (t *ThrottledClient) GetWallet(addr weave.Address) (*client.WalletResponse, error)

func (*ThrottledClient) TendermintClient

func (t *ThrottledClient) TendermintClient() rpcclient.Client

Jump to

Keyboard shortcuts

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