rpcInterfaceMessages

package
v2.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToConvertMessage = sdkerrors.New("RPC error", 1000, "failed to convert a message")
View Source
var WontCalculateBatchHash = sdkerrors.New("Wont calculate batch hash", 892, "wont calculate batch message hash") // on batches we just wont calculate hashes, meaning we wont retry.

Functions

func CheckResponseErrorForJsonRpcBatch

func CheckResponseErrorForJsonRpcBatch(data []byte, httpStatusCode int) (hasError bool, errorMessage string)

returns if error exists and

func ConvertErrorToRPCError

func ConvertErrorToRPCError(errString string, code int) *tenderminttypes.RPCError

func ConvertToTendermintError

func ConvertToTendermintError(errString string, inputInfo []byte) string

func DescriptorSourceFromServer

func DescriptorSourceFromServer(refClient *grpcreflect.Client) grpcurl.DescriptorSource

func GetTendermintRPCError

func GetTendermintRPCError(jsonError *rpcclient.JsonError) (*tenderminttypes.RPCError, error)

func IdFromRawMessage

func IdFromRawMessage(rawID json.RawMessage) (jsonrpcId, error)

func ParseSymbol

func ParseSymbol(svcAndMethod string) (string, string)

func ReflectionSupport

func ReflectionSupport(err error) error

Types

type GenericMessage

type GenericMessage interface {
	GetHeaders() []pairingtypes.Metadata
	DisableErrorHandling()
	GetParams() interface{}
}

type GrpcMessage

type GrpcMessage struct {
	Msg  []byte
	Path string

	Registry *dyncodec.Registry
	Codec    *dyncodec.Codec
	chainproxy.BaseMessage
	// contains filtered or unexported fields
}

func (GrpcMessage) CheckResponseError

func (jm GrpcMessage) CheckResponseError(data []byte, httpStatusCode int) (hasError bool, errorMessage string)

func (GrpcMessage) GetID added in v2.4.0

func (gm GrpcMessage) GetID() json.RawMessage

func (GrpcMessage) GetMethod

func (gm GrpcMessage) GetMethod() string

func (GrpcMessage) GetParams

func (gm GrpcMessage) GetParams() interface{}

GetParams will be deprecated after we remove old client Currently needed because of parser.RPCInput interface

func (*GrpcMessage) GetRawRequestHash

func (gm *GrpcMessage) GetRawRequestHash() ([]byte, error)

get msg hash byte array containing all the relevant information for a unique request. (headers / api / params)

func (GrpcMessage) GetResult

func (gm GrpcMessage) GetResult() json.RawMessage

GetResult will be deprecated after we remove old client Currently needed because of parser.RPCInput interface

func (GrpcMessage) NewParsableRPCInput

func (gm GrpcMessage) NewParsableRPCInput(input json.RawMessage) (parser.RPCInput, error)

func (GrpcMessage) ParseBlock

func (gm GrpcMessage) ParseBlock(inp string) (int64, error)

func (*GrpcMessage) SetParsingData

func (gm *GrpcMessage) SetParsingData(methodDesc *desc.MethodDescriptor, formatter grpcurl.Formatter)

func (*GrpcMessage) SubscriptionIdExtractor added in v2.4.0

func (gm *GrpcMessage) SubscriptionIdExtractor(reply *rpcclient.JsonrpcMessage) string

func (*GrpcMessage) UpdateLatestBlockInMessage

func (gm *GrpcMessage) UpdateLatestBlockInMessage(latestBlock uint64, modifyContent bool) (success bool)

type JSONRPCIntID

type JSONRPCIntID int

JSONRPCIntID a wrapper for JSON-RPC integer IDs

func (JSONRPCIntID) String

func (id JSONRPCIntID) String() string

type JSONRPCStringID

type JSONRPCStringID string

JSONRPCStringID a wrapper for JSON-RPC string IDs

func (JSONRPCStringID) String

func (id JSONRPCStringID) String() string

