( ctx context.Context, input *RequestInput, rawJSONRPC json.RawMessage, )
| 33 | } |
| 34 | |
| 35 | func (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 | |
| 69 | func (rp *RequestProcessor) ProcessQueryStream( |
| 70 | ctx context.Context, |
no test coverage detected