rpcInterfaceMessages

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BatchNodeErrorOnAny = false

BatchNodeErrorOnAny controls batch request error detection: - false (default): batch is an error only if ALL sub-requests failed - true: batch is an error if ANY sub-request failed (strict mode)

View Source
var ErrFailedToConvertMessage = errors.New("failed to convert a message")
View Source
var WontCalculateBatchHash = errors.New("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)

CheckResponseErrorForJsonRpcBatch classifies a JSON-RPC batch response body. Aggregation is controlled by BatchNodeErrorOnAny:

  • false (default): the batch is an error only when no sub-request succeeded AND at least one was faulty (had an error or was malformed)
  • true (strict): the batch is an error whenever any sub-request was faulty

A malformed sub-element (unparseable, or missing both 'result' and 'error') is treated as a faulty element. A malformed top-level array (truncated, not an array) is itself classified as a wrong-data verdict so the relay pipeline can retry against another provider. Sub-element classification reuses checkJsonrpcEnvelope so the rules stay in lockstep with the single path, including the error:null edge case.

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

func (gm GrpcMessage) GetError() *rpcclient.JsonError

func (GrpcMessage) GetID

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

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

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 ParseJsonRPCMsgWithBatchFlag

func ParseJsonRPCMsgWithBatchFlag(data []byte) (msgRet []JsonrpcMessage, isBatch bool, err error)

ParseJsonRPCMsgWithBatchFlag parses JSON-RPC message(s) and returns whether the input was a batch request (JSON array). This distinction matters for single-element batches like [{"id":1,"method":"getblockhash","params":[100]}] which must be treated as batch requests and receive array responses per the JSON-RPC spec.

func (JsonrpcMessage) CheckResponseError

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

CheckResponseError classifies a JSON-RPC response body for the smart-router retry pipeline. See checkJsonrpcEnvelope for the verdict rules; this method is a thin wrapper since JsonrpcMessage has no protocol-specific inner-error inspection (Tendermint does).

Direct callers in direct_rpc_relay.go short-circuit truncated wire-level failures via json.Valid before reaching here; this method's parse-failure branch remains as a backstop for callers that bypass that check.

func (JsonrpcMessage) GetError

func (jm JsonrpcMessage) GetError() *rpcclient.JsonError

func (JsonrpcMessage) GetID

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

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
	Error  *rpcclient.JsonError
	chainproxy.BaseMessage
}

func (ParsableRPCInput) GetError

func (pri ParsableRPCInput) GetError() *rpcclient.JsonError

func (ParsableRPCInput) GetID

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

func (rm RestMessage) GetError() *rpcclient.JsonError

func (RestMessage) GetID

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

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 TendermintMessageResponse

type TendermintMessageResponse struct {
	Response TendermintMessageResponseBody `json:"response,omitempty"`
}

type TendermintMessageResponseBody

type TendermintMessageResponseBody struct {
	Code int    `json:"code,omitempty"`
	Log  string `json:"log,omitempty"`
}

type TendermintrpcMessage

type TendermintrpcMessage struct {
	JsonrpcMessage
	Path string
}

func (TendermintrpcMessage) CheckResponseError

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

CheckResponseError classifies a Tendermint JSON-RPC response. The envelope shape check (malformed bytes, missing-both-fields, error:null normalisation, top-level error extraction) is delegated to checkJsonrpcEnvelope; this method adds the Tendermint-specific success-path inspection of the embedded `{"response": {"code": N, "log": M}}` payload that Tendermint nodes use to signal application-level errors over an otherwise-200 envelope.

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

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