types

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 33 Imported by: 30

Documentation

Overview

nolint

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EventTypeRequestRandom  = "request_random"
	EventTypeGenerateRandom = "generate_random"

	AttributeKeyRequestID        = "request_id"
	AttributeKeyGenHeight        = "generate_height"
	AttributeKeyRandom           = "random"
	AttributeKeyRequestContextID = "request_context_id"

	AttributeValueCategory = ModuleName
)

random module event types

View Source
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 asset module
	QuerierRoute = ModuleName

	// RouterKey is the msg router key for the asset module
	RouterKey = ModuleName
)
View Source
const (
	TypeMsgRequestRandom = "request_rand" // type for MsgRequestRandom

	DefaultBlockInterval = uint64(10) // DefaultBlockInterval is the default block interval
)
View Source
const (
	QueryRandom             = "random" // random query endpoint supported by the random querier
	QueryRandomRequestQueue = "queue"  // random request queue query endpoint supported by the random querier
)
View Source
const (
	ServiceName          = "random"
	ServiceDesc          = "system service definition of random module"
	ServiceValueJSONPath = "seed"
	AuthorDescription    = "random module account"
	ServiceSchemas       = `` /* 635-byte string literal not displayed */

)
View Source
const RandPrec = 20 // the precision for generated random numbers
View Source
const SeedBytesLength = 32 //

Variables

View Source
var (
	ErrInvalidReqID            = sdkerrors.Register(ModuleName, 2, "invalid request id")
	ErrInvalidHeight           = sdkerrors.Register(ModuleName, 3, "invalid height, must be greater than 0")
	ErrInvalidServiceBindings  = sdkerrors.Register(ModuleName, 4, "no service bindings available")
	ErrInvalidRequestContextID = sdkerrors.Register(ModuleName, 5, "invalid request context id")
)

random module sentinel errors

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 (
	KeyDelimiter              = []byte(":")                   // key delimiter
	PrefixRandom              = []byte("randoms:")            // key prefix for the random number
	PrefixRandomRequestQueue  = []byte("randRequestQueue:")   // key prefix for the random number request queue
	PrefixOracleRandomRequest = []byte("oracleRandRequests:") // key prefix for the oracle request
)
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")
)
View Source
var (
	ErrInvalidLengthRandom        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRandom          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRandom = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func CheckReqID

func CheckReqID(reqID string) error

CheckReqID checks if the given request id is valid

func GenerateRequestID

func GenerateRequestID(r Request) []byte

GenerateRequestID generate a request id

func GetSvcDefinition

func GetSvcDefinition() servicetypes.ServiceDefinition

func KeyOracleRandomRequest

func KeyOracleRandomRequest(requestContextID []byte) []byte

KeyOracleRandRequest returns the key for an OracleRandRequest by the specified requestContextID

func KeyRandom

func KeyRandom(reqID []byte) []byte

KeyRandom returns the key for a random number by the specified request id

func KeyRandomRequestQueue

func KeyRandomRequestQueue(height int64, reqID []byte) []byte

KeyRandomRequestQueue returns the key for the random number request queue by the given height and request id

func KeyRandomRequestQueueSubspace

func KeyRandomRequestQueueSubspace(height int64) []byte

KeyRandRequestQueueSubspace 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 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)

func SHA256

func SHA256(data []byte) []byte

SHA256 wraps sha256.Sum256 with result converted to slice

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the given random genesis state

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

type BankKeeper interface {
	SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}

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 GenesisState

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) 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) 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 MsgRequestRandom

type MsgRequestRandom struct {
	BlockInterval uint64                                        `protobuf:"varint,1,opt,name=block_interval,json=blockInterval,proto3" json:"block_interval,omitempty" yaml:"block_interval"`
	Consumer      github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=consumer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" 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 sdk.AccAddress,
	blockInterval uint64,
	oracle bool,
	serviceFeeCap sdk.Coins,
) *MsgRequestRandom

NewMsgRequestRandom constructs a MsgRequestRandom

func (*MsgRequestRandom) Descriptor

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

func (*MsgRequestRandom) GetBlockInterval

func (m *MsgRequestRandom) GetBlockInterval() uint64

func (*MsgRequestRandom) GetConsumer

func (*MsgRequestRandom) GetOracle

func (m *MsgRequestRandom) GetOracle() bool

func (*MsgRequestRandom) GetServiceFeeCap

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) MarshalTo

func (m *MsgRequestRandom) MarshalTo(dAtA []byte) (int, 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) Route

func (msg MsgRequestRandom) Route() string

