aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 05:35:42 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 05:35:42 +0800
commitbb12dbe233db2e064715b329b7ba987c76ba3bfa (patch)
tree5297b21e7cbcfc4ab04b51ea0f7dc9b622948393 /rpc/args.go
parent7eed7e1d965ed7194ca42e4637754b63fb4502a5 (diff)
downloaddexon-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar
dexon-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.gz
dexon-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.bz2
dexon-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.lz
dexon-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.xz
dexon-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.zst
dexon-bb12dbe233db2e064715b329b7ba987c76ba3bfa.zip
Prefer args as strings not objects
Diffstat (limited to 'rpc/args.go')
-rw-r--r--rpc/args.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/rpc/args.go b/rpc/args.go
index 19258263c..416c672b0 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -121,8 +121,8 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
}
type NewTxArgs struct {
- From common.Address
- To common.Address
+ From string
+ To string
Value *big.Int
Gas *big.Int
GasPrice *big.Int
@@ -154,8 +154,8 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
return NewValidationError("from", "is required")
}
- args.From = common.HexToAddress(ext.From)
- args.To = common.HexToAddress(ext.To)
+ args.From = ext.From
+ args.To = ext.To
args.Value = common.String2Big(ext.Value)
args.Gas = common.String2Big(ext.Gas)
args.GasPrice = common.String2Big(ext.GasPrice)
@@ -172,7 +172,7 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
}
type GetStorageArgs struct {
- Address common.Address
+ Address string
BlockNumber int64
}
@@ -190,7 +190,7 @@ func (args *GetStorageArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewInvalidTypeError("address", "not a string")
}
- args.Address = common.HexToAddress(addstr)
+ args.Address = addstr
if len(obj) > 1 {
if err := blockHeight(obj[1], &args.BlockNumber); err != nil {
@@ -202,8 +202,8 @@ func (args *GetStorageArgs) UnmarshalJSON(b []byte) (err error) {
}
type GetStorageAtArgs struct {
- Address common.Address
- Key common.Hash
+ Address string
+ Key string
BlockNumber int64
}
@@ -221,13 +221,13 @@ func (args *GetStorageAtArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewInvalidTypeError("address", "not a string")
}
- args.Address = common.HexToAddress(addstr)
+ args.Address = addstr
keystr, ok := obj[1].(string)
if !ok {
return NewInvalidTypeError("key", "not a string")
}
- args.Key = common.HexToHash(keystr)
+ args.Key = keystr
if len(obj) > 2 {
if err := blockHeight(obj[2], &args.BlockNumber); err != nil {
@@ -239,7 +239,7 @@ func (args *GetStorageAtArgs) UnmarshalJSON(b []byte) (err error) {
}
type GetTxCountArgs struct {
- Address common.Address
+ Address string
BlockNumber int64
}
@@ -257,7 +257,7 @@ func (args *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewInvalidTypeError("address", "not a string")
}
- args.Address = common.HexToAddress(addstr)
+ args.Address = addstr
if len(obj) > 1 {
if err := blockHeight(obj[1], &args.BlockNumber); err != nil {
@@ -269,7 +269,7 @@ func (args *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) {
}
type GetBalanceArgs struct {
- Address common.Address
+ Address string
BlockNumber int64
}
@@ -287,7 +287,7 @@ func (args *GetBalanceArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewInvalidTypeError("address", "not a string")
}
- args.Address = common.HexToAddress(addstr)
+ args.Address = addstr
if len(obj) > 1 {
if err := blockHeight(obj[1], &args.BlockNumber); err != nil {
@@ -299,7 +299,7 @@ func (args *GetBalanceArgs) UnmarshalJSON(b []byte) (err error) {
}
type GetDataArgs struct {
- Address common.Address
+ Address string
BlockNumber int64
}
@@ -317,7 +317,7 @@ func (args *GetDataArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewInvalidTypeError("address", "not a string")
}
- args.Address = common.HexToAddress(addstr)
+ args.Address = addstr
if len(obj) > 1 {
if err := blockHeight(obj[1], &args.BlockNumber); err != nil {
@@ -763,8 +763,8 @@ func (args *WhisperFilterArgs) UnmarshalJSON(b []byte) (err error) {
type SubmitWorkArgs struct {
Nonce uint64
- Header common.Hash
- Digest common.Hash
+ Header string
+ Digest string
}
func (args *SubmitWorkArgs) UnmarshalJSON(b []byte) (err error) {
@@ -788,13 +788,13 @@ func (args *SubmitWorkArgs) UnmarshalJSON(b []byte) (err error) {
return NewInvalidTypeError("header", "not a string")
}
- args.Header = common.HexToHash(objstr)
+ args.Header = objstr
if objstr, ok = obj[2].(string); !ok {
return NewInvalidTypeError("digest", "not a string")
}
- args.Digest = common.HexToHash(objstr)
+ args.Digest = objstr
return nil
}