testutils

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteMsgCounter  = "MsgCounter"
	RouteMsgCounter2 = "MsgCounter2"
)

Variables

View Source
var Package = amino.RegisterPackage(amino.NewPackage(
	"github.com/gnolang/gno/tm2/pkg/sdk/testutils",
	"sdk.testutils",
	amino.GetCallersDirname(),
).WithDependencies().WithTypes(

	&TestMsg{}, "TestMsg",

	MsgCounter{},
	MsgNoRoute{},
	MsgCounter2{},
))

Functions

func KeyTestPubAddr

func KeyTestPubAddr() (crypto.PrivKey, crypto.PubKey, crypto.Address)

func NewTestCoins

func NewTestCoins() std.Coins

coins to more than cover the fee

func NewTestFee

func NewTestFee() std.Fee

func NewTestTx

func NewTestTx(
	t *testing.T,
	chainID string,
	msgs []std.Msg,
	privs []crypto.PrivKey,
	accNums []uint64,
	seqs []uint64,
	fee std.Fee,
) std.Tx

func NewTestTxWithMemo

func NewTestTxWithMemo(
	t *testing.T,
	chainID string,
	msgs []std.Msg,
	privs []crypto.PrivKey,
	accNums []uint64,
	seqs []uint64,
	fee std.Fee,
	memo string,
) std.Tx

func NewTestTxWithSignBytes

func NewTestTxWithSignBytes(msgs []std.Msg, privs []crypto.PrivKey, fee std.Fee, signBytes []byte, memo string) std.Tx

func TestAddress

func TestAddress(name string) crypto.Address

func TestBech32Address

func TestBech32Address(name string) crypto.Bech32Address

Types

type MsgCounter

type MsgCounter struct {
	Counter       int64
	FailOnHandler bool
}

ValidateBasic() fails on negative counters. Otherwise it's up to the handlers

func (MsgCounter) GetSignBytes

func (msg MsgCounter) GetSignBytes() []byte

func (MsgCounter) GetSigners

func (msg MsgCounter) GetSigners() []crypto.Address

func (MsgCounter) Route

func (msg MsgCounter) Route() string

Implements Msg

func (MsgCounter) Type

func (msg MsgCounter) Type() string

func (MsgCounter) ValidateBasic

func (msg MsgCounter) ValidateBasic() error

type MsgCounter2

type MsgCounter2 struct {
	Counter int64
}

Another counter msg. Duplicate of MsgCounter

func (MsgCounter2) GetSignBytes

func (msg MsgCounter2) GetSignBytes() []byte

func (MsgCounter2) GetSigners

func (msg MsgCounter2) GetSigners() []crypto.Address

func (MsgCounter2) Route

func (msg MsgCounter2) Route() string

Implements Msg

func (MsgCounter2) Type

func (msg MsgCounter2) Type() string

func (MsgCounter2) ValidateBasic

func (msg MsgCounter2) ValidateBasic() error

type MsgNoRoute

type MsgNoRoute struct {
	MsgCounter
}

a msg we dont know how to route

func (MsgNoRoute) Route

func (tx MsgNoRoute) Route() string

type TestMsg

type TestMsg struct {
	Signers []crypto.Address
}

msg type for testing

func NewTestMsg

func NewTestMsg(addrs ...crypto.Address) *TestMsg

func (*TestMsg) GetSignBytes

func (msg *TestMsg) GetSignBytes() []byte

func (*TestMsg) GetSigners

func (msg *TestMsg) GetSigners() []crypto.Address

func (*TestMsg) Route

func (msg *TestMsg) Route() string

func (*TestMsg) Type

func (msg *TestMsg) Type() string

func (*TestMsg) ValidateBasic

func (msg *TestMsg) ValidateBasic() error

Jump to

Keyboard shortcuts

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