aboutsummaryrefslogtreecommitdiffstats
path: root/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'javascript')
-rw-r--r--javascript/types.go32
1 files changed, 1 insertions, 31 deletions
diff --git a/javascript/types.go b/javascript/types.go
index fb1e54ae7..375e7b24c 100644
--- a/javascript/types.go
+++ b/javascript/types.go
@@ -128,37 +128,7 @@ func (self *JSEthereum) toVal(v interface{}) otto.Value {
}
func (self *JSEthereum) Messages(object map[string]interface{}) otto.Value {
- filter := ethchain.NewFilter(self.ethereum)
-
- if object["earliest"] != nil {
- earliest := object["earliest"]
- if e, ok := earliest.(string); ok {
- filter.SetEarliestBlock(ethutil.Hex2Bytes(e))
- } else {
- filter.SetEarliestBlock(earliest)
- }
- }
-
- if object["latest"] != nil {
- latest := object["latest"]
- if l, ok := latest.(string); ok {
- filter.SetLatestBlock(ethutil.Hex2Bytes(l))
- } else {
- filter.SetLatestBlock(latest)
- }
- }
- if object["to"] != nil {
- filter.AddTo(ethutil.Hex2Bytes(object["to"].(string)))
- }
- if object["from"] != nil {
- filter.AddFrom(ethutil.Hex2Bytes(object["from"].(string)))
- }
- if object["max"] != nil {
- filter.SetMax(object["max"].(int))
- }
- if object["skip"] != nil {
- filter.SetSkip(object["skip"].(int))
- }
+ filter := ethchain.NewFilterFromMap(object, self.ethereum)
messages := filter.Find()
var msgs []JSMessage