aboutsummaryrefslogtreecommitdiffstats
path: root/mobile/ethereum.go
diff options
context:
space:
mode:
authorNicolas Guillaume <gunicolas@sqli.com>2017-05-23 17:16:25 +0800
committerNicolas Guillaume <gunicolas@sqli.com>2017-05-23 17:16:25 +0800
commit30cc1c3bf0a4747bef6b01d835b291721ba5dcb3 (patch)
tree359e72100099616553a3739a92685d3c244bd87c /mobile/ethereum.go
parentda636c53d6ebb2588b2a7b8b2cdaeecd06d7dcf0 (diff)
downloadgo-tangerine-30cc1c3bf0a4747bef6b01d835b291721ba5dcb3.tar
go-tangerine-30cc1c3bf0a4747bef6b01d835b291721ba5dcb3.tar.gz
go-tangerine-30cc1c3bf0a4747bef6b01d835b291721ba5dcb3.tar.bz2
go-tangerine-30cc1c3bf0a4747bef6b01d835b291721ba5dcb3.tar.lz
go-tangerine-30cc1c3bf0a4747bef6b01d835b291721ba5dcb3.tar.xz
go-tangerine-30cc1c3bf0a4747bef6b01d835b291721ba5dcb3.tar.zst
go-tangerine-30cc1c3bf0a4747bef6b01d835b291721ba5dcb3.zip
mobile: Add management methods to {Addresses,Topics,Hashes} structures
Diffstat (limited to 'mobile/ethereum.go')
-rw-r--r--mobile/ethereum.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/mobile/ethereum.go b/mobile/ethereum.go
index 68dc672db..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