MCPcopy Create free account
hub / github.com/erpc/erpc / ProcessUnary

Method ProcessUnary

erpc/request_processor.go:35–67  ·  view source on GitHub ↗
(
	ctx context.Context,
	input *RequestInput,
	rawJSONRPC json.RawMessage,
)

Source from the content-addressed store, hash-verified

33}
34
35func (rp *RequestProcessor) ProcessUnary(
36 ctx context.Context,
37 input *RequestInput,
38 rawJSONRPC json.RawMessage,
39) (*common.NormalizedResponse, error) {
40 project, err := rp.erpc.GetProject(input.ProjectId)
41 if err != nil {
42 return nil, err
43 }
44
45 nq := common.NewNormalizedRequest(rawJSONRPC)
46 if err := nq.Validate(); err != nil {
47 return nil, err
48 }
49
50 nq.SetClientIP(input.ClientIP)
51 method, _ := nq.Method()
52 user, err := project.AuthenticateConsumer(ctx, nq, method, input.AuthPayload)
53 if err != nil {
54 return nil, err
55 }
56 nq.SetUser(user)
57
58 networkID := fmt.Sprintf("%s:%s", input.Architecture, input.ChainId)
59 network, err := project.GetNetwork(ctx, networkID)
60 if err != nil {
61 return nil, err
62 }
63 nq.SetNetwork(network)
64 nq.ApplyDirectiveDefaults(network.Config().DirectiveDefaults)
65
66 return project.Forward(ctx, networkID, nq)
67}
68
69func (rp *RequestProcessor) ProcessQueryStream(
70 ctx context.Context,

Callers 7

ChainIdMethod · 0.80
GetBlockByNumberMethod · 0.80
GetBlockByHashMethod · 0.80
GetLogsMethod · 0.80
GetTransactionByHashMethod · 0.80
GetTransactionReceiptMethod · 0.80
GetBlockReceiptsMethod · 0.80

Calls 12

ValidateMethod · 0.95
SetClientIPMethod · 0.95
MethodMethod · 0.95
SetUserMethod · 0.95
SetNetworkMethod · 0.95
NewNormalizedRequestFunction · 0.92
AuthenticateConsumerMethod · 0.80
ConfigMethod · 0.65
ForwardMethod · 0.65
GetProjectMethod · 0.45
GetNetworkMethod · 0.45

Tested by

no test coverage detected