ethereum

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const SignatureKey = "ethereum"
View Source
const WormholeEventType = "wormhole"

Variables

This section is empty.

Functions

This section is empty.

Types

type EthClient

type EthClient interface {
	BlockNumber(ctx context.Context) (uint64, error)
	FilterLogs(ctx context.Context, q geth.FilterQuery) ([]types.Log, error)
}

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer signs Ethereum log messages using Ethereum signature.

func NewSigner

func NewSigner(signer ethereum.Signer, types []string) *Signer

NewSigner returns a new instance of the Signer struct.

func (*Signer) Sign

func (l *Signer) Sign(event *messages.Event) (bool, error)

Sign implements the Signer interface.

type WormholeListener

type WormholeListener struct {
	// contains filtered or unexported fields
}

WormholeListener listens to particular logs on Ethereum compatible blockchain and converts them into event messages.

func NewWormholeListener

func NewWormholeListener(cfg WormholeListenerConfig) *WormholeListener

NewWormholeListener returns a new instance of the WormholeListener struct.

func (*WormholeListener) Events

func (l *WormholeListener) Events() chan *messages.Event

Events implements the publisher.Listener interface.

func (*WormholeListener) Start

func (l *WormholeListener) Start(ctx context.Context) error

Start implements the publisher.Listener interface.

type WormholeListenerConfig

type WormholeListenerConfig struct {
	// Client is an instance of Ethereum RPC client.
	Client EthClient
	// Addresses is a list of contracts from which logs will be fetched.
	Addresses []ethereum.Address
	// Interval specifies how often listener should check for new logs.
	Interval time.Duration
	// BlocksBehind specifies the distance between the newest block on the
	// blockchain and the newest block from which logs are to be taken. This
	// parameter can be used to ensure sufficient block confirmations.
	BlocksBehind int
	// MaxBlocks specifies how from many blocks logs can be fetched at once.
	MaxBlocks int
	// Logger is an instance of a logger. Logger is used mostly to report
	// recoverable errors.
	Logger log.Logger
}

WormholeListenerConfig contains a configuration options for NewWormholeListener.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL