aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-05-06 17:40:23 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-06-06 21:21:41 +0800
commitc39de61a0a3f2e5e9427f842d48e8b325b2afec3 (patch)
tree203c078474f8d16944618ebcad491183d9cbe4af /rpc
parentaf53767e162e59e45e18aad61fa79b85d74f0aeb (diff)
downloadgo-tangerine-c39de61a0a3f2e5e9427f842d48e8b325b2afec3.tar
go-tangerine-c39de61a0a3f2e5e9427f842d48e8b325b2afec3.tar.gz
go-tangerine-c39de61a0a3f2e5e9427f842d48e8b325b2afec3.tar.bz2
go-tangerine-c39de61a0a3f2e5e9427f842d48e8b325b2afec3.tar.lz
go-tangerine-c39de61a0a3f2e5e9427f842d48e8b325b2afec3.tar.xz
go-tangerine-c39de61a0a3f2e5e9427f842d48e8b325b2afec3.tar.zst
go-tangerine-c39de61a0a3f2e5e9427f842d48e8b325b2afec3.zip
[release/1.4.6] cmd, console: split off the console into a reusable package
(cherry picked from commit ffaf58f0a98bd987bbe76e8669bb22c405dcd62a)
Diffstat (limited to 'rpc')
-rw-r--r--rpc/json.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/rpc/json.go b/rpc/json.go
index 8a3bea2ee..151ed546e 100644
--- a/rpc/json.go
+++ b/rpc/json.go
@@ -30,7 +30,7 @@ import (
)
const (
- jsonRPCVersion = "2.0"
+ JSONRPCVersion = "2.0"
serviceMethodSeparator = "_"
subscribeMethod = "eth_subscribe"
unsubscribeMethod = "eth_unsubscribe"
@@ -302,31 +302,31 @@ func parsePositionalArguments(args json.RawMessage, callbackArgs []reflect.Type)
// CreateResponse will create a JSON-RPC success response with the given id and reply as result.
func (c *jsonCodec) CreateResponse(id interface{}, reply interface{}) interface{} {
if isHexNum(reflect.TypeOf(reply)) {
- return &JSONSuccessResponse{Version: jsonRPCVersion, Id: id, Result: fmt.Sprintf(`%#x`, reply)}
+ return &JSONSuccessResponse{Version: JSONRPCVersion, Id: id, Result: fmt.Sprintf(`%#x`, reply)}
}
- return &JSONSuccessResponse{Version: jsonRPCVersion, Id: id, Result: reply}
+ return &JSONSuccessResponse{Version: JSONRPCVersion, Id: id, Result: reply}
}
// CreateErrorResponse will create a JSON-RPC error response with the given id and error.
func (c *jsonCodec) CreateErrorResponse(id interface{}, err RPCError) interface{} {
- return &JSONErrResponse{Version: jsonRPCVersion, Id: id, Error: JSONError{Code: err.Code(), Message: err.Error()}}
+ return &JSONErrResponse{Version: JSONRPCVersion, Id: id, Error: JSONError{Code: err.Code(), Message: err.Error()}}
}
// CreateErrorResponseWithInfo will create a JSON-RPC error response with the given id and error.
// info is optional and contains additional information about the error. When an empty string is passed it is ignored.
func (c *jsonCodec) CreateErrorResponseWithInfo(id interface{}, err RPCError, info interface{}) interface{} {
- return &JSONErrResponse{Version: jsonRPCVersion, Id: id,
+ return &JSONErrResponse{Version: JSONRPCVersion, Id: id,
Error: JSONError{Code: err.Code(), Message: err.Error(), Data: info}}
}
// CreateNotification will create a JSON-RPC notification with the given subscription id and event as params.
func (c *jsonCodec) CreateNotification(subid string, event interface{}) interface{} {
if isHexNum(reflect.TypeOf(event)) {
- return &jsonNotification{Version: jsonRPCVersion, Method: notificationMethod,
+ return &jsonNotification{Version: JSONRPCVersion, Method: notificationMethod,
Params: jsonSubscription{Subscription: subid, Result: fmt.Sprintf(`%#x`, event)}}
}
- return &jsonNotification{Version: jsonRPCVersion, Method: notificationMethod,
+ return &jsonNotification{Version: JSONRPCVersion, Method: notificationMethod,
Params: jsonSubscription{Subscription: subid, Result: event}}
}