Fixed RPC tests. Changed some names.

This commit is contained in:
Jae Kwon
2015-04-01 13:23:20 -07:00
parent 25ab73a51a
commit bfb61fb539
9 changed files with 475 additions and 534 deletions

27
rpc/types.go Normal file
View File

@ -0,0 +1,27 @@
package rpc
type RPCRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params []interface{} `json:"params"`
Id int `json:"id"`
}
type RPCResponse struct {
Result interface{} `json:"result"`
Error string `json:"error"`
Id string `json:"id"`
JSONRPC string `json:"jsonrpc"`
}
func NewRPCResponse(res interface{}, err string) RPCResponse {
if res == nil {
res = struct{}{}
}
return RPCResponse{
Result: res,
Error: err,
Id: "",
JSONRPC: "2.0",
}
}