aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/message.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-29 07:24:00 +0800
committerobscuren <geffobscura@gmail.com>2015-01-29 07:24:18 +0800
commitec85458612e1d5374767f87005dd0ad5934f74d5 (patch)
treea7e11798765bd56eb088259f2ab4401ec87e4f24 /rpc/message.go
parent73dcbf7ba23ea4d4d87d4261ff7ebaecfe0ec810 (diff)
downloaddexon-ec85458612e1d5374767f87005dd0ad5934f74d5.tar
dexon-ec85458612e1d5374767f87005dd0ad5934f74d5.tar.gz
dexon-ec85458612e1d5374767f87005dd0ad5934f74d5.tar.bz2
dexon-ec85458612e1d5374767f87005dd0ad5934f74d5.tar.lz
dexon-ec85458612e1d5374767f87005dd0ad5934f74d5.tar.xz
dexon-ec85458612e1d5374767f87005dd0ad5934f74d5.tar.zst
dexon-ec85458612e1d5374767f87005dd0ad5934f74d5.zip
updated ethereum.js and moved to subfolder
* Previous subtree caused a lot of trouble * Implemented sha3 in our shiny new http JSON RPC
Diffstat (limited to 'rpc/message.go')
-rw-r--r--rpc/message.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/rpc/message.go b/rpc/message.go
index caf50a6c0..5785fcc87 100644
--- a/rpc/message.go
+++ b/rpc/message.go
@@ -56,6 +56,20 @@ type RpcRequest struct {
Params []json.RawMessage `json:"params"`
}
+func (req *RpcRequest) ToSha3Args() (*Sha3Args, error) {
+ if len(req.Params) < 1 {
+ return nil, NewErrorResponse(ErrorArguments)
+ }
+
+ args := new(Sha3Args)
+ r := bytes.NewReader(req.Params[0])
+ if err := json.NewDecoder(r).Decode(args); err != nil {
+ return nil, NewErrorResponse(ErrorDecodeArgs)
+ }
+ rpclogger.DebugDetailf("%T %v", args, args)
+ return args, nil
+}
+
func (req *RpcRequest) ToGetBlockArgs() (*GetBlockArgs, error) {
if len(req.Params) < 1 {
return nil, NewErrorResponse(ErrorArguments)