From 7ec8c257ffd90ba4b63e5419ac9b9011af79be07 Mon Sep 17 00:00:00 2001 From: SilentCicero Date: Tue, 16 Jun 2015 12:28:10 -0400 Subject: New DataArgs and eth_sendRawTransaction --- rpc/api/eth_args.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'rpc/api/eth_args.go') diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index ad9a35fa2..70fb18289 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -226,6 +226,35 @@ func (args *GetDataArgs) UnmarshalJSON(b []byte) (err error) { return nil } +type NewDataArgs struct { + Data string +} + +func (args *NewDataArgs) UnmarshalJSON(b []byte) (err error) { + var obj []interface{} + + if err := json.Unmarshal(b, &obj); err != nil { + return shared.NewDecodeParamError(err.Error()) + } + + // Check for sufficient params + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) + } + + data, ok := obj[0].(string) + if !ok { + return shared.NewInvalidTypeError("data", "not a string") + } + args.Data = data + + if len(args.Data) == 0 { + return shared.NewValidationError("data", "is required") + } + + return nil +} + type NewSigArgs struct { From string Data string -- cgit v1.2.3