types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ModuleName defines the IBC mockapp name
	ModuleName = "mockapp"

	// Version defines the current version the IBC mockapp
	// module supports
	Version = "mockapp-1"

	// PortID is the default port id that mockapp module binds to
	PortID = "mockapp"

	// StoreKey is the store key string for IBC mockapp
	StoreKey = ModuleName

	// RouterKey is the message route for IBC mockapp
	RouterKey = ModuleName

	// QuerierRoute is the querier route for IBC mockapp
	QuerierRoute = ModuleName
)
View Source
const (
	TypeMsgSendPacket = "sendpacket"
)

msg types

Variables

View Source
var (

	// ModuleCdc references the global mockapp module codec. Note, the codec
	// should ONLY be used in certain instances of tests and for JSON encoding.
	//
	// The actual codec used for serialization should be provided to mockapp and
	// defined at the application level.
	ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())

	// AminoCdc is a amino codec created to support amino json compatible msgs.
	AminoCdc = codec.NewAminoCodec(amino)
)
View Source
var (
	ErrInvalidVersion            = errorsmod.Register(ModuleName, 1, "invalid MockApp version")
	ErrUnexpectedAcknowledgement = errorsmod.Register(ModuleName, 2, "unexpected MockApp acknowledgement")
)

IBC transfer sentinel errors

