github.com/karalabe/go-ethereum@v0.8.5/ui/qt/filter.go (about) 1 package qt 2 3 import ( 4 "github.com/ethereum/go-ethereum/core" 5 "github.com/ethereum/go-ethereum/ui" 6 "github.com/obscuren/qml" 7 ) 8 9 func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Filter { 10 filter := ui.NewFilterFromMap(object, eth) 11 12 if object["topics"] != nil { 13 filter.SetTopics(makeTopics(object["topics"])) 14 } 15 16 return filter 17 } 18 19 func makeTopics(v interface{}) (d [][]byte) { 20 if qList, ok := v.(*qml.List); ok { 21 var s []string 22 qList.Convert(&s) 23 24 d = ui.MakeTopics(s) 25 } else if str, ok := v.(string); ok { 26 d = ui.MakeTopics(str) 27 } 28 29 return 30 }