sidecar

package
v0.3.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: LGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidEventsSequence is the error returned when the returned sequence
	// of events is invalid.
	ErrInvalidEventsSequence = fmt.Errorf(
		"server returned invalid events sequence",
	)

	// ErrRequestedBoundariesViolated is the error returned when the sequence of
	// events returned from the server violate the requested boundaries.
	ErrRequestedBoundariesViolated = fmt.Errorf(
		"server returned events sequence violating requested boundaries",
	)
)

Functions

func RunServer

func RunServer(
	grpcAddress string,
	providerURL string,
	ethereumNetwork string,
	logger log.Logger,
)

RunServer initializes the server, starts the event observing routine and starts the gRPC server.

Types

type Client

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

Client connects to the Ethereum sidecar server and queries for the `AssetsLocked` events.

func NewClient

func NewClient(
	logger log.Logger,
	serverAddress string,
	requestTimeout time.Duration,
	registry types.InterfaceRegistry,
) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetAssetsLockedEvents

func (c *Client) GetAssetsLockedEvents(
	ctx context.Context,
	sequenceStart sdkmath.Int,
	sequenceEnd sdkmath.Int,
) ([]bridgetypes.AssetsLockedEvent, error)

GetAssetsLockedEvents returns confirmed AssetsLockedEvents with the sequence number falling within the half-open range, denoted by sequenceStart (included) and sequenceEnd (excluded). Nil can be passed for sequenceStart and sequenceEnd to indicate an unbounded edge of the range.

type ClientMock

type ClientMock struct{}

ClientMock is the mock implementation of the Ethereum sidecar client used in contexts where there is no need for a server connection.

func NewClientMock

func NewClientMock() *ClientMock

func (*ClientMock) GetAssetsLockedEvents

func (cm *ClientMock) GetAssetsLockedEvents(
	_ context.Context,
	_ sdkmath.Int,
	_ sdkmath.Int,
) ([]bridgetypes.AssetsLockedEvent, error)

type Server

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

Server observes events emitted by the Mezo `BitcoinBridge` contract on the Ethereum chain. It enables retrieval of information on the assets locked by the contract. It is intended to be run as a separate process.

func (*Server) AssetsLockedEvents

func (s *Server) AssetsLockedEvents(
	_ context.Context,
	req *pb.AssetsLockedEventsRequest,
) (
	*pb.AssetsLockedEventsResponse,
	error,
)

AssetsLockedEvents returns a list of AssetsLocked events based on the passed request. It is executed by the gRPC server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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