diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-29 07:24:00 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-29 07:24:18 +0800 |
commit | ec85458612e1d5374767f87005dd0ad5934f74d5 (patch) | |
tree | a7e11798765bd56eb088259f2ab4401ec87e4f24 /rpc/message.go | |
parent | 73dcbf7ba23ea4d4d87d4261ff7ebaecfe0ec810 (diff) | |
download | dexon-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.go | 14 |
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) |