View Source
var (
	// DefaultRelativePacketTimeoutHeight is the default packet timeout height (in blocks) relative
	// to the current block height of the counterparty chain provided by the client state. The
	// timeout is disabled when set to 0.
	DefaultRelativePacketTimeoutHeight = "0-1000"

	// DefaultRelativePacketTimeoutTimestamp is the default packet timeout timestamp (in nanoseconds)
	// relative to the current block timestamp of the counterparty chain provided by the client
	// state. The timeout is disabled when set to 0. The default is currently set to a 10 minute
	// timeout.
	DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// PortKey defines the key to store the port ID in store
	PortKey = []byte{0x01}
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the mockapp module interfaces to protobuf Any.

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the necessary mockapp module interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

Types

type ChannelKeeper

type ChannelKeeper interface {
	GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
	GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
}

ChannelKeeper defines the expected IBC channel keeper

type ClientKeeper

type ClientKeeper interface {
	GetClientConsensusState(ctx sdk.Context, clientID string) (connection ibcexported.ConsensusState, found bool)
}

ClientKeeper defines the expected IBC client keeper

type ConnectionKeeper

type ConnectionKeeper interface {
	GetConnection(ctx sdk.Context, connectionID string) (connection connectiontypes.ConnectionEnd, found bool)
}

ConnectionKeeper defines the expected IBC connection keeper

type FailedAcknowledgement

type FailedAcknowledgement struct {
	Error string `json:"error"`
}

func NewFailedAcknowledgement

func NewFailedAcknowledgement(e string) FailedAcknowledgement

func (FailedAcknowledgement) Acknowledgement

func (a FailedAcknowledgement) Acknowledgement() []byte

func (FailedAcknowledgement) Success

func (FailedAcknowledgement) Success() bool

type GenesisState

type GenesisState struct {
	PortId string `json:"port_id,omitempty"`
}

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState returns a GenesisState with "mockapp" as the default PortID.

func NewGenesisState

func NewGenesisState(portID string) *GenesisState

NewGenesisState creates a new mockapp GenesisState instance.

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

type ICS4Wrapper

type ICS4Wrapper interface {
	SendPacket(
		ctx sdk.Context,
		chanCap *capabilitytypes.Capability,
		sourcePort string,
		sourceChannel string,
		timeoutHeight clienttypes.Height,
		timeoutTimestamp uint64,
		data []byte,
	) (sequence uint64, err error)
}

ICS4Wrapper defines the expected ICS4Wrapper for middleware

type MsgClient

type MsgClient interface {
	// SendPacket defines a rpc handler method for MsgSendPacket.
	SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgSendPacket

type MsgSendPacket struct {
	// the port on which the packet will be sent
	SourcePort string `protobuf:"bytes,1,opt,name=source_port,json=sourcePort,proto3" json:"source_port,omitempty" yaml:"source_port"`
	// the channel by which the packet will be sent
	SourceChannel string `protobuf:"bytes,2,opt,name=source_channel,json=sourceChannel,proto3" json:"source_channel,omitempty" yaml:"source_channel"`
	// the message
	Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty" yaml:"message"`
	// the sender address
	Sender string `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"`
	// Timeout height relative to the current block height.
	// The timeout is disabled when set to 0.
	TimeoutHeight types.Height `protobuf:"bytes,5,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height" yaml:"timeout_height"`
	// Timeout timestamp in absolute nanoseconds since unix epoch.
	// The timeout is disabled when set to 0.
	TimeoutTimestamp uint64 `` /* 135-byte string literal not displayed */
}

MsgSendPacket defines a msg to send an arbitrary message between chains.

func NewMsgSendPacket

func NewMsgSendPacket(
	sourcePort, sourceChannel string, sender string,
	message string,
	timeoutHeight clienttypes.Height, timeoutTimestamp uint64,
) *MsgSendPacket

NewMsgSendPacket creates a new MsgSendPacket instance

func (*MsgSendPacket) Descriptor

func (*MsgSendPacket) Descriptor() ([]byte, []int)

func (MsgSendPacket) GetSignBytes

func (msg MsgSendPacket) GetSignBytes() []byte

GetSignBytes implements sdk.Msg.

func (MsgSendPacket) GetSigners

func (msg MsgSendPacket) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (*MsgSendPacket) Marshal

func (m *MsgSendPacket) Marshal() (dAtA []byte, err error)

func (*MsgSendPacket) MarshalTo

func (m *MsgSendPacket) MarshalTo(dAtA []byte) (int, error)

func (*MsgSendPacket) MarshalToSizedBuffer

func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSendPacket) ProtoMessage

func (*MsgSendPacket) ProtoMessage()

func (*MsgSendPacket) Reset

func (m *MsgSendPacket) Reset()

func (MsgSendPacket) Route

func (MsgSendPacket) Route() string

Route implements sdk.Msg

func (*MsgSendPacket) Size

func (m *MsgSendPacket) Size() (n int)

func (*MsgSendPacket) String

func (m *MsgSendPacket) String() string

func (MsgSendPacket) Type

func (MsgSendPacket) Type() string

Type implements sdk.Msg

func (*MsgSendPacket) Unmarshal

func (m *MsgSendPacket) Unmarshal(dAtA []byte) error

func (MsgSendPacket) ValidateBasic

func (msg MsgSendPacket) ValidateBasic() error

ValidateBasic performs a basic check of the MsgSendPacket fields. NOTE: timeout height or timestamp values can be 0 to disable the timeout. NOTE: The recipient addresses format is not validated as the format defined by the chain is not known to IBC.

func (*MsgSendPacket) XXX_DiscardUnknown

func (m *MsgSendPacket) XXX_DiscardUnknown()

func (*MsgSendPacket) XXX_Marshal

func (m *MsgSendPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSendPacket) XXX_Merge

func (m *MsgSendPacket) XXX_Merge(src proto.Message)

func (*MsgSendPacket) XXX_Size

func (m *MsgSendPacket) XXX_Size() int

func (*MsgSendPacket) XXX_Unmarshal

func (m *MsgSendPacket) XXX_Unmarshal(b []byte) error

type MsgSendPacketResponse

type MsgSendPacketResponse struct {
}

MsgSendPacketResponse defines the Msg/SendPacket response type.

func (*MsgSendPacketResponse) Descriptor

func (*MsgSendPacketResponse) Descriptor() ([]byte, []int)

func (*MsgSendPacketResponse) Marshal

func (m *MsgSendPacketResponse) Marshal() (dAtA []byte, err error)

func (*MsgSendPacketResponse) MarshalTo

func (m *MsgSendPacketResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgSendPacketResponse) MarshalToSizedBuffer

func (m *MsgSendPacketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSendPacketResponse) ProtoMessage

func (*MsgSendPacketResponse) ProtoMessage()

func (*MsgSendPacketResponse) Reset

func (m *MsgSendPacketResponse) Reset()

func (*MsgSendPacketResponse) Size

func (m *MsgSendPacketResponse) Size() (n int)

func (*MsgSendPacketResponse) String

func (m *MsgSendPacketResponse) String() string

func (*MsgSendPacketResponse) Unmarshal

func (m *MsgSendPacketResponse) Unmarshal(dAtA []byte) error

func (*MsgSendPacketResponse) XXX_DiscardUnknown

func (m *MsgSendPacketResponse) XXX_DiscardUnknown()

func (*MsgSendPacketResponse) XXX_Marshal

func (m *MsgSendPacketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSendPacketResponse) XXX_Merge

func (m *MsgSendPacketResponse) XXX_Merge(src proto.Message)

func (*MsgSendPacketResponse) XXX_Size

func (m *MsgSendPacketResponse) XXX_Size() int

func (*MsgSendPacketResponse) XXX_Unmarshal

func (m *MsgSendPacketResponse) XXX_Unmarshal(b []byte) error

type MsgServer

type MsgServer interface {
	// SendPacket defines a rpc handler method for MsgSendPacket.
	SendPacket(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error)
}

MsgServer is the server API for Msg service.

type PortKeeper

type PortKeeper interface {
	BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
}

PortKeeper defines the expected IBC port keeper

type SuccessfulAcknowledgement

type SuccessfulAcknowledgement struct {
	Result []byte `json:"result"`
}

func NewSuccessfulAcknowledgement

func NewSuccessfulAcknowledgement(r string) SuccessfulAcknowledgement

func (SuccessfulAcknowledgement) Acknowledgement

func (a SuccessfulAcknowledgement) Acknowledgement() []byte

func (SuccessfulAcknowledgement) Success

func (SuccessfulAcknowledgement) Success() bool

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) SendPacket

Jump to

Keyboard shortcuts

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