api

package
v10.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 5 Imported by: 48

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IBCModule

type IBCModule interface {
	// OnSendPacket is executed when a packet is being sent from sending chain.
	// this callback is provided with the source and destination IDs, the signer, the packet sequence and the packet data
	// for this specific application.
	OnSendPacket(
		ctx sdk.Context,
		sourceClient string,
		destinationClient string,
		sequence uint64,
		payload channeltypesv2.Payload,
		signer sdk.AccAddress,
	) error

	OnRecvPacket(
		ctx sdk.Context,
		sourceClient string,
		destinationClient string,
		sequence uint64,
		payload channeltypesv2.Payload,
		relayer sdk.AccAddress,
	) channeltypesv2.RecvPacketResult

	// OnTimeoutPacket is executed when a packet has timed out on the receiving chain.
	OnTimeoutPacket(
		ctx sdk.Context,
		sourceClient string,
		destinationClient string,
		sequence uint64,
		payload channeltypesv2.Payload,
		relayer sdk.AccAddress,
	) error

	// OnAcknowledgementPacket is executed when a packet gets acknowledged
	OnAcknowledgementPacket(
		ctx sdk.Context,
		sourceClient string,
		destinationClient string,
		sequence uint64,
		acknowledgement []byte,
		payload channeltypesv2.Payload,
		relayer sdk.AccAddress,
	) error
}

IBCModule defines an interface that implements all the callbacks that modules must define as specified in IBC Protocol V2.

type PacketDataUnmarshaler

type PacketDataUnmarshaler interface {
	// UnmarshalPacketData unmarshals the packet data into a concrete type
	// the payload is provided and the packet data interface is returned
	UnmarshalPacketData(payload channeltypesv2.Payload) (any, error)
}

PacketDataUnmarshaler defines an optional interface which allows a middleware to request the packet data to be unmarshaled by the base application.

type Router

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

Router contains all the module-defined callbacks required by IBC Protocol V2.

func NewRouter

func NewRouter() *Router

NewRouter creates a new Router instance.

func (*Router) AddPrefixRoute added in v10.3.0

func (rtr *Router) AddPrefixRoute(portIDPrefix string, cbs IBCModule) *Router

AddPrefixRoute registers a route for a given portID prefix to a given IBCModule. A prefix route matches any portID that starts with the given prefix.

Panics:

  • if `portIDPrefix` is not alphanumeric.
  • if a direct route `portIDPrefix` has already been registered.
  • if a prefix of `portIDPrefix` is already registered as a prefix.
  • if `portIDPrefix` is a prefix of am already registered prefix.

func (*Router) AddRoute

func (rtr *Router) AddRoute(portID string, cbs IBCModule) *Router

AddRoute registers a route for a given portID to a given IBCModule.

Panics:

  • if a route with the same portID has already been registered
  • if the portID is not alphanumeric

func (*Router) HasRoute

func (rtr *Router) HasRoute(portID string) bool

HasRoute returns true if the Router has a module registered (whether it's a direct or a prefix route) for the portID or false if no module is registered for it.

func (*Router) Route

func (rtr *Router) Route(portID string) IBCModule

Route returns the IBCModule for a given portID.

type WriteAcknowledgementWrapper

type WriteAcknowledgementWrapper interface {
	// WriteAcknowledgement writes the acknowledgement for an async acknowledgement
	WriteAcknowledgement(
		ctx sdk.Context,
		srcClientID string,
		sequence uint64,
		ack channeltypesv2.Acknowledgement,
	) error
}

Jump to

Keyboard shortcuts

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