aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/args.go')
-rw-r--r--rpc/args.go20
1 files changed, 8 insertions, 12 deletions
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