mock

package
v3.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppGenState

func AppGenState(_ *codec.LegacyAmino, _ genutiltypes.AppGenesis, _ []json.RawMessage) (appState json.RawMessage, err error)

AppGenState can be passed into InitCmd, returns a static string of a few key-values that can be parsed by InitChainer

func AppGenStateEmpty

func AppGenStateEmpty(_ *codec.LegacyAmino, _ genutiltypes.AppGenesis, _ []json.RawMessage) (appState json.RawMessage, err error)

AppGenStateEmpty returns an empty transaction state for mocking.

func InitChainer

InitChainer returns a function that can initialize the chain with key/value pairs

func KVStoreHandler

func KVStoreHandler(storeKey storetypes.StoreKey) bam.MsgServiceHandler

KVStoreHandler is a simple handler that takes KVStoreTx and writes them to the db.

func MsgTestHandler

func MsgTestHandler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error)

func NewApp

func NewApp(rootDir string, logger log.Logger) (servertypes.ABCI, error)

NewApp creates a simple mock kvstore app for testing. It should work similar to a real app. Make sure rootDir is empty before running the test, in order to guarantee consistent results.

func NewCommitMultiStore

func NewCommitMultiStore() storetypes.CommitMultiStore

Types

type GenesisJSON

type GenesisJSON struct {
	Values []KV `json:"values"`
}

GenesisJSON what genesis JSON is formatted as

type KV

type KV struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

KV is a basic kv structure

type KVStoreTx

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

KVStoreTx is an sdk.Tx which is its own sdk.Msg.

func NewTx

func NewTx(key, value string, accAddress sdk.AccAddress) *KVStoreTx

func (*KVStoreTx) Address

func (msg *KVStoreTx) Address() cryptotypes.Address

func (*KVStoreTx) Bytes

func (msg *KVStoreTx) Bytes() []byte

func (*KVStoreTx) Equals

func (msg *KVStoreTx) Equals(key cryptotypes.PubKey) bool

func (*KVStoreTx) GetGasLimit

func (msg *KVStoreTx) GetGasLimit() (uint64, error)

func (*KVStoreTx) GetMessages

func (msg *KVStoreTx) GetMessages() ([]transaction.Msg, error)

func (*KVStoreTx) GetMsgs

func (msg *KVStoreTx) GetMsgs() []sdk.Msg

func (*KVStoreTx) GetPubKeys

func (msg *KVStoreTx) GetPubKeys() ([]cryptotypes.PubKey, error)

func (*KVStoreTx) GetReflectMessages

func (msg *KVStoreTx) GetReflectMessages() ([]protoreflect.Message, error)

func (*KVStoreTx) GetSenders

func (msg *KVStoreTx) GetSenders() ([][]byte, error)

func (*KVStoreTx) GetSignBytes

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

func (*KVStoreTx) GetSignaturesV2

func (msg *KVStoreTx) GetSignaturesV2() (res []txsigning.SignatureV2, err error)

func (*KVStoreTx) GetSigners

func (msg *KVStoreTx) GetSigners() ([][]byte, error)

func (*KVStoreTx) Hash

func (msg *KVStoreTx) Hash() [32]byte

func (*KVStoreTx) ProtoMessage

func (msg *KVStoreTx) ProtoMessage()

func (*KVStoreTx) Reset

func (msg *KVStoreTx) Reset()

func (*KVStoreTx) String

func (msg *KVStoreTx) String() string

func (*KVStoreTx) Type

func (msg *KVStoreTx) Type() string

func (*KVStoreTx) ValidateBasic

func (msg *KVStoreTx) ValidateBasic() error

ValidateBasic should the app be calling this? or only handlers?

func (*KVStoreTx) VerifySignature

func (msg *KVStoreTx) VerifySignature(msgByte, sig []byte) bool

type MsgServer

type MsgServer interface {
	Test(ctx context.Context, msg *KVStoreTx) (*sdk.Result, error)
}

MsgServer manually write the handlers for this custom message

type MsgServerImpl

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

func (MsgServerImpl) Test

func (m MsgServerImpl) Test(ctx context.Context, msg *KVStoreTx) (*sdk.Result, error)

Jump to

Keyboard shortcuts

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