NewTxArgs

This commit is contained in:
Taylor Gerring
2015-03-26 10:34:21 +01:00
parent c7dc379da5
commit 966cfa4bdd
3 changed files with 18 additions and 39 deletions

View File

@ -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