aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-26 17:34:21 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-26 17:34:21 +0800
commit966cfa4bddb0fbe355dadb83541325a3b5c132f8 (patch)
tree69f3270d7021949de54d2142e76301d7c325c6ef /rpc/args.go
parentc7dc379da5a02fb8ac92788fa317379fbde00d20 (diff)
downloaddexon-966cfa4bddb0fbe355dadb83541325a3b5c132f8.tar
dexon-966cfa4bddb0fbe355dadb83541325a3b5c132f8.tar.gz
dexon-966cfa4bddb0fbe355dadb83541325a3b5c132f8.tar.bz2
dexon-966cfa4bddb0fbe355dadb83541325a3b5c132f8.tar.lz
dexon-966cfa4bddb0fbe355dadb83541325a3b5c132f8.tar.xz
dexon-966cfa4bddb0fbe355dadb83541325a3b5c132f8.tar.zst
dexon-966cfa4bddb0fbe355dadb83541325a3b5c132f8.zip
NewTxArgs
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