aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/message.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-30 20:25:12 +0800
committerobscuren <geffobscura@gmail.com>2015-01-30 20:25:12 +0800
commitc03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7 (patch)
tree137343143b03e4b76bbbfa269c2fc7d35f9f6a35 /rpc/message.go
parentc48644490f039fb9756b4cd1fedf11fbb1c4a16f (diff)
downloadgo-tangerine-c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7.tar
go-tangerine-c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7.tar.gz
go-tangerine-c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7.tar.bz2
go-tangerine-c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7.tar.lz
go-tangerine-c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7.tar.xz
go-tangerine-c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7.tar.zst
go-tangerine-c03d403437c20584bcbf3cf3fa9d79ac7a0a8ca7.zip
Added whisper interface for xeth, added examples, updated RPC
* Added RPC methods for whisper * Added whisper example
Diffstat (limited to 'rpc/message.go')
-rw-r--r--rpc/message.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/rpc/message.go b/rpc/message.go
index 5045adb8f..919302921 100644
--- a/rpc/message.go
+++ b/rpc/message.go
@@ -21,6 +21,8 @@ import (
"encoding/json"
"errors"
"fmt"
+
+ "github.com/ethereum/go-ethereum/xeth"
)
const (
@@ -270,3 +272,45 @@ func (req *RpcRequest) ToDbGetArgs() (*DbArgs, error) {
rpclogger.DebugDetailf("%T %v", args, args)
return &args, nil
}
+
+func (req *RpcRequest) ToWhisperFilterArgs() (*xeth.Options, error) {
+ if len(req.Params) < 1 {
+ return nil, NewErrorResponse(ErrorArguments)
+ }
+
+ var args xeth.Options
+ err := json.Unmarshal(req.Params[0], &args)
+ if err != nil {
+ return nil, NewErrorResponseWithError(ErrorDecodeArgs, err)
+ }
+ rpclogger.DebugDetailf("%T %v", args, args)
+ return &args, nil
+}
+
+func (req *RpcRequest) ToWhisperChangedArgs() (int, error) {
+ if len(req.Params) < 1 {
+ return 0, NewErrorResponse(ErrorArguments)
+ }
+
+ var id int
+ err := json.Unmarshal(req.Params[0], &id)
+ if err != nil {
+ return 0, NewErrorResponse(ErrorDecodeArgs)
+ }
+ rpclogger.DebugDetailf("%T %v", id, id)
+ return id, nil
+}
+
+func (req *RpcRequest) ToWhisperPostArgs() (*WhisperMessageArgs, error) {
+ if len(req.Params) < 1 {
+ return nil, NewErrorResponse(ErrorArguments)
+ }
+
+ var args WhisperMessageArgs
+ err := json.Unmarshal(req.Params[0], &args)
+ if err != nil {
+ return nil, err
+ }
+ rpclogger.DebugDetailf("%T %v", args, args)
+ return &args, nil
+}