codec

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

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

func NewCodec

func NewCodec() *Codec

NewCodec creates a new instance of Codec with registered interfaces.

func NewCodecWithInterfaces added in v0.1.5

func NewCodecWithInterfaces(interfaceRegistry codectypes.InterfaceRegistry, codec ProtoCodec, sdkTypes SDKTypes) *Codec

func (*Codec) AddInterfaces

func (c *Codec) AddInterfaces(registerFuncs ...func(codectypes.InterfaceRegistry))

func (*Codec) IsTypedEvent added in v0.1.4

func (c *Codec) IsTypedEvent(event *abcitypes.Event) bool

func (*Codec) MarshalProtoJSON

func (c *Codec) MarshalProtoJSON(event proto.Message) (json.RawMessage, error)

MarshalJSON marshals a proto message to a json string

func (*Codec) ParseEvent

func (c *Codec) ParseEvent(event *abcitypes.Event) (proto.Message, error)

DecodeMsg decodes a typed event and returns a decoded event

func (*Codec) ParseTx

func (c *Codec) ParseTx(txBytes []byte) (*tx.Tx, error)

DecodeTxMsgs decodes a transaction and returns a list of decoded messages

func (*Codec) ParseTxMessage

func (c *Codec) ParseTxMessage(message *codectypes.Any) (proto.Message, error)

func (*Codec) ParseTxMessages

func (c *Codec) ParseTxMessages(messages []*codectypes.Any) ([]proto.Message, error)

func (*Codec) ParseUntypedEvent added in v0.1.4

func (c *Codec) ParseUntypedEvent(event *abcitypes.Event) (json.RawMessage, error)

type DefaultSDKTypes

type DefaultSDKTypes struct{}

Default implementation of the SDKTypes interface

func (DefaultSDKTypes) ParseTypedEvent

func (d DefaultSDKTypes) ParseTypedEvent(event abcitypes.Event) (proto.Message, error)

type ProtoCodec

type ProtoCodec interface {
	MarshalJSON(msg proto.Message) ([]byte, error)
	Unmarshal(data []byte, msg proto.Message) error
	UnpackAny(a *codectypes.Any, iface interface{}) error
}

ProtoCodec is a wrapper around codec.ProtoCodec

type SDKTypes

type SDKTypes interface {
	ParseTypedEvent(event abcitypes.Event) (proto.Message, error)
}

Define an interface for the sdktypes package

Directories

Path Synopsis
allora-chain

Jump to

Keyboard shortcuts

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