type JsonrpcBatchMessage

type JsonrpcBatchMessage struct {
	chainproxy.BaseMessage
	// contains filtered or unexported fields
}

func NewBatchMessage

func NewBatchMessage(msgs []JsonrpcMessage) (JsonrpcBatchMessage, error)

func (*JsonrpcBatchMessage) GetBatch

func (jbm *JsonrpcBatchMessage) GetBatch() []rpcclient.BatchElemWithId

func (JsonrpcBatchMessage) GetParams

func (jbm JsonrpcBatchMessage) GetParams() interface{}

func (JsonrpcBatchMessage) GetRawRequestHash

func (jbm JsonrpcBatchMessage) GetRawRequestHash() ([]byte, error)

on batches we don't want to calculate the batch hash as its impossible to get the args we will just return false so retry wont trigger.

func (*JsonrpcBatchMessage) SubscriptionIdExtractor added in v2.4.0

func (jbm *JsonrpcBatchMessage) SubscriptionIdExtractor(reply *rpcclient.JsonrpcMessage) string

func (*JsonrpcBatchMessage) UpdateLatestBlockInMessage

func (jbm *JsonrpcBatchMessage) UpdateLatestBlockInMessage(latestBlock uint64, modifyContent bool) (success bool)

type JsonrpcMessage

type JsonrpcMessage struct {
	Version                string               `json:"jsonrpc,omitempty"`
	ID                     json.RawMessage      `json:"id,omitempty"`
	Method                 string               `json:"method,omitempty"`
	Params                 interface{}          `json:"params,omitempty"`
	Error                  *rpcclient.JsonError `json:"error,omitempty"`
	Result                 json.RawMessage      `json:"result,omitempty"`
	chainproxy.BaseMessage `json:"-"`
}

func ConvertBatchElement

func ConvertBatchElement(batchElement rpcclient.BatchElemWithId) (JsonrpcMessage, error)

func ConvertJsonRPCMsg

func ConvertJsonRPCMsg(rpcMsg *rpcclient.JsonrpcMessage) (*JsonrpcMessage, error)

func ParseJsonRPCMsg

func ParseJsonRPCMsg(data []byte) (msgRet []JsonrpcMessage, err error)

func (JsonrpcMessage) CheckResponseError

func (jm JsonrpcMessage) CheckResponseError(data []byte, httpStatusCode int) (hasError bool, errorMessage string)

returns if error exists and

func (JsonrpcMessage) GetID added in v2.4.0

func (jm JsonrpcMessage) GetID() json.RawMessage

func (JsonrpcMessage) GetMethod

func (jm JsonrpcMessage) GetMethod() string

func (JsonrpcMessage) GetParams

func (jm JsonrpcMessage) GetParams() interface{}

func (*JsonrpcMessage) GetRawRequestHash

func (jm *JsonrpcMessage) GetRawRequestHash() ([]byte, error)

get msg hash byte array containing all the relevant information for a unique request. (headers / api / params)

func (JsonrpcMessage) GetResult

func (jm JsonrpcMessage) GetResult() json.RawMessage

func (JsonrpcMessage) NewParsableRPCInput

func (jm JsonrpcMessage) NewParsableRPCInput(input json.RawMessage) (parser.RPCInput, error)

func (JsonrpcMessage) ParseBlock

func (jm JsonrpcMessage) ParseBlock(inp string) (int64, error)

func (*JsonrpcMessage) SubscriptionIdExtractor added in v2.4.0

func (jm *JsonrpcMessage) SubscriptionIdExtractor(reply *rpcclient.JsonrpcMessage) string

func (*JsonrpcMessage) UpdateLatestBlockInMessage

func (jm *JsonrpcMessage) UpdateLatestBlockInMessage(latestBlock uint64, modifyContent bool) (success bool)

type ParsableRPCInput

type ParsableRPCInput struct {
	Result json.RawMessage
	chainproxy.BaseMessage
}

func (ParsableRPCInput) GetID added in v2.4.0

