Documentation ¶
Overview ¶
nolint
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func CheckReqID(reqID string) error
- func GenerateRequestID(r Request) []byte
- func GetSvcDefinition() servicetypes.ServiceDefinition
- func KeyOracleRandomRequest(requestContextID []byte) []byte
- func KeyRandom(reqID []byte) []byte
- func KeyRandomRequestQueue(height int64, reqID []byte) []byte
- func KeyRandomRequestQueueSubspace(height int64) []byte
- func RegisterInterfaces(registry types.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)
- func SHA256(data []byte) []byte
- func ValidateGenesis(data GenesisState) error
- func ValidateServiceFeeCap(serviceFeeCap sdk.Coins) error
- type AccountKeeper
- type BankKeeper
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (m *GenesisState) GetPendingRandomRequests() map[string]Requests
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type MsgClient
- type MsgRequestRandom
- func (*MsgRequestRandom) Descriptor() ([]byte, []int)
- func (m *MsgRequestRandom) GetBlockInterval() uint64
- func (m *MsgRequestRandom) GetConsumer() string
- func (m *MsgRequestRandom) GetOracle() bool
- func (m *MsgRequestRandom) GetServiceFeeCap() github_com_cosmos_cosmos_sdk_types.Coins
- func (msg MsgRequestRandom) GetSignBytes() []byte
- func (msg MsgRequestRandom) GetSigners() []sdk.AccAddress
- func (m *MsgRequestRandom) Marshal() (dAtA []byte, err error)
- func (m *MsgRequestRandom) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgRequestRandom) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgRequestRandom) ProtoMessage()
- func (m *MsgRequestRandom) Reset()
- func (msg MsgRequestRandom) Route() string
- func (m *MsgRequestRandom) Size() (n int)
- func (m *MsgRequestRandom) String() string
- func (msg MsgRequestRandom) Type() string
- func (m *MsgRequestRandom) Unmarshal(dAtA []byte) error
- func (msg MsgRequestRandom) ValidateBasic() error
- func (m *MsgRequestRandom) XXX_DiscardUnknown()
- func (m *MsgRequestRandom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgRequestRandom) XXX_Merge(src proto.Message)
- func (m *MsgRequestRandom) XXX_Size() int
- func (m *MsgRequestRandom) XXX_Unmarshal(b []byte) error
- type MsgRequestRandomResponse
- func (*MsgRequestRandomResponse) Descriptor() ([]byte, []int)
- func (m *MsgRequestRandomResponse) Marshal() (dAtA []byte, err error)
- func (m *MsgRequestRandomResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgRequestRandomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgRequestRandomResponse) ProtoMessage()
- func (m *MsgRequestRandomResponse) Reset()
- func (m *MsgRequestRandomResponse) Size() (n int)
- func (m *MsgRequestRandomResponse) String() string
- func (m *MsgRequestRandomResponse) Unmarshal(dAtA []byte) error
- func (m *MsgRequestRandomResponse) XXX_DiscardUnknown()
- func (m *MsgRequestRandomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgRequestRandomResponse) XXX_Merge(src proto.Message)
- func (m *MsgRequestRandomResponse) XXX_Size() int
- func (m *MsgRequestRandomResponse) XXX_Unmarshal(b []byte) error
- type MsgServer
- type PRNG
- type QueryClient
- type QueryRandomParams
- type QueryRandomRequest
- func (*QueryRandomRequest) Descriptor() ([]byte, []int)
- func (m *QueryRandomRequest) GetReqId() string
- func (m *QueryRandomRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryRandomRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryRandomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryRandomRequest) ProtoMessage()
- func (m *QueryRandomRequest) Reset()
- func (m *QueryRandomRequest) Size() (n int)
- func (m *QueryRandomRequest) String() string
- func (m *QueryRandomRequest) Unmarshal(dAtA []byte) error
- func (m *QueryRandomRequest) XXX_DiscardUnknown()
- func (m *QueryRandomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryRandomRequest) XXX_Merge(src proto.Message)
- func (m *QueryRandomRequest) XXX_Size() int
- func (m *QueryRandomRequest) XXX_Unmarshal(b []byte) error
- type QueryRandomRequestQueueParams
- type QueryRandomRequestQueueRequest
- func (*QueryRandomRequestQueueRequest) Descriptor() ([]byte, []int)
- func (m *QueryRandomRequestQueueRequest) GetHeight() int64
- func (m *QueryRandomRequestQueueRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryRandomRequestQueueRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryRandomRequestQueueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryRandomRequestQueueRequest) ProtoMessage()
- func (m *QueryRandomRequestQueueRequest) Reset()
- func (m *QueryRandomRequestQueueRequest) Size() (n int)
- func (m *QueryRandomRequestQueueRequest) String() string
- func (m *QueryRandomRequestQueueRequest) Unmarshal(dAtA []byte) error
- func (m *QueryRandomRequestQueueRequest) XXX_DiscardUnknown()
- func (m *QueryRandomRequestQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryRandomRequestQueueRequest) XXX_Merge(src proto.Message)
- func (m *QueryRandomRequestQueueRequest) XXX_Size() int
- func (m *QueryRandomRequestQueueRequest) XXX_Unmarshal(b []byte) error
- type QueryRandomRequestQueueResponse
- func (*QueryRandomRequestQueueResponse) Descriptor() ([]byte, []int)
- func (m *QueryRandomRequestQueueResponse) GetRequests() []Request
- func (m *QueryRandomRequestQueueResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryRandomRequestQueueResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryRandomRequestQueueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryRandomRequestQueueResponse) ProtoMessage()
- func (m *QueryRandomRequestQueueResponse) Reset()
- func (m *QueryRandomRequestQueueResponse) Size() (n int)
- func (m *QueryRandomRequestQueueResponse) String() string
- func (m *QueryRandomRequestQueueResponse) Unmarshal(dAtA []byte) error
- func (m *QueryRandomRequestQueueResponse) XXX_DiscardUnknown()
- func (m *QueryRandomRequestQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryRandomRequestQueueResponse) XXX_Merge(src proto.Message)
- func (m *QueryRandomRequestQueueResponse) XXX_Size() int
- func (m *QueryRandomRequestQueueResponse) XXX_Unmarshal(b []byte) error
- type QueryRandomResponse
- func (*QueryRandomResponse) Descriptor() ([]byte, []int)
- func (m *QueryRandomResponse) GetRandom() *Random
- func (m *QueryRandomResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryRandomResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryRandomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryRandomResponse) ProtoMessage()
- func (m *QueryRandomResponse) Reset()
- func (m *QueryRandomResponse) Size() (n int)
- func (m *QueryRandomResponse) String() string
- func (m *QueryRandomResponse) Unmarshal(dAtA []byte) error
- func (m *QueryRandomResponse) XXX_DiscardUnknown()
- func (m *QueryRandomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryRandomResponse) XXX_Merge(src proto.Message)
- func (m *QueryRandomResponse) XXX_Size() int
- func (m *QueryRandomResponse) XXX_Unmarshal(b []byte) error
- type QueryServer
- type RNG
- type Random
- func (*Random) Descriptor() ([]byte, []int)
- func (m *Random) GetHeight() int64
- func (m *Random) GetRequestTxHash() string
- func (m *Random) GetValue() string
- func (m *Random) Marshal() (dAtA []byte, err error)
- func (m *Random) MarshalTo(dAtA []byte) (int, error)
- func (m *Random) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Random) ProtoMessage()
- func (m *Random) Reset()
- func (m *Random) Size() (n int)
- func (m *Random) String() string
- func (m *Random) Unmarshal(dAtA []byte) error
- func (m *Random) XXX_DiscardUnknown()
- func (m *Random) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Random) XXX_Merge(src proto.Message)
- func (m *Random) XXX_Size() int
- func (m *Random) XXX_Unmarshal(b []byte) error
- type Request
- func (*Request) Descriptor() ([]byte, []int)
- func (m *Request) GetConsumer() string
- func (m *Request) GetHeight() int64
- func (m *Request) GetOracle() bool
- func (m *Request) GetServiceContextID() string
- func (m *Request) GetServiceFeeCap() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *Request) GetTxHash() string
- func (m *Request) Marshal() (dAtA []byte, err error)
- func (m *Request) MarshalTo(dAtA []byte) (int, error)
- func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Request) ProtoMessage()
- func (m *Request) Reset()
- func (m *Request) Size() (n int)
- func (m *Request) String() string
- func (m *Request) Unmarshal(dAtA []byte) error
- func (m *Request) XXX_DiscardUnknown()
- func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Request) XXX_Merge(src proto.Message)
- func (m *Request) XXX_Size() int
- func (m *Request) XXX_Unmarshal(b []byte) error
- type Requests
- func (*Requests) Descriptor() ([]byte, []int)
- func (m *Requests) GetRequests() []Request
- func (m *Requests) Marshal() (dAtA []byte, err error)
- func (m *Requests) MarshalTo(dAtA []byte) (int, error)
- func (m *Requests) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Requests) ProtoMessage()
- func (m *Requests) Reset()
- func (m *Requests) Size() (n int)
- func (m *Requests) String() string
- func (m *Requests) Unmarshal(dAtA []byte) error
- func (m *Requests) XXX_DiscardUnknown()
- func (m *Requests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Requests) XXX_Merge(src proto.Message)
- func (m *Requests) XXX_Size() int
- func (m *Requests) XXX_Unmarshal(b []byte) error
- type ServiceKeeper
- type UnimplementedMsgServer
- type UnimplementedQueryServer
Constants ¶
const ( EventTypeRequestRandom = "request_random" EventTypeRequestService = "request_service" EventTypeGenerateRandom = "generate_random" AttributeValueCategory = ModuleName AttributeKeyConsumer = "consumer" AttributeKeyRequestID = "request_id" AttributeKeyGenHeight = "generate_height" AttributeKeyOracle = "oracle" AttributeKeyRandom = "random" AttributeKeyRequestContextID = "request_context_id" )
random module event types
const ( // ModuleName is the name of the random module ModuleName = "random" // StoreKey is the string store representation StoreKey = ModuleName // QuerierRoute is the querier route for the random module QuerierRoute = ModuleName // RouterKey is the msg router key for the random module RouterKey = ModuleName )
const ( TypeMsgRequestRandom = "request_random" // type for MsgRequestRandom DefaultBlockInterval = uint64(10) // DefaultBlockInterval is the default block interval )
const ( QueryRandom = "random" // random query endpoint supported by the random querier QueryRandomRequestQueue = "queue" // random request queue query endpoint supported by the random querier )
const ( ServiceName = "random" ServiceDesc = "system service definition of random module" ServiceValueJSONPath = "seed" AuthorDescription = "random module account" ServiceSchemas = `` /* 635-byte string literal not displayed */ )
const RandPrec = 20 // the precision for generated random numbers
const SeedBytesLength = 32 //
Variables ¶
var ( ErrInvalidReqID = errorsmod.Register(ModuleName, 2, "invalid request id") ErrInvalidHeight = errorsmod.Register(ModuleName, 3, "invalid height, must be greater than 0") ErrInvalidServiceBindings = errorsmod.Register(ModuleName, 4, "no service bindings available") ErrInvalidRequestContextID = errorsmod.Register(ModuleName, 5, "invalid request context id") ErrInvalidServiceFeeCap = errorsmod.Register(ModuleName, 6, "invalid service fee cap") )
random module sentinel errors
var ( ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") )
var ( RandomKey = []byte{0x01} // key prefix for the random number RandomRequestQueueKey = []byte{0x02} // key prefix for the random number request queue OracleRandomRequestKey = []byte{0x03} // key prefix for the oracle request )
var ( ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthRandom = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRandom = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupRandom = fmt.Errorf("proto: unexpected end of group") )
var ( ServiceTags = []string{types.ModuleName} Author = sdk.AccAddress(crypto.AddressHash([]byte(types.ModuleName))) )
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 (
ModuleCdc = codec.NewAminoCodec(amino)
)
Functions ¶
func CheckReqID ¶
CheckReqID checks if the given request id is valid
func GenerateRequestID ¶
GenerateRequestID generates a request id
func GetSvcDefinition ¶
func GetSvcDefinition() servicetypes.ServiceDefinition
func KeyOracleRandomRequest ¶
KeyOracleRandomRequest returns the key for an OracleRandRequest by the specified requestContextID
func KeyRandomRequestQueue ¶
KeyRandomRequestQueue returns the key for the random number request queue by the given height and request id
func KeyRandomRequestQueueSubspace ¶
KeyRandomRequestQueueSubspace returns the key prefix for iterating through all requests at the specified height
func RegisterInterfaces ¶
func RegisterInterfaces(registry types.InterfaceRegistry)
func RegisterLegacyAminoCodec ¶
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers concrete types on the codec.
func RegisterMsgServer ¶ added in v1.2.0
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 to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryServer ¶
func RegisterQueryServer(s grpc1.Server, srv QueryServer)
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the given random genesis state
func ValidateServiceFeeCap ¶ added in v1.2.1
ValidateServiceFeeCap verifies whether the service fee cap is legal
Types ¶
type AccountKeeper ¶
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
}
accountKeeper defines the expected account keeper used for simulations (noalias)
type BankKeeper ¶
bankKeeper defines the expected bank keeper for module accounts (noalias)
type GenesisState ¶
type GenesisState struct {
PendingRandomRequests map[string]Requests `` /* 204-byte string literal not displayed */
}
GenesisState defines the random module's genesis state
func DefaultGenesisState ¶
func DefaultGenesisState() *GenesisState
DefaultGenesisState gets the default genesis state
func NewGenesisState ¶
func NewGenesisState(pendingRequests map[string]Requests) *GenesisState
NewGenesisState constructs a new GenesisState instance
func (*GenesisState) Descriptor ¶
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) GetPendingRandomRequests ¶
func (m *GenesisState) GetPendingRandomRequests() map[string]Requests
func (*GenesisState) Marshal ¶
func (m *GenesisState) Marshal() (dAtA []byte, err 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) 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 MsgClient ¶ added in v1.2.0
type MsgClient interface { // RequestRandom defines a method for requesting a new random number RequestRandom(ctx context.Context, in *MsgRequestRandom, opts ...grpc.CallOption) (*MsgRequestRandomResponse, 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 ¶ added in v1.2.0
func NewMsgClient(cc grpc1.ClientConn) MsgClient
type MsgRequestRandom ¶
type MsgRequestRandom struct { BlockInterval uint64 `protobuf:"varint,1,opt,name=block_interval,json=blockInterval,proto3" json:"block_interval,omitempty" yaml:"block_interval"` Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` Oracle bool `protobuf:"varint,3,opt,name=oracle,proto3" json:"oracle,omitempty"` ServiceFeeCap github_com_cosmos_cosmos_sdk_types.Coins `` /* 169-byte string literal not displayed */ }
MsgRequestRandom defines an sdk.Msg type that supports requesting a random number
func NewMsgRequestRandom ¶
func NewMsgRequestRandom( consumer string, blockInterval uint64, oracle bool, serviceFeeCap sdk.Coins, ) *MsgRequestRandom
NewMsgRequestRandom constructs a new MsgRequestRandom instance
func (*MsgRequestRandom) Descriptor ¶
func (*MsgRequestRandom) Descriptor() ([]byte, []int)
func (*MsgRequestRandom) GetBlockInterval ¶
func (m *MsgRequestRandom) GetBlockInterval() uint64
func (*MsgRequestRandom) GetConsumer ¶
func (m *MsgRequestRandom) GetConsumer() string
func (*MsgRequestRandom) GetOracle ¶
func (m *MsgRequestRandom) GetOracle() bool
func (*MsgRequestRandom) GetServiceFeeCap ¶
func (m *MsgRequestRandom) GetServiceFeeCap() github_com_cosmos_cosmos_sdk_types.Coins
func (MsgRequestRandom) GetSignBytes ¶
func (msg MsgRequestRandom) GetSignBytes() []byte
GetSignBytes implements Msg.
func (MsgRequestRandom) GetSigners ¶
func (msg MsgRequestRandom) GetSigners() []sdk.AccAddress
GetSigners implements Msg.
func (*MsgRequestRandom) Marshal ¶
func (m *MsgRequestRandom) Marshal() (dAtA []byte, err error)
func (*MsgRequestRandom) MarshalToSizedBuffer ¶
func (m *MsgRequestRandom) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgRequestRandom) ProtoMessage ¶
func (*MsgRequestRandom) ProtoMessage()
func (*MsgRequestRandom) Reset ¶
func (m *MsgRequestRandom) Reset()
func (*MsgRequestRandom) Size ¶
func (m *MsgRequestRandom) Size() (n int)
func (*MsgRequestRandom) String ¶
func (m *MsgRequestRandom) String() string
func (*MsgRequestRandom) Unmarshal ¶
func (m *MsgRequestRandom) Unmarshal(dAtA []byte) error
func (MsgRequestRandom) ValidateBasic ¶
func (msg MsgRequestRandom) ValidateBasic() error
ValidateBasic implements Msg.
func (*MsgRequestRandom) XXX_DiscardUnknown ¶
func (m *MsgRequestRandom) XXX_DiscardUnknown()
func (*MsgRequestRandom) XXX_Marshal ¶
func (m *MsgRequestRandom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgRequestRandom) XXX_Merge ¶
func (m *MsgRequestRandom) XXX_Merge(src proto.Message)
func (*MsgRequestRandom) XXX_Size ¶
func (m *MsgRequestRandom) XXX_Size() int
func (*MsgRequestRandom) XXX_Unmarshal ¶
func (m *MsgRequestRandom) XXX_Unmarshal(b []byte) error
type MsgRequestRandomResponse ¶ added in v1.2.0
type MsgRequestRandomResponse struct { }
MsgRequestRandomResponse defines the Msg/RequestRandom response type
func (*MsgRequestRandomResponse) Descriptor ¶ added in v1.2.0
func (*MsgRequestRandomResponse) Descriptor() ([]byte, []int)
func (*MsgRequestRandomResponse) Marshal ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) Marshal() (dAtA []byte, err error)
func (*MsgRequestRandomResponse) MarshalTo ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) MarshalTo(dAtA []byte) (int, error)
func (*MsgRequestRandomResponse) MarshalToSizedBuffer ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgRequestRandomResponse) ProtoMessage ¶ added in v1.2.0
func (*MsgRequestRandomResponse) ProtoMessage()
func (*MsgRequestRandomResponse) Reset ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) Reset()
func (*MsgRequestRandomResponse) Size ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) Size() (n int)
func (*MsgRequestRandomResponse) String ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) String() string
func (*MsgRequestRandomResponse) Unmarshal ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) Unmarshal(dAtA []byte) error
func (*MsgRequestRandomResponse) XXX_DiscardUnknown ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) XXX_DiscardUnknown()
func (*MsgRequestRandomResponse) XXX_Marshal ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgRequestRandomResponse) XXX_Merge ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) XXX_Merge(src proto.Message)
func (*MsgRequestRandomResponse) XXX_Size ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) XXX_Size() int
func (*MsgRequestRandomResponse) XXX_Unmarshal ¶ added in v1.2.0
func (m *MsgRequestRandomResponse) XXX_Unmarshal(b []byte) error
type MsgServer ¶ added in v1.2.0
type MsgServer interface { // RequestRandom defines a method for requesting a new random number RequestRandom(context.Context, *MsgRequestRandom) (*MsgRequestRandomResponse, error) }
MsgServer is the server API for Msg service.
type PRNG ¶
type PRNG struct { BlockHash []byte // hash of some block BlockTimestamp int64 // timestamp of the next block TxInitiator sdk.AccAddress // address initiating the request tx OracleSeed []byte // oracle seed Oracle bool // oracle method }
PRNG represents a pseudo-random number implementation based on block or oracle for RNG
type QueryClient ¶
type QueryClient interface { // Random queries the random result Random(ctx context.Context, in *QueryRandomRequest, opts ...grpc.CallOption) (*QueryRandomResponse, error) // RandomRequestQueue queries the random request queue RandomRequestQueue(ctx context.Context, in *QueryRandomRequestQueueRequest, opts ...grpc.CallOption) (*QueryRandomRequestQueueResponse, 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 QueryRandomParams ¶
type QueryRandomParams struct {
ReqID string `json:"req_id" yaml:"req_id"` // request id
}
QueryRandomParams is the query parameters for 'custom/random/random'
type QueryRandomRequest ¶
type QueryRandomRequest struct {
ReqId string `protobuf:"bytes,1,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"`
}
QueryRandomRequest is request type for the Query/Random RPC method
func (*QueryRandomRequest) Descriptor ¶
func (*QueryRandomRequest) Descriptor() ([]byte, []int)
func (*QueryRandomRequest) GetReqId ¶
func (m *QueryRandomRequest) GetReqId() string
func (*QueryRandomRequest) Marshal ¶
func (m *QueryRandomRequest) Marshal() (dAtA []byte, err error)
func (*QueryRandomRequest) MarshalTo ¶
func (m *QueryRandomRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryRandomRequest) MarshalToSizedBuffer ¶
func (m *QueryRandomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryRandomRequest) ProtoMessage ¶
func (*QueryRandomRequest) ProtoMessage()
func (*QueryRandomRequest) Reset ¶
func (m *QueryRandomRequest) Reset()
func (*QueryRandomRequest) Size ¶
func (m *QueryRandomRequest) Size() (n int)
func (*QueryRandomRequest) String ¶
func (m *QueryRandomRequest) String() string
func (*QueryRandomRequest) Unmarshal ¶
func (m *QueryRandomRequest) Unmarshal(dAtA []byte) error
func (*QueryRandomRequest) XXX_DiscardUnknown ¶
func (m *QueryRandomRequest) XXX_DiscardUnknown()
func (*QueryRandomRequest) XXX_Marshal ¶
func (m *QueryRandomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryRandomRequest) XXX_Merge ¶
func (m *QueryRandomRequest) XXX_Merge(src proto.Message)
func (*QueryRandomRequest) XXX_Size ¶
func (m *QueryRandomRequest) XXX_Size() int
func (*QueryRandomRequest) XXX_Unmarshal ¶
func (m *QueryRandomRequest) XXX_Unmarshal(b []byte) error
type QueryRandomRequestQueueParams ¶
type QueryRandomRequestQueueParams struct {
Height int64 `json:"height" yaml:"height"` // the height of the block where the random number is generated
}
QueryRandomRequestQueueParams is the query parameters for 'custom/random/queue'
type QueryRandomRequestQueueRequest ¶
type QueryRandomRequestQueueRequest struct {
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
}
QueryRandomRequestQueueRequest is request type for the Query/RandomRequestQueue RPC method
func (*QueryRandomRequestQueueRequest) Descriptor ¶
func (*QueryRandomRequestQueueRequest) Descriptor() ([]byte, []int)
func (*QueryRandomRequestQueueRequest) GetHeight ¶
func (m *QueryRandomRequestQueueRequest) GetHeight() int64
func (*QueryRandomRequestQueueRequest) Marshal ¶
func (m *QueryRandomRequestQueueRequest) Marshal() (dAtA []byte, err error)
func (*QueryRandomRequestQueueRequest) MarshalTo ¶
func (m *QueryRandomRequestQueueRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryRandomRequestQueueRequest) MarshalToSizedBuffer ¶
func (m *QueryRandomRequestQueueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryRandomRequestQueueRequest) ProtoMessage ¶
func (*QueryRandomRequestQueueRequest) ProtoMessage()
func (*QueryRandomRequestQueueRequest) Reset ¶
func (m *QueryRandomRequestQueueRequest) Reset()
func (*QueryRandomRequestQueueRequest) Size ¶
func (m *QueryRandomRequestQueueRequest) Size() (n int)
func (*QueryRandomRequestQueueRequest) String ¶
func (m *QueryRandomRequestQueueRequest) String() string
func (*QueryRandomRequestQueueRequest) Unmarshal ¶
func (m *QueryRandomRequestQueueRequest) Unmarshal(dAtA []byte) error
func (*QueryRandomRequestQueueRequest) XXX_DiscardUnknown ¶
func (m *QueryRandomRequestQueueRequest) XXX_DiscardUnknown()
func (*QueryRandomRequestQueueRequest) XXX_Marshal ¶
func (m *QueryRandomRequestQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryRandomRequestQueueRequest) XXX_Merge ¶
func (m *QueryRandomRequestQueueRequest) XXX_Merge(src proto.Message)
func (*QueryRandomRequestQueueRequest) XXX_Size ¶
func (m *QueryRandomRequestQueueRequest) XXX_Size() int
func (*QueryRandomRequestQueueRequest) XXX_Unmarshal ¶
func (m *QueryRandomRequestQueueRequest) XXX_Unmarshal(b []byte) error
type QueryRandomRequestQueueResponse ¶
type QueryRandomRequestQueueResponse struct {
Requests []Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests"`
}
QueryRandomRequestQueueResponse is response type for the Query/RandomRequestQueue RPC method
func (*QueryRandomRequestQueueResponse) Descriptor ¶
func (*QueryRandomRequestQueueResponse) Descriptor() ([]byte, []int)
func (*QueryRandomRequestQueueResponse) GetRequests ¶
func (m *QueryRandomRequestQueueResponse) GetRequests() []Request
func (*QueryRandomRequestQueueResponse) Marshal ¶
func (m *QueryRandomRequestQueueResponse) Marshal() (dAtA []byte, err error)
func (*QueryRandomRequestQueueResponse) MarshalTo ¶
func (m *QueryRandomRequestQueueResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryRandomRequestQueueResponse) MarshalToSizedBuffer ¶
func (m *QueryRandomRequestQueueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryRandomRequestQueueResponse) ProtoMessage ¶
func (*QueryRandomRequestQueueResponse) ProtoMessage()
func (*QueryRandomRequestQueueResponse) Reset ¶
func (m *QueryRandomRequestQueueResponse) Reset()
func (*QueryRandomRequestQueueResponse) Size ¶
func (m *QueryRandomRequestQueueResponse) Size() (n int)
func (*QueryRandomRequestQueueResponse) String ¶
func (m *QueryRandomRequestQueueResponse) String() string
func (*QueryRandomRequestQueueResponse) Unmarshal ¶
func (m *QueryRandomRequestQueueResponse) Unmarshal(dAtA []byte) error
func (*QueryRandomRequestQueueResponse) XXX_DiscardUnknown ¶
func (m *QueryRandomRequestQueueResponse) XXX_DiscardUnknown()
func (*QueryRandomRequestQueueResponse) XXX_Marshal ¶
func (m *QueryRandomRequestQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryRandomRequestQueueResponse) XXX_Merge ¶
func (m *QueryRandomRequestQueueResponse) XXX_Merge(src proto.Message)
func (*QueryRandomRequestQueueResponse) XXX_Size ¶
func (m *QueryRandomRequestQueueResponse) XXX_Size() int
func (*QueryRandomRequestQueueResponse) XXX_Unmarshal ¶
func (m *QueryRandomRequestQueueResponse) XXX_Unmarshal(b []byte) error
type QueryRandomResponse ¶
type QueryRandomResponse struct {
Random *Random `protobuf:"bytes,1,opt,name=random,proto3" json:"random,omitempty"`
}
QueryParametersResponse is response type for the Query/Random RPC method
func (*QueryRandomResponse) Descriptor ¶
func (*QueryRandomResponse) Descriptor() ([]byte, []int)
func (*QueryRandomResponse) GetRandom ¶
func (m *QueryRandomResponse) GetRandom() *Random
func (*QueryRandomResponse) Marshal ¶
func (m *QueryRandomResponse) Marshal() (dAtA []byte, err error)
func (*QueryRandomResponse) MarshalTo ¶
func (m *QueryRandomResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryRandomResponse) MarshalToSizedBuffer ¶
func (m *QueryRandomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryRandomResponse) ProtoMessage ¶
func (*QueryRandomResponse) ProtoMessage()
func (*QueryRandomResponse) Reset ¶
func (m *QueryRandomResponse) Reset()
func (*QueryRandomResponse) Size ¶
func (m *QueryRandomResponse) Size() (n int)
func (*QueryRandomResponse) String ¶
func (m *QueryRandomResponse) String() string
func (*QueryRandomResponse) Unmarshal ¶
func (m *QueryRandomResponse) Unmarshal(dAtA []byte) error
func (*QueryRandomResponse) XXX_DiscardUnknown ¶
func (m *QueryRandomResponse) XXX_DiscardUnknown()
func (*QueryRandomResponse) XXX_Marshal ¶
func (m *QueryRandomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryRandomResponse) XXX_Merge ¶
func (m *QueryRandomResponse) XXX_Merge(src proto.Message)
func (*QueryRandomResponse) XXX_Size ¶
func (m *QueryRandomResponse) XXX_Size() int
func (*QueryRandomResponse) XXX_Unmarshal ¶
func (m *QueryRandomResponse) XXX_Unmarshal(b []byte) error
type QueryServer ¶
type QueryServer interface { // Random queries the random result Random(context.Context, *QueryRandomRequest) (*QueryRandomResponse, error) // RandomRequestQueue queries the random request queue RandomRequestQueue(context.Context, *QueryRandomRequestQueueRequest) (*QueryRandomRequestQueueResponse, error) }
QueryServer is the server API for Query service.
type Random ¶
type Random struct { RequestTxHash string `protobuf:"bytes,1,opt,name=request_tx_hash,json=requestTxHash,proto3" json:"request_tx_hash,omitempty" yaml:"request_tx_hash"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` }
Random defines the feed standard
func (*Random) Descriptor ¶
func (*Random) GetRequestTxHash ¶
func (*Random) MarshalToSizedBuffer ¶
func (*Random) ProtoMessage ¶
func (*Random) ProtoMessage()
func (*Random) XXX_DiscardUnknown ¶
func (m *Random) XXX_DiscardUnknown()
func (*Random) XXX_Marshal ¶
func (*Random) XXX_Unmarshal ¶
type Request ¶
type Request struct { Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"tx_hash"` Oracle bool `protobuf:"varint,4,opt,name=oracle,proto3" json:"oracle,omitempty"` ServiceFeeCap github_com_cosmos_cosmos_sdk_types.Coins `` /* 169-byte string literal not displayed */ ServiceContextID string `` /* 137-byte string literal not displayed */ }
Request defines the random request standard
func NewRequest ¶
func NewRequest( height int64, consumer string, txHash string, oracle bool, serviceFeeCap sdk.Coins, serviceContextID string, ) Request
NewRequest constructs a new Request instance
func (*Request) Descriptor ¶
func (*Request) GetConsumer ¶
func (*Request) GetServiceContextID ¶
func (*Request) GetServiceFeeCap ¶
func (m *Request) GetServiceFeeCap() github_com_cosmos_cosmos_sdk_types.Coins
func (*Request) MarshalToSizedBuffer ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) XXX_DiscardUnknown ¶
func (m *Request) XXX_DiscardUnknown()
func (*Request) XXX_Marshal ¶
func (*Request) XXX_Unmarshal ¶
type Requests ¶
type Requests struct {
Requests []Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests"`
}
Requests defines the random requests
func (*Requests) Descriptor ¶
func (*Requests) GetRequests ¶
func (*Requests) MarshalToSizedBuffer ¶
func (*Requests) ProtoMessage ¶
func (*Requests) ProtoMessage()
func (*Requests) XXX_DiscardUnknown ¶
func (m *Requests) XXX_DiscardUnknown()
func (*Requests) XXX_Marshal ¶
func (*Requests) XXX_Unmarshal ¶
type ServiceKeeper ¶
type ServiceKeeper interface { RegisterResponseCallback( moduleName string, respCallback service.ResponseCallback, ) error RegisterStateCallback( moduleName string, stateCallback service.StateCallback, ) error GetRequestContext( ctx sdk.Context, requestContextID tmbytes.HexBytes, ) (service.RequestContext, bool) CreateRequestContext( ctx sdk.Context, serviceName string, providers []sdk.AccAddress, consumer sdk.AccAddress, input string, serviceFeeCap sdk.Coins, timeout int64, repeated bool, repeatedFrequency uint64, repeatedTotal int64, state service.RequestContextState, responseThreshold uint32, moduleName string, ) (tmbytes.HexBytes, error) UpdateRequestContext( ctx sdk.Context, requestContextID tmbytes.HexBytes, providers []sdk.AccAddress, respThreshold uint32, serviceFeeCap sdk.Coins, timeout int64, repeatedFreq uint64, repeatedTotal int64, consumer sdk.AccAddress, ) error StartRequestContext( ctx sdk.Context, requestContextID tmbytes.HexBytes, consumer sdk.AccAddress, ) error PauseRequestContext( ctx sdk.Context, requestContextID tmbytes.HexBytes, consumer sdk.AccAddress, ) error ServiceBindingsIterator(ctx sdk.Context, serviceName string) sdk.Iterator GetParams(ctx sdk.Context) servicetypes.Params }
expected Service keeper
type UnimplementedMsgServer ¶ added in v1.2.0
type UnimplementedMsgServer struct { }
UnimplementedMsgServer can be embedded to have forward compatible implementations.
func (*UnimplementedMsgServer) RequestRandom ¶ added in v1.2.0
func (*UnimplementedMsgServer) RequestRandom(ctx context.Context, req *MsgRequestRandom) (*MsgRequestRandomResponse, error)
type UnimplementedQueryServer ¶
type UnimplementedQueryServer struct { }
UnimplementedQueryServer can be embedded to have forward compatible implementations.
func (*UnimplementedQueryServer) Random ¶
func (*UnimplementedQueryServer) Random(ctx context.Context, req *QueryRandomRequest) (*QueryRandomResponse, error)
func (*UnimplementedQueryServer) RandomRequestQueue ¶
func (*UnimplementedQueryServer) RandomRequestQueue(ctx context.Context, req *QueryRandomRequestQueueRequest) (*QueryRandomRequestQueueResponse, error)