Documentation ¶
Overview ¶
Package jsonrpc implements Gin middleware for handling JSON-RPC requests via HTTP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Controller ¶
func Controller(api interface{}) gin.HandlerFunc
Controller returns a custom Gin middleware that handles incoming JSON-RPC requests via HTTP. It maps the RPC method name to struct methods on the given api. For example, if the RPC request has the method field set to "namespace_methodName" then the controller will make a call to api.Namespace_methodName with the params spread as arguments.
If request is valid it will also set the data on the Gin context with the key "json-rpc-request".
NOTE: For batched requests in the current version, "json-rpc-request" on the Gin context contains only the last request in the array.
func WithOTELTracerAttributes ¶
func WithOTELTracerAttributes() gin.HandlerFunc
WithOTELTracerAttributes adds custom opentelemetry attributes relating to the JSON-RPC method call for the current span.
Types ¶
This section is empty.