testutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTestGenTxGas = 1000000
	TestChainId         = "cude_47-5"
)

Variables

This section is empty.

Functions

func AddTestAddrsIncremental

func AddTestAddrsIncremental(app *xapp.XplaApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func ConvertAddrsToValAddrs

func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress

ConvertAddrsToValAddrs converts the provided addresses to ValAddress.

func CreateTestPubKeys

func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey

CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.

func DefaultConfig

func DefaultConfig() network.Config

DefaultConfig returns a sane default configuration suitable for nearly all testing requirements.

func FundAccount

func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error

FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!

TODO: Instead of using the mint module account, which has the permission of minting, create a "faucet" account. (@fdymylja)

func GenAndDeliverTx added in v0.1.0

GenAndDeliverTx generates a transactions and delivers it.

func GenAndDeliverTxWithRandFees added in v0.1.0

func GenAndDeliverTxWithRandFees(txCtx simutil.OperationInput) (simulation.OperationMsg, []simulation.FutureOperation, error)

GenAndDeliverTxWithRandFees generates a transaction with a random fee and delivers it.

func GenTx

func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)

GenTx generates a signed mock transaction.

func NewAppConstructor

func NewAppConstructor(encodingCfg params.EncodingConfig) network.AppConstructor

NewAppConstructor returns a new AppConstructor

func NewPubKeyFromHex

func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)

NewPubKeyFromHex returns a PubKey from a hex string.

func NewTestEthSecpPrivKey

func NewTestEthSecpPrivKey(mnemonic string) (cryptotypes.PrivKey, error)

func NewTestMnemonic

func NewTestMnemonic(entropy []byte) (string, error)

func RandomAccounts

func RandomAccounts(r *rand.Rand, n int) []simtypes.Account

RandomAccounts generates n random accounts

func Setup

func Setup(isCheckTx bool, invCheckPeriod uint) *xapp.XplaApp

func TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

Types

type GenerateAccountStrategy

type GenerateAccountStrategy func(int) []sdk.AccAddress

Jump to

Keyboard shortcuts

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