Documentation ¶
Overview ¶
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func RegisterMsgServer(s grpc1.Server, srv MsgServer)
- func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
- func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
- func RegisterQueryServer(s grpc1.Server, srv QueryServer)
- type FungibleTokenPacketData
- func (ftpd FungibleTokenPacketData) CompatibilityGetBytes() []byte
- func (*FungibleTokenPacketData) Descriptor() ([]byte, []int)
- func (m *FungibleTokenPacketData) GetAmount() string
- func (ftpd FungibleTokenPacketData) GetBytes() []byte
- func (m *FungibleTokenPacketData) GetDenom() string
- func (m *FungibleTokenPacketData) GetFee() string
- func (m *FungibleTokenPacketData) GetMemo() string
- func (m *FungibleTokenPacketData) GetReceiver() string
- func (m *FungibleTokenPacketData) GetRouter() string
- func (m *FungibleTokenPacketData) GetSender() string
- func (m *FungibleTokenPacketData) Marshal() (dAtA []byte, err error)
- func (m *FungibleTokenPacketData) MarshalTo(dAtA []byte) (int, error)
- func (m *FungibleTokenPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FungibleTokenPacketData) ProtoMessage()
- func (m *FungibleTokenPacketData) Reset()
- func (m *FungibleTokenPacketData) Size() (n int)
- func (m *FungibleTokenPacketData) String() string
- func (ftpd FungibleTokenPacketData) ToIBCPacketData() transfertypes.FungibleTokenPacketData
- func (m *FungibleTokenPacketData) Unmarshal(dAtA []byte) error
- func (ftpd FungibleTokenPacketData) ValidateBasic() error
- func (m *FungibleTokenPacketData) XXX_DiscardUnknown()
- func (m *FungibleTokenPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FungibleTokenPacketData) XXX_Merge(src proto.Message)
- func (m *FungibleTokenPacketData) XXX_Size() int
- func (m *FungibleTokenPacketData) XXX_Unmarshal(b []byte) error
- type MsgClient
- type MsgServer
- type MsgTransfer
- func (*MsgTransfer) Descriptor() ([]byte, []int)
- func (msg MsgTransfer) GetSignBytes() []byte
- func (msg MsgTransfer) GetSigners() []sdk.AccAddress
- func (m *MsgTransfer) Marshal() (dAtA []byte, err error)
- func (m *MsgTransfer) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgTransfer) ProtoMessage()
- func (m *MsgTransfer) Reset()
- func (MsgTransfer) Route() string
- func (m *MsgTransfer) Size() (n int)
- func (m *MsgTransfer) String() string
- func (MsgTransfer) Type() string
- func (m *MsgTransfer) Unmarshal(dAtA []byte) error
- func (msg MsgTransfer) ValidateBasic() error
- func (m *MsgTransfer) XXX_DiscardUnknown()
- func (m *MsgTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgTransfer) XXX_Merge(src proto.Message)
- func (m *MsgTransfer) XXX_Size() int
- func (m *MsgTransfer) XXX_Unmarshal(b []byte) error
- type QueryClient
- type QueryServer
- type UnimplementedMsgServer
- type UnimplementedQueryServer
- func (*UnimplementedQueryServer) DenomHash(ctx context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error)
- func (*UnimplementedQueryServer) DenomTrace(ctx context.Context, req *types.QueryDenomTraceRequest) (*types.QueryDenomTraceResponse, error)
- func (*UnimplementedQueryServer) DenomTraces(ctx context.Context, req *types.QueryDenomTracesRequest) (*types.QueryDenomTracesResponse, error)
- func (*UnimplementedQueryServer) EscrowAddress(ctx context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
- func (*UnimplementedQueryServer) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Constants ¶
const ( EventTypeReceive = "ibc_receive" AttributeKeyRecvError = "error" )
IBC transfer events
const ( // ModuleName defines the IBC transfer name ModuleName = "transfer" // CompatibleModuleName is the query and tx module name CompatibleModuleName = "fxtransfer" // RouterKey is the message route for IBC transfer RouterKey = CompatibleModuleName // QuerierRoute is the querier route for IBC transfer QuerierRoute = CompatibleModuleName )
const (
TypeMsgTransfer = "transfer"
)
Variables ¶
var ( // ModuleCdc references the global x/ibc-transfer 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 x/ibc transfer 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) )
var ( ErrFeeDenomNotMatchTokenDenom = sdkerrors.Register(ModuleName, 100, "invalid fee denom, must match token denom") ErrNotSupportRouter = sdkerrors.Register(ModuleName, 101, "not support router") ErrNotSupportFee = sdkerrors.Register(ModuleName, 102, "not support fee") )
var ( ErrInvalidLengthTransfer = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTransfer = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTransfer = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") )
var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(12) * time.Hour).Nanoseconds())
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 12-hour timeout.
Functions ¶
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces register the ibc transfer module interfaces to protobuf Any.
func RegisterLegacyAminoCodec ¶
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
func RegisterMsgServer ¶
func RegisterQueryHandler ¶
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 FungibleTokenPacketData ¶
type FungibleTokenPacketData struct { // the token denomination to be transferred Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` // the token amount to be transferred Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` // the sender address Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` // the recipient address on the destination chain Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"` // the router is hook destination chain Router string `protobuf:"bytes,5,opt,name=router,proto3" json:"router,omitempty"` // the fee is destination fee Fee string `protobuf:"bytes,6,opt,name=fee,proto3" json:"fee,omitempty"` // optional memo Memo string `protobuf:"bytes,7,opt,name=memo,proto3" json:"memo,omitempty"` }
FungibleTokenPacketData defines a struct for the packet payload See FungibleTokenPacketData spec: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures
func NewFungibleTokenPacketData ¶
func NewFungibleTokenPacketData(denom, amount, sender, receiver, router string, fee string, ) FungibleTokenPacketData
NewFungibleTokenPacketData contructs a new FungibleTokenPacketData instance
func (FungibleTokenPacketData) CompatibilityGetBytes ¶ added in v0.2.2
func (ftpd FungibleTokenPacketData) CompatibilityGetBytes() []byte
CompatibilityGetBytes is a helper for serialising, compatibility fx ibc transfer
func (*FungibleTokenPacketData) Descriptor ¶
func (*FungibleTokenPacketData) Descriptor() ([]byte, []int)
func (*FungibleTokenPacketData) GetAmount ¶
func (m *FungibleTokenPacketData) GetAmount() string
func (FungibleTokenPacketData) GetBytes ¶
func (ftpd FungibleTokenPacketData) GetBytes() []byte
GetBytes is a helper for serialising
func (*FungibleTokenPacketData) GetDenom ¶
func (m *FungibleTokenPacketData) GetDenom() string
func (*FungibleTokenPacketData) GetFee ¶
func (m *FungibleTokenPacketData) GetFee() string
func (*FungibleTokenPacketData) GetMemo ¶ added in v0.2.0
func (m *FungibleTokenPacketData) GetMemo() string
func (*FungibleTokenPacketData) GetReceiver ¶
func (m *FungibleTokenPacketData) GetReceiver() string
func (*FungibleTokenPacketData) GetRouter ¶
func (m *FungibleTokenPacketData) GetRouter() string
func (*FungibleTokenPacketData) GetSender ¶
func (m *FungibleTokenPacketData) GetSender() string
func (*FungibleTokenPacketData) Marshal ¶
func (m *FungibleTokenPacketData) Marshal() (dAtA []byte, err error)
func (*FungibleTokenPacketData) MarshalTo ¶
func (m *FungibleTokenPacketData) MarshalTo(dAtA []byte) (int, error)
func (*FungibleTokenPacketData) MarshalToSizedBuffer ¶
func (m *FungibleTokenPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*FungibleTokenPacketData) ProtoMessage ¶
func (*FungibleTokenPacketData) ProtoMessage()
func (*FungibleTokenPacketData) Reset ¶
func (m *FungibleTokenPacketData) Reset()
func (*FungibleTokenPacketData) Size ¶
func (m *FungibleTokenPacketData) Size() (n int)
func (*FungibleTokenPacketData) String ¶
func (m *FungibleTokenPacketData) String() string
func (FungibleTokenPacketData) ToIBCPacketData ¶ added in v0.2.0
func (ftpd FungibleTokenPacketData) ToIBCPacketData() transfertypes.FungibleTokenPacketData
GetBytes is a helper for serialising
func (*FungibleTokenPacketData) Unmarshal ¶
func (m *FungibleTokenPacketData) Unmarshal(dAtA []byte) error
func (FungibleTokenPacketData) ValidateBasic ¶
func (ftpd FungibleTokenPacketData) ValidateBasic() error
ValidateBasic is used for validating the token transfer. NOTE: The addresses formats are not validated as the sender and recipient can have different formats defined by their corresponding chains that are not known to IBC.
func (*FungibleTokenPacketData) XXX_DiscardUnknown ¶
func (m *FungibleTokenPacketData) XXX_DiscardUnknown()
func (*FungibleTokenPacketData) XXX_Marshal ¶
func (m *FungibleTokenPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FungibleTokenPacketData) XXX_Merge ¶
func (m *FungibleTokenPacketData) XXX_Merge(src proto.Message)
func (*FungibleTokenPacketData) XXX_Size ¶
func (m *FungibleTokenPacketData) XXX_Size() int
func (*FungibleTokenPacketData) XXX_Unmarshal ¶
func (m *FungibleTokenPacketData) XXX_Unmarshal(b []byte) error
type MsgClient ¶
type MsgClient interface { // Transfer defines a rpc handler method for MsgTransfer. Transfer(ctx context.Context, in *MsgTransfer, opts ...grpc.CallOption) (*types2.MsgTransferResponse, 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 MsgServer ¶
type MsgServer interface { // Transfer defines a rpc handler method for MsgTransfer. Transfer(context.Context, *MsgTransfer) (*types2.MsgTransferResponse, error) }
MsgServer is the server API for Msg service.
type MsgTransfer ¶
type MsgTransfer 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 tokens to be transferred Token types.Coin `protobuf:"bytes,3,opt,name=token,proto3" json:"token"` // the sender address Sender string `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty"` // the recipient address on the destination chain Receiver string `protobuf:"bytes,5,opt,name=receiver,proto3" json:"receiver,omitempty"` // Timeout height relative to the current block height. // The timeout is disabled when set to 0. TimeoutHeight types1.Height `protobuf:"bytes,6,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height" yaml:"timeout_height"` // Timeout timestamp (in nanoseconds) relative to the current block timestamp. // The timeout is disabled when set to 0. TimeoutTimestamp uint64 `` /* 135-byte string literal not displayed */ // the router is hook destination chain Router string `protobuf:"bytes,8,opt,name=router,proto3" json:"router,omitempty"` // the tokens to be destination fee Fee types.Coin `protobuf:"bytes,9,opt,name=fee,proto3" json:"fee"` // optional memo Memo string `protobuf:"bytes,10,opt,name=memo,proto3" json:"memo,omitempty"` }
MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between ICS20 enabled chains. See ICS Spec here: https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures
func NewMsgTransfer ¶
func NewMsgTransfer( sourcePort, sourceChannel string, token sdk.Coin, sender string, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, router string, fee sdk.Coin, ) *MsgTransfer
NewMsgTransfer creates a new MsgTransfer instance
func (*MsgTransfer) Descriptor ¶
func (*MsgTransfer) Descriptor() ([]byte, []int)
func (MsgTransfer) GetSignBytes ¶
func (msg MsgTransfer) GetSignBytes() []byte
GetSignBytes implements sdk.Msg.
func (MsgTransfer) GetSigners ¶
func (msg MsgTransfer) GetSigners() []sdk.AccAddress
GetSigners implements sdk.Msg
func (*MsgTransfer) Marshal ¶
func (m *MsgTransfer) Marshal() (dAtA []byte, err error)
func (*MsgTransfer) MarshalToSizedBuffer ¶
func (m *MsgTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgTransfer) ProtoMessage ¶
func (*MsgTransfer) ProtoMessage()
func (*MsgTransfer) Reset ¶
func (m *MsgTransfer) Reset()
func (*MsgTransfer) Size ¶
func (m *MsgTransfer) Size() (n int)
func (*MsgTransfer) String ¶
func (m *MsgTransfer) String() string
func (*MsgTransfer) Unmarshal ¶
func (m *MsgTransfer) Unmarshal(dAtA []byte) error
func (MsgTransfer) ValidateBasic ¶
func (msg MsgTransfer) ValidateBasic() error
ValidateBasic performs a basic check of the MsgTransfer 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 (*MsgTransfer) XXX_DiscardUnknown ¶
func (m *MsgTransfer) XXX_DiscardUnknown()
func (*MsgTransfer) XXX_Marshal ¶
func (m *MsgTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgTransfer) XXX_Merge ¶
func (m *MsgTransfer) XXX_Merge(src proto.Message)
func (*MsgTransfer) XXX_Size ¶
func (m *MsgTransfer) XXX_Size() int
func (*MsgTransfer) XXX_Unmarshal ¶
func (m *MsgTransfer) XXX_Unmarshal(b []byte) error
type QueryClient ¶
type QueryClient interface { // DenomTrace queries a denomination trace information. DenomTrace(ctx context.Context, in *types.QueryDenomTraceRequest, opts ...grpc.CallOption) (*types.QueryDenomTraceResponse, error) // DenomTraces queries all denomination traces. DenomTraces(ctx context.Context, in *types.QueryDenomTracesRequest, opts ...grpc.CallOption) (*types.QueryDenomTracesResponse, error) // Params queries all parameters of the ibc-transfer module. Params(ctx context.Context, in *types.QueryParamsRequest, opts ...grpc.CallOption) (*types.QueryParamsResponse, error) // DenomHash queries a denomination hash information. DenomHash(ctx context.Context, in *types.QueryDenomHashRequest, opts ...grpc.CallOption) (*types.QueryDenomHashResponse, error) // EscrowAddress returns the escrow address for a particular port and channel // id. EscrowAddress(ctx context.Context, in *types.QueryEscrowAddressRequest, opts ...grpc.CallOption) (*types.QueryEscrowAddressResponse, 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 { // DenomTrace queries a denomination trace information. DenomTrace(context.Context, *types.QueryDenomTraceRequest) (*types.QueryDenomTraceResponse, error) // DenomTraces queries all denomination traces. DenomTraces(context.Context, *types.QueryDenomTracesRequest) (*types.QueryDenomTracesResponse, error) // Params queries all parameters of the ibc-transfer module. Params(context.Context, *types.QueryParamsRequest) (*types.QueryParamsResponse, error) // DenomHash queries a denomination hash information. DenomHash(context.Context, *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error) // EscrowAddress returns the escrow address for a particular port and channel // id. EscrowAddress(context.Context, *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error) }
QueryServer is the server API for Query service.
type UnimplementedMsgServer ¶
type UnimplementedMsgServer struct { }
UnimplementedMsgServer can be embedded to have forward compatible implementations.
func (*UnimplementedMsgServer) Transfer ¶
func (*UnimplementedMsgServer) Transfer(ctx context.Context, req *MsgTransfer) (*types2.MsgTransferResponse, error)
type UnimplementedQueryServer ¶
type UnimplementedQueryServer struct { }
UnimplementedQueryServer can be embedded to have forward compatible implementations.
func (*UnimplementedQueryServer) DenomHash ¶ added in v0.2.0
func (*UnimplementedQueryServer) DenomHash(ctx context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error)
func (*UnimplementedQueryServer) DenomTrace ¶
func (*UnimplementedQueryServer) DenomTrace(ctx context.Context, req *types.QueryDenomTraceRequest) (*types.QueryDenomTraceResponse, error)
func (*UnimplementedQueryServer) DenomTraces ¶
func (*UnimplementedQueryServer) DenomTraces(ctx context.Context, req *types.QueryDenomTracesRequest) (*types.QueryDenomTracesResponse, error)
func (*UnimplementedQueryServer) EscrowAddress ¶ added in v0.2.0
func (*UnimplementedQueryServer) EscrowAddress(ctx context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
func (*UnimplementedQueryServer) Params ¶
func (*UnimplementedQueryServer) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)