2020-08-03 20:01:38 +00:00
|
|
|
package rpc
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
2020-11-13 14:04:10 +00:00
|
|
|
type RequestBody struct {
|
|
|
|
Jsonrpc string `json:"jsonrpc"`
|
|
|
|
Method string `json:"method"`
|
|
|
|
Params []string `json:"params"`
|
|
|
|
ID int `json:"id"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRequestBody(method string) *RequestBody {
|
|
|
|
return &RequestBody{
|
|
|
|
Jsonrpc: "2.0",
|
|
|
|
Method: method,
|
|
|
|
Params: []string{},
|
|
|
|
ID: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-03 20:01:38 +00:00
|
|
|
type Client interface {
|
|
|
|
HandleRequest(r *http.Request, data []byte) (*http.Response, error)
|
|
|
|
}
|