aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-26 19:40:09 +0800
committerobscuren <geffobscura@gmail.com>2015-03-26 19:40:09 +0800
commitc33dc3e328c791be8c82b514ba07523f065402e1 (patch)
tree76d11d954203d425f6c7d8635bec5049454d902f
parent83b0cad76667c570a1be81653b531e6a9d513928 (diff)
downloadgo-tangerine-c33dc3e328c791be8c82b514ba07523f065402e1.tar
go-tangerine-c33dc3e328c791be8c82b514ba07523f065402e1.tar.gz
go-tangerine-c33dc3e328c791be8c82b514ba07523f065402e1.tar.bz2
go-tangerine-c33dc3e328c791be8c82b514ba07523f065402e1.tar.lz
go-tangerine-c33dc3e328c791be8c82b514ba07523f065402e1.tar.xz
go-tangerine-c33dc3e328c791be8c82b514ba07523f065402e1.tar.zst
go-tangerine-c33dc3e328c791be8c82b514ba07523f065402e1.zip
moved helper
-rw-r--r--rpc/args.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/rpc/args.go b/rpc/args.go
index 61331d993..1928ec218 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -36,6 +36,26 @@ func blockHeight(raw interface{}, number *int64) (err error) {
return nil
}
+func toNumber(v interface{}) (int64, error) {
+ var str string
+ if v != nil {
+ var ok bool
+ str, ok = v.(string)
+ if !ok {
+ return 0, errors.New("is not a string or undefined")
+ }
+ } else {
+ str = "latest"
+ }
+
+ switch str {
+ case "latest":
+ return -1, nil
+ default:
+ return int64(common.Big(v.(string)).Int64()), nil
+ }
+}
+
type GetBlockByHashArgs struct {
BlockHash string
IncludeTxs bool
@@ -444,26 +464,6 @@ type BlockFilterArgs struct {
Max int
}
-func toNumber(v interface{}) (int64, error) {
- var str string
- if v != nil {
- var ok bool
- str, ok = v.(string)
- if !ok {
- return 0, errors.New("is not a string or undefined")
- }
- } else {
- str = "latest"
- }
-
- switch str {
- case "latest":
- return -1, nil
- default:
- return int64(common.Big(v.(string)).Int64()), nil
- }
-}
-
func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error) {
var obj []struct {
FromBlock interface{} `json:"fromBlock"`