From a4a4e9fcf824189d8d06940492a01effe6e6cf92 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Wed, 17 Jun 2015 16:22:35 +0200 Subject: removed old rpc structure and added new inproc api client --- rpc/api/args.go | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 rpc/api/args.go (limited to 'rpc/api/args.go') diff --git a/rpc/api/args.go b/rpc/api/args.go new file mode 100644 index 000000000..4ef1b26e7 --- /dev/null +++ b/rpc/api/args.go @@ -0,0 +1,57 @@ +package api + +import ( + "encoding/json" + "github.com/ethereum/go-ethereum/rpc/shared" +) + +type CompileArgs struct { + Source string +} + +func (args *CompileArgs) UnmarshalJSON(b []byte) (err error) { + var obj []interface{} + if err := json.Unmarshal(b, &obj); err != nil { + return shared.NewDecodeParamError(err.Error()) + } + + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) + } + argstr, ok := obj[0].(string) + if !ok { + return shared.NewInvalidTypeError("arg0", "is not a string") + } + args.Source = argstr + + return nil +} + +type FilterStringArgs struct { + Word string +} + +func (args *FilterStringArgs) UnmarshalJSON(b []byte) (err error) { + var obj []interface{} + if err := json.Unmarshal(b, &obj); err != nil { + return shared.NewDecodeParamError(err.Error()) + } + + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) + } + + var argstr string + argstr, ok := obj[0].(string) + if !ok { + return shared.NewInvalidTypeError("filter", "not a string") + } + switch argstr { + case "latest", "pending": + break + default: + return shared.NewValidationError("Word", "Must be `latest` or `pending`") + } + args.Word = argstr + return nil +} \ No newline at end of file -- cgit v1.2.3 From 2e0b56a72b3eafc89938003da29c06496ac9ad4e Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Mon, 22 Jun 2015 12:47:32 +0200 Subject: added RPC start/stop support --- rpc/api/args.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'rpc/api/args.go') diff --git a/rpc/api/args.go b/rpc/api/args.go index 4ef1b26e7..fc85448e6 100644 --- a/rpc/api/args.go +++ b/rpc/api/args.go @@ -2,6 +2,7 @@ package api import ( "encoding/json" + "github.com/ethereum/go-ethereum/rpc/shared" ) @@ -54,4 +55,4 @@ func (args *FilterStringArgs) UnmarshalJSON(b []byte) (err error) { } args.Word = argstr return nil -} \ No newline at end of file +} -- cgit v1.2.3