Route implements Msg.

func (*MsgRequestRandom) Size

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

func (*MsgRequestRandom) String

func (m *MsgRequestRandom) String() string

func (MsgRequestRandom) Type

func (msg MsgRequestRandom) Type() string

Type implements Msg.

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 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 for RNG

func MakePRNG

func MakePRNG(blockHash []byte, blockTimestampt int64, txInitiator sdk.AccAddress, oracleSeed []byte, oracle bool) PRNG

MakePRNG constructs a PRNG

func (PRNG) GetRand

func (p PRNG) GetRand() *big.Rat

GetRand implements 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 (*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 (*QueryRandomRequestQueueResponse) Size

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

func (*QueryRandomRequestQueueResponse) 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 RNG

type RNG interface {
	GetRand() big.Rat // interface which returns a random number between [0,1)
}

RNG is a random number generator

type Random

type Random struct {
	RequestTxHash github_com_tendermint_tendermint_libs_bytes.HexBytes `` /* 187-byte string literal not displayed */
	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 NewRandom

func NewRandom(requestTxHash []byte, height int64, value string) Random

NewRandom constructs a Random

func (*Random) Descriptor

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

func (*Random) GetHeight

func (m *Random) GetHeight() int64

func (*Random) GetRequestTxHash

func (*Random) GetValue

func (m *Random) GetValue() string

func (*Random) Marshal

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

func (*Random) MarshalTo

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

func (*Random) MarshalToSizedBuffer

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

func (*Random) ProtoMessage

func (*Random) ProtoMessage()

func (*Random) Reset

func (m *Random) Reset()

func (*Random) Size

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

func (*Random) String

func (m *Random) String() string

func (*Random) Unmarshal

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

func (*Random) XXX_DiscardUnknown

func (m *Random) XXX_DiscardUnknown()

func (*Random) XXX_Marshal

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

func (*Random) XXX_Merge

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

func (*Random) XXX_Size

func (m *Random) XXX_Size() int

func (*Random) XXX_Unmarshal

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

type Request

type Request struct {
	Height           int64                                                `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	Consumer         github_com_cosmos_cosmos_sdk_types.AccAddress        `protobuf:"bytes,2,opt,name=consumer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"consumer,omitempty"`
	TxHash           github_com_tendermint_tendermint_libs_bytes.HexBytes `` /* 156-byte string literal not displayed */
	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 github_com_tendermint_tendermint_libs_bytes.HexBytes `` /* 199-byte string literal not displayed */
}

Request defines the random request standard

func NewRequest

func NewRequest(
	height int64,
	consumer sdk.AccAddress,
	txHash tmbytes.HexBytes,
	oracle bool,
	serviceFeeCap sdk.Coins,
	serviceContextID tmbytes.HexBytes,
) Request

NewRequest constructs a request

func (*Request) Descriptor

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

func (*Request) GetConsumer

func (*Request) GetHeight

func (m *Request) GetHeight() int64

func (*Request) GetOracle

func (m *Request) GetOracle() bool

func (*Request) GetServiceContextID

func (*Request) GetServiceFeeCap

func (m *Request) GetServiceFeeCap() github_com_cosmos_cosmos_sdk_types.Coins

func (*Request) Marshal

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

func (*Request) MarshalTo

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

func (*Request) MarshalToSizedBuffer

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

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) Size

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

func (*Request) String

func (m *Request) String() string

func (*Request) Unmarshal

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

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

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

func (*Request) XXX_Merge

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

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

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

type Requests

type Requests struct {
	Requests []Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests"`
}

func (*Requests) Descriptor

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

func (*Requests) GetRequests

func (m *Requests) GetRequests() []Request

func (*Requests) Marshal

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

func (*Requests) MarshalTo

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

func (*Requests) MarshalToSizedBuffer

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

func (*Requests) ProtoMessage

func (*Requests) ProtoMessage()

func (*Requests) Reset

func (m *Requests) Reset()

func (*Requests) Size

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

func (*Requests) String

func (m *Requests) String() string

func (*Requests) Unmarshal

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

func (*Requests) XXX_DiscardUnknown

func (m *Requests) XXX_DiscardUnknown()

func (*Requests) XXX_Marshal

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

func (*Requests) XXX_Merge

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

func (*Requests) XXX_Size

func (m *Requests) XXX_Size() int

func (*Requests) XXX_Unmarshal

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

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,
		superMode bool,
		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 UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Random

func (*UnimplementedQueryServer) RandomRequestQueue

Jump to

Keyboard shortcuts

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