github.com/0xsequence/ethkit@v1.25.0/ethmempool/subscription.go (about)

     1  package ethmempool
     2  
     3  type Subscription interface {
     4  	PendingTransactionHash() <-chan string
     5  	Done() <-chan struct{}
     6  	Unsubscribe()
     7  }
     8  
     9  type subscriber struct {
    10  	ch               chan string
    11  	done             chan struct{}
    12  	unsubscribe      func()
    13  	notifyFilterFunc NotifyFilterFunc
    14  }
    15  
    16  func (s *subscriber) PendingTransactionHash() <-chan string {
    17  	return s.ch
    18  }
    19  
    20  func (s *subscriber) Done() <-chan struct{} {
    21  	return s.done
    22  }
    23  
    24  func (s *subscriber) Unsubscribe() {
    25  	s.unsubscribe()
    26  }
    27  
    28  type NotifyFilterFunc func(pendingTxnHash string) bool