Updated chain for filtering
This commit is contained in:
@ -2,15 +2,16 @@ package ethutil
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_ "encoding/binary"
|
||||
"fmt"
|
||||
_ "log"
|
||||
_ "math"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
type RlpEncodable interface {
|
||||
type RlpEncode interface {
|
||||
RlpEncode() []byte
|
||||
}
|
||||
|
||||
type RlpEncodeDecode interface {
|
||||
RlpEncode
|
||||
RlpValue() []interface{}
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,30 @@ func (val *Value) Uint() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (val *Value) Int() int64 {
|
||||
if Val, ok := val.Val.(int8); ok {
|
||||
return int64(Val)
|
||||
} else if Val, ok := val.Val.(int16); ok {
|
||||
return int64(Val)
|
||||
} else if Val, ok := val.Val.(int32); ok {
|
||||
return int64(Val)
|
||||
} else if Val, ok := val.Val.(int64); ok {
|
||||
return Val
|
||||
} else if Val, ok := val.Val.(int); ok {
|
||||
return int64(Val)
|
||||
} else if Val, ok := val.Val.(float32); ok {
|
||||
return int64(Val)
|
||||
} else if Val, ok := val.Val.(float64); ok {
|
||||
return int64(Val)
|
||||
} else if Val, ok := val.Val.([]byte); ok {
|
||||
return new(big.Int).SetBytes(Val).Int64()
|
||||
} else if Val, ok := val.Val.(*big.Int); ok {
|
||||
return Val.Int64()
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func (val *Value) Byte() byte {
|
||||
if Val, ok := val.Val.(byte); ok {
|
||||
return Val
|
||||
|
Reference in New Issue
Block a user