2019-10-09 14:22:53 +00:00
|
|
|
package gethbridge
|
|
|
|
|
|
|
|
import (
|
2019-11-23 17:57:05 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
2019-12-09 10:06:04 +00:00
|
|
|
"github.com/status-im/status-go/whisper"
|
2019-10-09 14:22:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type gethEnvelopeWrapper struct {
|
|
|
|
envelope *whisper.Envelope
|
|
|
|
}
|
|
|
|
|
2019-11-23 17:57:05 +00:00
|
|
|
// NewGethEnvelopeWrapper returns an object that wraps Geth's Envelope in a types interface
|
|
|
|
func NewGethEnvelopeWrapper(e *whisper.Envelope) types.Envelope {
|
2019-10-09 14:22:53 +00:00
|
|
|
return &gethEnvelopeWrapper{
|
|
|
|
envelope: e,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetGethEnvelopeFrom retrieves the underlying whisper Envelope struct from a wrapped Envelope interface
|
2019-11-23 17:57:05 +00:00
|
|
|
func GetGethEnvelopeFrom(f types.Envelope) *whisper.Envelope {
|
2019-10-09 14:22:53 +00:00
|
|
|
return f.(*gethEnvelopeWrapper).envelope
|
|
|
|
}
|
|
|
|
|
2019-11-23 17:57:05 +00:00
|
|
|
func (w *gethEnvelopeWrapper) Hash() types.Hash {
|
|
|
|
return types.Hash(w.envelope.Hash())
|
2019-10-09 14:22:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *gethEnvelopeWrapper) Bloom() []byte {
|
|
|
|
return w.envelope.Bloom()
|
|
|
|
}
|