func (pri ParsableRPCInput) GetID() json.RawMessage

func (ParsableRPCInput) GetMethod

func (pri ParsableRPCInput) GetMethod() string

func (ParsableRPCInput) GetParams

func (pri ParsableRPCInput) GetParams() interface{}

func (ParsableRPCInput) GetResult

func (pri ParsableRPCInput) GetResult() json.RawMessage

func (ParsableRPCInput) ParseBlock

func (pri ParsableRPCInput) ParseBlock(inp string) (int64, error)

type RPCResponse

type RPCResponse struct {
	JSONRPC string                    `json:"jsonrpc"`
	ID      jsonrpcId                 `json:"id,omitempty"`
	Result  json.RawMessage           `json:"result,omitempty"`
	Error   *tenderminttypes.RPCError `json:"error,omitempty"`
}

func ConvertTendermintMsg

func ConvertTendermintMsg(rpcMsg *rpcclient.JsonrpcMessage) (*RPCResponse, error)

type RestMessage

type RestMessage struct {
	Msg      []byte
	Path     string
	SpecPath string
	chainproxy.BaseMessage
}

func (RestMessage) CheckResponseError

func (jm RestMessage) CheckResponseError(data []byte, httpStatusCode int) (hasError bool, errorMessage string)

func (RestMessage) GetID added in v2.4.0

func (rm RestMessage) GetID() json.RawMessage

func (RestMessage) GetMethod

func (rm RestMessage) GetMethod() string

func (RestMessage) GetParams

func (rm RestMessage) GetParams() interface{}

GetParams will be deprecated after we remove old client Currently needed because of parser.RPCInput interface

func (*RestMessage) GetRawRequestHash

func (rm *RestMessage) GetRawRequestHash() ([]byte, error)

get msg hash byte array containing all the relevant information for a unique request. (headers / api / params)

func (RestMessage) GetResult

func (rm RestMessage) GetResult() json.RawMessage

GetResult will be deprecated after we remove old client Currently needed because of parser.RPCInput interface

func (RestMessage) ParseBlock

func (rm RestMessage) ParseBlock(inp string) (int64, error)

ParseBlock parses default block number from string to int

func (*RestMessage) SubscriptionIdExtractor added in v2.4.0

func (rm *RestMessage) SubscriptionIdExtractor(reply *rpcclient.JsonrpcMessage) string

func (*RestMessage) UpdateLatestBlockInMessage

func (rm *RestMessage) UpdateLatestBlockInMessage(latestBlock uint64, modifyContent bool) (success bool)

type ServerSource

type ServerSource struct {
	Client *grpcreflect.Client
}

func (ServerSource) AllExtensionsForType

func (ss ServerSource) AllExtensionsForType(typeName string) ([]*desc.FieldDescriptor, error)

func (ServerSource) FindSymbol

func (ss ServerSource) FindSymbol(fullyQualifiedName string) (desc.Descriptor, error)

func (ServerSource) ListServices

func (ss ServerSource) ListServices() ([]string, error)

type TendermintrpcMessage

type TendermintrpcMessage struct {
	JsonrpcMessage
	Path string
}

func (TendermintrpcMessage) GetParams

func (cp TendermintrpcMessage) GetParams() interface{}

func (*TendermintrpcMessage) GetRawRequestHash

func (tm *TendermintrpcMessage) GetRawRequestHash() ([]byte, error)

get msg hash byte array containing all the relevant information for a unique request. (headers / api / params)

func (TendermintrpcMessage) GetResult

func (tm TendermintrpcMessage) GetResult() json.RawMessage

func (TendermintrpcMessage) ParseBlock

func (tm TendermintrpcMessage) ParseBlock(inp string) (int64, error)

func (TendermintrpcMessage) SubscriptionIdExtractor added in v2.4.0

func (tm TendermintrpcMessage) SubscriptionIdExtractor(reply *rpcclient.JsonrpcMessage) string

Jump to

Keyboard shortcuts

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