aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-10 00:55:01 +0800
committerobscuren <geffobscura@gmail.com>2015-03-10 00:55:01 +0800
commit8560004f380dc688a1171ad5aeffa593aae41193 (patch)
treefea395acf042b51e97a86e2c4cbcf8c16b2912b7 /rpc/args.go
parent9723191b19f6ddc12f0c3376ede7529b2d72e6a2 (diff)
parent676a0de58d3d7c508b0eeeff192d2095a46f7382 (diff)
downloaddexon-8560004f380dc688a1171ad5aeffa593aae41193.tar
dexon-8560004f380dc688a1171ad5aeffa593aae41193.tar.gz
dexon-8560004f380dc688a1171ad5aeffa593aae41193.tar.bz2
dexon-8560004f380dc688a1171ad5aeffa593aae41193.tar.lz
dexon-8560004f380dc688a1171ad5aeffa593aae41193.tar.xz
dexon-8560004f380dc688a1171ad5aeffa593aae41193.tar.zst
dexon-8560004f380dc688a1171ad5aeffa593aae41193.zip
wip
Diffstat (limited to 'rpc/args.go')
-rw-r--r--rpc/args.go29
1 files changed, 21 insertions, 8 deletions
diff --git a/rpc/args.go b/rpc/args.go
index 43cad5fde..d34cfb2fa 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -333,19 +333,19 @@ type FilterOptions struct {
Earliest int64
Latest int64
Address interface{}
- Topic []string
+ Topic []interface{}
Skip int
Max int
}
func (args *FilterOptions) UnmarshalJSON(b []byte) (err error) {
var obj []struct {
- FromBlock string `json:"fromBlock"`
- ToBlock string `json:"toBlock"`
- Limit string `json:"limit"`
- Offset string `json:"offset"`
- Address string `json:"address"`
- Topics []string `json:"topics"`
+ FromBlock string `json:"fromBlock"`
+ ToBlock string `json:"toBlock"`
+ Limit string `json:"limit"`
+ Offset string `json:"offset"`
+ Address string `json:"address"`
+ Topics []interface{} `json:"topics"`
}
if err = json.Unmarshal(b, &obj); err != nil {
@@ -360,7 +360,20 @@ func (args *FilterOptions) UnmarshalJSON(b []byte) (err error) {
args.Max = int(ethutil.Big(obj[0].Limit).Int64())
args.Skip = int(ethutil.Big(obj[0].Offset).Int64())
args.Address = obj[0].Address
- args.Topic = obj[0].Topics
+
+ topics := make([][][]byte, len(obj[0].Topics))
+ for i, topicDat := range obj[0].Topics {
+ 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)
+ }
+ }
+ args.Topics = topics
return nil
}