restructured eth rpc API

This commit is contained in:
Bas van Kervel
2015-06-08 10:23:54 +02:00
committed by Bas van Kervel
parent 6609d45ef4
commit 2f55a1d798
11 changed files with 2167 additions and 0 deletions

38
rpc/shared/types.go Normal file
View File

@@ -0,0 +1,38 @@
package shared
import "encoding/json"
// RPC request
type Request struct {
Id interface{} `json:"id"`
Jsonrpc string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
// RPC response
type Response struct {
Id interface{} `json:"id"`
Jsonrpc string `json:"jsonrpc"`
}
// RPC success response
type SuccessResponse struct {
Id interface{} `json:"id"`
Jsonrpc string `json:"jsonrpc"`
Result interface{} `json:"result"`
}
// RPC error response
type ErrorResponse struct {
Id interface{} `json:"id"`
Jsonrpc string `json:"jsonrpc"`
Error *ErrorObject `json:"error"`
}
// RPC error response details
type ErrorObject struct {
Code int `json:"code"`
Message string `json:"message"`
// Data interface{} `json:"data"`
}