aboutsummaryrefslogtreecommitdiffstats
path: root/mobile/ethereum.go
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/ethereum.go')
-rw-r--r--mobile/ethereum.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/mobile/ethereum.go b/mobile/ethereum.go
index 94f707a87..30a94dc89 100644
--- a/mobile/ethereum.go
+++ b/mobile/ethereum.go
@@ -87,6 +87,18 @@ func (p *SyncProgress) GetKnownStates() int64 { return int64(p.progress.KnownS
// Topics is a set of topic lists to filter events with.
type Topics struct{ topics [][]common.Hash }
+// NewTopics creates a slice of uninitialized Topics.
+func NewTopics(size int) *Topics {
+ return &Topics{
+ topics: make([][]common.Hash, size),
+ }
+}
+
+// NewTopicsEmpty creates an empty slice of Topics values.
+func NewTopicsEmpty() *Topics {
+ return NewTopics(0)
+}
+
// Size returns the number of topic lists inside the set
func (t *Topics) Size() int {
return len(t.topics)
@@ -109,6 +121,11 @@ func (t *Topics) Set(index int, topics *Hashes) error {
return nil
}
+// Append adds a new topic list to the end of the slice.
+func (t *Topics) Append(topics *Hashes) {
+ t.topics = append(t.topics, topics.hashes)
+}
+
// FilterQuery contains options for contact log filtering.
type FilterQuery struct {
query ethereum.FilterQuery
@@ -123,3 +140,8 @@ func (fq *FilterQuery) GetFromBlock() *BigInt { return &BigInt{fq.query.FromB
func (fq *FilterQuery) GetToBlock() *BigInt { return &BigInt{fq.query.ToBlock} }
func (fq *FilterQuery) GetAddresses() *Addresses { return &Addresses{fq.query.Addresses} }
func (fq *FilterQuery) GetTopics() *Topics { return &Topics{fq.query.Topics} }
+
+func (fq *FilterQuery) SetFromBlock(fromBlock *BigInt) { fq.query.FromBlock = fromBlock.bigint }
+func (fq *FilterQuery) SetToBlock(toBlock *BigInt) { fq.query.ToBlock = toBlock.bigint }
+func (fq *FilterQuery) SetAddresses(addresses *Addresses) { fq.query.Addresses = addresses.addresses }
+func (fq *FilterQuery) SetTopics(topics *Topics) { fq.query.Topics = topics.topics }