starknet

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerTag = "STARKNET_TELEPORT_LISTENER"
View Source
const TeleportEventType = "teleport_starknet"

Variables

This section is empty.

Functions

This section is empty.

Types

type Sequencer

type Sequencer interface {
	GetPendingBlock(ctx context.Context) (*starknet.Block, error)
	GetLatestBlock(ctx context.Context) (*starknet.Block, error)
	GetBlockByNumber(ctx context.Context, blockNumber uint64) (*starknet.Block, error)
}

Sequencer is a Starknet sequencer.

type TeleportListener

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

TeleportListener listens for TeleportGUID events on Starknet from pending blocks and, if BlockDelta is set, also from accepted blocks.

https://github.com/makerdao/dss-teleport

func NewTeleportListener

func NewTeleportListener(cfg TeleportListenerConfig) *TeleportListener

NewTeleportListener creates a new instance of TeleportListener.

func (*TeleportListener) Events

func (tl *TeleportListener) Events() chan *messages.Event

Events implements the publisher.Listener interface.

func (*TeleportListener) Start

func (tl *TeleportListener) Start(ctx context.Context) error

Start implements the publisher.Listener interface.

type TeleportListenerConfig

type TeleportListenerConfig struct {
	// Sequencer is an instance of Ethereum RPC sequencer.
	Sequencer Sequencer
	// Addresses is a list of contracts from which events will be fetched.
	Addresses []*starknet.Felt
	// Interval specifies how often listener should check for new events.
	Interval time.Duration
	// BlocksDelta is a list of distances between the latest accepted block on
	// the blockchain and blocks from which events are to be fetched. If empty,
	// then only events from pending block will be fetched. The purpose of this
	// field is to ensure that older events are resent from time to time.
	// This is to allow other clients on the Oracle network to restore its state
	// and ensure that no events are missed in the event of an Oracle failure.
	BlocksDelta []int
	// BlocksLimit specifies how from many blocks events can be fetched at once.
	BlocksLimit int
	// Logger is an instance of a logger. Logger is used mostly to report
	// recoverable errors.
	Logger log.Logger
}

TeleportListenerConfig contains a configuration options for NewTeleportListener.

Jump to

Keyboard shortcuts

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