Skip to content

Commit b110f8d

Browse files
committed
Fix the indexes for the topic
1 parent a69e744 commit b110f8d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

logs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ func (c *Client) GetLogs(fromBlock, toBlock *int, address *string, topicsOrOps .
3030
// Only operator in between topics are supported.
3131
for index, topicOrOp := range topicsOrOps {
3232
if index%2 == 0 {
33-
param[fmt.Sprintf("topic%v", index)] = topicOrOp
33+
param[fmt.Sprintf("topic%v", index/2)] = topicOrOp
3434
} else {
3535
if topicOrOp != "and" && topicOrOp != "or" {
3636
return nil, fmt.Errorf("invalid operator")
3737
}
3838

39-
param[fmt.Sprintf("topic%v_%v_opr", index-1, index)] = topicOrOp
39+
param[fmt.Sprintf("topic%v_%v_opr", index/2, index/2+1)] = topicOrOp
4040
}
4141
}
4242

0 commit comments

Comments
 (0)