helpers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 22 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(legacyAmino *codec.LegacyAmino)

Types

type Auxiliaries

type Auxiliaries interface {
	Get() []Auxiliary
	GetAuxiliary(string) Auxiliary
}

type Auxiliary

type Auxiliary interface {
	GetName() string
	GetKeeper() AuxiliaryKeeper
	Initialize(Mapper, ParameterManager, ...interface{}) Auxiliary
}

type AuxiliaryKeeper

type AuxiliaryKeeper interface {
	Help(context.Context, AuxiliaryRequest) (AuxiliaryResponse, error)
	Keeper
}

type AuxiliaryRequest

type AuxiliaryRequest interface {
	Request
}

type AuxiliaryResponse

type AuxiliaryResponse interface {
}

type Block

type Block interface {
	Begin(context.Context, abciTypes.RequestBeginBlock)
	End(context.Context, abciTypes.RequestEndBlock)
	Initialize(Mapper, ParameterManager, ...interface{}) Block
}

type CLICommand

type CLICommand interface {
	ReadInt64(CLIFlag) int64
	ReadInt(CLIFlag) int
	ReadBool(CLIFlag) bool
	ReadString(CLIFlag) string
	ReadBaseReq(client.Context) rest.BaseReq

	CreateCommand(func(command *cobra.Command, args []string) error) *cobra.Command
}

type CLIFlag

type CLIFlag interface {
	GetName() string
	GetValue() interface{}
	Register(*cobra.Command)
	ReadCLIValue() interface{}
}

type Codec

type Codec interface {
	client.TxConfig
	codec.Codec

	GetProtoCodec() *codec.ProtoCodec
	GetLegacyAmino() *codec.LegacyAmino
	InterfaceRegistry() types.InterfaceRegistry
	Initialize(module.BasicManager) Codec
}

type Collection

type Collection interface {
	GetMappable(Key) Mappable
	Get() []Record
	GetMappables() []Mappable

	// TODO convert rest of the accumulators to below logic
	// The accumulator function should return true if the iterated Mappable is to be included in the returned collection
	IterateAll(func(Record) bool) Collection
	Iterate(Key, func(Record) bool)
	IteratePaginated(Key, int32, func(Record) bool)
	Fetch(Key) Collection
	FetchRecord(Key) Record
	FetchAll() Collection
	FetchPaginated(Key, int32) Collection
	Add(Record) Collection
	Remove(Record) Collection
	Mutate(Record) Collection
	Initialize(context.Context, Mapper) Collection
}

Collection a list of mappable with create CRUD methods

type Genesis

type Genesis interface {
	proto.Message

	Default() Genesis

	ValidateBasic(ParameterManager) error

	Import(context.Context, Mapper, ParameterManager)
	Export(context.Context, Mapper, ParameterManager) Genesis

	Encode(sdkCodec.JSONCodec) []byte
	Decode(sdkCodec.JSONCodec, []byte) Genesis

	Initialize([]Record, lists.ParameterList) Genesis
}

type Invariants

type Invariants interface {
	Register(sdkTypes.InvariantRegistry)
}

type Keeper

type Keeper interface {
	Initialize(Mapper, ParameterManager, []interface{}) Keeper
}

type Key

type Key interface {
	GenerateStorePrefixBytes() []byte
	GenerateStoreKeyBytes() []byte
	GeneratePrefixedStoreKeyBytes() []byte
	IsPartial() bool
	// TODO ** check all key impls
	Equals(Key) bool
}

Key SHOULD be derivable from the object it is referencing and SHOULD not be totally arbitrary or sequential

type Mappable

type Mappable interface {
	codec.ProtoMarshaler
	RegisterLegacyAminoCodec(*codec.LegacyAmino)
	ValidateBasic() error
}

type Mapper

type Mapper interface {
	NewCollection(context.Context) Collection

	Upsert(context.Context, Record)
	Read(context.Context, Key) Record
	Delete(context.Context, Key)
	FetchAll(context.Context) []Record
	Iterate(context.Context, Key, func(Record) bool)
	IterateAll(context.Context, func(Record) bool)
	IteratePaginated(context.Context, Key, int32, func(Record) bool)

	StoreDecoder(kv.Pair, kv.Pair) string
	Initialize(*sdkTypes.KVStoreKey) Mapper
}

type Message

type Message interface {
	// TODO check if register message code is required
	RegisterLegacyAminoCodec(*codec.LegacyAmino)
	RegisterInterface(types.InterfaceRegistry)
	Type() string
	sdkTypes.Msg
}

type Module

