Documentation
¶
Index ¶
- Variables
- func RegisterMessageOnManager[In any, Out any](manager *Manager, name string, opts ...MessageOption[In, Out]) error
- type Manager
- type MessageOption
- type MessageType
- func (t *MessageType[In, Out]) ABIEncode(v any) ([]byte, error)
- func (t *MessageType[In, Out]) AddError(wCtx engine.Context, hash types.TxHash, err error)
- func (t *MessageType[In, Out]) Decode(bytes []byte) (any, error)
- func (t *MessageType[In, Out]) DecodeEVMBytes(bz []byte) (any, error)
- func (t *MessageType[In, Out]) Each(wCtx engine.Context, fn func(TxData[In]) (Out, error))
- func (t *MessageType[In, Out]) Encode(a any) ([]byte, error)
- func (t *MessageType[In, Out]) GetReceipt(wCtx engine.Context, hash types.TxHash) (v Out, errs []error, ok bool)
- func (t *MessageType[In, Out]) Group() string
- func (t *MessageType[In, Out]) ID() types.MessageID
- func (t *MessageType[In, Out]) In(wCtx engine.Context) []TxData[In]
- func (t *MessageType[In, Out]) IsEVMCompatible() bool
- func (t *MessageType[In, Out]) Name() string
- func (t *MessageType[In, Out]) SetGroup(group string)
- func (t *MessageType[In, Out]) SetID(id types.MessageID) error
- func (t *MessageType[In, Out]) SetName(name string)
- func (t *MessageType[In, Out]) SetResult(wCtx engine.Context, hash types.TxHash, result Out)
- type TxData
Constants ¶
This section is empty.
Variables ¶
var (
ErrEVMTypeNotSet = errors.New("EVM type is not set")
)
Functions ¶
func RegisterMessageOnManager ¶
func RegisterMessageOnManager[In any, Out any](manager *Manager, name string, opts ...MessageOption[In, Out]) error
RegisterMessageOnManager registers a single message on a manager. You do not need to provide the message type You just need to provide the input and Output parameters
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) GetMessageByID ¶
GetMessageByID iterates over the all registered messages and returns the types.Message associated with the MessageID.
func (*Manager) GetMessageByName ¶
GetMessageByName returns the message with the given name, if it exists.
func (*Manager) GetMessageByType ¶
func (*Manager) GetRegisteredMessages ¶
GetRegisteredMessages returns the list of all registered messages
type MessageOption ¶
type MessageOption[In, Out any] func(mt *MessageType[In, Out]) //nolint:revive // this is fine for now
func WithCustomMessageGroup ¶
func WithCustomMessageGroup[In, Out any](group string) MessageOption[In, Out]
WithCustomMessageGroup sets a custom group for the message. By default, messages are registered under the "game" group which maps it to the /tx/game/:txType route. This option allows you to set a custom group, which allow you to register the message under /tx/<custom_group>/:txType.
func WithMsgEVMSupport ¶
func WithMsgEVMSupport[In, Out any]() MessageOption[In, Out]
type MessageType ¶
type MessageType[In, Out any] struct { // contains filtered or unexported fields }
MessageType manages a user defined state transition message struct.
func (*MessageType[In, Out]) ABIEncode ¶
func (t *MessageType[In, Out]) ABIEncode(v any) ([]byte, error)
ABIEncode encodes the input to the message's matching evm type. If the input is not either of the message's evm types, an error is returned.
func (*MessageType[In, Out]) Decode ¶
func (t *MessageType[In, Out]) Decode(bytes []byte) (any, error)
func (*MessageType[In, Out]) DecodeEVMBytes ¶
func (t *MessageType[In, Out]) DecodeEVMBytes(bz []byte) (any, error)
DecodeEVMBytes decodes abi encoded solidity structs into the message's "In" type.
func (*MessageType[In, Out]) Each ¶
func (t *MessageType[In, Out]) Each(wCtx engine.Context, fn func(TxData[In]) (Out, error))
func (*MessageType[In, Out]) GetReceipt ¶
func (*MessageType[In, Out]) Group ¶
func (t *MessageType[In, Out]) Group() string
func (*MessageType[In, Out]) ID ¶
func (t *MessageType[In, Out]) ID() types.MessageID
func (*MessageType[In, Out]) In ¶
func (t *MessageType[In, Out]) In(wCtx engine.Context) []TxData[In]
In extracts all the TxData in the tx pool that match this MessageType's ID.
func (*MessageType[In, Out]) IsEVMCompatible ¶
func (t *MessageType[In, Out]) IsEVMCompatible() bool
func (*MessageType[In, Out]) Name ¶
func (t *MessageType[In, Out]) Name() string
func (*MessageType[In, Out]) SetGroup ¶
func (t *MessageType[In, Out]) SetGroup(group string)
func (*MessageType[In, Out]) SetName ¶
func (t *MessageType[In, Out]) SetName(name string)