types

package
v5.1.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 28 Imported by: 3

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName defines the 29-fee name
	ModuleName = "packetfowardmiddleware"

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

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

	// QuerierRoute is the querier route for IBC transfer
	QuerierRoute = ModuleName
)

Variables

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	DefaultFeePercentage = sdk.NewDec(0)
	// KeyFeePercentage is store's key for FeePercentage Params
	KeyFeePercentage = []byte("FeePercentage")
)
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 ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable type declaration for parameters

func RefundPacketKey

func RefundPacketKey(channelID, portID string, sequence uint64) []byte

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type BankKeeper

type BankKeeper interface {
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
}

BankKeeper defines the expected bank keeper

type ChannelKeeper

type ChannelKeeper interface {
	GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
	GetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) []byte
	GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
	LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capabilitytypes.Capability, error)
}

ChannelKeeper defines the expected IBC channel keeper

type DisableDenomCompositionKey added in v5.1.0

type DisableDenomCompositionKey struct{}

type DistributionKeeper

type DistributionKeeper interface {
	FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

DistributionKeeper defines the expected distribution keeper

type Duration added in v5.1.3

type Duration time.Duration

func (Duration) MarshalJSON added in v5.1.3

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON added in v5.1.3

func (d *Duration) UnmarshalJSON(b []byte) error

type ForwardMetadata added in v5.1.0

type ForwardMetadata struct {
	Receiver string   `json:"receiver,omitempty"`
	Port     string   `json:"port,omitempty"`
	Channel  string   `json:"channel,omitempty"`
	Timeout  Duration `json:"timeout,omitempty"`
	Retries  *uint8   `json:"retries,omitempty"`

	// Using JSONObject so that objects for next property will not be mutated by golang's lexicographic key sort on map keys during Marshal.
	// Supports primitives for Unmarshal/Marshal so that an escaped JSON-marshaled string is also valid.
	Next *JSONObject `json:"next,omitempty"`
}

func (*ForwardMetadata) Validate added in v5.1.0

func (m *ForwardMetadata) Validate() error

type GenesisState

type GenesisState struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	// key - information about forwarded packet: src_channel
	// (parsedReceiver.Channel), src_port (parsedReceiver.Port), sequence value -
	// information about original packet for refunding if necessary: retries,
	// srcPacketSender, srcPacket.DestinationChannel, srcPacket.DestinationPort
	InFlightPackets map[string]InFlightPacket `` /* 211-byte string literal not displayed */
}

GenesisState defines the router genesis state

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

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

func NewGenesisState

func NewGenesisState(params Params, inFlightPackets map[string]InFlightPacket) *GenesisState

NewGenesisState creates a 29-fee GenesisState instance.

func (*GenesisState) Descriptor

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

func (*GenesisState) GetInFlightPackets

func (m *GenesisState) GetInFlightPackets() map[string]InFlightPacket

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

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

func (*GenesisState) MarshalTo

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

func (*GenesisState) MarshalToSizedBuffer

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

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

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

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

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

func (GenesisState) Validate

func (gs GenesisState) Validate() error

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

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

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

func (*GenesisState) XXX_Merge

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

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

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

type InFlightPacket

type InFlightPacket struct {
	OriginalSenderAddress  string `` /* 126-byte string literal not displayed */
	RefundChannelId        string `protobuf:"bytes,2,opt,name=refund_channel_id,json=refundChannelId,proto3" json:"refund_channel_id,omitempty"`
	RefundPortId           string `protobuf:"bytes,3,opt,name=refund_port_id,json=refundPortId,proto3" json:"refund_port_id,omitempty"`
	PacketSrcChannelId     string `protobuf:"bytes,4,opt,name=packet_src_channel_id,json=packetSrcChannelId,proto3" json:"packet_src_channel_id,omitempty"`
	PacketSrcPortId        string `protobuf:"bytes,5,opt,name=packet_src_port_id,json=packetSrcPortId,proto3" json:"packet_src_port_id,omitempty"`
	PacketTimeoutTimestamp uint64 `` /* 130-byte string literal not displayed */
	PacketTimeoutHeight    string `protobuf:"bytes,7,opt,name=packet_timeout_height,json=packetTimeoutHeight,proto3" json:"packet_timeout_height,omitempty"`
	PacketData             []byte `protobuf:"bytes,8,opt,name=packet_data,json=packetData,proto3" json:"packet_data,omitempty"`
	RefundSequence         uint64 `protobuf:"varint,9,opt,name=refund_sequence,json=refundSequence,proto3" json:"refund_sequence,omitempty"`
	RetriesRemaining       int32  `protobuf:"varint,10,opt,name=retries_remaining,json=retriesRemaining,proto3" json:"retries_remaining,omitempty"`
	Timeout                uint64 `protobuf:"varint,11,opt,name=timeout,proto3" json:"timeout,omitempty"`
	Nonrefundable          bool   `protobuf:"varint,12,opt,name=nonrefundable,proto3" json:"nonrefundable,omitempty"`
}

InFlightPacket contains information about original packet for writing the acknowledgement and refunding if necessary.

func (*InFlightPacket) Descriptor

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

func (*InFlightPacket) GetNonrefundable added in v5.1.0

func (m *InFlightPacket) GetNonrefundable() bool

func (*InFlightPacket) GetOriginalSenderAddress

func (m *InFlightPacket) GetOriginalSenderAddress() string