type Module interface {
	sdkModuleTypes.EndBlockAppModule
	sdkModuleTypes.BeginBlockAppModule
	sdkModuleTypes.AppModuleSimulation

	GetAuxiliary(string) Auxiliary

	DecodeModuleTransactionRequest(string, json.RawMessage) (sdkTypes.Msg, error)

	Initialize(*sdkTypes.KVStoreKey, paramsTypes.Subspace, ...interface{}) Module

	GetTransactions() Transactions
}

type ParameterManager

type ParameterManager interface {
	Get() lists.ParameterList
	GetValidatableParameter(ids.PropertyID) ValidatableParameter
	GetParameter(ids.PropertyID) parameters.Parameter
	ValidateParameter(parameters.Parameter) error

	Fetch(context.Context) ParameterManager
	Set(context.Context, lists.ParameterList)

	GetKeyTable() paramsTypes.KeyTable
	RESTQueryHandler(client.Context) http.HandlerFunc
	Initialize(paramsTypes.Subspace) ParameterManager
}

type Queries

type Queries interface {
	Get() []Query
	GetQuery(string) Query
}

type Query

type Query interface {
	GetName() string
	Command() *cobra.Command
	HandleQuery(context.Context, abciTypes.RequestQuery) ([]byte, error)
	RESTQueryHandler(client.Context) http.HandlerFunc
	RegisterService(module.Configurator)
	RegisterGRPCGatewayRoute(client.Context, *runtime.ServeMux)
	Initialize(Mapper, ParameterManager, ...interface{}) Query
}

type QueryKeeper

type QueryKeeper interface {
	Enquire(context.Context, QueryRequest) (QueryResponse, error)
	Keeper
}

type QueryRequest

type QueryRequest interface {
	Request
	FromCLI(CLICommand, client.Context) (QueryRequest, error)
	FromHTTPRequest(*http.Request) (QueryRequest, error)
	Encode() ([]byte, error)
	Decode([]byte) (QueryRequest, error)
}

type QueryResponse

type QueryResponse interface {
	proto.Message
	Encode() ([]byte, error)
	Decode([]byte) (QueryResponse, error)
}

type Record

type Record interface {
	GetKey() Key
	GetMappable() Mappable

	WithKey(Key) Record

	ReadFromIterator(types.Iterator) Record
	Read(types.KVStore) Record
	Write(types.KVStore) Record
	Delete(types.KVStore)
}

type Request

type Request interface {
	Validate() error
}

type Response

type Response interface {
	IsSuccessful() bool
	GetError() error
}

type Simulator

type Simulator interface {
	RandomizedGenesisState(*module.SimulationState)
	WeightedOperations(module.SimulationState, Module) simulation.WeightedOperations
	WeightedProposalContentList(module.SimulationState) []simulationTypes.WeightedProposalContent
	ParamChangeList(*rand.Rand) []simulationTypes.ParamChange
}

type Transaction

type Transaction interface {
	GetName() string
	Command() *cobra.Command
	HandleMessage(context.Context, Message) (*sdkTypes.Result, error)
	RESTRequestHandler(client.Context) http.HandlerFunc
	RegisterLegacyAminoCodec(amino *codec.LegacyAmino)
	RegisterInterfaces(types.InterfaceRegistry)
	RegisterService(module.Configurator)
	RegisterGRPCGatewayRoute(client.Context, *runtime.ServeMux)
	DecodeTransactionRequest(json.RawMessage) (sdkTypes.Msg, error)
	InitializeKeeper(Mapper, ParameterManager, ...interface{}) Transaction
}

type TransactionKeeper

type TransactionKeeper interface {
	Transact(context.Context, Message) (TransactionResponse, error)
	Keeper
}

type TransactionRequest

type TransactionRequest interface {
	GetBaseReq() rest.BaseReq

	FromCLI(CLICommand, client.Context) (TransactionRequest, error)
	FromJSON(json.RawMessage) (TransactionRequest, error)
	MakeMsg() (sdkTypes.Msg, error)
	RegisterLegacyAminoCodec(*codec.LegacyAmino)
	Request
}

type TransactionResponse

type TransactionResponse interface {
	GetResult() *sdkTypes.Result
}

type Transactions

type Transactions interface {
	Get() []Transaction
	GetTransaction(string) Transaction
}

type ValidatableParameter

type ValidatableParameter interface {
	GetParameter() parameters.Parameter
	Mutate(data.Data) ValidatableParameter
	GetValidator() func(i interface{}) error
	Validate() error
}

type WasmMessage

type WasmMessage interface {
	GetType() string
	GetRawMessage() json.RawMessage
}

type WasmMessagePrototype

type WasmMessagePrototype func() WasmMessage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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