ccvsourcereader

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCClient

type RPCClient interface {
	// GetLatestLedger returns the latest ledger information.
	GetLatestLedger(ctx context.Context) (protocolrpc.GetLatestLedgerResponse, error)
	// GetLedgers returns ledger data for a range of ledgers.
	GetLedgers(ctx context.Context, req protocolrpc.GetLedgersRequest) (protocolrpc.GetLedgersResponse, error)
	// GetEvents returns contract events matching the specified filters.
	GetEvents(ctx context.Context, req protocolrpc.GetEventsRequest) (protocolrpc.GetEventsResponse, error)
}

RPCClient defines the interface for Stellar RPC client methods used by SourceReader. This interface allows for mocking in unit tests.

type ReaderConfig

type ReaderConfig struct {
	// NetworkPassphrase is the Stellar network passphrase (e.g., "Standalone Network ; February 2017").
	NetworkPassphrase string `toml:"network_passphrase"`
	// OnRampContractID is the contract ID of the Stellar OnRamp contract.
	OnRampContractID string `toml:"onramp_contract_id"`
	// RMNRemoteContractID is the contract ID of the RMN Remote contract.
	RMNRemoteContractID string `toml:"rmn_remote_contract_id"`
	// SorobanRPCURL is the URL of the Soroban RPC endpoint.
	SorobanRPCURL string `toml:"soroban_rpc_url"`
}

ReaderConfig is the configuration required to create a Stellar source reader.

type SourceReader

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

SourceReader is the Stellar implementation of chainaccess.SourceReader.

func NewSourceReaderWithClient

func NewSourceReaderWithClient(
	client RPCClient,
	invoker bindings.Invoker,
	ccipOnrampAddress string,
	ccipMessageSentTopic string,
	rmnRemoteAddress string,
	lggr *zerolog.Logger,
) (*SourceReader, error)

NewSourceReaderWithClient constructs a Stellar source reader with a RPC client.

func (*SourceReader) FetchMessageSentEvents

func (s *SourceReader) FetchMessageSentEvents(ctx context.Context, fromBlock, toBlock *big.Int) ([]protocol.MessageSentEvent, error)

FetchMessageSentEvents fetches CCIP MessageSent events from the Stellar OnRamp contract.

func (*SourceReader) GetBlocksHeaders

func (s *SourceReader) GetBlocksHeaders(ctx context.Context, ledgerNumber []*big.Int) (map[uint64]protocol.BlockHeader, error)

GetBlocksHeaders returns the block headers for the requested ledger sequence numbers.

func (*SourceReader) GetRMNCursedSubjects

func (s *SourceReader) GetRMNCursedSubjects(ctx context.Context) ([]protocol.Bytes16, error)

GetRMNCursedSubjects gets the cursed subjects from the RMN Remote contract.

func (*SourceReader) LatestAndFinalizedBlock

func (s *SourceReader) LatestAndFinalizedBlock(ctx context.Context) (latest, finalized *protocol.BlockHeader, err error)

LatestAndFinalizedBlock returns the latest and finalized ledger headers. Stellar does not have re-orgs, so the latest and finalized ledger headers are the same.

func (*SourceReader) LatestSafeBlock

func (s *SourceReader) LatestSafeBlock(_ context.Context) (*protocol.BlockHeader, error)

LatestSafeBlock returns nil because Stellar has no "safe" head concept — all closed ledgers are immediately final.

Jump to

Keyboard shortcuts

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