tendermint/rpc/types/types.go

25 lines
537 B
Go
Raw Normal View History

package rpctypes
2015-04-01 13:23:20 -07:00
type RPCRequest struct {
JSONRPC string `json:"jsonrpc"`
ID string `json:"id"`
2015-04-01 13:23:20 -07:00
Method string `json:"method"`
Params []interface{} `json:"params"`
}
type RPCResponse struct {
2015-07-23 17:06:38 -07:00
JSONRPC string `json:"jsonrpc"`
ID string `json:"id"`
2015-04-01 13:23:20 -07:00
Result interface{} `json:"result"`
Error string `json:"error"`
}
2015-07-23 17:06:38 -07:00
func NewRPCResponse(id string, res interface{}, err string) RPCResponse {
2015-04-01 13:23:20 -07:00
return RPCResponse{
2015-07-23 17:06:38 -07:00
JSONRPC: "2.0",
ID: id,
2015-04-01 13:23:20 -07:00
Result: res,
Error: err,
}
}