diff options
Diffstat (limited to 'rpc/args.go')
-rw-r--r-- | rpc/args.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/rpc/args.go b/rpc/args.go index e839da8bf..ea8489585 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -197,7 +197,7 @@ type FilterOptions struct { Earliest int64 Latest int64 Address interface{} - Topic []string + Topic []interface{} Skip int Max int } @@ -220,10 +220,20 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions { opts.Earliest = options.Earliest opts.Latest = options.Latest - opts.Topics = make([][]byte, len(options.Topic)) - for i, topic := range options.Topic { - opts.Topics[i] = fromHex(topic) + + topics := make([][][]byte, len(options.Topic)) + for i, topicDat := range options.Topic { + if slice, ok := topicDat.([]interface{}); ok { + topics[i] = make([][]byte, len(slice)) + for j, topic := range slice { + topics[i][j] = fromHex(topic.(string)) + } + } else if str, ok := topicDat.(string); ok { + topics[i] = make([][]byte, 1) + topics[i][0] = fromHex(str) + } } + opts.Topics = topics return opts } |