2019-10-09 14:22:53 +00:00
|
|
|
package gethbridge
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/event"
|
2020-01-02 09:10:19 +00:00
|
|
|
|
2019-11-23 17:57:05 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
2019-10-09 14:22:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type gethSubscriptionWrapper struct {
|
|
|
|
subscription event.Subscription
|
|
|
|
}
|
|
|
|
|
2019-11-23 17:57:05 +00:00
|
|
|
// NewGethSubscriptionWrapper returns an object that wraps Geth's Subscription in a types interface
|
|
|
|
func NewGethSubscriptionWrapper(subscription event.Subscription) types.Subscription {
|
2019-10-09 14:22:53 +00:00
|
|
|
if subscription == nil {
|
|
|
|
panic("subscription cannot be nil")
|
|
|
|
}
|
|
|
|
|
|
|
|
return &gethSubscriptionWrapper{
|
|
|
|
subscription: subscription,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *gethSubscriptionWrapper) Err() <-chan error {
|
|
|
|
return w.subscription.Err()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *gethSubscriptionWrapper) Unsubscribe() {
|
|
|
|
w.subscription.Unsubscribe()
|
|
|
|
}
|