diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-06 14:03:22 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-06 14:03:22 +0800 |
commit | 5da3d911cf80e032ceb79a17609e41973923fc1a (patch) | |
tree | c67f30abf1d2c1478173816a286da05145da4eb0 /rpc/args.go | |
parent | 18b076861e6a70109ab152c29fc1f11530c273e2 (diff) | |
download | dexon-5da3d911cf80e032ceb79a17609e41973923fc1a.tar dexon-5da3d911cf80e032ceb79a17609e41973923fc1a.tar.gz dexon-5da3d911cf80e032ceb79a17609e41973923fc1a.tar.bz2 dexon-5da3d911cf80e032ceb79a17609e41973923fc1a.tar.lz dexon-5da3d911cf80e032ceb79a17609e41973923fc1a.tar.xz dexon-5da3d911cf80e032ceb79a17609e41973923fc1a.tar.zst dexon-5da3d911cf80e032ceb79a17609e41973923fc1a.zip |
Initial args tests
Diffstat (limited to 'rpc/args.go')
-rw-r--r-- | rpc/args.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/rpc/args.go b/rpc/args.go index f56051242..ba2ef731a 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -47,7 +47,7 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) { if len(obj) < 1 { return errArguments } - args.BlockNumber = ethutil.BytesToNumber(fromHex(obj[0].(string))) + args.BlockNumber = uint64(ethutil.Big(obj[0].(string)).Int64()) if len(obj) > 1 { args.Transactions = obj[1].(bool) @@ -110,7 +110,7 @@ func (args *GetStorageArgs) UnmarshalJSON(b []byte) (err error) { args.Address = obj[0].(string) if len(obj) > 1 { - args.BlockNumber = ethutil.BytesToNumber(fromHex(obj[1].(string))) + args.BlockNumber = uint64(ethutil.Big(obj[1].(string)).Int64()) } return nil @@ -179,7 +179,7 @@ func (args *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) { args.Address = obj[0].(string) if len(obj) > 1 { - args.BlockNumber = ethutil.BytesToNumber(fromHex(obj[1].(string))) + args.BlockNumber = uint64(ethutil.Big(obj[1].(string)).Int64()) } return nil @@ -210,7 +210,7 @@ func (args *GetBalanceArgs) UnmarshalJSON(b []byte) (err error) { args.Address = obj[0].(string) if len(obj) > 1 { - args.BlockNumber = ethutil.BytesToNumber(fromHex(obj[1].(string))) + args.BlockNumber = uint64(ethutil.Big(obj[1].(string)).Int64()) } return nil @@ -241,7 +241,7 @@ func (args *GetDataArgs) UnmarshalJSON(b []byte) (err error) { args.Address = obj[0].(string) if len(obj) > 1 { - args.BlockNumber = ethutil.BytesToNumber(fromHex(obj[1].(string))) + args.BlockNumber = uint64(ethutil.Big(obj[1].(string)).Int64()) } return nil @@ -299,10 +299,10 @@ func (args *FilterArgs) UnmarshalJSON(b []byte) (err error) { if len(obj) < 1 { return errArguments } - args.FromBlock = ethutil.BytesToNumber(fromHex(obj[0].FromBlock)) - args.ToBlock = ethutil.BytesToNumber(fromHex(obj[0].ToBlock)) - args.Limit = ethutil.BytesToNumber(fromHex(obj[0].Limit)) - args.Offset = ethutil.BytesToNumber(fromHex(obj[0].Offset)) + args.FromBlock = uint64(ethutil.Big(obj[0].FromBlock).Int64()) + args.ToBlock = uint64(ethutil.Big(obj[0].ToBlock).Int64()) + args.Limit = uint64(ethutil.Big(obj[0].Limit).Int64()) + args.Offset = uint64(ethutil.Big(obj[0].Offset).Int64()) args.Address = obj[0].Address args.Topics = obj[0].Topics @@ -335,10 +335,10 @@ func (args *FilterOptions) UnmarshalJSON(b []byte) (err error) { if len(obj) < 1 { return errArguments } - args.Earliest = int64(ethutil.BytesToNumber(fromHex(obj[0].FromBlock))) - args.Latest = int64(ethutil.BytesToNumber(fromHex(obj[0].ToBlock))) - args.Max = int(ethutil.BytesToNumber(fromHex(obj[0].Limit))) - args.Skip = int(ethutil.BytesToNumber(fromHex(obj[0].Offset))) + args.Earliest = int64(ethutil.Big(obj[0].FromBlock).Int64()) + args.Latest = int64(ethutil.Big(obj[0].ToBlock).Int64()) + args.Max = int(ethutil.Big(obj[0].Limit).Int64()) + args.Skip = int(ethutil.Big(obj[0].Offset).Int64()) args.Address = obj[0].Address args.Topic = obj[0].Topics |