diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-20 22:18:07 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-20 22:18:07 +0800 |
commit | 75625801f597061076d1e5863f97c9ea12aa10e4 (patch) | |
tree | f45334ddc09a191c8dfe4e75f98f736bf67979f6 /rpc/message.go | |
parent | ea9a549bbdc8377bca73f1417f2dc4a18396a382 (diff) | |
parent | a59cd94625f589bb167be7a9c4588ff959dcfc00 (diff) | |
download | go-tangerine-75625801f597061076d1e5863f97c9ea12aa10e4.tar go-tangerine-75625801f597061076d1e5863f97c9ea12aa10e4.tar.gz go-tangerine-75625801f597061076d1e5863f97c9ea12aa10e4.tar.bz2 go-tangerine-75625801f597061076d1e5863f97c9ea12aa10e4.tar.lz go-tangerine-75625801f597061076d1e5863f97c9ea12aa10e4.tar.xz go-tangerine-75625801f597061076d1e5863f97c9ea12aa10e4.tar.zst go-tangerine-75625801f597061076d1e5863f97c9ea12aa10e4.zip |
fixed merge
Diffstat (limited to 'rpc/message.go')
-rw-r--r-- | rpc/message.go | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/rpc/message.go b/rpc/message.go index d96c35d7e..825ede05b 100644 --- a/rpc/message.go +++ b/rpc/message.go @@ -201,6 +201,36 @@ func (req *RpcRequest) ToGetCodeAtArgs() (*GetCodeAtArgs, error) { return args, nil } +func (req *RpcRequest) ToBoolArgs() (bool, error) { + if len(req.Params) < 1 { + return false, NewErrorResponse(ErrorArguments) + } + + var args bool + err := json.Unmarshal(req.Params[0], &args) + if err != nil { + return false, NewErrorResponse(ErrorDecodeArgs) + } + + rpclogger.DebugDetailf("%T %v", args, args) + return args, nil +} + +func (req *RpcRequest) ToCompileArgs() (string, error) { + if len(req.Params) < 1 { + return "", NewErrorResponse(ErrorArguments) + } + + var args string + err := json.Unmarshal(req.Params[0], &args) + if err != nil { + return "", NewErrorResponse(ErrorDecodeArgs) + } + + rpclogger.DebugDetailf("%T %v", args, args) + return args, nil +} + func (req *RpcRequest) ToFilterArgs() (*FilterOptions, error) { if len(req.Params) < 1 { return nil, NewErrorResponse(ErrorArguments) @@ -231,6 +261,36 @@ func (req *RpcRequest) ToFilterStringArgs() (string, error) { return args, nil } +func (req *RpcRequest) ToUninstallFilterArgs() (int, error) { + if len(req.Params) < 1 { + return 0, NewErrorResponse(ErrorArguments) + } + + var args int + err := json.Unmarshal(req.Params[0], &args) + if err != nil { + return 0, NewErrorResponse(ErrorDecodeArgs) + } + + rpclogger.DebugDetailf("%T %v", args, args) + return args, nil +} + +func (req *RpcRequest) ToFilterChangedArgs() (int, error) { + if len(req.Params) < 1 { + return 0, NewErrorResponse(ErrorArguments) + } + + var id int + r := bytes.NewReader(req.Params[0]) + err := json.NewDecoder(r).Decode(&id) + if err != nil { + return 0, NewErrorResponse(ErrorDecodeArgs) + } + rpclogger.DebugDetailf("%T %v", id, id) + return id, nil +} + func (req *RpcRequest) ToDbPutArgs() (*DbArgs, error) { if len(req.Params) < 3 { return nil, NewErrorResponse(ErrorArguments) |