diff options
Diffstat (limited to 'rpc/messages.go')
-rw-r--r-- | rpc/messages.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rpc/messages.go b/rpc/messages.go index 044f07545..b37d8229d 100644 --- a/rpc/messages.go +++ b/rpc/messages.go @@ -210,6 +210,19 @@ func (req *RpcRequest) ToBoolArgs() (bool, error) { return args, nil } +func (req *RpcRequest) ToIntArgs() (int, error) { + if len(req.Params) < 1 { + return 0, errArguments + } + + var args int + if err := json.Unmarshal(req.Params[0], &args); err != nil { + return 0, errArguments + } + + return args, nil +} + func (req *RpcRequest) ToCompileArgs() (string, error) { if len(req.Params) < 1 { return "", errArguments |