types

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 15 Imported by: 91

Documentation

Index

Constants

View Source
const (
	// SubModuleName defines the IBC port name
	SubModuleName = "port"

	// StoreKey is the store key string for IBC ports
	StoreKey = SubModuleName

	// RouterKey is the message route for IBC ports
	RouterKey = SubModuleName

	// QuerierRoute is the querier route for IBC ports
	QuerierRoute = SubModuleName
)

Variables

View Source
var (
	ErrPortExists   = sdkerrors.Register(SubModuleName, 2, "port is already binded")
	ErrPortNotFound = sdkerrors.Register(SubModuleName, 3, "port not found")
	ErrInvalidPort  = sdkerrors.Register(SubModuleName, 4, "invalid port")
	ErrInvalidRoute = sdkerrors.Register(SubModuleName, 5, "route not found")
)

IBC port sentinel errors

View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)

Functions

func GetModuleOwner

func GetModuleOwner(modules []string) string

GetModuleOwner enforces that only IBC and the module bound to port can own the capability while future implementations may allow multiple modules to bind to a port, currently we only allow one module to be bound to a port at any given time

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type IBCModule

type IBCModule interface {
	OnChanOpenInit(
		ctx sdk.Context,
		order channeltypes.Order,
		connectionHops []string,
		portID string,
		channelID string,
		channelCap *capabilitytypes.Capability,
		counterparty channeltypes.Counterparty,
		version string,
	) error

	OnChanOpenTry(
		ctx sdk.Context,
		order channeltypes.Order,
		connectionHops []string,
		portID,
		channelID string,
		channelCap *capabilitytypes.Capability,
		counterparty channeltypes.Counterparty,
		version,
		counterpartyVersion string,
	) error

	OnChanOpenAck(
		ctx sdk.Context,
		portID,
		channelID string,
		counterpartyVersion string,
	) error

	OnChanOpenConfirm(
		ctx sdk.Context,
		portID,
		channelID string,
	) error

	OnChanCloseInit(
		ctx sdk.Context,
		portID,
		channelID string,
	) error

	OnChanCloseConfirm(
		ctx sdk.Context,
		portID,
		channelID string,
	) error

	// OnRecvPacket must return an acknowledgement that implements the Acknowledgement interface.
	// In the case of an asynchronous acknowledgement, nil should be returned.
	// If the acknowledgement returned is successful, the state changes on callback are written,
	// otherwise the application state changes are discarded. In either case the packet is received
	// and the acknowledgement is written (in synchronous cases).
	OnRecvPacket(
		ctx sdk.Context,
		packet channeltypes.Packet,
		relayer sdk.AccAddress,
	) exported.Acknowledgement

	OnAcknowledgementPacket(
		ctx sdk.Context,
		packet channeltypes.Packet,
		acknowledgement []byte,
		relayer sdk.AccAddress,
	) error

	OnTimeoutPacket(
		ctx sdk.Context,
		packet channeltypes.Packet,
		relayer sdk.AccAddress,
	) error

	// NegotiateAppVersion performs application version negotiation given the provided channel ordering, connectionID, portID, counterparty and proposed version.
	// An error is returned if version negotiation cannot be performed. For example, an application module implementing this interface
	// may decide to return an error in the event of the proposed version being incompatible with it's own
	NegotiateAppVersion(
		ctx sdk.Context,
		order channeltypes.Order,
		connectionID string,
		portID string,
		counterparty channeltypes.Counterparty,
		proposedVersion string,
	) (version string, err error)
}

IBCModule defines an interface that implements all the callbacks that modules must define as specified in ICS-26

type QueryAppVersionRequest

type QueryAppVersionRequest struct {
	// port unique identifier
	PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"`
	// connection unique identifier
	ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"`
	// whether the channel is ordered or unordered
	Ordering types.Order `protobuf:"varint,3,opt,name=ordering,proto3,enum=ibc.core.channel.v1.Order" json:"ordering,omitempty"`
	// counterparty channel end
	Counterparty *types.Counterparty `protobuf:"bytes,4,opt,name=counterparty,proto3" json:"counterparty,omitempty"`
	// proposed version
	ProposedVersion string `protobuf:"bytes,5,opt,name=proposed_version,json=proposedVersion,proto3" json:"proposed_version,omitempty"`
}

QueryAppVersionRequest is the request type for the Query/AppVersion RPC method

func (*QueryAppVersionRequest) Descriptor

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

func (*QueryAppVersionRequest) GetConnectionId

func (m *QueryAppVersionRequest) GetConnectionId() string

func (*QueryAppVersionRequest) GetCounterparty

func (m *QueryAppVersionRequest) GetCounterparty() *types.Counterparty