func (*InFlightPacket) GetPacketData

func (m *InFlightPacket) GetPacketData() []byte

func (*InFlightPacket) GetPacketSrcChannelId

func (m *InFlightPacket) GetPacketSrcChannelId() string

func (*InFlightPacket) GetPacketSrcPortId

func (m *InFlightPacket) GetPacketSrcPortId() string

func (*InFlightPacket) GetPacketTimeoutHeight

func (m *InFlightPacket) GetPacketTimeoutHeight() string

func (*InFlightPacket) GetPacketTimeoutTimestamp

func (m *InFlightPacket) GetPacketTimeoutTimestamp() uint64

func (*InFlightPacket) GetRefundChannelId

func (m *InFlightPacket) GetRefundChannelId() string

func (*InFlightPacket) GetRefundPortId

func (m *InFlightPacket) GetRefundPortId() string

func (*InFlightPacket) GetRefundSequence

func (m *InFlightPacket) GetRefundSequence() uint64

func (*InFlightPacket) GetRetriesRemaining

func (m *InFlightPacket) GetRetriesRemaining() int32

func (*InFlightPacket) GetTimeout

func (m *InFlightPacket) GetTimeout() uint64

func (*InFlightPacket) Marshal

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

func (*InFlightPacket) MarshalTo

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

func (*InFlightPacket) MarshalToSizedBuffer

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

func (*InFlightPacket) ProtoMessage

func (*InFlightPacket) ProtoMessage()

func (*InFlightPacket) Reset

func (m *InFlightPacket) Reset()

func (*InFlightPacket) Size

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

func (*InFlightPacket) String

func (m *InFlightPacket) String() string

func (*InFlightPacket) Unmarshal

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

func (*InFlightPacket) XXX_DiscardUnknown

func (m *InFlightPacket) XXX_DiscardUnknown()

func (*InFlightPacket) XXX_Marshal

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

func (*InFlightPacket) XXX_Merge

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

func (*InFlightPacket) XXX_Size

func (m *InFlightPacket) XXX_Size() int

func (*InFlightPacket) XXX_Unmarshal

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

type JSONObject added in v5.1.1

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

JSONObject is a wrapper type to allow either a primitive type or a JSON object. In the case the value is a JSON object, OrderedMap type is used so that key order is retained across Unmarshal/Marshal.

func NewJSONObject added in v5.1.1

func NewJSONObject(object bool, primitive []byte, orderedMap orderedmap.OrderedMap) *JSONObject

NewJSONObject is a constructor used for tests. The usage of JSONObject in the middleware is only json Marshal/Unmarshal

func (JSONObject) MarshalJSON added in v5.1.1

func (o JSONObject) MarshalJSON() ([]byte, error)

MarshalJSON overrides the default json.Marshal behavior

func (*JSONObject) UnmarshalJSON added in v5.1.1

func (o *JSONObject) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the default json.Unmarshal behavior

type NonrefundableKey added in v5.1.0

type NonrefundableKey struct{}

type PacketMetadata added in v5.1.0

type PacketMetadata struct {
	Forward *ForwardMetadata `json:"forward"`
}

type Params

type Params struct {
	FeePercentage github_com_cosmos_cosmos_sdk_types.Dec `` /* 162-byte string literal not displayed */
}

Params defines the set of IBC router parameters.

func DefaultParams

func DefaultParams() Params

DefaultParams is the default parameter configuration for the ibc-transfer module

func NewParams

func NewParams(feePercentage sdk.Dec) Params

NewParams creates a new parameter configuration for the ibc transfer module

func (*Params) Descriptor

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

func (*Params) Marshal

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

func (*Params) MarshalTo

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

func (*Params) MarshalToSizedBuffer

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

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs implements params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

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

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

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

func (Params) Validate

func (p Params) Validate() error

Validate all ibc-transfer module parameters

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

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

func (*Params) XXX_Merge

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

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

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

type ProcessedKey added in v5.1.0

type ProcessedKey struct{}

type QueryClient

type QueryClient interface {
	// Params queries all parameters of the router module.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, 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 QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest is the request type for the Query/Params RPC method.

func (*QueryParamsRequest) Descriptor

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

func (*QueryParamsRequest) Marshal

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

func (*QueryParamsRequest) MarshalTo

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

func (*QueryParamsRequest) MarshalToSizedBuffer

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

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

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

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

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

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

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

func (*QueryParamsRequest) XXX_Merge

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

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

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

type QueryParamsResponse

type QueryParamsResponse struct {
	// params defines the parameters of the module.
	Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"`
}

QueryParamsResponse is the response type for the Query/Params RPC method.

func (*QueryParamsResponse) Descriptor

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

func (*QueryParamsResponse) GetParams

func (m *QueryParamsResponse) GetParams() *Params

func (*QueryParamsResponse) Marshal

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

func (*QueryParamsResponse) MarshalTo

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

func (*QueryParamsResponse) MarshalToSizedBuffer

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

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

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

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

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

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

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

func (*QueryParamsResponse) XXX_Merge

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

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

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

type QueryServer

type QueryServer interface {
	// Params queries all parameters of the router module.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
}

QueryServer is the server API for Query service.

type TransferKeeper

type TransferKeeper interface {
	Transfer(ctx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error)
	DenomPathFromHash(ctx sdk.Context, denom string) (string, error)
}

TransferKeeper defines the expected transfer keeper

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

Jump to

Keyboard shortcuts

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