aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-28 17:23:18 +0800
committerobscuren <geffobscura@gmail.com>2015-01-28 17:23:18 +0800
commitf3e78c8f3cd2196ef70a41f298b6df556543d581 (patch)
treee3db9bf06e87b1259a43161338447e6f82cf4c42 /ui
parentc54a85ee644bf02dd79e43e6a0ee3528bb39a815 (diff)
downloaddexon-f3e78c8f3cd2196ef70a41f298b6df556543d581.tar.gz
dexon-f3e78c8f3cd2196ef70a41f298b6df556543d581.tar.zst
dexon-f3e78c8f3cd2196ef70a41f298b6df556543d581.zip
reworking messages => log
Diffstat (limited to 'ui')
-rw-r--r--ui/filter.go26
-rw-r--r--ui/qt/filter.go17
2 files changed, 16 insertions, 27 deletions
diff --git a/ui/filter.go b/ui/filter.go
index e0797dad2..8f298a40c 100644
--- a/ui/filter.go
+++ b/ui/filter.go
@@ -28,14 +28,9 @@ func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.
filter.SetLatestBlock(val.Int())
}
- if object["to"] != nil {
- val := ethutil.NewValue(object["to"])
- filter.AddTo(fromHex(val.Str()))
- }
-
- if object["from"] != nil {
- val := ethutil.NewValue(object["from"])
- filter.AddFrom(fromHex(val.Str()))
+ if object["address"] != nil {
+ val := ethutil.NewValue(object["address"])
+ filter.SetAddress(fromHex(val.Str()))
}
if object["max"] != nil {
@@ -48,8 +43,8 @@ func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.
filter.SetSkip(int(val.Uint()))
}
- if object["altered"] != nil {
- filter.Altered = makeAltered(object["altered"])
+ if object["topics"] != nil {
+ filter.SetTopics(MakeTopics(object["topics"]))
}
return filter
@@ -70,16 +65,13 @@ func mapToAccountChange(m map[string]interface{}) (d core.AccountChange) {
// data can come in in the following formats:
// ["aabbccdd", {id: "ccddee", at: "11223344"}], "aabbcc", {id: "ccddee", at: "1122"}
-func makeAltered(v interface{}) (d []core.AccountChange) {
+func MakeTopics(v interface{}) (d [][]byte) {
if str, ok := v.(string); ok {
- d = append(d, core.AccountChange{fromHex(str), nil})
- } else if obj, ok := v.(map[string]interface{}); ok {
- d = append(d, mapToAccountChange(obj))
- } else if slice, ok := v.([]interface{}); ok {
+ d = append(d, fromHex(str))
+ } else if slice, ok := v.([]string); ok {
for _, item := range slice {
- d = append(d, makeAltered(item)...)
+ d = append(d, fromHex(item))
}
}
-
return
}
diff --git a/ui/qt/filter.go b/ui/qt/filter.go
index 423d5bd43..cb4d0311b 100644
--- a/ui/qt/filter.go
+++ b/ui/qt/filter.go
@@ -9,24 +9,21 @@ import (
func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.Filter {
filter := ui.NewFilterFromMap(object, eth)
- if object["altered"] != nil {
- filter.Altered = makeAltered(object["altered"])
+ if object["topics"] != nil {
+ filter.SetTopics(makeTopics(object["topics"]))
}
return filter
}
-func makeAltered(v interface{}) (d []core.AccountChange) {
+func makeTopics(v interface{}) (d [][]byte) {
if qList, ok := v.(*qml.List); ok {
- var s []interface{}
+ var s []string
qList.Convert(&s)
- d = makeAltered(s)
- } else if qMap, ok := v.(*qml.Map); ok {
- var m map[string]interface{}
- qMap.Convert(&m)
-
- d = makeAltered(m)
+ d = ui.MakeTopics(s)
+ } else if str, ok := v.(string); ok {
+ d = ui.MakeTopics(str)
}
return