You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
537 B

  1. package rpctypes
  2. type RPCRequest struct {
  3. JSONRPC string `json:"jsonrpc"`
  4. ID string `json:"id"`
  5. Method string `json:"method"`
  6. Params []interface{} `json:"params"`
  7. }
  8. type RPCResponse struct {
  9. JSONRPC string `json:"jsonrpc"`
  10. ID string `json:"id"`
  11. Result interface{} `json:"result"`
  12. Error string `json:"error"`
  13. }
  14. func NewRPCResponse(id string, res interface{}, err string) RPCResponse {
  15. return RPCResponse{
  16. JSONRPC: "2.0",
  17. ID: id,
  18. Result: res,
  19. Error: err,
  20. }
  21. }