func (*QueryAppVersionRequest) GetOrdering

func (m *QueryAppVersionRequest) GetOrdering() types.Order

func (*QueryAppVersionRequest) GetPortId

func (m *QueryAppVersionRequest) GetPortId() string

func (*QueryAppVersionRequest) GetProposedVersion

func (m *QueryAppVersionRequest) GetProposedVersion() string

func (*QueryAppVersionRequest) Marshal

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

func (*QueryAppVersionRequest) MarshalTo

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

func (*QueryAppVersionRequest) MarshalToSizedBuffer

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

func (*QueryAppVersionRequest) ProtoMessage

func (*QueryAppVersionRequest) ProtoMessage()

func (*QueryAppVersionRequest) Reset

func (m *QueryAppVersionRequest) Reset()

func (*QueryAppVersionRequest) Size

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

func (*QueryAppVersionRequest) String

func (m *QueryAppVersionRequest) String() string

func (*QueryAppVersionRequest) Unmarshal

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

func (*QueryAppVersionRequest) XXX_DiscardUnknown

func (m *QueryAppVersionRequest) XXX_DiscardUnknown()

func (*QueryAppVersionRequest) XXX_Marshal

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

func (*QueryAppVersionRequest) XXX_Merge

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

func (*QueryAppVersionRequest) XXX_Size

func (m *QueryAppVersionRequest) XXX_Size() int

func (*QueryAppVersionRequest) XXX_Unmarshal

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

type QueryAppVersionResponse

type QueryAppVersionResponse struct {
	// port id associated with the request identifiers
	PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"`
	// supported app version
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
}

QueryAppVersionResponse is the response type for the Query/AppVersion RPC method.

func NewQueryAppVersionResponse

func NewQueryAppVersionResponse(portID, version string) *QueryAppVersionResponse

NewQueryAppVersionResponse creates a new QueryAppVersionResponse instance

func (*QueryAppVersionResponse) Descriptor

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

func (*QueryAppVersionResponse) GetPortId

func (m *QueryAppVersionResponse) GetPortId() string

func (*QueryAppVersionResponse) GetVersion

func (m *QueryAppVersionResponse) GetVersion() string

func (*QueryAppVersionResponse) Marshal

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

func (*QueryAppVersionResponse) MarshalTo

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

func (*QueryAppVersionResponse) MarshalToSizedBuffer

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

func (*QueryAppVersionResponse) ProtoMessage

func (*QueryAppVersionResponse) ProtoMessage()

func (*QueryAppVersionResponse) Reset

func (m *QueryAppVersionResponse) Reset()

func (*QueryAppVersionResponse) Size

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

func (*QueryAppVersionResponse) String

func (m *QueryAppVersionResponse) String() string

func (*QueryAppVersionResponse) Unmarshal

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

func (*QueryAppVersionResponse) XXX_DiscardUnknown

func (m *QueryAppVersionResponse) XXX_DiscardUnknown()

func (*QueryAppVersionResponse) XXX_Marshal

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

func (*QueryAppVersionResponse) XXX_Merge

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

func (*QueryAppVersionResponse) XXX_Size

func (m *QueryAppVersionResponse) XXX_Size() int

func (*QueryAppVersionResponse) XXX_Unmarshal

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

type QueryClient

type QueryClient interface {
	// AppVersion queries an IBC Port and determines the appropriate application version to be used
	AppVersion(ctx context.Context, in *QueryAppVersionRequest, opts ...grpc.CallOption) (*QueryAppVersionResponse, error)
}

QueryClient is the client API for Query service.

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

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryServer

type QueryServer interface {
	// AppVersion queries an IBC Port and determines the appropriate application version to be used
	AppVersion(context.Context, *QueryAppVersionRequest) (*QueryAppVersionResponse, error)
}

QueryServer is the server API for Query service.

type Router

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

The router is a map from module name to the IBCModule which contains all the module-defined callbacks required by ICS-26

func NewRouter

func NewRouter() *Router

func (*Router) AddRoute

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

AddRoute adds IBCModule for a given module name. It returns the Router so AddRoute calls can be linked. It will panic if the Router is sealed.

func (*Router) GetRoute

func (rtr *Router) GetRoute(module string) (IBCModule, bool)

GetRoute returns a IBCModule for a given module.

func (*Router) HasRoute

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

HasRoute returns true if the Router has a module registered or false otherwise.

func (*Router) Seal

func (rtr *Router) Seal()

Seal prevents the Router from any subsequent route handlers to be registered. Seal will panic if called more than once.

func (Router) Sealed

func (rtr Router) Sealed() bool

Sealed returns a boolean signifying if the Router is sealed or not.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) AppVersion

Jump to

Keyboard shortcuts

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