From 966cfa4bddb0fbe355dadb83541325a3b5c132f8 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 26 Mar 2015 10:34:21 +0100 Subject: NewTxArgs --- rpc/args.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'rpc/args.go') diff --git a/rpc/args.go b/rpc/args.go index 9a51959f4..2446e778f 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -93,8 +93,8 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) { } type NewTxArgs struct { - From string - To string + From common.Address + To common.Address Value *big.Int Gas *big.Int GasPrice *big.Int @@ -122,9 +122,12 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) { return NewDecodeParamError(err.Error()) } - // var ok bool - args.From = ext.From - args.To = ext.To + if len(ext.From) == 0 { + return NewValidationError("from", "is required") + } + + args.From = common.HexToAddress(ext.From) + args.To = common.HexToAddress(ext.To) args.Value = common.String2Big(ext.Value) args.Gas = common.String2Big(ext.Gas) args.GasPrice = common.String2Big(ext.GasPrice) @@ -145,13 +148,6 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) { return nil } -func (args *NewTxArgs) requirements() error { - if len(args.From) == 0 { - return NewValidationError("From", "Is required") - } - return nil -} - type GetStorageArgs struct { Address string BlockNumber int64 -- cgit